コード例 #1
0
        public override void KeyEvent(Int32 key)
        {
            switch (key)
            {
            case KeysDef.K_ESCAPE:
                MainMenu.Show(Host);
                break;

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

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

            case KeysDef.K_ENTER:
                Host.Menu.EnterSound = true;
                switch (_Cursor)
                {
                case 0:
                    if (Host.Network.TcpIpAvailable)
                    {
                        LanConfigMenu.Show(Host);
                    }
                    break;

                case 1:
                    if (Host.Network.TcpIpAvailable)
                    {
                        LanConfigMenu.Show(Host);
                    }
                    break;

                case 2:
                    SetupMenu.Show(Host);
                    break;
                }
                break;
            }
        }
コード例 #2
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;
            }
        }
コード例 #3
0
ファイル: SearchMenu.cs プロジェクト: Kerfuffles/SharpQuake
        public override void Draw( )
        {
            var p = Host.DrawingContext.CachePic("gfx/p_multi.lmp", "GL_NEAREST");

            Host.Menu.DrawPic((320 - p.Width) / 2, 4, p);
            var x = (320 / 2) - ((12 * 8) / 2) + 4;

            Host.Menu.DrawTextBox(x - 8, 32, 12, 1);
            Host.Menu.Print(x, 40, "Searching...");

            if (Host.Network.SlistInProgress)
            {
                Host.Network.Poll( );
                return;
            }

            if (!_SearchComplete)
            {
                _SearchComplete     = true;
                _SearchCompleteTime = Host.RealTime;
            }

            if (Host.Network.HostCacheCount > 0)
            {
                ServerListMenu.Show(Host);
                return;
            }

            Host.Menu.PrintWhite((320 / 2) - ((22 * 8) / 2), 64, "No Quake servers found");
            if ((Host.RealTime - _SearchCompleteTime) < 3.0)
            {
                return;
            }

            LanConfigMenu.Show(Host);
        }
コード例 #4
0
        public override void KeyEvent(Int32 key)
        {
            switch (key)
            {
            case KeysDef.K_ESCAPE:
                LanConfigMenu.Show(Host);
                break;

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

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

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

            case KeysDef.K_RIGHTARROW:
                if (_Cursor == 0)
                {
                    break;
                }
                Host.Sound.LocalSound("misc/menu3.wav");
                Change(1);
                break;

            case KeysDef.K_ENTER:
                Host.Sound.LocalSound("misc/menu2.wav");
                if (_Cursor == 0)
                {
                    if (Host.Server.IsActive)
                    {
                        Host.Commands.Buffer.Append("disconnect\n");
                    }
                    Host.Commands.Buffer.Append("listen 0\n");          // so host_netport will be re-examined
                    Host.Commands.Buffer.Append(String.Format("maxplayers {0}\n", _MaxPlayers));
                    Host.Screen.BeginLoadingPlaque( );

                    if (MainWindow.Common.GameKind == GameKind.Hipnotic)
                    {
                        Host.Commands.Buffer.Append(String.Format("map {0}\n",
                                                                  HipnoticLevels[HipnoticEpisodes[_StartEpisode].firstLevel + _StartLevel].name));
                    }
                    else if (MainWindow.Common.GameKind == GameKind.Rogue)
                    {
                        Host.Commands.Buffer.Append(String.Format("map {0}\n",
                                                                  RogueLevels[RogueEpisodes[_StartEpisode].firstLevel + _StartLevel].name));
                    }
                    else
                    {
                        Host.Commands.Buffer.Append(String.Format("map {0}\n", Levels[Episodes[_StartEpisode].firstLevel + _StartLevel].name));
                    }

                    return;
                }

                Change(1);
                break;
            }
        }