side preview (needs optimization)

This commit is contained in:
Cameron Taylor 2022-02-03 19:51:16 -05:00
parent 42d89426a4
commit f710ad78bc
2 changed files with 34 additions and 10 deletions

View file

@ -237,6 +237,21 @@ class SongLoad
} }
} }
public static function castNoteDataToNoteData(noteStuff:Array<SwagSection>)
{
if (noteStuff == null)
return;
for (sectionIndex => section in noteStuff)
{
for (noteIndex => noteTypedefShit in section.sectionNotes)
{
trace(noteTypedefShit);
noteStuff[sectionIndex].sectionNotes[noteIndex] = noteTypedefShit;
}
}
}
public static function parseJSONshit(rawJson:String):SwagSong public static function parseJSONshit(rawJson:String):SwagSong
{ {
var songParsed:Dynamic = Json.parse(rawJson); var songParsed:Dynamic = Json.parse(rawJson);
@ -248,18 +263,24 @@ class SongLoad
{ {
swagShit.difficulties.push(diff); swagShit.difficulties.push(diff);
swagShit.noteMap[diff] = cast Reflect.field(songParsed.song.notes, diff); swagShit.noteMap[diff] = cast Reflect.field(songParsed.song.notes, diff);
trace(swagShit.noteMap[diff]);
castArrayToNoteData(swagShit.noteMap[diff]); castArrayToNoteData(swagShit.noteMap[diff]);
switch (diff) // castNoteDataToNoteData(swagShit.noteMap[diff]);
{
case "easy":
castArrayToNoteData(swagShit.notes.hard);
case "normal": /*
castArrayToNoteData(swagShit.notes.normal); switch (diff)
case "hard": {
castArrayToNoteData(swagShit.notes.hard); case "easy":
} castArrayToNoteData(swagShit.notes.hard);
case "normal":
castArrayToNoteData(swagShit.notes.normal);
case "hard":
castArrayToNoteData(swagShit.notes.hard);
}
*/
} }
for (diff in swagShit.difficulties) for (diff in swagShit.difficulties)

View file

@ -1177,7 +1177,10 @@ class ChartingState extends MusicBeatState
0xFFFF0000; 0xFFFF0000;
} }
sidePreview.drawRect(5 * notes.noteData, FlxMath.remapToRange(notes.strumTime, 0, FlxG.sound.music.length, 0, FlxG.height), 5, 1, col); var noteFlip:Int = (sideSection.mustHitSection ? 1 : -1);
var noteX:Float = 5 * (((notes.noteData - 4) * noteFlip) + 4);
sidePreview.drawRect(noteX, FlxMath.remapToRange(notes.strumTime, 0, FlxG.sound.music.length, 0, FlxG.height), 5, 1, col);
} }
} }
} }