1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-27 09:13:18 +00:00

AUTOSAVE FOR NOTE EDITOR!

This commit is contained in:
Cameron Taylor 2020-12-25 04:09:14 -05:00
parent 18b87b391e
commit ea1c0e3888
2 changed files with 29 additions and 8 deletions

View file

@ -102,6 +102,9 @@ class ChartingState extends MusicBeatState
}; };
} }
FlxG.mouse.visible = true;
FlxG.save.bind('funkin', 'ninjamuffin99');
tempBpm = _song.bpm; tempBpm = _song.bpm;
addSection(); addSection();
@ -175,6 +178,8 @@ class ChartingState extends MusicBeatState
loadJson(_song.song.toLowerCase()); loadJson(_song.song.toLowerCase());
}); });
var loadAutosaveBtn:FlxButton = new FlxButton(reloadSongJson.x, reloadSongJson.y + 60, 'load autosave', loadAutosave);
var stepperSpeed:FlxUINumericStepper = new FlxUINumericStepper(10, 80, 0.1, 1, 0.1, 10, 1); var stepperSpeed:FlxUINumericStepper = new FlxUINumericStepper(10, 80, 0.1, 1, 0.1, 10, 1);
stepperSpeed.value = _song.speed; stepperSpeed.value = _song.speed;
stepperSpeed.name = 'song_speed'; stepperSpeed.name = 'song_speed';
@ -206,6 +211,7 @@ class ChartingState extends MusicBeatState
tab_group_song.add(saveButton); tab_group_song.add(saveButton);
tab_group_song.add(reloadSong); tab_group_song.add(reloadSong);
tab_group_song.add(reloadSongJson); tab_group_song.add(reloadSongJson);
tab_group_song.add(loadAutosaveBtn);
tab_group_song.add(stepperBPM); tab_group_song.add(stepperBPM);
tab_group_song.add(stepperSpeed); tab_group_song.add(stepperSpeed);
tab_group_song.add(player1DropDown); tab_group_song.add(player1DropDown);
@ -769,6 +775,8 @@ class ChartingState extends MusicBeatState
updateGrid(); updateGrid();
updateNoteUI(); updateNoteUI();
autosaveSong();
} }
function getStrumTime(yPos:Float):Float function getStrumTime(yPos:Float):Float
@ -829,11 +837,21 @@ class ChartingState extends MusicBeatState
FlxG.resetState(); FlxG.resetState();
} }
var mp3File:Sound; function loadAutosave():Void
var waveForm:FlxSprite;
function drawWave():Void
{ {
PlayState.SONG = Song.parseJSONshit(FlxG.save.data.autosave);
FlxG.resetState();
}
function autosaveSong():Void
{
FlxG.save.data.autosave = Json.stringify({
"song": _song,
"bpm": Conductor.bpm,
"sections": _song.notes.length,
'notes': _song.notes
});
FlxG.save.flush();
} }
private function saveLevel() private function saveLevel()

View file

@ -58,10 +58,6 @@ class Song
// LOL GOING THROUGH THE BULLSHIT TO CLEAN IDK WHATS STRANGE // LOL GOING THROUGH THE BULLSHIT TO CLEAN IDK WHATS STRANGE
} }
var swagShit:SwagSong = cast Json.parse(rawJson).song;
swagShit.validScore = true;
trace(swagShit.notes[0]);
// FIX THE CASTING ON WINDOWS/NATIVE // FIX THE CASTING ON WINDOWS/NATIVE
// Windows??? // Windows???
// trace(songData); // trace(songData);
@ -80,6 +76,13 @@ class Song
daBpm = songData.bpm; daBpm = songData.bpm;
daSectionLengths = songData.sectionLengths; */ daSectionLengths = songData.sectionLengths; */
return parseJSONshit(rawJson);
}
public static function parseJSONshit(rawJson:String):SwagSong
{
var swagShit:SwagSong = cast Json.parse(rawJson).song;
swagShit.validScore = true;
return swagShit; return swagShit;
} }
} }