-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: simplified escape menu #2395
Conversation
+ In game interface setting to toggle this feature. + Fix: "InvalidOperationException: Collection was modified (during iteration);" client crash was happening upon selecting 'yes' on Combat Warning prompt when logging out/exiting.
Added to (v0.8.0-beta.120+) Roadmap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with a change in UI, but I'm not ok with the new icons.
A general menu (that merely contains settings) should not be represented by a settings icon. I'd rather it get changed to a simpler triple-line (hamburger) menu icon.
The guild icon is not obvious as to what it means to me.
This icon (while still not super clear) to me looks like a more generic guild icon, and a pixel art version of the general structure of this icon I think would be better than the flag in the assets PR: https://cdn2.iconfinder.com/data/icons/rpg-basic-set-2/512/guild-512.png
Preview update: 2024-11-23_20-26-18.mp4 |
@@ -37,7 +37,7 @@ public partial class Menu | |||
|
|||
private readonly ImagePanel mMenuBackground; | |||
|
|||
private readonly Button mMenuButton; | |||
public readonly Button mMenuButton; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be done
|
||
if (simplifiedEscapeMenuSetting) | ||
{ | ||
Interface.GameUi?.SimplifiedEscapeMenu?.ToggleHidden(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead I think the button should be passed as a parameter here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private void MenuButtonClicked(Base sender, ClickedEventArgs arguments)
{
var simplifiedEscapeMenuSetting = Globals.Database.SimplifiedEscapeMenu;
if (simplifiedEscapeMenuSetting)
{
Interface.GameUi?.SimplifiedEscapeMenu?.ToggleHidden(mMenuButton);
}
else
{
Interface.GameUi?.EscapeMenu?.ToggleHidden();
}
}
LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer?.GetResolutionString()); | ||
} | ||
|
||
public override void ToggleHidden() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the override version should call ToggleHidden(default)
this should become public void ToggleHidden(Control? target)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used Button? target
instead since we passing over the menu button
public void ToggleHidden(Button? target)
{
if (!_settingsWindow.IsHidden || target == null)
{
return;
}
if (this.IsHidden)
{
// Position the context menu within the game canvas if near borders.
var menuPosX = target.LocalPosToCanvas(new Point(0, 0)).X;
var menuPosY = target.LocalPosToCanvas(new Point(0, 0)).Y;
var newX = menuPosX;
var newY = menuPosY + target.Height + 6;
if (newX + Width >= Canvas?.Width)
{
newX = menuPosX - Width + target.Width;
}
if (newY + Height >= Canvas?.Height)
{
newY = menuPosY - Height - 6;
}
SizeToChildren();
Open(Pos.None);
SetPosition(newX, newY);
}
else
{
Close();
}
}
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 newX = menuPosX; | ||
var newY = menuPosY + Interface.GameUi.GameMenu.mMenuButton.Height + 6; | ||
|
||
if (newX + Width >= Canvas?.Width) | ||
{ | ||
newX = menuPosX - Width + Interface.GameUi.GameMenu.mMenuButton.Width; | ||
} | ||
|
||
if (newY + Height >= Canvas?.Height) | ||
{ | ||
newY = menuPosY - Height - 6; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Position calculations should only happen if target
is not null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
SizeToChildren(); | ||
Open(Pos.None); | ||
SetPosition(newX, newY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only set position if target wasn't null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added an early return within method if target is null already 👍🏽
This pull request introduces a simplified escape menu feature with an in-game interface setting to toggle it on/off. It also fixes a long-standing bug that caused an InvalidOperationException client crash when selecting 'yes' on the Combat Warning prompt during logout/exit.
Assets (make sure to merge before this PR)
Preview:
2024-11-17_20-02-32.mp4
Updated Preview (18-11-24)
2024-11-18_23-22-42.mp4
Updated Preview (23-11-24)
2024-11-23_20-26-18.mp4