Skip to content

Commit

Permalink
fix: only close the menu if it has exit button (#622)
Browse files Browse the repository at this point in the history
Co-authored-by: KillStr3aK <[email protected]>
  • Loading branch information
KillStr3aK and KillStr3aK authored Oct 20, 2024
1 parent b54f5c3 commit 5c9d38b
Showing 1 changed file with 3 additions and 2 deletions.
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();
}
}
}

0 comments on commit 5c9d38b

Please sign in to comment.