public override void LoadContent()
        {
            // Sound Effect

            if (gameResult == GameResult.Lost)
            {
                GameSounds.PlayGameOverSound();
            }

            // Result Image

            if (gameResult == GameResult.Won)
            {
                resultImage = ContentManager.Load <Texture2D>("YouWin");
            }
            else
            {
                resultImage = ContentManager.Load <Texture2D>("GameOver");
            }

            textFont = ContentManager.Load <SpriteFont>("DefaultTextFont");

            leftMarginGameOver = (Robber2D.ScreenWidth - resultImage.Width) / 2;

            // Text

            scoreFont = ContentManager.Load <SpriteFont>("DefaultFont");
            CalculateScore();

            // Restart

            canRestart = false;

            new Handler().PostDelayed(delegate
            {
                canRestart = true;
            }, 2500);
        }
Beispiel #2
0
        public override void LoadContent()
        {
            // Sound Effect

            if (gameResult == GameResult.Lost)
            {
                GameSounds.PlayGameOverSound();
            }

            // Score

            scoreFont = ContentManager.Load <SpriteFont>("DefaultFont");
            CalculateScore();

            // Result Image

            if (gameResult == GameResult.Won)
            {
                resultImage = ContentManager.Load <Texture2D>("YouWin");
            }
            else
            {
                resultImage = ContentManager.Load <Texture2D>("GameOver");
            }

            leftMarginGameOver = (Robber2D.ScreenWidth - resultImage.Width) / 2;

            // Buttons

            allButtons   = new List <Button>();
            buttonBorder = ContentManager.Load <Texture2D>("ButtonBorder");
            buttonFont   = ContentManager.Load <SpriteFont>("ButtonFont");

            int leftMarginButton = (Robber2D.ScreenWidth - buttonBorder.Width) / 2;

            List <string> buttonTitles = new List <string>()
            {
                "SAVE SCORE", "BACK", "EXIT"
            };
            int nextYPos = 650;

            for (int i = 0; i < buttonTitles.Count; i++)
            {
                Button button = new Button(buttonBorder, buttonFont)
                {
                    Text     = buttonTitles[i],
                    Position = new Vector2(leftMarginButton, nextYPos)
                };

                allButtons.Add(button);
                nextYPos += 100;
            }

            allButtons[0].Click += SaveScore;
            allButtons[1].Click += ReturnToMenu;
            allButtons[2].Click += CloseGame;

            // Score Logger

            scoreLogger = new ScoreLogger();
        }