private void DrawInfoPage(int startX, int unit, int width) { // switch button var switchButtonX = (int)(startX + width - _switchButton.Width * Border.SCALE); _batch.Draw(_switchButton, new Rectangle( switchButtonX, 0, (int)(_switchButton.Width * Border.SCALE), (int)(_switchButton.Height * Border.SCALE)), Color.White); _fontRenderer.DrawText(_batch, "SWITCH>", new Vector2(switchButtonX + unit, unit), Color.Black, Border.SCALE); // time/date info _batch.Draw(_timeBox, new Rectangle( startX + unit * 2, unit * 4, (int)(_timeBox.Width * Border.SCALE), (int)(_timeBox.Height * Border.SCALE)), Color.White); var dateTime = DateTime.Now; var time = DateHelper.GetAmPmTime(dateTime); if (time.StartsWith("0")) { time = " " + time.Remove(0, 1); } _fontRenderer.DrawText(_batch, DateHelper.GetDisplayDayOfWeek(dateTime).ToUpper() + Environment.NewLine + time, new Vector2(startX + unit * 6, unit * 6), Color.Black, Border.SCALE); _exitTextbox.Draw(_batch, TINTED_WHITE); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var startX = (int)(Controller.ClientRectangle.Width / 2f - _background.Width * Border.SCALE / 2f); var unit = (int)(Border.SCALE * Border.UNIT); _batch.Draw(_background, new Rectangle(startX, 0, (int)(_background.Width * Border.SCALE), (int)(_background.Height * Border.SCALE)), Color.White); var money = "$" + Controller.ActivePlayer.Money.ToString(); _fontRenderer.DrawText(_batch, $"NAME/{Controller.ActivePlayer.Name}" + Environment.NewLine + $"^ID^NO {Controller.ActivePlayer.IDNo.ToString("D5")}" + Environment.NewLine + "MONEY" + money.PadLeft(7), new Vector2(startX + unit * 2, unit * 2), Color.Black, Border.SCALE); switch (_pageIndex) { case 0: DrawPage1(startX, unit); break; case 1: DrawPage2(startX, unit); break; } _batch.End(); }
public void Draw(SpriteBatch batch) { if (Visible) { var unitsHeight = 2 + _options.Length * 2; var width = (int)(WIDTH * UNIT * SCALE); var height = (int)(unitsHeight * UNIT * SCALE); var unit = (int)(UNIT * SCALE); var startX = Controller.ClientRectangle.Width - width; var startY = 0; Border.Draw(batch, startX, startY, WIDTH, unitsHeight, SCALE); var screenManager = GetComponent <ScreenManager>(); var selectorChar = screenManager.ActiveScreen == _parentScreen ? ">" : "^>>"; var text = string.Join(Environment.NewLine, _options.Select((t, i) => (i == _index ? selectorChar : " ") + t.Replace("PLAYER", Controller.ActivePlayer.Name))); _fontRenderer.DrawText(batch, text, new Vector2(startX + unit, startY + unit * 2), Color.Black, SCALE); // draw explanations if (Controller.GameOptions.MenuExplanations) { Border.DrawCenter(batch, startX, startY + height, WIDTH, 5, SCALE); var descText = DESCRIPTION_TEXTS[_options[_index]]; _fontRenderer.DrawText(batch, descText, new Vector2(startX, startY + height + unit), Color.Black, SCALE); } } }
internal override void Draw(GameTime gameTime) { _batch.Begin(samplerState: SamplerState.PointClamp); _batch.DrawRectangle(Controller.ClientRectangle, Border.DefaultWhite); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); if (_showInfoText) { var offsetY = Controller.ClientRectangle.Height / 2 - Border.SCREEN_HEIGHT * unit / 2 + unit * 8; var offsetX = startX + unit * 4; Border.Draw(_batch, offsetX, offsetY, 16, 10, Border.SCALE, Border.DefaultWhite); _fontRenderer.DrawText(_batch, _infoText, new Vector2(offsetX + unit, offsetY + unit * 2), Color.Black, Border.SCALE); } else { _optionsBox.Draw(_batch, Border.DefaultWhite); var offsetY = Controller.ClientRectangle.Height / 2 - Border.SCREEN_HEIGHT * unit / 2 + unit * 12; Border.Draw(_batch, startX, offsetY, 15, 6, Border.SCALE, Border.DefaultWhite); var timeStr = DateHelper.GetDisplayDayOfWeek(DateTime.Now).ToUpper() + Environment.NewLine + " " + DateHelper.GetDisplayDaytime(World.DetermineDaytime()).PadRight(4).ToUpper() + DateTime.Now.ToString("h:mm").PadLeft(5); _fontRenderer.DrawText(_batch, timeStr, new Vector2(startX + unit, offsetY + unit * 2), Color.Black, Border.SCALE); } _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var unit = (int)(Border.SCALE * Border.UNIT); var width = Border.SCREEN_WIDTH * unit; var height = Border.SCREEN_HEIGHT * unit; var startX = (int)(Controller.ClientRectangle.Width / 2f - width / 2f); // draw black background _batch.DrawRectangle(new Rectangle(startX, 0, width, height), Color.Black); var visibleEntries = _entries.Skip(_scrollIndex).Take(VisibleEntries).ToArray(); var selectedEntry = visibleEntries[_index]; // draw pokemon portrait DrawPokemonPortrait(selectedEntry); // seen/own count if (DrawPokedexCount) { _fontRenderer.LineGap = 0; _fontRenderer.DrawText(_batch, "SEEN" + NewLine + SeenCount.ToString().PadLeft(7) + NewLine + NewLine + "OWN" + NewLine + CaughtCount.ToString().PadLeft(7), new Vector2(startX + 3 * Border.SCALE, unit * 11), Border.DefaultWhite, Border.SCALE); } // do not end spritebatch here, implementing screen does that }
public void Draw(GameTime gameTime, SpriteBatch batch) { var startX = (int)(Controller.ClientRectangle.Width / 2f - _map.Width * Border.SCALE / 2f); batch.Draw(_map, new Rectangle(startX, 0, (int)(_map.Width * Border.SCALE), (int)(_map.Height * Border.SCALE)), Color.White); var selectedEntry = _entries[_selectedIndex]; batch.Draw(_selector, new Rectangle(startX + (int)((selectedEntry.Position.X + 8) * Border.SCALE), (int)((selectedEntry.Position.Y + 8) * Border.SCALE), (int)(_selector.Width * Border.SCALE), (int)(_selector.Height * Border.SCALE)), Color.White); var playerEntry = _entries[_playerIndex]; batch.Draw(_player, new Rectangle(startX + (int)((playerEntry.Position.X + 8) * Border.SCALE), (int)((playerEntry.Position.Y + 8) * Border.SCALE), (int)(16 * Border.SCALE), (int)(16 * Border.SCALE)), new Rectangle(PLAYER_ANIMATION_FRAMES[_playerFrameIndex] * 16, 0, 16, 16), Color.White); _fontRenderer.DrawText(batch, selectedEntry.Name, new Vector2(startX + 18 * 4 * Border.SCALE, 0), Color.Black, Border.SCALE); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // background _batch.Draw(_background, new Rectangle(startX, 0, width, height), Color.White); // message var lines = _mail.Lines; var message = lines[0]; if (lines[1] != null) { message += Environment.NewLine + lines[1]; } _fontRenderer.DrawText(_batch, message, new Vector2(startX + unit * 2, unit * 7), Color.Black, Border.SCALE); // pokemon portrait for portraitmail if (_mail.Template == "PORTRAITMAIL") { var sprite = PokemonTextureManager.GetFront(_mail.PokemonId, POKEMON_PORTRAIT_PALETTE, 0); _batch.Draw(sprite, new Rectangle( startX + unit, unit * 10, (int)(Border.SCALE * sprite.Width), (int)(Border.SCALE * sprite.Height)), null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0f); } // author var offsetX = DEFAULT_AUTHOR_OFFSET; if (MAIL_AUTHOR_OFFSET.ContainsKey(_mail.Template)) { offsetX = MAIL_AUTHOR_OFFSET[_mail.Template]; } _fontRenderer.DrawText(_batch, _mail.Author, new Vector2(startX + offsetX * unit, unit * 14), Color.Black, Border.SCALE); _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var unit = (int)(Border.SCALE * Border.UNIT); var width = Border.SCREEN_WIDTH * unit; var height = Border.SCREEN_HEIGHT * unit; var startX = (int)(Controller.ClientRectangle.Width / 2f - width / 2f); // draw black background _batch.DrawRectangle(new Rectangle(startX, 0, width, height), Color.Black); // title _fontRenderer.DrawText(_batch, "OPTION", new Vector2(startX + unit * 2, unit), Border.DefaultWhite, Border.SCALE); // options var optionsText = string.Join(Environment.NewLine, _options.Select((o, i) => { if (i == _index && _selectorVisible) { return(">" + o); } else { return(" " + o); } })); _fontRenderer.DrawText(_batch, optionsText, new Vector2(startX + unit * 2, unit * 4), Border.DefaultWhite, Border.SCALE); // description _fontRenderer.DrawText(_batch, DESCRIPTIONS[_index], new Vector2(startX + unit, unit * 14), Border.DefaultWhite, Border.SCALE); // overlay _batch.Draw(_overlay, new Rectangle(startX, 0, width, height), Color.White); _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // background Border.DrawCenter(_batch, startX, 0, Border.SCREEN_WIDTH, Border.SCREEN_HEIGHT, Border.SCALE); var entry = Controller.ActivePlayer.HallOfFame[_index]; // upper box Border.Draw(_batch, startX, 0, Border.SCREEN_WIDTH, 5, Border.SCALE); _fontRenderer.DrawText(_batch, entry.number.ToString().PadLeft(3) + "-Time Famer", new Vector2(startX + unit * 2, unit * 2), Color.Black, Border.SCALE); // pokemon sprite var sprite = _pokemon.GetFrontSprite(); _batch.Draw(sprite, new Rectangle( startX + unit * 6, unit * 5, (int)(Border.SCALE * sprite.Width), (int)(Border.SCALE * sprite.Height)), Color.White); // lower box Border.Draw(_batch, startX, unit * 12, Border.SCREEN_WIDTH, 6, Border.SCALE); var levelStr = ("^:L" + _pokemon.Level).PadRight(8); if (_pokemon.Level == Pokemon.MAX_LEVEL) { levelStr = _pokemon.Level.ToString().PadRight(6); } _fontRenderer.DrawText(_batch, $"^No.{_pokemon.Id.ToString("D3")} {_pokemon.DisplayName.PadRight(Pokemon.MAX_NAME_LENGTH)} {PokemonStatHelper.GetGenderChar(_pokemon.Gender)}\n" + new string(' ', 7) + "/" + _pokemon.Name + "\n\n" + levelStr + "^ID^No/" + entry.trainerId.ToString("D5"), new Vector2(startX + unit, unit * 13), Color.Black, Border.SCALE); _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var unit = (int)(Border.SCALE * Border.UNIT); var width = Border.SCREEN_WIDTH * unit; var height = Border.SCREEN_HEIGHT * unit; var startX = (int)(Controller.ClientRectangle.Width / 2f - width / 2f); // draw black background _batch.DrawRectangle(new Rectangle(startX, 0, width, unit), Color.Black); // draw title _fontRenderer.DrawText(_batch, _entry.Name + "'S NEST", new Vector2(startX + unit * 2, 0), FONT_COLOR, Border.SCALE); // draw map var mapRect = new Rectangle(startX, unit, width, height - unit); var mapTexture = _index == 0 ? _mapJohto : _mapKanto; _batch.Draw(mapTexture, mapRect, Color.White); // draw nest locations if (_entry.Areas.Length > 0 && !_playerVisible && _nestsVisible) { foreach (var mapEntry in _entries) { if (_entry.Areas.Contains(mapEntry.Name.Replace("\n", " ").ToUpper())) { _batch.Draw(_nestIndicator, new Rectangle( (int)(startX + mapEntry.Position.X * Border.SCALE + unit), (int)(mapEntry.Position.Y * Border.SCALE + unit), unit * 2, unit * 2), Color.White); } } } // draw player location if (_playerVisible) { var mapEntry = _entries.FirstOrDefault(e => e.Name.Replace("\n", " ").ToUpper() == _location.ToUpper()); if (!string.IsNullOrEmpty(mapEntry.Name)) // is in the current region { _batch.Draw(_player, new Rectangle( (int)(startX + mapEntry.Position.X * Border.SCALE + unit), (int)(mapEntry.Position.Y * Border.SCALE + unit), unit * 2, unit * 2), Color.White); } } _batch.End(); }
public void Draw(SpriteBatch batch) { if (Visible) { batch.Draw(_texture, new Rectangle(Controller.ClientRectangle.Width / 2 - WIDTH / 2, Controller.ClientRectangle.Height - HEIGHT + _y, WIDTH, HEIGHT), Color.White); var textSize = _fontRenderer.MeasureText(_text, TEXT_SIZE); _fontRenderer.DrawText(batch, _text, new Vector2(Controller.ClientRectangle.Width / 2f - textSize.X / 2f, Controller.ClientRectangle.Height - HEIGHT / 2f + _y - textSize.Y / 2f), Color.Black, TEXT_SIZE); } }
internal override void Draw(GameTime gameTime) { _batch.Begin(samplerState: SamplerState.PointClamp); var backgroundColor = (int)(Border.DefaultWhite.R * _brightness); _batch.DrawRectangle(Controller.ClientRectangle, new Color(backgroundColor, backgroundColor, backgroundColor)); _textbox.Draw(_batch, Border.DefaultWhite); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); var startY = Controller.ClientRectangle.Height / 2 - Border.SCREEN_HEIGHT * unit / 2; if (_oakStage >= 0 && _oakStage < OAK_TOTAL_STAGES) { var oakWidth = (int)(40 * Border.SCALE); var oakHeight = (int)(56 * Border.SCALE); _batch.Draw(_oak, new Rectangle(Controller.ClientRectangle.Width / 2 - oakWidth / 2, startY + unit * 4, oakWidth, oakHeight), new Rectangle(_oakStage * 40, 0, 40, 56), Color.White); } if (_playerStage >= 0 && _playerStage < PLAYER_TOTAL_STAGES) { var playerWidth = (int)(40 * Border.SCALE); var playerHeight = (int)(56 * Border.SCALE); _batch.Draw(_player, new Rectangle(Controller.ClientRectangle.Width / 2 - playerWidth / 2 + (int)(_playerOffset * Border.SCALE), startY + unit * 4, playerWidth, playerHeight), new Rectangle(_playerStage * 40, 0, 40, 56), Color.White); } if (_pokemonVisible && _pokemonAppearDelay == 0) { var texture = _previewPokemon.GetFrontSprite(); var pokemonWidth = (int)(texture.Width * Border.SCALE); var pokemonHeight = (int)(texture.Height * Border.SCALE); var alpha = (int)(255 * _pokemonAlpha); _batch.Draw(texture, new Rectangle(Controller.ClientRectangle.Width / 2 - pokemonWidth / 2, startY + unit * 4, pokemonWidth, pokemonHeight), null, new Color(255, 255, 255, alpha), 0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0f); } _nameSelection.Draw(_batch, Border.DefaultWhite); if (_nameSelection.Visible) { Border.DrawCenter(_batch, _nameSelection.OffsetX + unit * 2, startY, 4, 1, Border.SCALE); _fontRenderer.DrawText(_batch, "NAME", new Vector2(_nameSelection.OffsetX + unit * 2, startY), Color.Black, Border.SCALE); } _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var unit = Border.UNIT * Border.SCALE; var startX = (int)(Controller.ClientRectangle.Width / 2f - Border.SCREEN_WIDTH * unit / 2f); Border.Draw(_batch, startX, 0, Border.SCREEN_WIDTH, OPTIONS_COUNT * 2 + 2, Border.SCALE); _fontRenderer.DrawText(_batch, _optionsText, new Vector2(startX + unit, unit * 2), Color.Black, Border.SCALE); _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); // draw stats var unit = (int)(Border.UNIT * Border.SCALE); var startX = (int)(Controller.ClientRectangle.Width / 2f + (-Border.SCREEN_WIDTH / 2f + 4) * unit); Border.Draw(_batch, startX, 0, 16, 10, Border.SCALE); _fontRenderer.DrawText(_batch, _infoText, new Vector2(startX + unit, unit * 2), Color.Black, Border.SCALE); _textbox.Draw(_batch, Border.DefaultWhite); _optionsBox.Draw(_batch, Border.DefaultWhite); _batch.End(); }
public void Draw(SpriteBatch batch) { if (Visible) { var(unit, startX, width, height) = Border.GetDefaultScreenValues(); var startY = BattleScreen.StartY; Border.Draw(batch, startX + unit * 9, startY, 11, 12, Border.SCALE); var text = "ATTACK\n" + _pokemon.Attack.ToString().PadLeft(7) + "\n" + "DEFENSE\n" + _pokemon.Defense.ToString().PadLeft(7) + "\n" + "SPCL.ATK\n" + _pokemon.SpecialAttack.ToString().PadLeft(7) + "\n" + "SPCL.DEF\n" + _pokemon.SpecialDefense.ToString().PadLeft(7) + "\n" + "SPEED\n" + _pokemon.Speed.ToString().PadLeft(7); _fontRenderer.DrawText(batch, text, new Vector2(startX + unit * 11, startY + unit), Color.Black, Border.SCALE); } }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); Border.DrawCenter(_batch, startX, 0, Border.SCREEN_WIDTH, Border.SCREEN_HEIGHT, Border.SCALE); // borders for (var x = 0; x < Border.SCREEN_WIDTH; x++) { for (var y = 0; y < 6; y++) { if (y == 0 || x == 0 || x == Border.SCREEN_WIDTH - 1 || y == 5) { _batch.Draw(_border, new Rectangle(startX + x * unit, y * unit, unit, unit), Color.White); } } } // compose icon _batch.Draw(_icon, new Rectangle( startX, 0, (int)(Border.SCALE * _icon.Height), (int)(Border.SCALE * _icon.Height)), new Rectangle(_iconFrame * 16, 0, 16, 16), Color.White); // message var lines = Mail.GetLinesFromMessage(_message); _fontRenderer.DrawText(_batch, lines[0], new Vector2(startX + unit * 2, unit * 2), Color.Black, Border.SCALE); if (lines[1] != null) { _fontRenderer.DrawText(_batch, lines[1], new Vector2(startX + unit * 2, unit * 4), Color.Black, Border.SCALE); } // placeholders var messageLength = PokemonFontRenderer.PrintableCharAmount(_message); for (var i = messageLength; i < Mail.MESSAGE_MAX_LENGTH; i++) { var y = 0; var x = i; if (x >= Mail.MESSAGE_CHARS_PER_LINE) { y++; x -= Mail.MESSAGE_CHARS_PER_LINE; } var textureOffset = i > messageLength ? 1 : 0; _batch.Draw(_placeholders, new Rectangle( startX + unit * 2 + unit * x, unit * 2 + y * unit * 2, (int)(_placeholders.Height * Border.SCALE), (int)(_placeholders.Height * Border.SCALE)), new Rectangle(textureOffset * 8, 0, 8, 8), Color.White); } // char list var charListText = ""; for (var i = 0; i < ActiveCharset.Length; i++) { charListText += ActiveCharset[i]; if ((i + 1) % CHARS_PER_LINE == 0) { charListText += Environment.NewLine; } else { charListText += " "; } } _fontRenderer.DrawText(_batch, charListText, new Vector2(startX + unit, unit * 7), Color.Black, Border.SCALE); // menu var menuText = ""; if (_isLower) { menuText += "UPPER"; } else { menuText += "lower"; } menuText += " DEL END"; _fontRenderer.DrawText(_batch, menuText, new Vector2(startX + unit, unit * 17), Color.Black, Border.SCALE); // selector if (_selectorVisible) { if (_menuActive) { _batch.Draw(_selectorMenu, new Rectangle( startX + unit + unit * _menuIndex * 6, (int)(unit * 17 - Border.SCALE), (int)(_selectorMenu.Width * Border.SCALE), (int)(_selectorMenu.Height * Border.SCALE)), Color.White); } else { _batch.Draw(_selector, new Rectangle( (int)(startX + unit * _charX * 2 + unit - Border.SCALE), (int)(unit * _charY * 2 + unit * 7 - Border.SCALE), (int)(_selector.Width * Border.SCALE), (int)(_selector.Height * Border.SCALE)), Color.White); } } _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // item box Border.Draw(_batch, startX, 0, Border.SCREEN_WIDTH, 12, Border.SCALE); // item list var visibleItems = _items .Skip(_scrollIndex) .Take(ITEMS_VISIBLE) .Select(i => { if (i is MachineItem machine) { return(machine.MachineItemName); } else { return(i.Name); } }).ToList(); if (visibleItems.Count < ITEMS_VISIBLE) { visibleItems.Add("CANCEL"); } var itemListText = ""; for (var i = 0; i < visibleItems.Count; i++) { if (i == _index) { if (DialogVisible) { itemListText += "^>>"; } else { itemListText += ">"; } } else { itemListText += " "; } var itemIndex = i + _scrollIndex; if (_items.Length <= itemIndex || !_items[itemIndex].IsQuantifyable) { itemListText += visibleItems[i] + NewLine; } else { var item = _items[itemIndex]; itemListText += visibleItems[i] + NewLine + new string(' ', 10) + "*" + item.Amount.ToString().PadLeft(2); } itemListText += NewLine; } _fontRenderer.LineGap = 0; _fontRenderer.DrawText(_batch, itemListText, new Vector2(startX + unit * 4, unit * 2), Color.Black, Border.SCALE); // up/down arrows if (_scrollIndex > 0) { _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit, unit, unit), null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipVertically, 0f); } if (_scrollIndex < _items.Length - ITEMS_VISIBLE + 1) { _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit * 10, unit, unit), Color.White); } // item description Border.Draw(_batch, startX, unit * 12, Border.SCREEN_WIDTH, 6, Border.SCALE); if (_items.Length > _index + _scrollIndex) { var description = _items[_index + _scrollIndex].Description; _fontRenderer.LineGap = 1; _fontRenderer.DrawText(_batch, description, new Vector2(startX + unit, unit * 14), Color.Black, Border.SCALE); } _textbox.Draw(_batch, Border.DefaultWhite); _optionsBox.Draw(_batch, Border.DefaultWhite); _amountSelector.Draw(_batch, Border.DefaultWhite); _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // fill background Border.DrawCenter(_batch, startX, 0, Border.SCREEN_WIDTH, Border.SCREEN_HEIGHT, Border.SCALE); // pokemon list box Border.Draw(_batch, startX + unit * 8, 0, 12, 14, Border.SCALE); // title box Border.Draw(_batch, startX + unit * 8, 0, 12, 3, Border.SCALE); _fontRenderer.DrawText(_batch, _title, new Vector2(startX + unit * 10, unit), Color.Black, Border.SCALE); if (CanChangeBox) { _batch.Draw(_arrow, new Rectangle( startX + unit * 8, unit, (int)(_arrow.Width * Border.SCALE), (int)(_arrow.Height * Border.SCALE)), null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0f); _batch.Draw(_arrow, new Rectangle( startX + unit * 19, unit, (int)(_arrow.Width * Border.SCALE), (int)(_arrow.Height * Border.SCALE)), Color.White); } // pokemon list var visiblePokemon = _pokemon.Skip(_scrollIndex).Take(VISIBLE_POKEMON).Select(p => p.DisplayName).ToList(); if (visiblePokemon.Count < VISIBLE_POKEMON) { visiblePokemon.Add("CANCEL"); } var pokemonListText = string.Join(NewLine, visiblePokemon); _fontRenderer.DrawText(_batch, pokemonListText, new Vector2(startX + unit * 9, unit * 4), Color.Black, Border.SCALE); // selector if (!DialogVisible) { if (_isMoving) { _batch.Draw(_moveSelector, new Rectangle( startX + unit * 9, unit * 3 + unit * 2 * _index, (int)(_moveSelector.Width * Border.SCALE), (int)(_moveSelector.Height * Border.SCALE)), Color.White); } else { _batch.Draw(_selector, new Rectangle( (int)(startX + unit * 8 + 7 * Border.SCALE), (int)(unit * 3 + Border.SCALE + unit * 2 * _index), (int)(_selector.Width * Border.SCALE), (int)(_selector.Height * Border.SCALE)), Color.White); } } // portrait background var targetRect = new Rectangle( startX + unit, unit * 4, (int)(PokemonTextureManager.TEXTURE_SIZE * Border.SCALE), (int)(PokemonTextureManager.TEXTURE_SIZE * Border.SCALE)); if (!_optionsBox.Visible && !_isMoving) { _batch.DrawRectangle(targetRect, POKEMON_PORTRAIT_BACKGROUND); } if ((_pokemon.Length > _index + _scrollIndex || _isMoving) && _showPokemon) { // pokemon portrait var selectedPokemon = GetSelectedPokemon(); Texture2D sprite; if (_optionsBox.Visible || _isMoving) { sprite = selectedPokemon.GetFrontSprite(); } else { sprite = PokemonTextureManager.GetFront(selectedPokemon.Id, POKEMON_PORTRAIT_PALETTE, selectedPokemon.UnownLetter); } _batch.Draw(sprite, targetRect, Color.White); // pokemon info var levelStr = selectedPokemon.Level == Pokemon.MAX_LEVEL ? Pokemon.MAX_LEVEL.ToString().PadRight(4) : ("^:L" + selectedPokemon.Level).PadRight(6); var infoStr = levelStr + PokemonStatHelper.GetGenderChar(selectedPokemon.Gender) + NewLine + selectedPokemon.Name; _fontRenderer.DrawText(_batch, infoStr, new Vector2(startX + unit, unit * 12), Color.Black, Border.SCALE); // draw item box if the pokemon holds an item var heldItem = selectedPokemon.HeldItem; if (heldItem != null) { Texture2D icon; if (heldItem.IsMail) { icon = _mailIcon; } else { icon = _itemIcon; } _batch.Draw(icon, new Rectangle( startX + unit * 7, unit * 12, (int)(Border.SCALE * _itemIcon.Width), (int)(Border.SCALE * _itemIcon.Height)), Color.White); } } // text box Border.Draw(_batch, startX, unit * 15, Border.SCREEN_WIDTH, 3, Border.SCALE); _fontRenderer.DrawText(_batch, _message, new Vector2(startX + unit, unit * 16), Color.Black, Border.SCALE); _optionsBox.Draw(_batch, Border.DefaultWhite); _confirmationBox.Draw(_batch, Border.DefaultWhite); _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var unit = (int)(Border.SCALE * Border.UNIT); var width = Border.SCREEN_WIDTH * unit; var height = Border.SCREEN_HEIGHT * unit; var startX = (int)(Controller.ClientRectangle.Width / 2f - width / 2f); // draw black background _batch.DrawRectangle(new Rectangle(startX, 0, width, height), Color.Black); // title _fontRenderer.DrawText(_batch, "SEARCH", new Vector2(startX + unit * 2, unit), Border.DefaultWhite, Border.SCALE); // type selection void DrawTypeLine(string typeStr, int typeNo, int y) { while (typeStr.Length < 8) { if (typeStr.Length % 2 == 1) { typeStr += " "; } else { typeStr = " " + typeStr; } } typeStr = (_index == typeNo - 1 && _selectorVisible ? ">" : " ") + "TYPE" + typeNo + " " + typeStr; _fontRenderer.DrawText(_batch, typeStr, new Vector2(startX + unit * 2, y), Border.DefaultWhite, Border.SCALE); } DrawTypeLine(_type1Options[_type1Index], 1, unit * 4); DrawTypeLine(_type2Options[_type2Index], 2, unit * 6); // arrows var arrowSize = new Point((int)(_arrow.Width * Border.SCALE)); _batch.Draw(_arrow, new Rectangle(new Point(startX + unit * 8, unit * 4), arrowSize), Color.White); _batch.Draw(_arrow, new Rectangle(new Point(startX + unit * 17, unit * 4), arrowSize), null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0f); _batch.Draw(_arrow, new Rectangle(new Point(startX + unit * 8, unit * 6), arrowSize), Color.White); _batch.Draw(_arrow, new Rectangle(new Point(startX + unit * 17, unit * 6), arrowSize), null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0f); // search graphic _batch.Draw(_search, new Rectangle( startX + unit * 8, unit * 9, (int)(Border.SCALE * _search.Width), (int)(Border.SCALE * _search.Height)), Color.White); // options var optionsText = (_index == 2 && _selectorVisible ? ">" : " ") + "BEGIN SEARCH!!" + NewLine + (_index == 3 && _selectorVisible ? ">" : " ") + "CANCEL"; _fontRenderer.DrawText(_batch, optionsText, new Vector2(startX + unit * 2, unit * 13), Border.DefaultWhite, Border.SCALE); // overlay _batch.Draw(_overlay, new Rectangle(startX, 0, width, height), Color.White); // no results overlay if (_noResultsDelay > 0) { _batch.Draw(_noResultsOverlay, new Rectangle( startX, unit * 12, (int)(Border.SCALE * _noResultsOverlay.Width), (int)(Border.SCALE * _noResultsOverlay.Height)), Color.White); _fontRenderer.DrawText(_batch, "The specified type\nwas not found.", new Vector2(startX + unit, unit * 14), Border.DefaultWhite, Border.SCALE); } _batch.End(); }
public void Draw(SpriteBatch batch) { if (Visible) { var(unit, startX, width, height) = Border.GetDefaultScreenValues(); startX = (int)(startX + Offset.X * Border.SCALE); var startY = (int)(BattleScreen.StartY + Offset.Y * Border.SCALE); var pokemon = Battle.ActiveBattle.PlayerPokemon.Pokemon; // name _fontRenderer.DrawText(batch, pokemon.DisplayName, new Vector2(startX + unit * 10, startY + unit * 7), Color.Black, Border.SCALE); // level/gender string levelStr; switch (pokemon.Status) { case PokemonStatus.PAR: case PokemonStatus.SLP: case PokemonStatus.BRN: case PokemonStatus.FRZ: case PokemonStatus.PSN: levelStr = pokemon.Status.ToString().ToUpper(); break; case PokemonStatus.TOX: levelStr = "PSN"; break; default: var level = pokemon.Level; if (ArtificialLevelUpActive) { level++; } if (level == Pokemon.MAX_LEVEL) { levelStr = level.ToString(); } else { levelStr = "^:L" + level.ToString().PadRight(2); } break; } _fontRenderer.DrawText(batch, levelStr + PokemonStatHelper.GetGenderChar(pokemon.Gender), new Vector2(startX + unit * 14, startY + unit * 8), Color.Black, Border.SCALE); // main bar texture batch.Draw(_texture, new Rectangle(startX + unit * 9, startY + unit * 9, (int)(_texture.Width * Border.SCALE), (int)(_texture.Height * Border.SCALE)), Color.White); // hp var hp = (int)(GetCurrentHPState() * pokemon.MaxHP); var hpStr = hp.ToString().PadLeft(3) + "/" + pokemon.MaxHP.ToString().PadLeft(3); _fontRenderer.DrawText(batch, hpStr, new Vector2(startX + unit * 11, startY + unit * 10), Color.Black, Border.SCALE); // hp bar var barWidth = (int)Math.Ceiling(HP_BAR_WIDTH * Border.SCALE * GetCurrentHPState()); var barHeight = (int)(BAR_HEIGHT * Border.SCALE); var barColor = PokemonStatHelper.GetHPBarColor(PokemonStatHelper.GetPokemonHealth(hp, pokemon.MaxHP)); batch.DrawRectangle(new Rectangle( (int)(HP_BAR_OFFSET_X * Border.SCALE) + startX + unit * 9, (int)(BAR_OFFSET_Y * Border.SCALE) + startY + unit * 9, barWidth, barHeight), barColor); // exp bar if (pokemon.Level < Pokemon.MAX_LEVEL) { var expBarWidth = (int)Math.Ceiling(EXP_BAR_WIDTH * Border.SCALE * GetCurrentExpState()); batch.DrawRectangle(new Rectangle( (int)(startX + unit * 10 + EXP_BAR_WIDTH * Border.SCALE - expBarWidth), (int)(startY + unit * 11 + Border.SCALE * BAR_OFFSET_Y), expBarWidth, (int)(Border.SCALE * BAR_HEIGHT)), EXPBAR_COLOR); } } }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); Border.DrawCenter(_batch, startX, 0, Border.SCREEN_WIDTH, Border.SCREEN_HEIGHT, Border.SCALE); Border.Draw(_batch, startX, 0, Border.SCREEN_WIDTH, 4, Border.SCALE); Border.Draw(_batch, startX, unit * 4, 11, 10, Border.SCALE); Border.Draw(_batch, startX + unit * 11, unit * 7, 9, 7, Border.SCALE); Border.Draw(_batch, startX, unit * 14, Border.SCREEN_WIDTH, 4, Border.SCALE); // title var currentBox = Controller.ActivePlayer.Boxes[Controller.ActivePlayer.ActiveBoxIndex]; _fontRenderer.DrawText(_batch, "CURRENT " + currentBox.Name, new Vector2(startX + unit, unit * 2), Color.Black, Border.SCALE); // box list var visibleBoxes = Controller.ActivePlayer.Boxes .Skip(_scrollIndex) .Take(VISIBLE_BOXES) .Select(b => b.Name).ToList(); if (visibleBoxes.Count < VISIBLE_BOXES) { visibleBoxes.Add("CANCEL"); } var boxListText = string.Join(NewLine, visibleBoxes.Select((b, i) => { if (i == _index) { if (_optionsBox.Visible) { return("^>>" + b); } else { return(">" + b); } } else { return(" " + b); } })); _fontRenderer.DrawText(_batch, boxListText, new Vector2(startX + unit, unit * 6), Color.Black, Border.SCALE); // box text if (StorageBox.BOX_COUNT > _index + _scrollIndex) { var selectedBox = Controller.ActivePlayer.Boxes[_index + _scrollIndex]; var boxText = "POKéMON" + NewLine + selectedBox.PokemonCount.ToString().PadLeft(3) + "/" + StorageBox.POKEMON_PER_BOX.ToString(); _fontRenderer.DrawText(_batch, boxText, new Vector2(startX + unit * 12, unit * 9), Color.Black, Border.SCALE); } // message var message = "Choose a BOX."; if (_optionsBox.Visible) { message = "What^'s up?"; } _fontRenderer.DrawText(_batch, message, new Vector2(startX + unit, unit * 16), Color.Black, Border.SCALE); _optionsBox.Draw(_batch, Border.DefaultWhite); _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var unit = (int)(Border.SCALE * Border.UNIT); var width = Border.SCREEN_WIDTH * unit; var height = 10 * unit; var startX = (int)(Controller.ClientRectangle.Width / 2f - width / 2f); // ui Border.DrawCenter(_batch, startX, 0, Border.SCREEN_WIDTH, 1, Border.SCALE); Border.Draw(_batch, startX, unit, Border.SCREEN_WIDTH, 11, Border.SCALE); var levelStrWidth = Pokemon.Level == Pokemon.MAX_LEVEL ? 3 : 4; Border.DrawCenter(_batch, startX + unit * 2, unit, levelStrWidth + Pokemon.DisplayName.Length + Pokemon.Level.ToString().Length, 1, Border.SCALE); Border.Draw(_batch, startX, height + unit, Border.SCREEN_WIDTH, 7, Border.SCALE); // TODO: replace with correct border texture _batch.Draw(_overlay, new Rectangle( startX, height, (int)(_overlay.Width * Border.SCALE), (int)(_overlay.Height * Border.SCALE) ), Border.DefaultWhite); // switch arrows if (_partyIndex > 0) { _fontRenderer.DrawText(_batch, "<", new Vector2(startX + unit * 16, 0), Color.Black, Border.SCALE); } if (_partyIndex < Controller.ActivePlayer.PartyPokemon.Length - 1) { _fontRenderer.DrawText(_batch, ">", new Vector2(startX + unit * 18, 0), Color.Black, Border.SCALE); } // pokemon sprite/name/level _batch.Draw(Pokemon.GetMenuSprite(), new Rectangle( (int)(startX + unit * 2.5), (int)(unit * 0.5), (int)(16 * Border.SCALE), (int)(16 * Border.SCALE)), new Rectangle(_animationIndex * 16, 0, 16, 16), Color.White); var lvStr = Pokemon.Level.ToString(); if (Pokemon.Level < Pokemon.MAX_LEVEL) { lvStr = "^:L" + lvStr; } _fontRenderer.DrawText(_batch, Pokemon.DisplayName + lvStr, new Vector2(startX + unit * 5, unit), Color.Black, Border.SCALE); // move list var moveListText = ""; for (var i = 0; i < Pokemon.MAX_MOVES; i++) { if (i < Pokemon.Moves.Length) { // selection arrow if (_moveIndex == i) { moveListText += ">"; } else if (_isOrdering && i == _orderMoveIndex) { moveListText += "^>>"; } else { moveListText += " "; } var move = Pokemon.Moves[i]; moveListText += move.name + Environment.NewLine + new string(' ', 9) + $"^PP^PP {move.pp.ToString().PadLeft(2)}/{move.maxPP.ToString().PadLeft(2)}" + Environment.NewLine; } else { moveListText += " -" + Environment.NewLine + new string(' ', 9) + "--" + Environment.NewLine; } } _fontRenderer.LineGap = 0; _fontRenderer.DrawText(_batch, moveListText, new Vector2(startX + unit, unit * 3), Color.Black, Border.SCALE); // move info if (_isOrdering) { _fontRenderer.DrawText(_batch, "Where?", new Vector2(startX + unit, height + unit * 2), Color.Black, Border.SCALE); } else { var selectedMove = Pokemon.Moves[_moveIndex].GetMove(); var attk = selectedMove.Attack == -1 ? "---" : selectedMove.Attack.ToString().PadLeft(3); _fontRenderer.DrawText(_batch, "TYPE/" + Environment.NewLine + " " + selectedMove.Type.ToString().ToUpper().PadRight(9) + "ATTK/" + attk, new Vector2(startX + unit, height + unit), Color.Black, Border.SCALE); _fontRenderer.LineGap = 1; _fontRenderer.DrawText(_batch, selectedMove.Description, new Vector2(startX + unit, height + unit * 4), Color.Black, Border.SCALE); } _batch.End(); }
public void Draw(SpriteBatch batch) { if (Visible) { var(unit, startX, width, height) = Border.GetDefaultScreenValues(); startX = (int)(startX + Offset.X * Border.SCALE); var startY = (int)(BattleScreen.StartY + Offset.Y * Border.SCALE); var pokemon = Battle.ActiveBattle.EnemyPokemon.Pokemon; // name _fontRenderer.DrawText(batch, pokemon.DisplayName, new Vector2(startX + unit, startY), Color.Black, Border.SCALE); // caught if (Battle.ActiveBattle.IsWildBattle && Controller.ActivePlayer.PokedexCaught.Contains(pokemon.Id)) { batch.Draw(_caughtIndicator, new Rectangle(startX + unit, startY + unit, (int)(_caughtIndicator.Width * Border.SCALE), (int)(_caughtIndicator.Height * Border.SCALE)), Color.White); } // level/gender string levelStr; switch (pokemon.Status) { case PokemonStatus.PAR: case PokemonStatus.SLP: case PokemonStatus.BRN: case PokemonStatus.FRZ: case PokemonStatus.PSN: levelStr = pokemon.Status.ToString().ToUpper(); break; case PokemonStatus.TOX: levelStr = "PSN"; break; default: if (pokemon.Level == Pokemon.MAX_LEVEL) { levelStr = pokemon.Level.ToString(); } else { levelStr = "^:L" + pokemon.Level.ToString().PadRight(2); } break; } _fontRenderer.DrawText(batch, levelStr + PokemonStatHelper.GetGenderChar(pokemon.Gender), new Vector2(startX + unit * 6, startY + unit), Color.Black, Border.SCALE); // hp bar texture batch.Draw(_texture, new Rectangle(startX + unit, startY + unit * 2, (int)(_texture.Width * Border.SCALE), (int)(_texture.Height * Border.SCALE)), Color.White); // hp bar var barWidth = (int)Math.Ceiling(BAR_WIDTH * Border.SCALE * GetCurrentHPState()); var barHeight = (int)(BAR_HEIGHT * Border.SCALE); var hp = (int)(GetCurrentHPState() * pokemon.MaxHP); var barColor = PokemonStatHelper.GetHPBarColor(PokemonStatHelper.GetPokemonHealth(hp, pokemon.MaxHP)); batch.DrawRectangle(new Rectangle( (int)(BAR_OFFSET_X * Border.SCALE) + startX + unit * 2, (int)(BAR_OFFSET_Y * Border.SCALE) + startY + unit * 2, barWidth, barHeight), barColor); } }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); Border.DrawCenter(_batch, startX, 0, Border.SCREEN_WIDTH, Border.SCREEN_HEIGHT, Border.SCALE); // draw border // vertical for (var i = 0; i < Border.SCREEN_HEIGHT; i++) { _batch.Draw(_border, new Rectangle(startX, unit * i, unit, unit), Color.White); _batch.Draw(_border, new Rectangle(startX + unit * 19, unit * i, unit, unit), Color.White); } var verticalOffset = (5 - ActiveCharset.Length / CHARS_PER_LINE) * 2; // horizontal var horizontalBars = new[] { 0, 5 + verticalOffset, 15, 17 }; for (var i = 1; i < Border.SCREEN_WIDTH - 1; i++) { foreach (var y in horizontalBars) { _batch.Draw(_border, new Rectangle(startX + i * unit, unit * y, unit, unit), Color.White); } } // title _fontRenderer.DrawText(_batch, _title, new Vector2(startX + unit * 5, unit * 2), Color.Black, Border.SCALE); // icon if (_icon != null) { _batch.Draw(_icon, new Rectangle( startX + 2 * unit, (int)(unit * 1.5), (int)(Border.SCALE * _iconFrameSize), (int)(Border.SCALE * _iconFrameSize)), new Rectangle(_iconFrame * _iconFrameSize, 0, _iconFrameSize, _iconFrameSize), Color.White); } // name _fontRenderer.DrawText(_batch, _name, new Vector2(startX + unit * 5, unit * (4 + verticalOffset)), Color.Black, Border.SCALE); var nameLength = PokemonFontRenderer.PrintableCharAmount(_name); for (var i = nameLength; i < _maxLength; i++) { var textureOffset = i > nameLength ? 1 : 0; _batch.Draw(_placeholders, new Rectangle( startX + unit * 5 + unit * i, unit * (4 + verticalOffset), (int)(_placeholders.Height * Border.SCALE), (int)(_placeholders.Height * Border.SCALE)), new Rectangle(textureOffset * 8, 0, 8, 8), Color.White); } // char list var charListText = ""; for (var i = 0; i < ActiveCharset.Length; i++) { charListText += ActiveCharset[i]; if ((i + 1) % CHARS_PER_LINE == 0) { charListText += NewLine; } else { charListText += " "; } } _fontRenderer.DrawText(_batch, charListText, new Vector2(startX + unit * 2, unit * (6 + verticalOffset)), Color.Black, Border.SCALE); // menu var menuText = ""; if (_isLower) { menuText += "UPPER"; } else { menuText += "lower"; } menuText += " DEL END"; _fontRenderer.DrawText(_batch, menuText, new Vector2(startX + unit * 2, unit * 16), Color.Black, Border.SCALE); // selector if (_selectorVisible) { if (_menuActive) { _batch.Draw(_selectorMenu, new Rectangle( startX + unit * 2 + unit * _menuIndex * 6, (int)(unit * 16 - Border.SCALE), (int)(_selectorMenu.Width * Border.SCALE), (int)(_selectorMenu.Height * Border.SCALE)), Color.White); } else { _batch.Draw(_selector, new Rectangle( (int)(startX + unit * _charX * 2 + unit * 2 - Border.SCALE), (int)(unit * _charY * 2 + unit * (6 + verticalOffset) - Border.SCALE), (int)(_selector.Width * Border.SCALE), (int)(_selector.Height * Border.SCALE)), Color.White); } } _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var unit = (int)(Border.SCALE * Border.UNIT); var width = Border.SCREEN_WIDTH * unit; var startX = (int)(Controller.ClientRectangle.Width / 2f - width / 2f); Border.DrawCenter(_batch, startX, 0, Border.SCREEN_WIDTH, 8, Border.SCALE); // pokemon portrait _batch.Draw(_pokemon.GetFrontSprite(), new Rectangle( startX, 0, (int)(56 * Border.SCALE), (int)(56 * Border.SCALE)), null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0f); // basic info var lvText = ""; if (_pokemon.Level == Pokemon.MAX_LEVEL) { lvText = Pokemon.MAX_LEVEL.ToString().PadRight(4); } else { lvText = "^:L" + _pokemon.Level.ToString().PadRight(3); } _fontRenderer.LineGap = 1; _fontRenderer.DrawText(_batch, "^NO." + _pokemon.Id.ToString("D3") + " " + lvText + PokemonStatHelper.GetGenderChar(_pokemon.Gender) + Environment.NewLine + _pokemon.DisplayName + Environment.NewLine + " /" + _pokemon.Name, new Vector2(startX + unit * 8, 0), Color.Black, Border.SCALE); // page selector _fontRenderer.DrawText(_batch, "< >", new Vector2(startX + unit * 12, unit * 6), Color.Black, Border.SCALE); for (var i = 0; i < PAGE_COUNT; i++) { _batch.Draw(_pages, new Rectangle(startX + unit * 13 + i * 2 * unit, unit * 5, unit * 2, unit * 2), new Rectangle(i * 16, i == _pageIndex ? 16 : 0, 16, 16), Color.White); } // separator line _batch.DrawRectangle(new Rectangle(startX, (int)(unit * 8 - Border.SCALE * 2), width, (int)(Border.SCALE)), Color.Black); // background bottom _batch.DrawRectangle(new Rectangle(startX, unit * 8, width, unit * 10), PAGE_COLORS[_pageIndex]); // draw page content switch (_pageIndex) { case 0: // page 1 { // hp bar _hpbar.Draw(_batch, new Vector2(startX, unit * 9), _pokemon.HP, _pokemon.MaxHP, Border.SCALE); _fontRenderer.DrawText(_batch, _pokemon.HP.ToString().PadLeft(3) + "/" + _pokemon.MaxHP.ToString().PadLeft(3), new Vector2(startX + unit, unit * 10), Color.Black, Border.SCALE); // status and type var statusText = "STATUS/" + Environment.NewLine + _pokemon.Status.ToString().ToUpper().PadLeft(8) + Environment.NewLine + "TYPE/" + Environment.NewLine + " " + _pokemon.Type1.ToString().ToUpper(); if (_pokemon.Type2 != PokemonType.None) { statusText += Environment.NewLine + " " + _pokemon.Type2.ToString().ToUpper(); } _fontRenderer.LineGap = 0; _fontRenderer.DrawText(_batch, statusText, new Vector2(startX, unit * 12), Color.Black, Border.SCALE); // divider line _batch.DrawRectangle(new Rectangle( startX + unit * 9, unit * 8, (int)(Border.SCALE * 2), unit * 10), Color.Black); // exp and level var toLvText = ""; if (_pokemon.Level == Pokemon.MAX_LEVEL) { toLvText = ("TO " + Pokemon.MAX_LEVEL.ToString()).PadLeft(10); } else { // two extra chars for ^: var toLv = _pokemon.Level + 1; toLvText = ("TO ^:L" + toLv.ToString()).PadLeft(12); } _fontRenderer.DrawText(_batch, "EXP POINTS" + Environment.NewLine + _pokemon.Experience.ToString().PadLeft(10) + Environment.NewLine + Environment.NewLine + "LEVEL UP" + Environment.NewLine + _pokemon.NeededExperience.ToString().PadLeft(10) + Environment.NewLine + toLvText, new Vector2(startX + unit * 10, unit * 9), Color.Black, Border.SCALE); // exp bar _batch.Draw(_expBar, new Rectangle( startX + unit * 10, unit * 16, (int)(_expBar.Width * Border.SCALE), (int)(_expBar.Height * Border.SCALE)), Color.White); if (_pokemon.Level < Pokemon.MAX_LEVEL) { var expCurrentLv = PokemonStatHelper.GetExperienceForLevel(_pokemon.ExperienceType, _pokemon.Level); var expProgress = (double)(_pokemon.Experience - expCurrentLv) / (PokemonStatHelper.GetExperienceForLevel(_pokemon.ExperienceType, _pokemon.Level + 1) - expCurrentLv); var barWidth = (int)(Math.Ceiling(64 * Border.SCALE * expProgress)); _batch.DrawRectangle(new Rectangle( (int)(startX + unit * 11 + 64 * Border.SCALE - barWidth), (int)(unit * 16 + Border.SCALE * 3), barWidth, (int)(Border.SCALE * 2)), EXPBAR_COLOR); } } break; case 1: // page 2 { var itemText = ""; if (_pokemon.HeldItem == null) { itemText = "---"; } else { itemText = _pokemon.HeldItem.Name; } var moveListText = ""; for (var i = 0; i < Pokemon.MAX_MOVES; i++) { if (i == 0) { moveListText += "MOVE "; } else { moveListText += " "; } if (_pokemon.Moves.Length > i) { var move = _pokemon.Moves[i]; moveListText += move.name + Environment.NewLine + new string(' ', 12) + "^PP^PP " + move.pp.ToString().PadLeft(2) + "/" + move.maxPP.ToString().PadLeft(2); } else { moveListText += "-" + Environment.NewLine + new string(' ', 12) + "--"; } moveListText += Environment.NewLine; } _fontRenderer.LineGap = 0; _fontRenderer.DrawText(_batch, "ITEM " + itemText + Environment.NewLine + Environment.NewLine + moveListText, new Vector2(startX, unit * 8), Color.Black, Border.SCALE); } break; case 2: // page 3 { // ot/trainer id var trainerText = "^ID^NO." + Environment.NewLine + " " + _pokemon.TrainerID.ToString("D5") + Environment.NewLine + Environment.NewLine + "OT/" + Environment.NewLine + " " + _pokemon.OT; _fontRenderer.LineGap = 0; _fontRenderer.DrawText(_batch, trainerText, new Vector2(startX, unit * 9), Color.Black, Border.SCALE); // divider line _batch.DrawRectangle(new Rectangle( startX + unit * 10, unit * 8, (int)(Border.SCALE * 2), unit * 10), Color.Black); var statText = "ATTACK" + Environment.NewLine + _pokemon.Attack.ToString().PadLeft(9) + Environment.NewLine + "DEFENSE" + Environment.NewLine + _pokemon.Defense.ToString().PadLeft(9) + Environment.NewLine + "SPCL.ATK" + Environment.NewLine + _pokemon.SpecialAttack.ToString().PadLeft(9) + Environment.NewLine + "SPCL.DEF" + Environment.NewLine + _pokemon.SpecialDefense.ToString().PadLeft(9) + Environment.NewLine + "SPEED" + Environment.NewLine + _pokemon.Speed.ToString().PadLeft(9) + Environment.NewLine; _fontRenderer.DrawText(_batch, statText, new Vector2(startX + unit * 11, unit * 8), Color.Black, Border.SCALE); } break; } _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var unit = (int)(Border.SCALE * Border.UNIT); var width = Border.SCREEN_WIDTH * unit; var height = Border.SCREEN_HEIGHT * unit; var startX = (int)(Controller.ClientRectangle.Width / 2f - width / 2f); // draw black background _batch.DrawRectangle(new Rectangle(startX, 0, width, height), Color.Black); // draw pokemon portrait _batch.DrawRectangle(new Rectangle( (int)(startX + Border.SCALE * 3), unit, unit * 7, unit * 7), Border.DefaultWhite); var portrait = PokemonTextureManager.GetFront(_entry.Id, _portraitPalette); _batch.Draw(portrait, new Rectangle( (int)(startX + Border.SCALE * 3), unit, (int)(Border.SCALE * portrait.Width), (int)(Border.SCALE * portrait.Height)), Color.White); // pokemon id _fontRenderer.DrawText(_batch, "^No." + _entry.Id.ToString("D3"), new Vector2(startX + Border.SCALE * 3 + unit, unit * 8), Border.DefaultWhite, Border.SCALE); // basic info _fontRenderer.DrawText(_batch, _entry.Name + NewLine + _entry.Species + NewLine + "HT" + _height + NewLine + "WT" + _weight, new Vector2(startX + Border.SCALE * 3 + unit * 8, unit * 3), Border.DefaultWhite, Border.SCALE); // footprint // 16 footprints per row var footprintTextureX = ((_entry.Id - 1) % 16) * 16; var footprintTextureY = (int)Math.Floor((_entry.Id - 1) / 16d) * 16; _batch.Draw(_footprints, new Rectangle( (int)(startX + unit * 17 + Border.SCALE * 3), unit, unit * 2, unit * 2), new Rectangle(footprintTextureX, footprintTextureY, 16, 16), Color.White); if (_entry.IsCaught) { // text page _fontRenderer.DrawText(_batch, _pages[_pageIndex], new Vector2(startX + Border.SCALE * 3 + unit, unit * 11), Border.DefaultWhite, Border.SCALE); // page indicator _batch.Draw(_pageIndicators, new Rectangle( (int)(startX + Border.SCALE * 3), (int)(unit * 9 + Border.SCALE * 5), (int)(Border.SCALE * _pageIndicators.Width), (int)(Border.SCALE * _pageIndicators.Height / 2)), new Rectangle(0, _pageIndex * 8, 16, 8), Color.White); } // options and cursor var optionsStr = string.Join("", OPTIONS.Select((o, i) => { if (i == _cursorIndex && _selectorVisible) { return(">" + o); } else { return(" " + o); } })); _fontRenderer.DrawText(_batch, optionsStr, new Vector2(startX + Border.SCALE * 3, unit * 17), Border.DefaultWhite, Border.SCALE); // overlay _batch.Draw(_overlay, new Rectangle(startX, 0, width, height), Color.White); _batch.End(); }
internal override void Draw(GameTime gameTime) { // clear backbuffer Controller.GraphicsDevice.Clear(BACKGROUND_COLOR); var previousTargets = Controller.GraphicsDevice.GetRenderTargets(); RenderTargetManager.BeginRenderToTarget(_sceneTarget); Controller.GraphicsDevice.Clear(BACKGROUND_COLOR); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // draw empty box at bottom of the screen Border.Draw(_batch, startX, StartY + unit * 12, Border.SCREEN_WIDTH, 6, Border.SCALE); DrawScreen(gameTime); // status _enemyPokemonStatus.Draw(_batch); _playerPokemonStatus.Draw(_batch); _playerStatus.Draw(_batch); _pokemonStats.Draw(_batch); // battle messages _battleTextbox.Draw(_batch, Border.DefaultWhite); // main menu if (_menuState == BattleMenuState.Main) { Border.Draw(_batch, startX + unit * 8, StartY + unit * 12, 12, 6, Border.SCALE); var menuStr = ""; for (var i = 0; i < MENU_OPTIONS.Length; i++) { if (i == _mainMenuIndex) { menuStr += ">"; } else { menuStr += " "; } menuStr += MENU_OPTIONS[i].PadRight(5); if (i == 1) { menuStr += "\n"; } } _fontRenderer.LineGap = 1; _fontRenderer.DrawText(_batch, menuStr, new Vector2(startX + unit * 9, StartY + unit * 14), Color.Black, Border.SCALE); } else if (_menuState == BattleMenuState.Fight) { Border.Draw(_batch, startX + unit * 4, StartY + unit * 12, 16, 6, Border.SCALE); // move list var pokemon = Battle.ActiveBattle.PlayerPokemon.Pokemon; var moveListStr = ""; for (var i = 0; i < Pokemon.MAX_MOVES; i++) { if (i == _moveMenuIndex) { moveListStr += ">"; } else { moveListStr += " "; } if (pokemon.Moves.Length > i) { moveListStr += pokemon.Moves[i].name; } else { moveListStr += "-"; } moveListStr += "\n"; } _fontRenderer.LineGap = 0; _fontRenderer.DrawText(_batch, moveListStr, new Vector2(startX + unit * 5, StartY + unit * 13), Color.Black, Border.SCALE); // move info Border.Draw(_batch, startX, StartY + unit * 8, 11, 5, Border.SCALE); var selectedMove = pokemon.Moves[_moveMenuIndex]; // disabled? if (Battle.ActiveBattle.PlayerPokemon.DisabledMove == selectedMove && Battle.ActiveBattle.PlayerPokemon.DisabledTurns > 0) { _fontRenderer.DrawText(_batch, "Disabled!", new Vector2(startX + unit, StartY + unit * 10), Color.Black, Border.SCALE); } else { _fontRenderer.DrawText(_batch, "TYPE/\n" + " " + selectedMove.GetMove().Type.ToString().ToUpper() + "\n" + new string(' ', 4) + selectedMove.pp.ToString().PadLeft(2) + "/" + selectedMove.maxPP.ToString().PadLeft(2), new Vector2(startX + unit, StartY + unit * 9), Color.Black, Border.SCALE); } } // animations lock (_animations) { foreach (var animation in _animations) { if (!animation.IsFinished) { animation.Draw(_batch); } } } _batch.End(); Controller.GraphicsDevice.SetRenderTargets(previousTargets); if (_invertColors) { _batch.Begin(samplerState: SamplerState.PointClamp, blendState: INVERT_COLORS_BLENDSTATE, effect: _screenEffect); } else { _batch.Begin(samplerState: SamplerState.PointClamp, effect: _screenEffect); } var color = Color.White; if (_fadeOut) { color = new Color(255, 255, 255, (int)(255 * (1f - _fadeOutProgress))); } _batch.Draw(_sceneTarget, _screenOffset, color); _batch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // border Border.Draw(_batch, startX + unit * 7, 0, 13, 12, Border.SCALE); // mail list var visibleMails = _mails .Skip(_scrollIndex) .Take(MAILS_VISIBLE) .Select(m => m.Author) .ToList(); if (visibleMails.Count < MAILS_VISIBLE) { visibleMails.Add("CANCEL"); } var listText = ""; for (var i = 0; i < visibleMails.Count; i++) { if (i == _index) { if (DialogVisible) { listText += "^>>"; } else { listText += ">"; } } else { listText += " "; } listText += visibleMails[i] + NewLine; } _fontRenderer.DrawText(_batch, listText, new Vector2(startX + unit * 8, unit * 2), Color.Black, Border.SCALE); // up/down arrows if (_scrollIndex > 0) { _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit, unit, unit), null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipVertically, 0f); } if (_scrollIndex < _mails.Length - MAILS_VISIBLE + 1) { _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit * 10, unit, unit), Color.White); } _textbox.Draw(_batch, Border.DefaultWhite); _optionsBox.Draw(_batch, Border.DefaultWhite); _confirmationBox.Draw(_batch, Border.DefaultWhite); _batch.End(); }