Skip to content

Commit

Permalink
Don't kill window incorrectly if CoopSettingsWindow is active
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Oct 17, 2024
1 parent 43168eb commit 1bba747
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Fika.Core/UI/Custom/MatchMakerUIScript.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Comfort.Common;
using EFT;
using EFT.UI;
using EFT.UI.Matchmaker;
using Fika.Core.Bundles;
using Fika.Core.Coop.Patches;
using Fika.Core.Coop.Utils;
Expand Down Expand Up @@ -45,6 +46,7 @@ public DefaultUIButton AcceptButton
internal RaidSettings raidSettings;
internal DefaultUIButton backButton;
internal DefaultUIButton acceptButton;
internal CoopSettingsWindow coopSettingsWindow;

protected void OnEnable()
{
Expand Down Expand Up @@ -78,7 +80,7 @@ protected void Start()

protected void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
if (Input.GetKeyDown(KeyCode.Escape) && coopSettingsWindow != null && !coopSettingsWindow.IsActive)
{
DestroyThis();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected override MethodBase GetTargetMethod()
public static GameObject MatchmakerObject { get; set; }

[PatchPrefix]
private static void Prefix(ref RaidSettings raidSettings, DefaultUIButton ____acceptButton, DefaultUIButton ____backButton)
private static void Prefix(ref RaidSettings raidSettings, DefaultUIButton ____acceptButton, DefaultUIButton ____backButton, CoopSettingsWindow ____coopSettingsWindow)
{
if (MatchmakerObject == null)
{
Expand All @@ -37,6 +37,7 @@ private static void Prefix(ref RaidSettings raidSettings, DefaultUIButton ____ac
newMatchMaker.raidSettings = raidSettings;
newMatchMaker.acceptButton = ____acceptButton;
newMatchMaker.backButton = ____backButton;
newMatchMaker.coopSettingsWindow = ____coopSettingsWindow;
}

[PatchPostfix]
Expand Down

0 comments on commit 1bba747

Please sign in to comment.