From b33cc08c375289bece8327ca0a0fb1cc725dcdc7 Mon Sep 17 00:00:00 2001 From: Arufonsu <17498701+Arufonsu@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:15:02 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20=E2=99=BB=EF=B8=8F=20Apply=20review=20ch?= =?UTF-8?q?anges=20(II)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Intersect.Client/Interface/Game/Menu.cs | 6 +++--- .../Interface/Game/SimplifiedEscapeMenu.cs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Intersect.Client/Interface/Game/Menu.cs b/Intersect.Client/Interface/Game/Menu.cs index 48ebc85563..7b41abcc35 100644 --- a/Intersect.Client/Interface/Game/Menu.cs +++ b/Intersect.Client/Interface/Game/Menu.cs @@ -37,7 +37,7 @@ public partial class Menu private readonly ImagePanel mMenuBackground; - public readonly Button mMenuButton; + private readonly Button mMenuButton; //Menu Container private readonly ImagePanel mMenuContainer; @@ -355,13 +355,13 @@ public bool HasWindowsOpen() } //Input Handlers - private static void MenuButtonClicked(Base sender, ClickedEventArgs arguments) + private void MenuButtonClicked(Base sender, ClickedEventArgs arguments) { var simplifiedEscapeMenuSetting = Globals.Database.SimplifiedEscapeMenu; if (simplifiedEscapeMenuSetting) { - Interface.GameUi?.SimplifiedEscapeMenu?.ToggleHidden(); + Interface.GameUi?.SimplifiedEscapeMenu?.ToggleHidden(mMenuButton); } else { diff --git a/Intersect.Client/Interface/Game/SimplifiedEscapeMenu.cs b/Intersect.Client/Interface/Game/SimplifiedEscapeMenu.cs index 31ff568fb1..3e315befc0 100644 --- a/Intersect.Client/Interface/Game/SimplifiedEscapeMenu.cs +++ b/Intersect.Client/Interface/Game/SimplifiedEscapeMenu.cs @@ -39,9 +39,9 @@ public SimplifiedEscapeMenu(Canvas gameCanvas) : base(gameCanvas, nameof(Simplif LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer?.GetResolutionString()); } - public override void ToggleHidden() + public void ToggleHidden(Button? target) { - if (!_settingsWindow.IsHidden) + if (!_settingsWindow.IsHidden || target == null) { return; } @@ -49,14 +49,14 @@ public override void ToggleHidden() if (this.IsHidden) { // Position the context menu within the game canvas if near borders. - var menuPosX = Interface.GameUi.GameMenu.mMenuButton.LocalPosToCanvas(new Point(0, 0)).X; - var menuPosY = Interface.GameUi.GameMenu.mMenuButton.LocalPosToCanvas(new Point(0, 0)).Y; + var menuPosX = target.LocalPosToCanvas(new Point(0, 0)).X; + var menuPosY = target.LocalPosToCanvas(new Point(0, 0)).Y; var newX = menuPosX; - var newY = menuPosY + Interface.GameUi.GameMenu.mMenuButton.Height + 6; + var newY = menuPosY + target.Height + 6; if (newX + Width >= Canvas?.Width) { - newX = menuPosX - Width + Interface.GameUi.GameMenu.mMenuButton.Width; + newX = menuPosX - Width + target.Width; } if (newY + Height >= Canvas?.Height)