Skip to content

Commit

Permalink
Restore original Deserialize() method signature
Browse files Browse the repository at this point in the history
Make Deserialize() optional param non-optional.
Restore original Deserialize() method signature matching injects default value.
  • Loading branch information
Interkarma committed Jun 12, 2023
1 parent d4f0ffc commit 157236b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Assets/Scripts/Game/Serialization/SaveLoadManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,12 @@ public static string Serialize(Type type, object value, bool pretty = true)
return (pretty) ? fsJsonPrinter.PrettyJson(data) : fsJsonPrinter.CompressedJson(data);
}

public static object Deserialize(Type type, string serializedState, bool assertSuccess = false)
public static object Deserialize(Type type, string serializedState)
{
return Deserialize(type, serializedState, false);
}

public static object Deserialize(Type type, string serializedState, bool assertSuccess)
{
// Step 1: Parse the JSON data
fsData data = fsJsonParser.Parse(serializedState);
Expand Down Expand Up @@ -1377,7 +1382,7 @@ IEnumerator LoadGame(string path)
// Restore quest machine state
if (!string.IsNullOrEmpty(questDataJson))
{
QuestMachine.QuestMachineData_v1 questData = Deserialize(typeof(QuestMachine.QuestMachineData_v1), questDataJson, assertSuccess:true) as QuestMachine.QuestMachineData_v1;
QuestMachine.QuestMachineData_v1 questData = Deserialize(typeof(QuestMachine.QuestMachineData_v1), questDataJson, true) as QuestMachine.QuestMachineData_v1;
QuestMachine.Instance.RestoreSaveData(questData);
}

Expand Down

0 comments on commit 157236b

Please sign in to comment.