move clear save data to the top, add clear ng save data

This commit is contained in:
TechnikTil
2025-07-27 00:56:31 -05:00
committed by Abnormal
parent d661d93184
commit eb1986b246
3 changed files with 55 additions and 29 deletions
@@ -122,6 +122,28 @@ class NGSaveSlot
}
}
public function clear():Void
{
try
{
ngSaveSlot?.clear(function(outcome:Outcome<CallError>) {
switch (outcome)
{
case SUCCESS:
trace('[NEWGROUNDS] Successfully cleared save slot!');
case FAIL(error):
trace('[NEWGROUNDS] Failed to clear save slot!');
trace(error);
}
});
}
catch (error:String)
{
trace('[NEWGROUNDS] Failed to clear save slot!');
trace(error);
}
}
public function checkSlot():Void
{
trace('[NEWGROUNDS] Checking save slot with the ID of ${ngSaveSlot?.id}...');
+1
View File
@@ -1381,6 +1381,7 @@ class Save
var gameSave = SaveDataMigrator.migrate(data);
FlxG.save.mergeData(gameSave.data, true);
FlxG.save.flush();
}, function(error:io.newgrounds.Call.CallError) {
var errorMsg:String = io.newgrounds.Call.CallErrorTools.toString(error);
+32 -29
View File
@@ -5,9 +5,6 @@ import funkin.api.newgrounds.NewgroundsClient;
#end
import funkin.save.Save;
/**
* Our default Page when we enter the OptionsState, a bit of the root
*/
class SaveDataMenu extends Page<OptionsState.OptionsMenuPageName>
{
var items:TextMenuList;
@@ -18,32 +15,6 @@ class SaveDataMenu extends Page<OptionsState.OptionsMenuPageName>
add(items = new TextMenuList());
#if FEATURE_NEWGROUNDS
if (NewgroundsClient.instance.isLoggedIn())
{
createItem("LOAD FROM NEWGROUNDS", function() {
openConfirmPrompt("This will overwrite
\nALL your save data.
\nAre you sure?
", "Overwrite", function() {
Save.loadFromNewgrounds();
FlxG.switchState(() -> new funkin.InitState());
});
});
createItem("SAVE TO NEWGROUNDS", function() {
openConfirmPrompt("This will overwrite
\nALL save data saved
\non Newgrounds.
\nAre you sure?
", "Overwrite", function() {
Save.saveToNewgrounds();
});
});
}
#end
createItem("CLEAR SAVE DATA", function() {
openConfirmPrompt("This will delete
\nALL your save data.
@@ -56,6 +27,38 @@ class SaveDataMenu extends Page<OptionsState.OptionsMenuPageName>
});
});
#if FEATURE_NEWGROUNDS
if (NewgroundsClient.instance.isLoggedIn())
{
createItem("LOAD FROM NG", function() {
openConfirmPrompt("This will overwrite
\nALL your save data.
\nAre you sure?
", "Overwrite", function() {
Save.loadFromNewgrounds();
FlxG.switchState(() -> new funkin.InitState());
});
});
createItem("SAVE TO NG", function() {
openConfirmPrompt("This will overwrite
\nALL save data saved
\non NG. Are you sure?", "Overwrite", function() {
Save.saveToNewgrounds();
});
});
createItem("CLEAR NG SAVE DATA", function() {
openConfirmPrompt("This will delete
\nALL save data saved
\non NG. Are you sure?", "Delete", function() {
funkin.api.newgrounds.NGSaveSlot.instance.clear();
});
});
}
#end
createItem("EXIT", exit);
}