Ejemplo n.º 1
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)
Ejemplo n.º 2
0
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(DungeonQuestGame 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 = 260 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos,
                "Highscores:");

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

            yPos = 310 * 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 * 29,
                    (1 + num) + ".", col);
                TextureFont.WriteText(xPos + 50, yPos + num * 30,
                    selectedHighscores[num].name, col);
                TextureFont.WriteText(xPos + 340, yPos + num * 30,
                    "Score: " + selectedHighscores[num].points, col);
                TextureFont.WriteText(xPos + 610, yPos + num * 30,
                    "Mission: " + selectedHighscores[num].level, col);
            } // for (num)
            /*TODO
            if (game.RenderMenuButton(MenuButton.Back,
                new Point(1024 - 230, 768 - 150)))
            {
                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();

            // 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
        }