Skip to content

Commit

Permalink
Fix quicksave button not responding after loading
Browse files Browse the repository at this point in the history
 - I don't really understand how this fix works, so it might not fix in all situations
 - This would only happen under a certain set of conditions, not every time (for example, spamming the quick save button, then making a save, then loading that save)
 - Once a save had the problem, loading the 'bad save' would cause the quicksave to be broken after loading most of the time
 - See 07th-mod/higurashi-rei#2 (comment) for more details
  • Loading branch information
drojf committed Jul 31, 2022
1 parent 4b617d5 commit 3e27c2d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Assets.Scripts.Core/GameSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,7 @@ private void Update()
{
if (GameState == GameState.Normal)
{
UI.SaveLoad.SaveLoadButton.QuicksaveButtonFixerUpdate();
TextController.Update();
if (!IsSkipping)
{
Expand Down
17 changes: 17 additions & 0 deletions Assets.Scripts.UI.SaveLoad/SaveLoadButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class SaveLoadButton : MonoBehaviour

private SaveLoadManager manager;

private static int needUIRefresh = 0;

private void OnClick()
{
if (gameSystem == null)
Expand Down Expand Up @@ -61,6 +63,7 @@ private void OnClick()
}
(gameSystem.GetStateObject() as StateChapterScreen)?.RequestLeaveImmediate();
GameSystem.Instance.ScriptSystem.LoadGame(slot);
needUIRefresh = 2;
});
}, null);
gameSystem.PushStateObject(state2);
Expand Down Expand Up @@ -162,5 +165,19 @@ private void Update()
time -= Time.deltaTime;
}
}

public static void QuicksaveButtonFixerUpdate()
{
if (needUIRefresh == 1)
{
GameSystem.Instance.HideUIControls();
GameSystem.Instance.ShowUIControls();
}

if (needUIRefresh > 0)
{
needUIRefresh--;
}
}
}
}

0 comments on commit 3e27c2d

Please sign in to comment.