Esempio n. 1
0
        public override void LoadContent(object obj = null)
        {
            this.validButtonTexture  = ContentHandler.Load <Texture2D>(GameResources.ValidGreenButton);
            this.replayButtonTexture = ContentHandler.Load <Texture2D>(GameResources.ReplayOrangeButton);
            this.homeButtonTexture   = ContentHandler.Load <Texture2D>(GameResources.HomeGrayButton);
            this.scoreItemTexture    = ContentHandler.Load <Texture2D>(GameResources.CustomerScoreBackground);
            this.fontTexture         = ContentHandler.Load <SpriteFont>(GameResources.FontSpriteFontName);

            GameScore     score        = obj as GameScore;
            CustomerScore currentScore = new CustomerScore("User", (score != null) ? (int)score.Score : -1);

            this.timer = new Timer();

            this.scoreItem                        = new GameScoreItem(this.Game, this.scoreItemTexture, this.fontTexture, currentScore);
            this.scoreItem.Color                  = Color.Orange;
            this.scoreItem.Size                   = new Vector2(Game.Window.ClientBounds.Width * 3 / 4, GameScoreItem.HEIGHT_DEFAULT);
            this.scoreItem.Label1.Color           = Color.White;
            this.scoreItem.Label1.BorderColor     = Color.Black;
            this.scoreItem.Label1.BorderThickness = 1;
            this.scoreItem.Label2.BorderColor     = Color.White;
            this.scoreItem.Label2.BorderThickness = 1;
            this.scoreItem.Position               = new Vector2(Game.Window.ClientBounds.Width / 2 - this.scoreItem.Size.X / 2, Game.Window.ClientBounds.Height / 6 - this.scoreItem.Size.Y / 2);


            this.scorePanel          = new GamePanel(this.Game);
            this.scorePanel.Size     = new Vector2(Game.Window.ClientBounds.Width * 3 / 4, 5 * GameScoreItem.HEIGHT_DEFAULT);
            this.scorePanel.Position = new Vector2(Game.Window.ClientBounds.Width / 2 - this.scorePanel.Size.X / 2, Game.Window.ClientBounds.Height * 2 / 5 - this.scorePanel.Size.Y / 2);

            this.scoresList.ForEach(item => this.scorePanel.Add(new GameScoreItem(this.Game, this.scoreItemTexture, this.fontTexture, item)));

            this.replayButton          = new GameButton(this.Game, this.replayButtonTexture);
            this.replayButton.Scale    = 1.5f;
            this.replayButton.Position = new Vector2(Game.Window.ClientBounds.Width / 4 - this.replayButton.Size.X / 2, Game.Window.ClientBounds.Height * 4 / 5 - this.replayButton.Size.Y / 2);

            this.homeButton          = new GameButton(this.Game, this.homeButtonTexture);
            this.homeButton.Scale    = 1.5f;
            this.homeButton.Position = new Vector2(Game.Window.ClientBounds.Width / 2 - this.homeButton.Size.X / 2, Game.Window.ClientBounds.Height * 4 / 5 - this.homeButton.Size.Y / 2);

            this.validButton          = new GameButton(this.Game, this.validButtonTexture);
            this.validButton.Scale    = 1.5f;
            this.validButton.Position = new Vector2(Game.Window.ClientBounds.Width * 3 / 4 - this.validButton.Size.X / 2, Game.Window.ClientBounds.Height * 4 / 5 - this.validButton.Size.Y / 2);

            this.replayButton.OnClick += replayButton_OnClick;
            this.homeButton.OnClick   += HomeButton_OnClick;
            this.validButton.OnClick  += ValidButton_OnClick;

            Thread.Sleep(1000);
        }