private void Initialize() { _backgroundInactive = Content.Load<Texture2D>("Hud/inactive_background"); _buttonGotoOffice = new Button(NarratorText.ButtonReturnToOffice); _monitorViewport = new Rectangle(); _backgroundWinScreen = new Texture2D[3]; _backgroundWinScreen[(int)Trophies.Gold] = Content.Load<Texture2D>("Hud/Winscreens/winscreen_gold"); _backgroundWinScreen[(int)Trophies.Silver] = Content.Load<Texture2D>("Hud/Winscreens/winscreen_silver"); _backgroundWinScreen[(int)Trophies.Bronze] = Content.Load<Texture2D>("Hud/Winscreens/winscreen_bronze"); _captionFont = Content.Load<SpriteFont>("Hud/Fonts/WinCaptionFont"); _bodyTextFont = Content.Load<SpriteFont>("Hud/Fonts/WinBodyFont"); _currentMouseState = _previousMouseState = Mouse.GetState(); _bodyTextFont.LineSpacing = 25; // So why cant I do this via XML? _backgroundConfirm = Content.Load<Texture2D>("Hud/confirm_background"); _previousMouseState = _currentMouseState = Mouse.GetState(); // In case update is called before draw: if (_yesReturn == null) _yesReturn = new Button(NarratorText.ButtonConfirmGotoOfficeYes); if (_noReturn == null) _noReturn = new Button(NarratorText.ButtonConfirmGotoOfficeNo); }
// Draw and handle anything related to the "are you sure you want to go to kantoor3D". private void DrawReturnConfirmation(SpriteBatch spriteBatch) { spriteBatch.Draw(_backgroundConfirm, new Vector2((_graphicsDevice.Viewport.Width - _backgroundConfirm.Width) / 2, (_graphicsDevice.Viewport.Height - _backgroundConfirm.Height) / 2), Color.White); Vector2 textSize = _bodyTextFont.MeasureString(NarratorText.ConfirmGotoOfficeText); Vector2 textLocation = new Vector2((_graphicsDevice.Viewport.Width - textSize.X) / 2, (_graphicsDevice.Viewport.Height/2 - 65)); spriteBatch.DrawString(_bodyTextFont, NarratorText.ConfirmGotoOfficeText, textLocation, Color.Black); if (_yesReturn == null) _yesReturn = new Button(NarratorText.ButtonConfirmGotoOfficeYes); if (_noReturn == null) _noReturn = new Button(NarratorText.ButtonConfirmGotoOfficeNo); _yesReturn.Draw(spriteBatch, new Vector2(_graphicsDevice.Viewport.Width / 2 - 0, (_graphicsDevice.Viewport.Height / 2 + 5)), Mouse.GetState()); _noReturn.Draw(spriteBatch, new Vector2(_graphicsDevice.Viewport.Width / 2 - _noReturn.Width - 0, (_graphicsDevice.Viewport.Height / 2 + 5)), Mouse.GetState()); }