Exemplo n.º 1
0
        }         // WriteCreditsWithLink(xPos, yPos, leftText)

        #endregion

        #region Run
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(RocketCommanderGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Credits
            int xPos = 50 * BaseGame.Width / 1024;
            int yPos = 180 * BaseGame.Height / 768;

            TextureFont.WriteText(xPos, yPos, Texts.Credits);

            WriteCreditsWithLink(xPos, yPos + 72, "Idea, Design, Programming",
                                 "Benjamin Nitschke (abi)",
                                 "http://abi.exdream.com", game);
            WriteCredits(xPos, yPos + 167, "Thanks fly out to",
                         "Christoph Rienäcker, Leif Griga, Boje Holtz,");
            WriteCredits(xPos, yPos + 217, "",
                         "Enrico Cieslik (Judge), ZMan (www.thezbuffer.com),");
            WriteCredits(xPos, yPos + 267, "",
                         "Dirk Primbs and Christina Storm of Microsoft and");
            WriteCredits(xPos, yPos + 317, "",
                         "and the XNA and .NET Teams at Microsoft :)");

            TextureFont.WriteText(xPos, 647 * BaseGame.Height / 768,
                                  "Dedicated to the great XNA Framework.");

            if (game.RenderMenuButton(MenuButton.Back,
                                      new Point(1024 - 230, 768 - 150)))
            {
                quit = true;
            }     // if
        }         // Run(game)
        }         // Help()

        #endregion

        #region Run
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co.</param>
        public void Run(RocketCommanderGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Show helper screen texture
            game.helpScreenTexture.RenderOnScreen(
                new Rectangle(0,
                              174 * BaseGame.Height / 768,
                              BaseGame.Width,
                              510 * BaseGame.Height / 768),
                new Rectangle(0, 0, 1024, 510));

            if (game.RenderMenuButton(MenuButton.Back,
                                      new Point(1024 - 230, 768 - 140)) ||
                Input.KeyboardEscapeJustPressed ||
                Input.GamePadBJustPressed ||
                Input.GamePadBackJustPressed)
            {
                quit = true;
            }     // if
        }         // Run(game)
        }         // SelectMenuItemForXInput()

        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(RocketCommanderGame game)
        {
            if (xInputMenuSelection < 0)
            {
                xInputMenuSelection = 0;
                SelectMenuItemForXInput();
            }             // if

            if (resetCamera)
            {
                resetCamera = false;
                RocketCommanderGame.camera.SetPosition(Vector3.Zero);
                RocketCommanderGame.camera.InGame = false;
                xInputMenuSelection = 0;
            }             // if

            // Render background
            game.RenderMenuBackground();

            // Show all buttons
            int buttonNum = 0;

            MenuButton[] menuButtons = new MenuButton[]
            {
                MenuButton.Missions,
                MenuButton.Highscore,
                MenuButton.Credits,
                MenuButton.Help,
                MenuButton.Options,
                MenuButton.Exit,
                MenuButton.Back,
            };
            foreach (MenuButton button in menuButtons)
            {
                //EnumHelper.GetEnumerator(typeof(MenuButton)))
                // Don't render the back button
                if (button != MenuButton.Back)
                {
                    if (game.RenderMenuButton(button, buttonLocations[buttonNum]))
                    {
                        if (button == MenuButton.Missions)
                        {
                            xInputMenuSelection = -1;
                            game.AddGameScreen(new MissionSelection());
                        }                         // if
                        else if (button == MenuButton.Highscore)
                        {
                            game.AddGameScreen(new Highscores());
                        }
                        else if (button == MenuButton.Credits)
                        {
                            game.AddGameScreen(new Credits());
                        }
                        else if (button == MenuButton.Options)
                        {
                            game.AddGameScreen(new Options());
                        }
                        else if (button == MenuButton.Help)
                        {
                            game.AddGameScreen(new Help());
                        }
                        else if (button == MenuButton.Exit)
                        {
                            quit = true;
                        }
                    }                     // if
                    buttonNum++;
                    if (buttonNum >= buttonLocations.Length)
                    {
                        break;
                    }
                }                 // if
            }
            // Hotkeys, M=Mission, H=Highscores, C=Credits, Esc=Quit
            if (Input.KeyboardKeyJustPressed(Keys.M))
            {
                xInputMenuSelection = -1;
                game.AddGameScreen(new MissionSelection());
            }             // if
            else if (Input.KeyboardKeyJustPressed(Keys.H))
            {
                game.AddGameScreen(new Highscores());
            }
            else if (Input.KeyboardKeyJustPressed(Keys.C))
            {
                game.AddGameScreen(new Credits());
            }
            else if (Input.KeyboardKeyJustPressed(Keys.O))
            {
                game.AddGameScreen(new Options());
            }
            else if (Input.KeyboardKeyJustPressed(Keys.F1))
            {
                game.AddGameScreen(new Help());
            }
            else if (Input.KeyboardEscapeJustPressed ||
                     Input.GamePadBackJustPressed)
            {
                quit = true;
            }

            // If pressing XBox controller up/down change selection
            if (Input.GamePadDownJustPressed)
            {
                xInputMenuSelection =
                    (xInputMenuSelection + 1) % buttonLocations.Length;
                SelectMenuItemForXInput();
            }             // if (Input.GamePad)
            else if (Input.GamePadUpJustPressed)
            {
                if (xInputMenuSelection <= 0)
                {
                    xInputMenuSelection = buttonLocations.Length;
                }
                xInputMenuSelection--;
                SelectMenuItemForXInput();
            }             // if (Input.GamePad)

            string versionText = "v" +
                                 //obs: Application.ProductVersion.Substring(0, 3);
                                 Program.versionHigh + "." + Program.versionLow;
            int xPos = BaseGame.Width -
                       versionText.Length * TextureFont.Height / 2 - 2,         // + 4,
                yPos = BaseGame.Height - TextureFont.Height - 1;

#if XBOX360
            xPos -= BaseGame.XToRes(42);            //32);
            yPos -= BaseGame.YToRes(66);            //26);
#endif
            TextureFont.WriteText(xPos, yPos, versionText, Color.Gray);
        }         // Run(game)
