working intermediate state of the save system
This commit is contained in:
@@ -216,6 +216,9 @@ public partial class FieldBehaviour2D : Sprite2D
|
||||
var sceneName = _sceneKeyProvider.Payload.AsString();
|
||||
var id = SaveId + _fieldIndex.Payload.AsString();
|
||||
string jsonPayload = SavegameService.GetSaveData(sceneName, id);
|
||||
if (string.IsNullOrEmpty(jsonPayload))
|
||||
return;
|
||||
|
||||
Dictionary<string, Variant> save = Json.ParseString(jsonPayload).AsGodotDictionary<string, Variant>();
|
||||
|
||||
if (save.Count > 0)
|
||||
|
||||
@@ -206,6 +206,9 @@ public partial class InventoryInstance : Node
|
||||
var sceneName = SCENE_NAME;
|
||||
var id = ID;
|
||||
string jsonPayload = SavegameService.GetSaveData(sceneName, id);
|
||||
if (string.IsNullOrEmpty(jsonPayload))
|
||||
return;
|
||||
|
||||
Godot.Collections.Dictionary<string, Variant> save = Json.ParseString(jsonPayload).AsGodotDictionary<string, Variant>();
|
||||
|
||||
if (save.Count > 0)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using Godot;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.Savegame;
|
||||
|
||||
[Tool]
|
||||
public partial class SaveCheats : Node
|
||||
{
|
||||
[ExportToolButton("ResetSave")] Callable _raiseAction => Callable.From(Reset);
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
SavegameService.Reset();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://iquhbkr7pqeg
|
||||
@@ -94,4 +94,10 @@ public static class SavegameService
|
||||
|
||||
_loaded = true;
|
||||
}
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
SaveDatas = new ();
|
||||
Save();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user