Skip to content

Commit

Permalink
Fix for disconnection modal not showing (#2174)
Browse files Browse the repository at this point in the history
* Fixed modals not showing due to FreezeTIme being executed too early
Co-authored-by: dartasen <[email protected]>

* Changed function name from Show_Impl to ShowImplementation
  • Loading branch information
OhmV-IR authored Aug 27, 2024
1 parent 3cb808f commit af49b16
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions NitroxClient/MonoBehaviours/Gui/Modals/Modal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,9 @@ public Modal(string yesButtonText = "YES", bool hideNoButton = true, string noBu
/// </summary>
public void Show()
{
if (FreezeGame)
{
FreezeTime.Begin(FreezeTime.Id.Quit);
}
CurrentModal?.Hide();
CurrentModal = this;
CoroutineHost.StartCoroutine(Show_Impl());
CoroutineHost.StartCoroutine(ShowImplementation());
}

/// <summary>
Expand Down Expand Up @@ -173,14 +169,19 @@ private void UpdateModal()
public virtual void ClickYes() { }
public virtual void ClickNo() { }

private IEnumerator Show_Impl()
private IEnumerator ShowImplementation()
{
// Execute frame-by-frame to allow UI scripts to initialize.
InitSubWindow();
yield return new WaitForEndOfFrame();
IngameMenu.main.Open();
yield return new WaitForEndOfFrame();
IngameMenu.main.ChangeSubscreen(SubWindowName);
yield return new WaitForEndOfFrame();
if (FreezeGame)
{
FreezeTime.Begin(FreezeTime.Id.Quit);
}
}

/// <summary>
Expand Down

0 comments on commit af49b16

Please sign in to comment.