Exemplo n.º 4
0
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co.</param>
        public void Run(RocketCommanderGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Show helper screen texture
            game.helpScreenTexture.RenderOnScreen(
                new Rectangle(0,
                174 * BaseGame.Height / 768,
                BaseGame.Width,
                510 * BaseGame.Height / 768),
                new Rectangle(0, 0, 1024, 510));

            if (game.RenderMenuButton(MenuButton.Back,
                new Point(1024 - 230, 768 - 140)) ||
                Input.KeyboardEscapeJustPressed ||
                Input.GamePadBJustPressed ||
                Input.GamePadBackJustPressed)
            {
                quit = true;
            } // if
        }
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(RocketCommanderGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Credits
            int xPos = 50 * BaseGame.Width / 1024;
            int yPos = 180 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos, Texts.Credits);

            WriteCreditsWithLink(xPos, yPos+72, "Idea, Design, Programming",
                "Benjamin Nitschke (abi)",
                "http://abi.exdream.com", game);
            WriteCredits(xPos, yPos + 167, "Thanks fly out to",
                "Christoph Rienäcker, Leif Griga, Boje Holtz,");
            WriteCredits(xPos, yPos + 217, "",
                "Enrico Cieslik (Judge), ZMan (www.thezbuffer.com),");
            WriteCredits(xPos, yPos + 267, "",
                "Dirk Primbs and Christina Storm of Microsoft and");
            WriteCredits(xPos, yPos + 317, "",
                "and the XNA and .NET Teams at Microsoft :)");

            TextureFont.WriteText(xPos, 647 * BaseGame.Height / 768,
                "Dedicated to the great XNA Framework.");

            if (game.RenderMenuButton(MenuButton.Back,
                new Point(1024 - 230, 768 - 150)))
            {
                quit = true;
            } // if
        }
        }         // SelectMenuItemForXInput()

        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(RocketCommanderGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Select mission
            int xPos = 50 * BaseGame.Width / 1024;
            int yPos = 154 * BaseGame.Height / 768;

            TextureFont.WriteText(xPos, yPos, Texts.SelectMission);

            if (game.RenderMenuButton(MenuButton.Back,
                                      new Point(1024 - 230, 768 - 150)))
            {
                quit = true;
            }             // if

            // If pressing XBox controller right/left change selection
            int maxLevels = Math.Min(game.levels.Length, 4);

            if (Input.GamePadRightJustPressed)
            {
                xInputLevelSelection =
                    (xInputLevelSelection + 1) % maxLevels;
                SelectLevelForXInput(maxLevels);
            }             // if (Input.GamePad)
            else if (Input.GamePadLeftJustPressed)
            {
                if (xInputLevelSelection <= 0)
                {
                    xInputLevelSelection = maxLevels;
                }
                xInputLevelSelection--;
                SelectLevelForXInput(maxLevels);
            }             // if (Input.GamePad)

            // Show all levels (max. 4 levels are supported right now)
            for (int num = 0; num < game.levels.Length &&
                 num < 4; num++)
            {
                Level level = game.levels[num];
                xPos = 50 * BaseGame.Width / 1024 +
                       num * (BaseGame.Width - 175) / 4;
                yPos = 192 * BaseGame.Height / 768;

                // Is selected?
                int       maxHeight = BaseGame.Height * 5 / 6 - yPos;
                int       height    = Math.Min(level.Length, maxHeight);
                Rectangle clickArea = new Rectangle(
                    xPos, yPos,
                    (BaseGame.Width - 180) / 4 - 10, height + 27);
                Color col = Input.MouseInBox(clickArea) && quit == false ?
                            Color.Red : Color.White;

                // Write name on top
                TextureFont.WriteText(
                    xPos, yPos,                    // - (num%2==1?40:0),
                    level.Name, col);

                // Calc preview rect
                Rectangle previewRect = new Rectangle(
                    xPos, yPos + 38, 40, height);

                // Disable linear filtering for level textures
                BaseGame.DisableLinearTextureFiltering();

                // Show level preview.
                // Show 2 parts if bigger than 512
                if (level.Length > 512)
                {
                    previewRect = new Rectangle(
                        xPos + 70, yPos + 38, 40, height);
                    level.Texture.RenderOnScreen(previewRect,
                                                 new Rectangle(0, 0, 40, Math.Min(level.Length, 512)));

                    // Draw lines around preview rect to mark highlighting
                    Point upperLeft  = new Point(previewRect.X, previewRect.Y);
                    Point upperRight = new Point(previewRect.Right, previewRect.Y);
                    Point lowerLeft  = new Point(previewRect.X, previewRect.Bottom);
                    Point lowerRight = new Point(previewRect.Right, previewRect.Bottom);
                    BaseGame.DrawLine(upperLeft, upperRight, col);
                    BaseGame.DrawLine(upperLeft, lowerLeft, col);
                    BaseGame.DrawLineWithShadow(upperRight, lowerRight,
                                                col);
                    BaseGame.DrawLineWithShadow(lowerLeft,
                                                new Point(lowerRight.X + 1, lowerRight.Y), col);

                    previewRect = new Rectangle(
                        xPos, yPos + 26 + 8, 40, height);
                    level.Texture.RenderOnScreen(previewRect,
                                                 new Rectangle(0, 512, 40, Math.Min(level.Length - 512, 512)));

                    upperLeft  = new Point(previewRect.X, previewRect.Y);
                    upperRight = new Point(previewRect.Right, previewRect.Y);
                    lowerLeft  = new Point(previewRect.X, previewRect.Bottom);
                    lowerRight = new Point(previewRect.Right, previewRect.Bottom);
                    BaseGame.DrawLine(upperLeft, upperRight, col);
                    BaseGame.DrawLine(upperLeft, lowerLeft, col);
                    BaseGame.DrawLineWithShadow(upperRight, lowerRight,
                                                col);
                    BaseGame.DrawLineWithShadow(lowerLeft,
                                                new Point(lowerRight.X + 1, lowerRight.Y), col);

                    // Draw connection line (makes more sense to understand structure)
                    Point p1 =
                        new Point(xPos + 20, previewRect.Y);
                    Point p2 =
                        new Point(xPos + 20, previewRect.Y - 8);
                    Point p3 =
                        new Point(xPos + 40 + 15, previewRect.Y - 8);
                    Point p4 =
                        new Point(xPos + 40 + 15, previewRect.Bottom);
                    Point p5 =
                        new Point(xPos + 40 + 30 + 20, previewRect.Bottom);
                    Point p6 =
                        new Point(xPos + 40 + 30 + 20, previewRect.Bottom - 8);
                    col = Color.LightGray;
                    BaseGame.DrawLine(p1, p2, col);
                    BaseGame.DrawLine(p2, p3, col);
                    BaseGame.DrawLine(p3, p4, col);
                    BaseGame.DrawLine(p4, p5, col);
                    BaseGame.DrawLine(p5, p6, col);
                }                 // if
                else
                {
                    // Show just one part
                    level.Texture.RenderOnScreen(previewRect,
                                                 new Rectangle(0, 0, 40, Math.Min(level.Length, 512)));

                    // Draw lines around preview rect to mark highlighting
                    Point upperLeft  = new Point(previewRect.X, previewRect.Y);
                    Point upperRight = new Point(previewRect.Right, previewRect.Y);
                    Point lowerLeft  = new Point(previewRect.X, previewRect.Bottom);
                    Point lowerRight = new Point(previewRect.Right, previewRect.Bottom);
                    BaseGame.DrawLine(upperLeft, upperRight, col);
                    BaseGame.DrawLine(upperLeft, lowerLeft, col);
                    BaseGame.DrawLineWithShadow(upperRight, lowerRight,
                                                col);
                    BaseGame.DrawLineWithShadow(lowerLeft,
                                                new Point(lowerRight.X + 1, lowerRight.Y), col);
                }                 // else

                // Enable linear texture filtering again
                BaseGame.EnableLinearTextureFiltering();

                // Level selected?
                if (Input.MouseInBox(clickArea) &&
                    quit == false &&
                    (Input.MouseLeftButtonJustPressed ||
                     Input.GamePadAJustPressed ||
                     Input.GamePadStartPressed))
                {
                    // Close mission selection
                    game.RemoveCurrentGameScreen();

                    // Remember selected level number for the sky rotation.
                    Level.currentLevelNumber = num;

                    // Start mission with this level
                    game.AddGameScreen(new Mission(level, game.asteroidManager));
                } // if
            }     // for (num)
        }         // Run(game)
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(RocketCommanderGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Write player name
            int xPos = 100 * BaseGame.Width / 1024,
                yPos = 168 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos,
                Texts.Options);

            // Edit player name
            yPos += 40 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos,
                Texts.PlayerName + ": " + currentPlayerName +
                ((BaseGame.TotalTimeMs / 200) % 2 == 0 ? "|" : ""));

            // Allow editing player name
            string oldPlayerName = currentPlayerName;
            Input.HandleKeyboardInput(ref currentPlayerName);
            if (currentPlayerName != oldPlayerName)
            {
                // , and : are not allowed for the player name!
                StringHelper.RemoveCharacter(ref currentPlayerName, ',');
                StringHelper.RemoveCharacter(ref currentPlayerName, ':');

                GameSettings.Default.PlayerName = currentPlayerName;
            } // if (BaseGame.lastPressedKeys.Length)

            // Show all available languages and allow changing
            yPos += 40 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos, Texts.Language + ": ");

            TextureFont.WriteText(xPos + 225, yPos, Texts.English,
                Texts.Culture == null ||
                Texts.Culture == CultureInfo.InvariantCulture ?
                Color.Red : Color.White);
            if (Input.MouseLeftButtonPressed &&
                Texts.Culture != CultureInfo.InvariantCulture &&
                Input.MouseInBox(new Rectangle(xPos + 225, yPos, 160, 30)))
            {
                Texts.Culture = CultureInfo.InvariantCulture;
                GameSettings.Default.Language = "Invariant";
            } // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 400, yPos, Texts.German,
                Texts.Culture != null && Texts.Culture.Name == "de-DE" ?
                Color.Red : Color.White);
            if (Input.MouseLeftButtonPressed &&
                (Texts.Culture == null || Texts.Culture.Name != "de-DE") &&
                Input.MouseInBox(new Rectangle(xPos + 400, yPos, 200, 30)))
            {
                Texts.Culture = new CultureInfo("de-DE");
                GameSettings.Default.Language = Texts.Culture.Name;
            } // if (Input.MouseLeftButtonPressed)
            //TODO: more languages

            // Allow changing the graphic quality
            yPos += 40 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos, Texts.Performance + ":");

            TextureFont.WriteText(xPos + 40, yPos + 40, Texts.PerformanceMedium,
                BaseGame.GraphicsPerformanceSetting ==
                BaseGame.PerformanceSetting.Medium ?
                Color.Red :
                Input.MouseInBox(new Rectangle(xPos, yPos + 40, 500, 30)) ?
                Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos, yPos + 40, 500, 30)))
            {
                BaseGame.GraphicsPerformanceSetting =
                    BaseGame.PerformanceSetting.Medium;
            } // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 40, yPos + 80, Texts.PerformanceQuality,
                BaseGame.GraphicsPerformanceSetting ==
                BaseGame.PerformanceSetting.Quality ?
                Color.Red :
                Input.MouseInBox(new Rectangle(xPos, yPos + 80, 500, 30)) ?
                Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos, yPos + 80, 500, 30)))
            {
                BaseGame.GraphicsPerformanceSetting =
                    BaseGame.PerformanceSetting.Quality;
            } // if (Input.MouseLeftButtonPressed)

            // Allow to select from some of the supported resolutions
            yPos += 120 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos, Texts.ChangeResolution + ":");

            TextureFont.WriteText(xPos + 40, yPos + 40, "Autodetect Best",
                resolutionWidth == 0 &&
                resolutionHeight == 0 ?
                Color.Red :
                Input.MouseInBox(new Rectangle(xPos + 40, yPos + 40, 300, 30)) ?
                Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 40, yPos + 40, 300, 30)))
            {
                GameSettings.Default.ResolutionWidth = resolutionWidth = 0;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 0;
            } // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 370, yPos + 40, "640x480",
                resolutionWidth == 640 &&
                resolutionHeight == 480 ?
                Color.Red :
                Input.MouseInBox(new Rectangle(xPos + 350, yPos + 40, 150, 30)) ?
                Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 350, yPos + 40, 150, 30)))
            {
                GameSettings.Default.ResolutionWidth = resolutionWidth = 640;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 480;
            } // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 550, yPos + 40, "800x600",
                resolutionWidth == 800 &&
                resolutionHeight == 600 ?
                Color.Red :
                Input.MouseInBox(new Rectangle(xPos + 510, yPos + 40, 150, 30)) ?
                Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 510, yPos + 40, 150, 30)))
            {
                GameSettings.Default.ResolutionWidth = resolutionWidth = 800;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 600;
            } // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 40, yPos + 80, "1024x768",
                resolutionWidth == 1024 &&
                resolutionHeight == 768 ?
                Color.Red :
                Input.MouseInBox(new Rectangle(xPos + 40, yPos + 80, 150, 30)) ?
                Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 40, yPos + 80, 150, 30)))
            {
                GameSettings.Default.ResolutionWidth = resolutionWidth = 1024;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 768;
            } // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 370, yPos + 80, "1280x1024",
                resolutionWidth == 1280 &&
                resolutionHeight == 1024 ?
                Color.Red :
                Input.MouseInBox(new Rectangle(xPos + 220, yPos + 80, 150, 30)) ?
                Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 220, yPos + 80, 150, 30)))
            {
                GameSettings.Default.ResolutionWidth = resolutionWidth = 1280;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 1024;
            } // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 550, yPos + 80, "1600x1200",
                resolutionWidth == 1600 &&
                resolutionHeight == 1200 ? Color.Red :
                Input.MouseInBox(new Rectangle(xPos + 400, yPos + 80, 150, 30)) ?
                Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 400, yPos + 80, 150, 30)))
            {
                GameSettings.Default.ResolutionWidth = resolutionWidth = 1600;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 1200;
            } // if (Input.MouseLeftButtonPressed)

            // Allow to toggle vsync on/off
            yPos += 80 + 30 + 10;// + 5;
            bool overVsyncOnOff = Input.MouseInBox(new Rectangle(
                xPos, yPos, 200, 20));
            TextureFont.WriteText(
                xPos, yPos,
                "VSync" + ":",
                overVsyncOnOff ? Color.Red : Color.LightGray);
            TextureFont.WriteText(
                xPos + 150, yPos,
                isVsyncOn ? Texts.On : Texts.Off,
                overVsyncOnOff ? Color.Red : Color.LightGray);
            if (overVsyncOnOff &&
                Input.MouseLeftButtonJustPressed)
            {
                // Toggle state and set to both settings and local variable
                isVsyncOn = GameSettings.Default.WaitForVSync = !isVsyncOn;
            } // if (overVsyncOnOff)

            if (game.RenderMenuButton(MenuButton.Back,
                new Point(1024 - 230, 768 - 150)))
            {
                // Save options (e.g. player name or language) in case they were
                // changed.
                GameSettings.Save();

                quit = true;
            } // if (game.RenderMenuButton)
        }
