Beispiel #1
0
        public override void KeyEvent(Int32 key)
        {
            switch (key)
            {
            case KeysDef.K_ESCAPE:
            case 'n':
            case 'N':
                if (_PrevMenu != null)
                {
                    _PrevMenu.Show(Host);
                }
                else
                {
                    CurrentMenu.Hide( );
                }
                break;

            case 'Y':
            case 'y':
                Host.Keyboard.Destination = KeyDestination.key_console;
                Host.Quit_f(null);
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        public override void KeyEvent(Int32 key)
        {
            switch (key)
            {
            case KeysDef.K_ESCAPE:
                SinglePlayerMenu.Show(Host);
                break;

            case KeysDef.K_ENTER:
                CurrentMenu.Hide( );
                Host.Commands.Buffer.Append(String.Format("save s{0}\n", _Cursor));
                return;

            case KeysDef.K_UPARROW:
            case KeysDef.K_LEFTARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                _Cursor--;
                if (_Cursor < 0)
                {
                    _Cursor = MAX_SAVEGAMES - 1;
                }
                break;

            case KeysDef.K_DOWNARROW:
            case KeysDef.K_RIGHTARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                _Cursor++;
                if (_Cursor >= MAX_SAVEGAMES)
                {
                    _Cursor = 0;
                }
                break;
            }
        }
Beispiel #3
0
        /// <summary>
        /// M_Main_Key
        /// </summary>
        public override void KeyEvent(Int32 key)
        {
            switch (key)
            {
            case KeysDef.K_ESCAPE:
                //Host.Keyboard.Destination = keydest_t.key_game;
                CurrentMenu.Hide( );
                Host.Client.cls.demonum = _SaveDemoNum;
                if (Host.Client.cls.demonum != -1 && !Host.Client.cls.demoplayback && Host.Client.cls.state != cactive_t.ca_connected)
                {
                    Host.Client.NextDemo( );
                }
                break;

            case KeysDef.K_DOWNARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                if (++_Cursor >= MAIN_ITEMS)
                {
                    _Cursor = 0;
                }
                break;

            case KeysDef.K_UPARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                if (--_Cursor < 0)
                {
                    _Cursor = MAIN_ITEMS - 1;
                }
                break;

            case KeysDef.K_ENTER:
                Host.Menu.EnterSound = true;

                switch (_Cursor)
                {
                case 0:
                    SinglePlayerMenu.Show(Host);
                    break;

                case 1:
                    MultiPlayerMenu.Show(Host);
                    break;

                case 2:
                    OptionsMenu.Show(Host);
                    break;

                case 3:
                    HelpMenu.Show(Host);
                    break;

                case 4:
                    QuitMenu.Show(Host);
                    break;
                }
                break;
            }
        }
Beispiel #4
0
 /// <summary>
 /// 隐藏菜单
 /// </summary>
 public static void HideMenu()
 {
     if (Root != null)
     {
         Root.gameObject.SetActive(false);
     }
     if (CurrentMenu != null)
     {
         CurrentMenu.Hide();
     }
 }
Beispiel #5
0
 /// <summary>
 /// 隐藏菜单
 /// </summary>
 public static void HideMenu()
 {
     if (UIRoot != null)
     {
         UIRoot.activeSelf = false;
     }
     if (CurrentMenu != null)
     {
         CurrentMenu.Hide();
     }
 }
Beispiel #6
0
        public override void KeyEvent(Int32 key)
        {
            switch (key)
            {
            case KeysDef.K_ESCAPE:
                SinglePlayerMenu.Show(Host);
                break;

            case KeysDef.K_ENTER:
                Host.Sound.LocalSound("misc/menu2.wav");
                if (!_Loadable[_Cursor])
                {
                    return;
                }
                CurrentMenu.Hide( );

                // Host_Loadgame_f can't bring up the loading plaque because too much
                // stack space has been used, so do it now
                Host.Screen.BeginLoadingPlaque( );

                // issue the load command
                Host.Commands.Buffer.Append(String.Format("load s{0}\n", _Cursor));
                return;

            case KeysDef.K_UPARROW:
            case KeysDef.K_LEFTARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                _Cursor--;
                if (_Cursor < 0)
                {
                    _Cursor = MAX_SAVEGAMES - 1;
                }
                break;

            case KeysDef.K_DOWNARROW:
            case KeysDef.K_RIGHTARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                _Cursor++;
                if (_Cursor >= MAX_SAVEGAMES)
                {
                    _Cursor = 0;
                }
                break;
            }
        }
Beispiel #7
0
    protected IEnumerator DoHideAnim()
    {
        IsDuringHiding           = true;
        CanvasGroup.interactable = false;

        float duration = Master.Hide.Duration;

        Master.Hide.Play();
        switch (Master.Hide.AlphaMode)
        {
        case AlphaMode.Custom:
            yield return(new WaitForSecondsRealtime(duration));

            break;

        case AlphaMode.Animate:
        {
            yield return(StartCoroutine(CoHandleAlphaAnim(1, 0, duration, CanvasGroup)));

            CanvasGroup.alpha = 0;
            break;
        }

        case AlphaMode.Snap:
        {
            yield return(new WaitForSecondsRealtime(duration));

            CanvasGroup.alpha = 0;
            break;
        }
        }

        if (CurrentMenu)
        {
            CurrentMenu.Hide();
            CurrentMenu.gameObject.SetActive(false);
        }

        IsDuringHiding = false;

        CanvasGroup.alpha = 0;

        SkipLocalAnim = true;
        SwitchToMenuImmediate(null, false);
    }
Beispiel #8
0
        public override void KeyEvent(Int32 key)
        {
            switch (key)
            {
            case KeysDef.K_ESCAPE:
                LanConfigMenu.Show(Host);
                break;

            case KeysDef.K_SPACE:
                SearchMenu.Show(Host);
                break;

            case KeysDef.K_UPARROW:
            case KeysDef.K_LEFTARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                _Cursor--;
                if (_Cursor < 0)
                {
                    _Cursor = Host.Network.HostCacheCount - 1;
                }
                break;

            case KeysDef.K_DOWNARROW:
            case KeysDef.K_RIGHTARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                _Cursor++;
                if (_Cursor >= Host.Network.HostCacheCount)
                {
                    _Cursor = 0;
                }
                break;

            case KeysDef.K_ENTER:
                Host.Sound.LocalSound("misc/menu2.wav");
                Host.Menu.ReturnMenu    = this;
                Host.Menu.ReturnOnError = true;
                _Sorted = false;
                CurrentMenu.Hide( );
                Host.Commands.Buffer.Append(String.Format("connect \"{0}\"\n", Host.Network.HostCache[_Cursor].cname));
                break;

            default:
                break;
            }
        }
Beispiel #9
0
        /// <summary>
        /// M_ToggleMenu_f
        /// </summary>
        public void ToggleMenu_f(CommandMessage msg)
        {
            EnterSound = true;

            if (Host.Keyboard.Destination == KeyDestination.key_menu)
            {
                if (CurrentMenu.Name != "menu_menu")
                {
                    Show("menu_main");
                    return;
                }
                CurrentMenu.Hide();
                return;
            }
            if (Host.Keyboard.Destination == KeyDestination.key_console)
            {
                Host.Console.ToggleConsole_f(null);
            }
            else
            {
                Show("menu_main");
            }
        }
Beispiel #10
0
        public override void KeyEvent(Int32 key)
        {
            switch (key)
            {
            case KeysDef.K_ESCAPE:
                MultiPlayerMenu.Show(Host);
                break;

            case KeysDef.K_UPARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                _Cursor--;
                if (_Cursor < 0)
                {
                    _Cursor = NUM_LANCONFIG_CMDS - 1;
                }
                break;

            case KeysDef.K_DOWNARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                _Cursor++;
                if (_Cursor >= NUM_LANCONFIG_CMDS)
                {
                    _Cursor = 0;
                }
                break;

            case KeysDef.K_ENTER:
                if (_Cursor == 0)
                {
                    break;
                }

                Host.Menu.EnterSound  = true;
                Host.Network.HostPort = _Port;

                if (_Cursor == 1)
                {
                    if (StartingGame)
                    {
                        GameOptionsMenu.Show(Host);
                    }
                    else
                    {
                        SearchMenu.Show(Host);
                    }
                    break;
                }

                if (_Cursor == 2)
                {
                    Host.Menu.ReturnMenu    = this;
                    Host.Menu.ReturnOnError = true;
                    CurrentMenu.Hide( );
                    Host.Commands.Buffer.Append(String.Format("connect \"{0}\"\n", _JoinName));
                    break;
                }
                break;

            case KeysDef.K_BACKSPACE:
                if (_Cursor == 0)
                {
                    if (!String.IsNullOrEmpty(_PortName))
                    {
                        _PortName = _PortName.Substring(0, _PortName.Length - 1);
                    }
                }

                if (_Cursor == 2)
                {
                    if (!String.IsNullOrEmpty(_JoinName))
                    {
                        _JoinName = _JoinName.Substring(0, _JoinName.Length - 1);
                    }
                }
                break;

            default:
                if (key < 32 || key > 127)
                {
                    break;
                }

                if (_Cursor == 2)
                {
                    if (_JoinName.Length < 21)
                    {
                        _JoinName += ( Char )key;
                    }
                }

                if (key < '0' || key > '9')
                {
                    break;
                }

                if (_Cursor == 0)
                {
                    if (_PortName.Length < 5)
                    {
                        _PortName += ( Char )key;
                    }
                }
                break;
            }

            if (StartingGame && _Cursor == 2)
            {
                if (key == KeysDef.K_UPARROW)
                {
                    _Cursor = 1;
                }
                else
                {
                    _Cursor = 0;
                }
            }

            var k = MathLib.atoi(_PortName);

            if (k > 65535)
            {
                k = _Port;
            }
            else
            {
                _Port = k;
            }
            _PortName = _Port.ToString( );
        }
Beispiel #11
0
        public override void KeyEvent(Int32 key)
        {
            switch (key)
            {
            case KeysDef.K_ESCAPE:
                MainMenu.Show(Host);
                break;

            case KeysDef.K_ENTER:
                Host.Menu.EnterSound = true;
                switch (_Cursor)
                {
                case 0:
                    KeysMenu.Show(Host);
                    break;

                case 1:
                    CurrentMenu.Hide( );
                    Host.Console.ToggleConsole_f(null);
                    break;

                case 2:
                    Host.Commands.Buffer.Append("exec default.cfg\n");
                    break;

                case 12:
                    VideoMenu.Show(Host);
                    break;

                default:
                    AdjustSliders(1);
                    break;
                }
                return;

            case KeysDef.K_UPARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                _Cursor--;
                if (_Cursor < 0)
                {
                    _Cursor = OPTIONS_ITEMS - 1;
                }
                break;

            case KeysDef.K_DOWNARROW:
                Host.Sound.LocalSound("misc/menu1.wav");
                _Cursor++;
                if (_Cursor >= OPTIONS_ITEMS)
                {
                    _Cursor = 0;
                }
                break;

            case KeysDef.K_LEFTARROW:
                AdjustSliders(-1);
                break;

            case KeysDef.K_RIGHTARROW:
                AdjustSliders(1);
                break;
            }

            /*if( _Cursor == 12 && VideoMenu == null )
             * {
             *  if( key == KeysDef.K_UPARROW )
             *      _Cursor = 11;
             *  else
             *      _Cursor = 0;
             * }*/

            if (_Cursor == 12)
            {
                if (key == KeysDef.K_UPARROW)
                {
                    _Cursor = 11;
                }
                else
                {
                    _Cursor = 0;
                }
            }

            /*#if _WIN32
             *          if ((options_cursor == 13) && (modestate != MS_WINDOWED))
             *          {
             *              if (k == K_UPARROW)
             *                  options_cursor = 12;
             *              else
             *                  options_cursor = 0;
             *          }
             #endif*/
        }