Fix bug
This commit is contained in:
@@ -277,7 +277,7 @@ public class PersistentDataController
|
||||
{
|
||||
string text = File.ReadAllText(PATH);
|
||||
SavedDataStructure newJson = JsonUtility.FromJson<SavedDataStructure>(text);
|
||||
if (newJson == null || newJson.version < VERSION)
|
||||
if (newJson == null || newJson.version != VERSION)
|
||||
goto failed;
|
||||
|
||||
json = newJson;
|
||||
|
||||
@@ -107,6 +107,14 @@ public class PersistentDataTests
|
||||
Assert.IsFalse(pdc.Load(false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_PersistentDataController_Load_NewerVersion()
|
||||
{
|
||||
string content = $"{{\"version\":{PersistentDataController.VERSION + 1},\"users\":[],\"currentUser\":-1,\"currentMinigame\":0,\"currentCourse\":0,\"currentTheme\":0}}";
|
||||
File.WriteAllText(PATH, content);
|
||||
Assert.IsFalse(pdc.Load(false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_PersistentDataController_Load_New()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user