Beispiel #1
0
        private void Button_Click_Multi_Player(object sender, RoutedEventArgs e)
        {
            MultiPlayerMenu w = new MultiPlayerMenu();

            w.Show();
            this.Close();
        }
Beispiel #2
0
        private void MultiPlayer_Click(object sender, RoutedEventArgs e)
        {
            MultiPlayerMenu multiPlayer = new MultiPlayerMenu();

            multiPlayer.Show();
            this.Close();
        }
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
        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_SETUP_CMDS - 1;
                }
                break;

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

            case KeysDef.K_LEFTARROW:
                if (_Cursor < 2)
                {
                    return;
                }
                Host.Sound.LocalSound("misc/menu3.wav");
                if (_Cursor == 2)
                {
                    _Top = _Top - 1;
                }
                if (_Cursor == 3)
                {
                    _Bottom = _Bottom - 1;
                }
                break;

            case KeysDef.K_RIGHTARROW:
                if (_Cursor < 2)
                {
                    return;
                }
forward:
                Host.Sound.LocalSound("misc/menu3.wav");
                if (_Cursor == 2)
                {
                    _Top = _Top + 1;
                }
                if (_Cursor == 3)
                {
                    _Bottom = _Bottom + 1;
                }
                break;

            case KeysDef.K_ENTER:
                if (_Cursor == 0 || _Cursor == 1)
                {
                    return;
                }

                if (_Cursor == 2 || _Cursor == 3)
                {
                    goto forward;
                }

                // _Cursor == 4 (OK)
                if (_MyName != Host.Client.Name)
                {
                    Host.Commands.Buffer.Append(String.Format("name \"{0}\"\n", _MyName));
                }
                if (Host.Network.HostName != _HostName)
                {
                    Host.CVars.Set("hostname", _HostName);
                }
                if (_Top != _OldTop || _Bottom != _OldBottom)
                {
                    Host.Commands.Buffer.Append(String.Format("color {0} {1}\n", _Top, _Bottom));
                }
                Host.Menu.EnterSound = true;
                MultiPlayerMenu.Show(Host);
                break;

            case KeysDef.K_BACKSPACE:
                if (_Cursor == 0)
                {
                    if (!String.IsNullOrEmpty(_HostName))
                    {
                        _HostName = _HostName.Substring(0, _HostName.Length - 1);      // setup_hostname[strlen(setup_hostname) - 1] = 0;
                    }
                }

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

            default:
                if (key < 32 || key > 127)
                {
                    break;
                }
                if (_Cursor == 0)
                {
                    var l = _HostName.Length;
                    if (l < 15)
                    {
                        _HostName = _HostName + ( Char )key;
                    }
                }
                if (_Cursor == 1)
                {
                    var l = _MyName.Length;
                    if (l < 15)
                    {
                        _MyName = _MyName + ( Char )key;
                    }
                }
                break;
            }

            if (_Top > 13)
            {
                _Top = 0;
            }
            if (_Top < 0)
            {
                _Top = 13;
            }
            if (_Bottom > 13)
            {
                _Bottom = 0;
            }
            if (_Bottom < 0)
            {
                _Bottom = 13;
            }
        }
Beispiel #5
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( );
        }