/// <summary> /// /// </summary> /// <param name="spriteBatch"></param> /// <param name="gameState"></param> public void Draw(SpriteBatch spriteBatch, GameTime gameTime, string score) { Debug.Assert(spriteBatch != null); Debug.Assert(gameTime != null); spriteBatch.Draw(_background, _menuPosition, Color.White); spriteBatch.Draw(_hitItem.ItemTexture, _hitItem.ItemPosition, Color.Yellow); spriteBatch.DrawString(_myFont, _typeUserNameString.OutString, _typeUserNameString.StringPosition, Color.White, 0, _typeUserNameString.StringOrigin, 1.5f, SpriteEffects.None, 0.5f); _score = score; string temp = _scoreString.OutString + score; spriteBatch.DrawString(_myFont, temp, _scoreString.StringPosition, Color.Yellow, 0, _scoreString.StringOrigin, 1.8f, SpriteEffects.None, 0.5f); var newItem = new BasicInfoString(_currentInput); newItem.StringPosition = new Vector2(512, 400); newItem.StringOrigin = _myFont.MeasureString(newItem.OutString) / 2; spriteBatch.DrawString(_myFont, newItem.OutString, newItem.StringPosition, Color.White, 0, newItem.StringOrigin, 2.0f, SpriteEffects.None, 0.5f); }
/// <summary> /// /// </summary> public UserInput() { _hitItem = new BasicMenuItem(new Vector2(370, 30)); _typeUserNameString = new BasicInfoString("Hey, space hero, type your name:"); _scoreString = new BasicInfoString("Your score is "); _menuPosition = new Vector2(0, 0); }
/// <summary> /// /// </summary> public InfoDisplay() { _levelInfoString = new BasicInfoString("Level:"); _pointsInfoString = new BasicInfoString("Score:"); _pauseInfoString = new BasicInfoString("PAUSED"); _gameOverInfoString = new BasicInfoString("GAME OVER"); _helpInfoString = new BasicInfoString("Press 'P' for pause"); _exitInfoString = new BasicInfoString("Press 'Esc' to exit"); _livesInfoString = new BasicInfoString("Lives:"); _overheatingInfoString = new BasicInfoString("OVERHEAT!"); _statusOverheatingInfoString = new BasicInfoString(TIME_FOR_COOLING_TEXT); _nextLevelInfoString = new BasicInfoString(NEXT_LEVEL_STATUS_TEXT); _level1InfoString = new BasicInfoString("LEVEL 1"); _level2InfoString = new BasicInfoString("LEVEL 2"); _level3InfoString = new BasicInfoString("LEVEL 3"); }
/// <summary> /// Load content for Hits List one by one: header, items. /// </summary> /// <param name="keyboardState"></param> public void Update(KeyboardState keyboardState) { Debug.Assert(keyboardState != null); _visibleItems.Clear(); int index = 0; foreach (var item in _userData.Collection) { string screenItem = _GetScreenItem(item); var newItem = new BasicInfoString(screenItem); newItem.StringPosition = new Vector2(550, 200 + index * 40); newItem.StringOrigin = _myFont.MeasureString(newItem.OutString) / 2; _visibleItems.Add(newItem); index++; } }