diff --git a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs
index 31157cb..80a1254 100644
--- a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs
+++ b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs
@@ -179,9 +179,9 @@ public partial class FieldBehaviour2D : Sprite2D
{
_currentPlant.Field = this;
}
-
}
-
+
+ #region SAVE AND LOAD
public void UpdateSaveData()
{
@@ -258,7 +258,7 @@ public partial class FieldBehaviour2D : Sprite2D
}
}
-
}
-
+#endregion
+
}
diff --git a/scripts/CSharp/Common/Savegame/SaveData.cs b/scripts/CSharp/Common/Savegame/SaveData.cs
index f7970f2..1a7e3a8 100644
--- a/scripts/CSharp/Common/Savegame/SaveData.cs
+++ b/scripts/CSharp/Common/Savegame/SaveData.cs
@@ -2,6 +2,10 @@ using System;
namespace Babushka.scripts.CSharp.Common.Savegame;
+///
+/// Central structure for SaveData entries.
+/// SceneName and ID are later combined and used as keys for the save system.
+///
[Serializable]
public class SaveData
{
diff --git a/scripts/CSharp/Common/Savegame/SavegameService.cs b/scripts/CSharp/Common/Savegame/SavegameService.cs
index 9e12b18..c3c8b9f 100644
--- a/scripts/CSharp/Common/Savegame/SavegameService.cs
+++ b/scripts/CSharp/Common/Savegame/SavegameService.cs
@@ -5,6 +5,11 @@ using FileAccess = Godot.FileAccess;
namespace Babushka.scripts.CSharp.Common.Savegame;
+///
+/// Handles the saving and loading of game states.
+/// Holds the central SaveData object that serves as a temporary SaveFile.
+/// Automatically writes to disk on every scene change.
+///
public static class SavegameService
{
public static readonly string SavePath = "res://savegame/savegame.json";
@@ -14,6 +19,10 @@ public static class SavegameService
public static bool _loaded = false;
+ ///
+ /// Adds or overwrites an entry in the SaveData dictionary.
+ ///
+ ///
public static void AppendSave(SaveData saveData)
{
string key = string.Concat(saveData.SceneName, "_", saveData.Id);
@@ -29,6 +38,13 @@ public static class SavegameService
}
+ ///
+ /// Checks the SaveData dictionary for an entry and returns the jsondata as a string for it.
+ /// Requires the scenename and object ID for lookup.
+ ///
+ ///
+ ///
+ ///
public static string GetSaveData(string sceneName, string id)
{
string saveData = "";
@@ -50,6 +66,9 @@ public static class SavegameService
}
+ ///
+ /// Writes the contents of the current SaveData dictionary to disk as a json file.
+ ///
public static void Save()
{
string json = Json.Stringify(SaveDatas, indent: "\t");
@@ -57,6 +76,9 @@ public static class SavegameService
file.StoreString(json);
}
+ ///
+ /// Loads the current savegame file from disk and parses it into the SaveData dictionary.
+ ///
public static void Load()
{
try