@@ -33,6 +33,7 @@ public class Menu : IMenu, IDisposable
3333 public int ItemsPerPage { get ; } = 6 ;
3434 public PostSelect PostSelect = PostSelect . Nothing ;
3535 public MenuType MenuType = MenuType . KeyPress ;
36+ private bool _menuTypeExplicitlySet = false ;
3637 public bool HasExitButon { get ; set ; }
3738 public bool ShowPageCount { get ; set ; }
3839 public bool ShowControlsInfo { get ; set ; }
@@ -43,6 +44,7 @@ public class Menu : IMenu, IDisposable
4344 internal string ScrollUpKey = "W" ;
4445 internal string ScrollDownKey = "S" ;
4546 internal string SelectKey = "E" ;
47+ internal string ExitKey = "Tab" ;
4648
4749 public Menu ( CCSPlayerController player , BasePlugin plugin )
4850 {
@@ -622,6 +624,7 @@ private void OnTick()
622624 if ( ButtonMapping . TryGetValue ( ScrollUpKey , out PlayerButtons scrollUpButton ) && ( button & scrollUpButton ) == 0 && ( g_OldButtons & scrollUpButton ) != 0 ) { ScrollUp ( ) ; }
623625 else if ( ButtonMapping . TryGetValue ( ScrollDownKey , out PlayerButtons scrollDownButton ) && ( button & scrollDownButton ) == 0 && ( g_OldButtons & scrollDownButton ) != 0 ) { ScrollDown ( ) ; }
624626 else if ( ButtonMapping . TryGetValue ( SelectKey , out PlayerButtons selectButton ) && ( button & selectButton ) == 0 && ( g_OldButtons & selectButton ) != 0 ) { SelectCurrentOption ( ) ; }
627+ else if ( ButtonMapping . TryGetValue ( ExitKey , out PlayerButtons exitButton ) && ( button & exitButton ) == 0 && ( g_OldButtons & exitButton ) != 0 ) { Close ( _player ) ; }
625628 g_OldButtons = button ;
626629 }
627630 }
@@ -632,25 +635,41 @@ private void OnCheckTransmit(CCheckTransmitInfoList infoList)
632635 }
633636 private void ConfigureSettings ( )
634637 {
635- MenuType = _config . Settings . MenuType switch
638+ if ( ! _menuTypeExplicitlySet )
636639 {
637- "Scrollable" => MenuType . Scrollable ,
638- "Both" => MenuType . Both ,
639- _ => MenuType . KeyPress ,
640- } ;
640+ MenuType = _config . Settings . MenuType switch
641+ {
642+ "Scrollable" => MenuType . Scrollable ,
643+ "Both" => MenuType . Both ,
644+ _ => MenuType . KeyPress ,
645+ } ;
646+ }
641647 HasExitButon = _config . Settings . HasExitOption ;
642648 ShowResolutionOption = _config . Settings . ShowResolutionOption ;
643649 ShowPageCount = _config . Settings . ShowPageCount ;
644650 ShowDisabledOptionNum = _config . Settings . ShowDisabledOptionNum ;
645651 ShowControlsInfo = _config . Settings . ShowControlsInfo ;
652+ ConfigureControlsForMenuType ( ) ;
653+ }
654+
655+ private void ConfigureControlsForMenuType ( )
656+ {
646657 if ( MenuType != MenuType . KeyPress )
647658 {
648659 ScrollUpKey = _config . Controls . ScrollUp ;
649660 ScrollDownKey = _config . Controls . ScrollDown ;
650661 SelectKey = _config . Controls . Select ;
662+ ExitKey = _config . Controls . Exit ;
651663 }
652664 }
653665
666+ public void SetMenuType ( MenuType menuType )
667+ {
668+ MenuType = menuType ;
669+ _menuTypeExplicitlySet = true ;
670+ ConfigureControlsForMenuType ( ) ;
671+ }
672+
654673 internal int GetEnabledOptionsCountOnCurrentPage ( )
655674 {
656675 int startIndex = CurrentPage * ItemsPerPage ;
0 commit comments