feature/save_and_loaaaaaad #32
@@ -18,7 +18,6 @@ public partial class InventoryUi : Control
|
|||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
GD.Print("Ready inventory ui");
|
|
||||||
_playerInventory = InventoryManager.Instance.playerInventory;
|
_playerInventory = InventoryManager.Instance.playerInventory;
|
||||||
//PopulateSlots();
|
//PopulateSlots();
|
||||||
SubscribeSlots();
|
SubscribeSlots();
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ public partial class ItemOnGround2D : Node, ISaveable
|
|||||||
};
|
};
|
||||||
|
|
||||||
string id = GetMeta("SaveID").AsString();
|
string id = GetMeta("SaveID").AsString();
|
||||||
GD.Print($"Updating Save ID for object {Name}: {id}");
|
|
||||||
SavegameService.AppendDataToSave( id, payloadData);
|
SavegameService.AppendDataToSave( id, payloadData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +110,6 @@ public partial class ItemOnGround2D : Node, ISaveable
|
|||||||
|
|
||||||
// standard check: how many times has this item been collected?
|
// standard check: how many times has this item been collected?
|
||||||
string id = GetMeta("SaveID").AsString();
|
string id = GetMeta("SaveID").AsString();
|
||||||
GD.Print($"Loading Save ID for object {Name}: " + id);
|
|
||||||
|
|
||||||
Dictionary<string, Variant> save = SavegameService.GetSaveData(id);
|
Dictionary<string, Variant> save = SavegameService.GetSaveData(id);
|
||||||
if (save.Count > 0)
|
if (save.Count > 0)
|
||||||
@@ -119,11 +117,9 @@ public partial class ItemOnGround2D : Node, ISaveable
|
|||||||
if(save.TryGetValue("pickupCounter", out Variant countVar))
|
if(save.TryGetValue("pickupCounter", out Variant countVar))
|
||||||
{
|
{
|
||||||
int count = countVar.AsInt32();
|
int count = countVar.AsInt32();
|
||||||
GD.Print($"Item count for {Name}: {count}");
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
Pickup();
|
Pickup();
|
||||||
GD.Print($"Picking up {Name}: {i}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ public partial class QuestTrigger : Node
|
|||||||
|
|
||||||
public void Trigger()
|
public void Trigger()
|
||||||
{
|
{
|
||||||
GD.Print("trigger");
|
|
||||||
|
|
||||||
if (questResource == null)
|
if (questResource == null)
|
||||||
throw new Exception("QuestResource is not set on QuestTrigger node.");
|
throw new Exception("QuestResource is not set on QuestTrigger node.");
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ public static class SavegameService
|
|||||||
|
|
||||||
if (!_loaded)
|
if (!_loaded)
|
||||||
{
|
{
|
||||||
GD.Print("SavegameService: SaveFile not loaded.");
|
|
||||||
return saveData;
|
return saveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,12 +79,9 @@ public static class SavegameService
|
|||||||
public static void Save()
|
public static void Save()
|
||||||
{
|
{
|
||||||
string json = Json.Stringify(SaveDatas, indent: "\t");
|
string json = Json.Stringify(SaveDatas, indent: "\t");
|
||||||
|
|
||||||
GD.Print(SavePath);
|
|
||||||
// create cloud directory
|
// create cloud directory
|
||||||
|
|
||||||
CreateSaveDirectory();
|
CreateSaveDirectory();
|
||||||
GD.Print("Save.");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -108,7 +104,6 @@ public static class SavegameService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Load()
|
public static void Load()
|
||||||
{
|
{
|
||||||
GD.Print("Load.");
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!System.IO.File.Exists(SavePath))
|
if (!System.IO.File.Exists(SavePath))
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ public partial class MVPDuck : Node2D, ISaveable
|
|||||||
};
|
};
|
||||||
|
|
||||||
string id = GetMeta("SaveID").AsString();
|
string id = GetMeta("SaveID").AsString();
|
||||||
GD.Print($"Updating Save ID for object {Name}: {id}");
|
|
||||||
SavegameService.AppendDataToSave( id, payloadData);
|
SavegameService.AppendDataToSave( id, payloadData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +74,6 @@ public partial class MVPDuck : Node2D, ISaveable
|
|||||||
public void LoadFromSaveData()
|
public void LoadFromSaveData()
|
||||||
{
|
{
|
||||||
string id = GetMeta("SaveID").AsString();
|
string id = GetMeta("SaveID").AsString();
|
||||||
GD.Print($"Loading Save ID for object {Name}: " + id);
|
|
||||||
|
|
||||||
Dictionary<string, Variant> save = SavegameService.GetSaveData(id);
|
Dictionary<string, Variant> save = SavegameService.GetSaveData(id);
|
||||||
if (save.Count > 0)
|
if (save.Count > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user