Savesystem rework
This commit is contained in:
@@ -178,10 +178,6 @@ public partial class InventoryInstance : Node, ISaveable
|
||||
|
||||
public void UpdateSaveData()
|
||||
{
|
||||
var saveData = new SaveData();
|
||||
|
||||
saveData.SceneName = SCENE_NAME;
|
||||
saveData.Id = ID;
|
||||
var payloadData = new Godot.Collections.Dictionary<string, Variant>();
|
||||
|
||||
for (int i = 0; i < _slots.Count; i++)
|
||||
@@ -196,20 +192,15 @@ public partial class InventoryInstance : Node, ISaveable
|
||||
}
|
||||
}
|
||||
|
||||
saveData.JsonPayload = Json.Stringify(payloadData, indent: "\t");
|
||||
|
||||
SavegameService.AppendSave(saveData);
|
||||
SavegameService.AppendDataToSave(SCENE_NAME, ID, payloadData);
|
||||
}
|
||||
|
||||
public void LoadFromSaveData()
|
||||
{
|
||||
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>();
|
||||
Godot.Collections.Dictionary<string, Variant> save = SavegameService.GetSaveData(sceneName, id);
|
||||
|
||||
if (save.Count > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user