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); }
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 }
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); }