public TitleScreen(Game game, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; _globeGenerationScene = new GlobeSelectionScreen(game, spriteBatch); var buttonTexture = game.Content.Load <Texture2D>("Sprites/ui/button"); var font = Game.Content.Load <SpriteFont>("Fonts/Main"); _startButton = new TextButton(UiResources.StartGameButtonTitle, buttonTexture, font, new Rectangle(Game.GraphicsDevice.Viewport.Bounds.Center.X, 150, 100, 20)); _startButton.OnClick += StartButtonClickHandler; _switchLanguageButton = new TextButton(UiResources.SwitchLanguagebuttonTitle, buttonTexture, font, new Rectangle(Game.GraphicsDevice.Viewport.Bounds.Center.X, 200, 100, 20)); _switchLanguageButton.OnClick += SwitchLanguageButtonClickHandler; _switchResolutionButton = new TextButton(UiResources.SwitchResolutionButtonTitle, buttonTexture, font, new Rectangle(Game.GraphicsDevice.Viewport.Bounds.Center.X, 250, 100, 20)); _switchResolutionButton.OnClick += SwitchResolutionButton_OnClick; _leaderBoardButton = new TextButton(UiResources.LeaderBoardButtonTitle, buttonTexture, font, new Rectangle(Game.GraphicsDevice.Viewport.Bounds.Center.X, 250, 100, 20)); _leaderBoardButton.OnClick += LeaderBoardButton_OnClick; }
/// <inheritdoc /> public ScoresScreen(Game game, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; var serviceScope = ((LivGame)Game).ServiceProvider; var scoreManager = serviceScope.GetRequiredService <IScoreManager>(); _scoreSummary = TextSummaryHelper.CreateTextSummary(scoreManager.Scores); _uiContentStorage = serviceScope.GetRequiredService <IUiContentStorage>(); _globeGenerationScene = new GlobeSelectionScreen(game: game, spriteBatch: spriteBatch); var buttonTexture = _uiContentStorage.GetButtonTexture(); var font = _uiContentStorage.GetButtonFont(); _restartButton = new TextButton( title: UiResources.StartGameButtonTitle, texture: buttonTexture, font: font, rect: new Rectangle( x: RESTART_BUTTON_POSITION_X, y: BUTTON_POSITION_Y, width: BUTTON_WIDTH, height: BUTTON_HEIGHT)); _restartButton.OnClick += RestartButtonClickHandler; _goToMainMenu = new TextButton( title: UiResources.MainMenuButtonTitle, texture: buttonTexture, font: font, rect: new Rectangle( x: RESTART_BUTTON_POSITION_X + (BUTTON_WIDTH_OFFSET * 2), y: BUTTON_POSITION_Y, width: BUTTON_WIDTH, height: BUTTON_HEIGHT)); _goToMainMenu.OnClick += GoToMainMenuButtonClickHandler; _goToNextScreen = new TextButton( title: UiResources.NextScreenButtonTitle, texture: buttonTexture, font: font, rect: new Rectangle( x: RESTART_BUTTON_POSITION_X + (BUTTON_WIDTH_OFFSET * 4), y: BUTTON_POSITION_Y, width: BUTTON_WIDTH, height: BUTTON_HEIGHT)); _goToNextScreen.OnClick += GoToNextScreenButtonClickHandler; }
public TitleScreen(Game game, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; _globeGenerationScene = new GlobeSelectionScreen(game, spriteBatch); var buttonTexture = game.Content.Load <Texture2D>("Sprites/ui/button"); var font = Game.Content.Load <SpriteFont>("Fonts/Main"); _startButton = new TextButton(UiResources.StartGameButtonTitle, buttonTexture, font, new Rectangle(150, 150, 100, 20)); _startButton.OnClick += StartButtonClickHandler; _switchLanguageButton = new TextButton("Switch lang", buttonTexture, font, new Rectangle(150, 200, 100, 20)); _switchLanguageButton.OnClick += SwitchLanguageButtonClickHandler; }