Пример #1
0
        public override void LoadContent(object obj = null)
        {
            this.playerModel = new PlayerModel(this.Game, tapButtonTexture);
            this.playerModel.OnStateChanged += PlayerModel_OnStateChanged;
            this.playerModel.Scale           = Game.Window.ClientBounds.Width / playerModel.Size.X - 0.5f;

            this.playerModel.Position = new Vector2(Game.Window.ClientBounds.Width / 2 - playerModel.Size.X / 2,
                                                    Game.Window.ClientBounds.Height - 1.3f * playerModel.Size.Y);

            this.referentModel          = new ReferentModel(this.Game, tapButtonTexture, 0.4f);
            this.referentModel.Position = new Vector2(playerModel.Position.X + playerModel.Size.X - referentModel.Size.X,
                                                      Game.Window.ClientBounds.Width / 2 - referentModel.Size.Y / 2 + 10);

            this.homeButton          = new GameButton(this.Game, this.homeButtonTexture);
            this.homeButton.Scale    = 1.3f;
            this.homeButton.Position = new Vector2(this.playerModel.Position.X + this.playerModel.Size.X - this.homeButton.Size.X,
                                                   1.5f * this.homeButton.Size.Y);
            this.homeButton.OnClick += HomeButton_OnClick;

            this.score          = new GameScore(this.Game, gameFont, Color.LightGreen);
            this.score.Position = new Vector2(playerModel.Position.X,
                                              Game.Window.ClientBounds.Width / 2 - referentModel.Size.Y);

            this.timer          = new GameTimer(this.Game, gameFont, Color.WhiteSmoke);
            this.timer.Position = new Vector2(playerModel.Position.X,
                                              Game.Window.ClientBounds.Width / 2 - referentModel.Size.Y / 2);
            this.timer.OnStop += timer_OnStop;

            this.background = new GameDynamicBackground(this.Game, timer);
        }
Пример #2
0
        public override void LoadContent(object obj = null)
        {
            this.timer = new Timer();

            this.background = new GameDynamicBackground(this.Game);

            this.menuButtonTexture = ContentHandler.Load <Texture2D>(GameResources.MenuButtonTextureName);
            this.tapButtonTexture  = ContentHandler.Load <Texture2D>(GameResources.TapButtonTextureName);
            this.logo = ContentHandler.Load <Texture2D>(GameResources.LogoTextureName);
            this.font = ContentHandler.Load <SpriteFont>(GameResources.FontSpriteFontName);

            this.logoImage          = new GameImage(this.Game, this.logo);
            this.logoImage.Position = new Vector2(this.Game.Window.ClientBounds.Width / 2 - this.logoImage.Texture.Width / 2, this.Game.Window.ClientBounds.Height / 4 - this.logoImage.Texture.Height / 2);

            this.playButton                 = new GameButton(this.Game, this.menuButtonTexture);
            this.playButton.Size            = new Vector2(300, 100);
            this.playButton.Text            = Resources.AppResources.ButtonPlayText;
            this.playButton.TextColor       = Color.White;
            this.playButton.BackgroundColor = new Color(90, 235, 130);
            this.playButton.Position        = new Vector2(Game.Window.ClientBounds.Width / 2 - this.playButton.Size.X / 2, Game.Window.ClientBounds.Height / 2 - this.playButton.Size.Y / 2);

            this.tutorialButton                 = new GameButton(this.Game, this.menuButtonTexture);
            this.tutorialButton.Size            = new Vector2(300, 100);
            this.tutorialButton.Text            = Resources.AppResources.ButtonTutorialText;
            this.tutorialButton.TextColor       = new Color(150, 150, 150);
            this.tutorialButton.BackgroundColor = Color.Gray;
            this.tutorialButton.BorderColor     = Color.Black;
            this.tutorialButton.Position        = new Vector2(this.playButton.Position.X, this.playButton.Position.Y + this.tutorialButton.Size.Y + 20);

            this.leaveButton                 = new GameButton(this.Game, this.menuButtonTexture);
            this.leaveButton.Size            = new Vector2(300, 100);
            this.leaveButton.Text            = Resources.AppResources.ButtonLeaveText;
            this.leaveButton.TextColor       = Color.White;
            this.leaveButton.BackgroundColor = Color.LightGray;
            this.leaveButton.BorderColor     = Color.Black;
            this.leaveButton.Position        = new Vector2(this.tutorialButton.Position.X, this.tutorialButton.Position.Y + this.leaveButton.Size.Y + 20);

            this.playButton.OnClick     += playButton_OnClick;
            this.tutorialButton.OnClick += TutorialButton_OnClick;
            this.leaveButton.OnClick    += LeaveButton_OnClick;

#if DEBUG
            notif = new GameSlideNotification(this.Game, this.font);
            notif.Label.BorderThickness = 1;
            notif.Label.BorderColor     = Color.Black;
            notif.Label.Color           = Color.White;
#endif
        }