feature/save_and_loaaaaaad #32

Merged
kziolkowski merged 18 commits from feature/save_and_loaaaaaad into develop 2025-11-26 14:41:29 +01:00
4 changed files with 19 additions and 3 deletions
Showing only changes of commit 4bbaab1a2a - Show all commits
@@ -1,4 +1,3 @@
using System;
using System.Linq;
using Babushka.scripts.CSharp.Common.Services;
using Godot;
2
@@ -13,7 +13,7 @@ namespace Babushka.scripts.CSharp.Common.Farming;
/// Defines the behaviour of the field, i.e. interactions, states and effects.
/// </summary>
[GlobalClass]
public partial class FieldBehaviour2D : Sprite2D
public partial class FieldBehaviour2D : Sprite2D, ISaveable
{
[ExportGroup("Persistence")]
[Export] public string SaveId = "";
@@ -7,7 +7,7 @@ using Babushka.scripts.CSharp.Common.Savegame;
namespace Babushka.scripts.CSharp.Common.Inventory;
public partial class InventoryInstance : Node
public partial class InventoryInstance : Node, ISaveable
{
private List<InventorySlot> _slots = new();
public IReadOnlyList<InventorySlot> Slots => _slots;
@@ -0,0 +1,17 @@
namespace Babushka.scripts.CSharp.Common.Savegame;
/// <summary>
/// Defines the behaviour of Nodes that have fields that should save / load to disk.
/// </summary>
public interface ISaveable
{
/// <summary>
/// Adds or updates the field data that shall be stored to disk.
/// </summary>
public void UpdateSaveData();
/// <summary>
/// Loads the field data from disk.
/// </summary>
public void LoadFromSaveData();
}