private static void doSelectedStuffForSecondary(int i)
 {
     if (selected2 < 1)
     {
         MPAutoSelectUI_UIElement_Draw.isSecondarySelected[i] = true;
         GameManager.m_audio.PlayCue2D(364, 0.4f, 0.07f, 0f, false);
     }
     else
     {
         if (MPAutoSelectUI_UIElement_Draw.isSecondarySelected[i])
         {
             MPAutoSelectUI_UIElement_Draw.isSecondarySelected[i] = false;
             GameManager.m_audio.PlayCue2D(364, 0.4f, 0.07f, 0f, false);
         }
         else
         {
             MPAutoSelectUI_UIElement_Draw.isSecondarySelected[i] = true;
             MPAutoSelectUI_UIElement_Draw.SwapSelectedSecondary();
             SFXCueManager.PlayCue2D(SFXCue.guidebot_objective_found, 0.8f, 0f, 0f, false);
         }
     }
 }
            private static void AutoSelectUpdate(ref float m_menu_state_timer)
            {
                selected  = MPAutoSelectUI_UIElement_Draw.returnPrimarySelected();
                selected2 = MPAutoSelectUI_UIElement_Draw.returnSecondarySelected();
                UIManager.MouseSelectUpdate();
                switch (MenuManager.m_menu_sub_state)
                {
                case MenuSubState.INIT:
                    if (m_menu_state_timer > 0.25f)
                    {
                        UIManager.CreateUIElement(UIManager.SCREEN_CENTER, 7000, Menus.uiAutoSelect);
                        MenuManager.m_menu_sub_state = MenuSubState.ACTIVE;
                        m_menu_state_timer           = 0f;
                        MenuManager.SetDefaultSelection(0);
                    }
                    break;

                case MenuSubState.ACTIVE:
                    UIManager.ControllerMenu();
                    Controls.m_disable_menu_letter_keys = false;

                    if (m_menu_state_timer > 0.25f)
                    {
                        if (UIManager.PushedSelect(100) || (MenuManager.option_dir && UIManager.PushedDir() || UIManager.SliderMouseDown()))
                        {
                            MenuManager.MaybeReverseOption();
                            switch (UIManager.m_menu_selection)
                            {
                            case 100:
                                MenuManager.PlaySelectSound(1f);
                                m_menu_state_timer = 0f;
                                UIManager.DestroyAll(false);
                                MenuManager.m_menu_state       = 0;
                                MenuManager.m_menu_micro_state = 0;
                                MenuManager.m_menu_sub_state   = MenuSubState.BACK;
                                break;

                            case 200:
                            case 201:
                            case 202:
                            case 203:
                                if (UIManager.PushedSelect(100))
                                {
                                    MenuManager.m_menu_micro_state = UIManager.m_menu_selection - 200;
                                    MenuManager.UIPulse(1f);
                                    GameManager.m_audio.PlayCue2D(364, 0.4f, 0.07f, 0f, false);
                                }
                                break;

                            // Triggers Swap Logic for the Primary Weapon Buttons
                            case 1720:
                            case 1721:
                            case 1722:
                            case 1723:
                            case 1724:
                            case 1725:
                            case 1726:
                            case 1727:         // int nwhen (MenuManager.m_menu_micro_state > 1719 && MenuManager.m_menu_micro_state <= 1727):
                                if (UIManager.PushedSelect(100))
                                {
                                    doSelectedStuffForPrimary(UIManager.m_menu_selection - 1720);
                                }
                                break;


                            // Triggers Swap Logic for the Secondary Weapon Buttons
                            case 1728:
                            case 1729:
                            case 1730:
                            case 1731:
                            case 1732:
                            case 1733:
                            case 1734:
                            case 1735:
                                if (UIManager.PushedSelect(100))
                                {
                                    doSelectedStuffForSecondary(UIManager.m_menu_selection - 1728);
                                }
                                break;

                            // Triggers Neverselect Logic for the Primary Buttons
                            case 2000:
                            case 2001:
                            case 2002:
                            case 2003:
                            case 2004:
                            case 2005:
                            case 2006:
                            case 2007:
                                if (UIManager.PushedSelect(100))
                                {
                                    doNeverSelectStuffForPrimary(UIManager.m_menu_selection - 2000);
                                }
                                break;

                            // Triggers Neverselect Logic for the Secondary Buttons
                            case 2010:
                            case 2011:
                            case 2012:
                            case 2013:
                            case 2014:
                            case 2015:
                            case 2016:
                            case 2017:
                                if (UIManager.PushedSelect(100))
                                {
                                    doNeverSelectStuffForSecondary(UIManager.m_menu_selection - 2010);
                                }
                                break;

                            case 2100:
                                if (UIManager.PushedSelect(100))
                                {
                                    if (MPAutoSelection.primarySwapFlag || MPAutoSelection.secondarySwapFlag)
                                    {
                                        MPAutoSelection.primarySwapFlag   = false;
                                        MPAutoSelection.secondarySwapFlag = false;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_close, 0.8f, 0f, 0f, false);
                                    }
                                    else
                                    {
                                        MPAutoSelection.primarySwapFlag    = true;
                                        MPAutoSelection.secondarySwapFlag  = true;
                                        MenuManager.opt_primary_autoswitch = 0;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_picker, 0.8f, 0f, 0f, false);
                                    }
                                    ExtendedConfig.Section_AutoSelect.Set(true);
                                }
                                break;

                            case 2102:
                                if (UIManager.PushedSelect(100))
                                {
                                    if (MPAutoSelection.secondarySwapFlag)
                                    {
                                        MPAutoSelection.secondarySwapFlag = false;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_close, 0.8f, 0f, 0f, false);
                                    }
                                    else
                                    {
                                        MPAutoSelection.secondarySwapFlag = true;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_picker, 0.8f, 0f, 0f, false);
                                    }
                                    ExtendedConfig.Section_AutoSelect.Set(true);
                                }
                                break;

                            case 2103:
                                if (UIManager.PushedSelect(100))
                                {
                                    if (MPAutoSelection.primarySwapFlag)
                                    {
                                        MPAutoSelection.primarySwapFlag = false;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_close, 0.8f, 0f, 0f, false);
                                    }
                                    else
                                    {
                                        MPAutoSelection.primarySwapFlag    = true;
                                        MenuManager.opt_primary_autoswitch = 0;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_picker, 0.8f, 0f, 0f, false);
                                    }
                                    ExtendedConfig.Section_AutoSelect.Set(true);
                                }
                                break;

                            case 2104:
                                if (UIManager.PushedSelect(100))
                                {
                                    if (MPAutoSelection.zorc)
                                    {
                                        MPAutoSelection.zorc = false;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_close, 0.8f, 0f, 0f, false);
                                    }
                                    else
                                    {
                                        MPAutoSelection.zorc = true;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_picker, 0.8f, 0f, 0f, false);
                                    }
                                    ExtendedConfig.Section_AutoSelect.Set(true);
                                }
                                break;

                            case 2105:
                                if (UIManager.PushedSelect(100))
                                {
                                    if (MPAutoSelection.dontAutoselectAfterFiring)
                                    {
                                        MPAutoSelection.dontAutoselectAfterFiring = false;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_close, 0.8f, 0f, 0f, false);
                                    }
                                    else
                                    {
                                        MPAutoSelection.dontAutoselectAfterFiring = true;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_picker, 0.8f, 0f, 0f, false);
                                    }
                                    ExtendedConfig.Section_AutoSelect.Set(true);
                                }
                                break;

                            case 2106:
                                if (UIManager.PushedSelect(100))
                                {
                                    if (MPAutoSelection.swapWhileFiring)
                                    {
                                        MPAutoSelection.swapWhileFiring = false;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_close, 0.8f, 0f, 0f, false);
                                    }
                                    else
                                    {
                                        MPAutoSelection.swapWhileFiring = true;
                                        SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_picker, 0.8f, 0f, 0f, false);
                                    }
                                    ExtendedConfig.Section_AutoSelect.Set(true);
                                }
                                break;

                            case 2107:
                                if (UIManager.PushedSelect(100))
                                {
                                    SFXCueManager.PlayCue2D(SFXCue.hud_weapon_cycle_close, 0.8f, 0f, 0f, false);
                                    ExtendedConfig.Section_AutoSelect.Set();
                                    ExtendedConfig.Section_AutoSelect.ApplySettings();
                                }
                                break;
                            }
                        }
                    }
                    break;

                case MenuSubState.BACK:
                    if (m_menu_state_timer > 0.25f)
                    {
                        MenuManager.ChangeMenuState(((Stack <MenuState>)AccessTools.Field(typeof(MenuManager), "m_back_stack").GetValue(null)).Pop(), true);
                        AccessTools.Field(typeof(MenuManager), "m_went_back").SetValue(null, true);
                    }
                    break;

                case MenuSubState.START:
                    if (m_menu_state_timer > 0.25f)
                    {
                    }
                    break;
                }
            }