Skip to content
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

fix: only close the menu if it has exit button #622

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions managed/CounterStrikeSharp.API/Modules/Menu/BaseMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ protected BaseMenuInstance(CCSPlayerController player, IMenu menu)

protected bool HasPrevButton => Page > 0;
protected bool HasNextButton => Menu.MenuOptions.Count > NumPerPage && CurrentOffset + NumPerPage < Menu.MenuOptions.Count;
protected bool HasExitButton => Menu.ExitButton;
protected virtual int MenuItemsPerPage => NumPerPage;

public virtual void Display()
Expand All @@ -113,7 +114,7 @@ public void OnKeyPress(CCSPlayerController player, int key)
return;
}

if (key == 9)
if (key == 9 && HasExitButton)
{
Close();
return;
Expand Down Expand Up @@ -174,4 +175,4 @@ public void PrevPage()
CurrentOffset = PrevPageOffsets.Pop();
Display();
}
}
}
Loading