From 3f422c96b3220c711ecaf9968f5debdd2432b843 Mon Sep 17 00:00:00 2001 From: MaZiFAU <marco.alexander.zimmer@fau.de> Date: Sat, 3 Sep 2022 04:07:49 +0200 Subject: [PATCH] + Bug fixes: No val after reset, Force unique name for savegames --- Assets/Scripts/Loading/Stage.cs | 4 +++- Assets/Scripts/StageBehaviour.cs | 2 +- Assets/Scripts/StageStatic.cs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Loading/Stage.cs b/Assets/Scripts/Loading/Stage.cs index 68134204..e0164ce2 100644 --- a/Assets/Scripts/Loading/Stage.cs +++ b/Assets/Scripts/Loading/Stage.cs @@ -250,6 +250,7 @@ public bool set_record(string record_index) player_record = player_record_list[record_index].Clone(); player_record.name = record_name; + player_record.solved = false; store(false); return true; } @@ -281,6 +282,7 @@ public void push_record(double seconds_s = -1, bool force_push = false) player_record_list.Add(push.name, push); + player_record.solved = false; store(false); } @@ -522,7 +524,7 @@ public PlayerRecord Clone() { var ret = new PlayerRecord(this.name) { - solved = false, // this.solved, + solved = this.solved, seconds = this.seconds }; ret.factState = IJSONsavable<FactOrganizer>.postprocess(this.factState); diff --git a/Assets/Scripts/StageBehaviour.cs b/Assets/Scripts/StageBehaviour.cs index 5b08a6d6..1cb2349f 100644 --- a/Assets/Scripts/StageBehaviour.cs +++ b/Assets/Scripts/StageBehaviour.cs @@ -23,7 +23,7 @@ void Start() private void OnDestroy() { StageStatic.SetMode(Mode.Play); // no Mode.Create - StageStatic.stage.solution.hardreset(invoke_event: false); + // StageStatic.stage.solution.hardreset(invoke_event: false); NO! keep in memory! StageStatic.stage.factState.hardreset(invoke_event: false); } diff --git a/Assets/Scripts/StageStatic.cs b/Assets/Scripts/StageStatic.cs index aedd38f9..c1427d5f 100644 --- a/Assets/Scripts/StageStatic.cs +++ b/Assets/Scripts/StageStatic.cs @@ -224,7 +224,7 @@ public static StageErrorStruct Validate(string category, int id, string name, st return new StageErrorStruct( category.Length == 0, ContainsNumber(category, id, true), - name.Length == 0 || ContainsKey(name, local), + name.Length == 0 || ContainsKey(name, false) || ContainsKey(name, true), false, !Worlds.Contains(scene), local == false, -- GitLab