Exemplo n.º 8
0
        }         // GetOnlineHighscores(onlyThisHour)

        #endregion

        #region Run
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(RocketCommanderGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Show highscores, allow to select between local highscores,
            // online highscores this hour and online highscores best of all time.
            int xPos = 100 * BaseGame.Width / 1024;
            int yPos = 184 * BaseGame.Height / 768;

            TextureFont.WriteText(xPos, yPos,
                                  Texts.Highscores + ":");

            // Local Highscores
            Rectangle rect = new Rectangle(
                xPos + 210 * BaseGame.Width / 1024,
                yPos + 5 * BaseGame.Height / 768, 130, 28);
            bool highlighted = Input.MouseInBox(rect);

            TextureFont.WriteText(rect.X, rect.Y, Texts.Local,
                                  highscoreMode == HighscoreModes.Local ? Color.Red :
                                  highlighted ? Color.LightSalmon : Color.White);
            if (highlighted &&
                Input.MouseLeftButtonJustPressed)
            {
                highscoreMode = HighscoreModes.Local;
            }

            // Online This Hour Highscores
            rect = new Rectangle(
                xPos + 340 * BaseGame.Width / 1024,
                yPos + 5 * BaseGame.Height / 768, 650 - 340, 28);
            highlighted = Input.MouseInBox(rect);
            TextureFont.WriteText(rect.X, rect.Y, Texts.OnlineThisHour,
                                  highscoreMode == HighscoreModes.OnlineThisHour ? Color.Red :
                                  highlighted ? Color.LightSalmon : Color.White);
            if (highlighted &&
                Input.MouseLeftButtonJustPressed)
            {
                highscoreMode = HighscoreModes.OnlineThisHour;
                GetOnlineHighscores(true);
            }             // if

            // Online Total Highscores
            rect = new Rectangle(
                xPos + 650 * BaseGame.Width / 1024,
                yPos + 5 * BaseGame.Height / 768, 300, 28);
            highlighted = Input.MouseInBox(rect);
            TextureFont.WriteText(rect.X, rect.Y, Texts.OnlineTotal,
                                  highscoreMode == HighscoreModes.OnlineTotal ? Color.Red :
                                  highlighted ? Color.LightSalmon : Color.White);
            if (highlighted &&
                Input.MouseLeftButtonJustPressed)
            {
                highscoreMode = HighscoreModes.OnlineTotal;
                GetOnlineHighscores(false);
            }             // if

            yPos = 260 * BaseGame.Height / 768;
            Highscore[] selectedHighscores =
                highscoreMode == HighscoreModes.Local ?
                highscores : onlineHighscores;

            for (int num = 0; num < NumOfHighscores; num++)
            {
                Color col = Input.MouseInBox(new Rectangle(
                                                 xPos, yPos + num * 30, 600 + 200, 28)) ?
                            Color.White : ColorHelper.FromArgb(200, 200, 200);
                TextureFont.WriteText(xPos, yPos + num * 30,
                                      (1 + num) + ".", col);
                TextureFont.WriteText(xPos + 50, yPos + num * 30,
                                      selectedHighscores[num].name, col);
                TextureFont.WriteText(xPos + 380, yPos + num * 30,
                                      Texts.Score + ": " + selectedHighscores[num].points, col);
                TextureFont.WriteText(xPos + 620, yPos + num * 30,
                                      Texts.Mission + ": " + selectedHighscores[num].level, col);
            }             // for (num)

            if (game.RenderMenuButton(MenuButton.Back,
                                      new Point(1024 - 230, 768 - 150)))
            {
                quit = true;
            }             // if
            else
            {
                rect = new Rectangle(xPos,
                                     (768 - 110) * BaseGame.Height / 768, 600, 22 + 14);
                highlighted = Input.MouseInBox(rect);
                TextureFont.WriteText(xPos,
                                      (768 - 104) * BaseGame.Height / 768,
                                      "Online Highscores: www.RocketCommander.com",
                                      highlighted ? Color.Red : Color.White);
                if (highlighted &&
                    Input.MouseLeftButtonJustPressed)
                {
#if !XBOX360
                    new Thread(new ThreadStart(delegate
                    {
                        Process.Start("http://www.RocketCommander.com");
                    })).Start();
                    Thread.Sleep(100);
#endif
                } // if
            }     // else
        }         // Run(game)
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(RocketCommanderGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Write player name
            int xPos = 100 * BaseGame.Width / 1024,
                yPos = 168 * BaseGame.Height / 768;

            TextureFont.WriteText(xPos, yPos,
                                  Texts.Options);

            // Edit player name
            yPos += 40 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos,
                                  Texts.PlayerName + ": " + currentPlayerName +
                                  ((BaseGame.TotalTimeMs / 200) % 2 == 0 ? "|" : ""));

            // Allow editing player name
            string oldPlayerName = currentPlayerName;

            Input.HandleKeyboardInput(ref currentPlayerName);
            if (currentPlayerName != oldPlayerName)
            {
                // , and : are not allowed for the player name!
                StringHelper.RemoveCharacter(ref currentPlayerName, ',');
                StringHelper.RemoveCharacter(ref currentPlayerName, ':');

                GameSettings.Default.PlayerName = currentPlayerName;
            }             // if (BaseGame.lastPressedKeys.Length)

            // Show all available languages and allow changing
            yPos += 40 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos, Texts.Language + ": ");

            TextureFont.WriteText(xPos + 225, yPos, Texts.English,
                                  Texts.Culture == null ||
                                  Texts.Culture == CultureInfo.InvariantCulture ?
                                  Color.Red : Color.White);
            if (Input.MouseLeftButtonPressed &&
                Texts.Culture != CultureInfo.InvariantCulture &&
                Input.MouseInBox(new Rectangle(xPos + 225, yPos, 160, 30)))
            {
                Texts.Culture = CultureInfo.InvariantCulture;
                GameSettings.Default.Language = "Invariant";
            }             // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 400, yPos, Texts.German,
                                  Texts.Culture != null && Texts.Culture.Name == "de-DE" ?
                                  Color.Red : Color.White);
            if (Input.MouseLeftButtonPressed &&
                (Texts.Culture == null || Texts.Culture.Name != "de-DE") &&
                Input.MouseInBox(new Rectangle(xPos + 400, yPos, 200, 30)))
            {
                Texts.Culture = new CultureInfo("de-DE");
                GameSettings.Default.Language = Texts.Culture.Name;
            }             // if (Input.MouseLeftButtonPressed)
                          //TODO: more languages

            // Allow changing the graphic quality
            yPos += 40 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos, Texts.Performance + ":");

            TextureFont.WriteText(xPos + 40, yPos + 40, Texts.PerformanceMedium,
                                  BaseGame.GraphicsPerformanceSetting ==
                                  BaseGame.PerformanceSetting.Medium ?
                                  Color.Red :
                                  Input.MouseInBox(new Rectangle(xPos, yPos + 40, 500, 30)) ?
                                  Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos, yPos + 40, 500, 30)))
            {
                BaseGame.GraphicsPerformanceSetting =
                    BaseGame.PerformanceSetting.Medium;
            }             // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 40, yPos + 80, Texts.PerformanceQuality,
                                  BaseGame.GraphicsPerformanceSetting ==
                                  BaseGame.PerformanceSetting.Quality ?
                                  Color.Red :
                                  Input.MouseInBox(new Rectangle(xPos, yPos + 80, 500, 30)) ?
                                  Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos, yPos + 80, 500, 30)))
            {
                BaseGame.GraphicsPerformanceSetting =
                    BaseGame.PerformanceSetting.Quality;
            }             // if (Input.MouseLeftButtonPressed)

            // Allow to select from some of the supported resolutions
            yPos += 120 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos, Texts.ChangeResolution + ":");

            TextureFont.WriteText(xPos + 40, yPos + 40, "Autodetect Best",
                                  resolutionWidth == 0 &&
                                  resolutionHeight == 0 ?
                                  Color.Red :
                                  Input.MouseInBox(new Rectangle(xPos + 40, yPos + 40, 300, 30)) ?
                                  Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 40, yPos + 40, 300, 30)))
            {
                GameSettings.Default.ResolutionWidth  = resolutionWidth = 0;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 0;
            }             // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 370, yPos + 40, "640x480",
                                  resolutionWidth == 640 &&
                                  resolutionHeight == 480 ?
                                  Color.Red :
                                  Input.MouseInBox(new Rectangle(xPos + 350, yPos + 40, 150, 30)) ?
                                  Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 350, yPos + 40, 150, 30)))
            {
                GameSettings.Default.ResolutionWidth  = resolutionWidth = 640;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 480;
            }             // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 550, yPos + 40, "800x600",
                                  resolutionWidth == 800 &&
                                  resolutionHeight == 600 ?
                                  Color.Red :
                                  Input.MouseInBox(new Rectangle(xPos + 510, yPos + 40, 150, 30)) ?
                                  Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 510, yPos + 40, 150, 30)))
            {
                GameSettings.Default.ResolutionWidth  = resolutionWidth = 800;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 600;
            }             // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 40, yPos + 80, "1024x768",
                                  resolutionWidth == 1024 &&
                                  resolutionHeight == 768 ?
                                  Color.Red :
                                  Input.MouseInBox(new Rectangle(xPos + 40, yPos + 80, 150, 30)) ?
                                  Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 40, yPos + 80, 150, 30)))
            {
                GameSettings.Default.ResolutionWidth  = resolutionWidth = 1024;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 768;
            }             // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 370, yPos + 80, "1280x1024",
                                  resolutionWidth == 1280 &&
                                  resolutionHeight == 1024 ?
                                  Color.Red :
                                  Input.MouseInBox(new Rectangle(xPos + 220, yPos + 80, 150, 30)) ?
                                  Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 220, yPos + 80, 150, 30)))
            {
                GameSettings.Default.ResolutionWidth  = resolutionWidth = 1280;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 1024;
            }             // if (Input.MouseLeftButtonPressed)

            TextureFont.WriteText(xPos + 550, yPos + 80, "1600x1200",
                                  resolutionWidth == 1600 &&
                                  resolutionHeight == 1200 ? Color.Red :
                                  Input.MouseInBox(new Rectangle(xPos + 400, yPos + 80, 150, 30)) ?
                                  Color.LightSalmon : Color.White);
            if (Input.MouseLeftButtonJustPressed &&
                Input.MouseInBox(new Rectangle(xPos + 400, yPos + 80, 150, 30)))
            {
                GameSettings.Default.ResolutionWidth  = resolutionWidth = 1600;
                GameSettings.Default.ResolutionHeight = resolutionHeight = 1200;
            }             // if (Input.MouseLeftButtonPressed)

            // Allow to toggle vsync on/off
            yPos += 80 + 30 + 10;            // + 5;
            bool overVsyncOnOff = Input.MouseInBox(new Rectangle(
                                                       xPos, yPos, 200, 20));

            TextureFont.WriteText(
                xPos, yPos,
                "VSync" + ":",
                overVsyncOnOff ? Color.Red : Color.LightGray);
            TextureFont.WriteText(
                xPos + 150, yPos,
                isVsyncOn ? Texts.On : Texts.Off,
                overVsyncOnOff ? Color.Red : Color.LightGray);
            if (overVsyncOnOff &&
                Input.MouseLeftButtonJustPressed)
            {
                // Toggle state and set to both settings and local variable
                isVsyncOn = GameSettings.Default.WaitForVSync = !isVsyncOn;
            }             // if (overVsyncOnOff)

            if (game.RenderMenuButton(MenuButton.Back,
                                      new Point(1024 - 230, 768 - 150)))
            {
                // Save options (e.g. player name or language) in case they were
                // changed.
                GameSettings.Save();

                quit = true;
            }     // if (game.RenderMenuButton)
        }         // Run(game)
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(RocketCommanderGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Select mission
            int xPos = 50 * BaseGame.Width / 1024;
            int yPos = 154 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos, Texts.SelectMission);

            if (game.RenderMenuButton(MenuButton.Back,
                new Point(1024 - 230, 768 - 150)))
            {
                quit = true;
            } // if

            // If pressing XBox controller right/left change selection
            int maxLevels = Math.Min(game.levels.Length, 4);
            if (Input.GamePadRightJustPressed)
            {
                xInputLevelSelection =
                    (xInputLevelSelection + 1) % maxLevels;
                SelectLevelForXInput(maxLevels);
            } // if (Input.GamePad)
            else if (Input.GamePadLeftJustPressed)
            {
                if (xInputLevelSelection <= 0)
                    xInputLevelSelection = maxLevels;
                xInputLevelSelection--;
                SelectLevelForXInput(maxLevels);
            } // if (Input.GamePad)

            // Show all levels (max. 4 levels are supported right now)
            for (int num = 0; num < game.levels.Length &&
                num < 4; num++)
            {
                Level level = game.levels[num];
                xPos = 50 * BaseGame.Width / 1024 +
                    num * (BaseGame.Width - 175) / 4;
                yPos = 192 * BaseGame.Height / 768;

                // Is selected?
                int maxHeight = BaseGame.Height * 5 / 6 - yPos;
                int height = Math.Min(level.Length, maxHeight);
                Rectangle clickArea = new Rectangle(
                    xPos, yPos,
                    (BaseGame.Width - 180) / 4 - 10, height + 27);
                Color col = Input.MouseInBox(clickArea) && quit == false ?
                    Color.Red : Color.White;

                // Write name on top
                TextureFont.WriteText(
                    xPos, yPos,// - (num%2==1?40:0),
                    level.Name, col);

                // Calc preview rect
                Rectangle previewRect = new Rectangle(
                    xPos, yPos + 38, 40, height);

                // Disable linear filtering for level textures
                BaseGame.DisableLinearTextureFiltering();

                // Show level preview.
                // Show 2 parts if bigger than 512
                if (level.Length > 512)
                {
                    previewRect = new Rectangle(
                        xPos + 70, yPos + 38, 40, height);
                    level.Texture.RenderOnScreen(previewRect,
                        new Rectangle(0, 0, 40, Math.Min(level.Length, 512)));

                    // Draw lines around preview rect to mark highlighting
                    Point upperLeft = new Point(previewRect.X, previewRect.Y);
                    Point upperRight = new Point(previewRect.Right, previewRect.Y);
                    Point lowerLeft = new Point(previewRect.X, previewRect.Bottom);
                    Point lowerRight = new Point(previewRect.Right, previewRect.Bottom);
                    BaseGame.DrawLine(upperLeft, upperRight, col);
                    BaseGame.DrawLine(upperLeft, lowerLeft, col);
                    BaseGame.DrawLineWithShadow(upperRight, lowerRight,
                        col);
                    BaseGame.DrawLineWithShadow(lowerLeft,
                        new Point(lowerRight.X + 1, lowerRight.Y), col);

                    previewRect = new Rectangle(
                        xPos, yPos + 26 + 8, 40, height);
                    level.Texture.RenderOnScreen(previewRect,
                        new Rectangle(0, 512, 40, Math.Min(level.Length - 512, 512)));

                    upperLeft = new Point(previewRect.X, previewRect.Y);
                    upperRight = new Point(previewRect.Right, previewRect.Y);
                    lowerLeft = new Point(previewRect.X, previewRect.Bottom);
                    lowerRight = new Point(previewRect.Right, previewRect.Bottom);
                    BaseGame.DrawLine(upperLeft, upperRight, col);
                    BaseGame.DrawLine(upperLeft, lowerLeft, col);
                    BaseGame.DrawLineWithShadow(upperRight, lowerRight,
                        col);
                    BaseGame.DrawLineWithShadow(lowerLeft,
                        new Point(lowerRight.X + 1, lowerRight.Y), col);

                    // Draw connection line (makes more sense to understand structure)
                    Point p1 =
                        new Point(xPos + 20, previewRect.Y);
                    Point p2 =
                        new Point(xPos + 20, previewRect.Y - 8);
                    Point p3 =
                        new Point(xPos + 40 + 15, previewRect.Y - 8);
                    Point p4 =
                        new Point(xPos + 40 + 15, previewRect.Bottom);
                    Point p5 =
                        new Point(xPos + 40 + 30 + 20, previewRect.Bottom);
                    Point p6 =
                        new Point(xPos + 40 + 30 + 20, previewRect.Bottom - 8);
                    col = Color.LightGray;
                    BaseGame.DrawLine(p1, p2, col);
                    BaseGame.DrawLine(p2, p3, col);
                    BaseGame.DrawLine(p3, p4, col);
                    BaseGame.DrawLine(p4, p5, col);
                    BaseGame.DrawLine(p5, p6, col);
                } // if
                else
                {
                    // Show just one part
                    level.Texture.RenderOnScreen(previewRect,
                        new Rectangle(0, 0, 40, Math.Min(level.Length, 512)));

                    // Draw lines around preview rect to mark highlighting
                    Point upperLeft = new Point(previewRect.X, previewRect.Y);
                    Point upperRight = new Point(previewRect.Right, previewRect.Y);
                    Point lowerLeft = new Point(previewRect.X, previewRect.Bottom);
                    Point lowerRight = new Point(previewRect.Right, previewRect.Bottom);
                    BaseGame.DrawLine(upperLeft, upperRight, col);
                    BaseGame.DrawLine(upperLeft, lowerLeft, col);
                    BaseGame.DrawLineWithShadow(upperRight, lowerRight,
                        col);
                    BaseGame.DrawLineWithShadow(lowerLeft,
                        new Point(lowerRight.X + 1, lowerRight.Y), col);
                } // else

                // Enable linear texture filtering again
                BaseGame.EnableLinearTextureFiltering();

                // Level selected?
                if (Input.MouseInBox(clickArea) &&
                    quit == false &&
                    (Input.MouseLeftButtonJustPressed ||
                    Input.GamePadAJustPressed ||
                    Input.GamePadStartPressed))
                {
                    // Close mission selection
                    game.RemoveCurrentGameScreen();

                    // Remember selected level number for the sky rotation.
                    Level.currentLevelNumber = num;

                    // Start mission with this level
                    game.AddGameScreen(new Mission(level, game.asteroidManager));
                } // if
            } // for (num)
        }
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(RocketCommanderGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Show highscores, allow to select between local highscores,
            // online highscores this hour and online highscores best of all time.
            int xPos = 100 * BaseGame.Width / 1024;
            int yPos = 184 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos,
                Texts.Highscores + ":");

            // Local Highscores
            Rectangle rect = new Rectangle(
                xPos + 210 * BaseGame.Width / 1024,
                yPos + 5 * BaseGame.Height / 768, 130, 28);
            bool highlighted = Input.MouseInBox(rect);
            TextureFont.WriteText(rect.X, rect.Y, Texts.Local,
                highscoreMode == HighscoreModes.Local ? Color.Red :
                highlighted ? Color.LightSalmon : Color.White);
            if (highlighted &&
                Input.MouseLeftButtonJustPressed)
                highscoreMode = HighscoreModes.Local;

            // Online This Hour Highscores
            rect = new Rectangle(
                xPos + 340 * BaseGame.Width / 1024,
                yPos + 5 * BaseGame.Height / 768, 650 - 340, 28);
            highlighted = Input.MouseInBox(rect);
            TextureFont.WriteText(rect.X, rect.Y, Texts.OnlineThisHour,
                highscoreMode == HighscoreModes.OnlineThisHour ? Color.Red :
                highlighted ? Color.LightSalmon : Color.White);
            if (highlighted &&
                Input.MouseLeftButtonJustPressed)
            {
                highscoreMode = HighscoreModes.OnlineThisHour;
                GetOnlineHighscores(true);
            } // if

            // Online Total Highscores
            rect = new Rectangle(
                xPos + 650 * BaseGame.Width / 1024,
                yPos + 5 * BaseGame.Height / 768, 300, 28);
            highlighted = Input.MouseInBox(rect);
            TextureFont.WriteText(rect.X, rect.Y, Texts.OnlineTotal,
                highscoreMode == HighscoreModes.OnlineTotal ? Color.Red :
                highlighted ? Color.LightSalmon : Color.White);
            if (highlighted &&
                Input.MouseLeftButtonJustPressed)
            {
                highscoreMode = HighscoreModes.OnlineTotal;
                GetOnlineHighscores(false);
            } // if

            yPos = 260 * BaseGame.Height / 768;
            Highscore[] selectedHighscores =
                highscoreMode == HighscoreModes.Local ?
                highscores : onlineHighscores;

            for (int num = 0; num < NumOfHighscores; num++)
            {
                Color col = Input.MouseInBox(new Rectangle(
                    xPos, yPos + num * 30, 600 + 200, 28)) ?
                    Color.White : ColorHelper.FromArgb(200, 200, 200);
                TextureFont.WriteText(xPos, yPos + num * 30,
                    (1 + num) + ".", col);
                TextureFont.WriteText(xPos + 50, yPos + num * 30,
                    selectedHighscores[num].name, col);
                TextureFont.WriteText(xPos + 380, yPos + num * 30,
                    Texts.Score + ": " + selectedHighscores[num].points, col);
                TextureFont.WriteText(xPos + 620, yPos + num * 30,
                    Texts.Mission + ": " + selectedHighscores[num].level, col);
            } // for (num)

            if (game.RenderMenuButton(MenuButton.Back,
                new Point(1024 - 230, 768 - 150)))
            {
                quit = true;
            } // if
            else
            {
                rect = new Rectangle(xPos,
                    (768 - 110) * BaseGame.Height / 768, 600, 22 + 14);
                highlighted = Input.MouseInBox(rect);
                TextureFont.WriteText(xPos,
                    (768 - 104) * BaseGame.Height / 768,
                    "Online Highscores: www.RocketCommander.com",
                    highlighted ? Color.Red : Color.White);
                if (highlighted &&
                    Input.MouseLeftButtonJustPressed)
                {
            #if !XBOX360
                    new Thread(new ThreadStart(delegate
                        {
                            Process.Start("http://www.RocketCommander.com");
                        })).Start();
                    Thread.Sleep(100);
            #endif
                } // if
            } // else
        }