private void InitializeEntry() { // extract and load palette var pokemonData = PokemonData.Get(_entry.Id); _portraitPalette = PokemonTextureManager.GetPalette(pokemonData.colors.normal); // split text into pages _pages = _entry.Text.Split(new[] { "\n\n" }, StringSplitOptions.None); // get height/weigth and format if (_entry.IsCaught) { var height = _entry.Height; var feet = (int)Math.Floor(height); var inches = ((int)Math.Round((height - feet) * 100)).ToString("D2"); _height = (feet.ToString() + "^'1" + inches + "^'2").PadLeft(11); _weight = _entry.Weigth.ToString("N1", CultureInfo.InvariantCulture) + "lb"; _weight = _weight.PadLeft(8); } else { _height = "?^'1??^'2".PadLeft(11); _weight = "???lb".PadLeft(8); } // save selected entry Controller.ActivePlayer.MenuStates.PokedexLastSelectedId = _entry.Id; }
public override void LoadContent() { _palette1 = PokemonTextureManager.ShiftPalette(_user.Pokemon.GetPalette(), false, 1); _palette2 = PokemonTextureManager.ShiftPalette(_user.Pokemon.GetPalette(), false, 2); LoadTexture("agility"); }
public override void LoadContent() { LoadTexture("aurorabeam"); _userPalettes[0] = _user.Pokemon.GetPalette(); _userPalettes[1] = PokemonTextureManager.ShiftPalette(_userPalettes[0], true, 1); // dark _userPalettes[2] = PokemonTextureManager.ShiftPalette(_userPalettes[0], true, 2); // darker _userPalettes[3] = PokemonTextureManager.ShiftPalette(_userPalettes[0], false, 1); // light _userPalettes[4] = PokemonTextureManager.ShiftPalette(_userPalettes[0], false, 2); // lighter _targetPalettes[0] = _target.Pokemon.GetPalette(); _targetPalettes[1] = PokemonTextureManager.ShiftPalette(_targetPalettes[0], true, 1); // dark _targetPalettes[2] = PokemonTextureManager.ShiftPalette(_targetPalettes[0], true, 2); // darker _targetPalettes[3] = PokemonTextureManager.ShiftPalette(_targetPalettes[0], false, 1); // light _targetPalettes[4] = PokemonTextureManager.ShiftPalette(_targetPalettes[0], false, 2); // lighter }
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(); }
protected override void DrawScreen(GameTime gameTime) { var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // wild pokemon if (_enemyPokemonVisible && _enemyPokemonSize > 0f) { var characterAlpha = (int)((_introProgress * 2) * 255); if (characterAlpha > 255) { characterAlpha = 255; } var pokemon = Battle.ActiveBattle.EnemyPokemon.Pokemon; Texture2D sprite; if (_introProgress < 1f) { sprite = PokemonTextureManager.GetFront(pokemon.Id, WILD_POKEMON_INTRO_PALETTE, pokemon.UnownLetter); } else { if (_enemyPokemonPalette == null) { sprite = pokemon.GetFrontSprite(); } else { sprite = pokemon.GetFrontSprite(_enemyPokemonPalette); } } var pokemonTargetX = startX + unit * 12; var pokemonStartX = -width - unit * 4; var pokemonX = (int)(pokemonTargetX + (pokemonStartX * (1f - _introProgress))); var offset = _enemyPokemonOffset; var spriteX = (int)(pokemonX + offset.X * Border.SCALE); var spriteY = (int)(StartY + offset.Y * Border.SCALE); var spriteRectangle = sprite.Bounds; var spriteHeight = (int)(sprite.Height * Border.SCALE); if (offset.Y > 0) { spriteRectangle.Height -= (int)offset.Y; spriteHeight -= (int)(offset.Y * Border.SCALE); } _batch.Draw(sprite, new Rectangle(spriteX, spriteY, (int)(sprite.Width * Border.SCALE), spriteHeight), spriteRectangle, new Color(_enemyPokemonColor.R, _enemyPokemonColor.G, _enemyPokemonColor.B, characterAlpha)); } // player intro/outro if (_playerOutroProgress < 1f) { int characterAlpha; int playerX; if (_playerOutroStarted) { var playerTargetX = unit * 10; var playerStartX = startX + unit; playerX = (int)(playerStartX - (playerTargetX * _playerOutroProgress)); characterAlpha = (int)(((1f - _playerOutroProgress) * 2) * 255); } else { var playerTargetX = startX + unit; var playerStartX = width + unit * 4; playerX = (int)(playerTargetX + (playerStartX * (1f - _introProgress))); characterAlpha = (int)((_introProgress * 2) * 255); } if (characterAlpha > 255) { characterAlpha = 255; } var playerTextureX = _introProgress < 1f ? 1 : 0; _batch.Draw(_player, new Rectangle(playerX, StartY + unit * 5, (int)(_player.Width / 2f * Border.SCALE), (int)(_player.Height * Border.SCALE)), new Rectangle(playerTextureX * 56, 0, 56, 56), new Color(255, 255, 255, characterAlpha)); } // player pokemon if (_playerPokemonVisible && _playerPokemonSize > 0f) { Texture2D sprite; if (_playerPokemonPalette == null) { sprite = Battle.ActiveBattle.PlayerPokemon.Pokemon.GetBackSprite(); } else { sprite = Battle.ActiveBattle.PlayerPokemon.Pokemon.GetBackSprite(_playerPokemonPalette); } var spriteWidth = (int)((int)(sprite.Width * _playerPokemonSize) * Border.SCALE); var spriteHeight = spriteWidth; var spriteColor = new Color(_playerPokemonColor.R, (int)(_playerPokemonColor.G * _playerPokemonSize), (int)(_playerPokemonColor.B * _playerPokemonSize)); var offset = _playerPokemonOffset; var spriteX = (int)(startX + unit * 2 + sprite.Width * Border.SCALE / 2f - spriteWidth / 2f + offset.X); var spriteY = (int)(StartY + unit * 5 + (sprite.Height * Border.SCALE - spriteHeight) + offset.Y * Border.SCALE); var spriteRectangle = sprite.Bounds; if (offset.Y > 0) { spriteRectangle.Height -= (int)offset.Y; spriteHeight -= (int)(offset.Y * Border.SCALE); } _batch.Draw(sprite, new Rectangle(spriteX, spriteY, spriteWidth, spriteHeight), spriteRectangle, spriteColor); } _textbox.Draw(_batch, Border.DefaultWhite); }
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) { _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); // black background _batch.DrawRectangle(new Rectangle(startX, 0, width, height), Color.Black); var selectedLetter = Controller.ActivePlayer.UnownsCaught[_index]; // sprite var unownColor = UnownHelper.GetUnownDexColor(selectedLetter); var unownColor2 = new Color(unownColor.R / 2, unownColor.G / 2, unownColor.B / 2); // darker shade var palette = new[] { new Color(0, 0, 0), unownColor2, unownColor, new Color(248, 248, 248) }; var sprite = PokemonTextureManager.GetFront(UnownHelper.UNOWN_ID, palette, selectedLetter); _batch.DrawRectangle(new Rectangle( startX + unit * 6, unit * 5, (int)(Border.SCALE * sprite.Width), (int)(Border.SCALE * sprite.Height)), Border.DefaultWhite); _batch.Draw(sprite, new Rectangle( startX + unit * 6, unit * 5, (int)(Border.SCALE * sprite.Width), (int)(Border.SCALE * sprite.Height)), Color.White); // word var word = UNOWN_TEXTS[selectedLetter]; for (var i = 0; i < word.Length; i++) { var c = word[i] - 65; DrawUnownLetter(c, startX + unit * (4 + i), unit * 15); } // cursor Point cursorPos; if (_index < 8) { cursorPos = new Point(unit * 3, unit * (11 - _index)); } else if (_index == 8) { cursorPos = new Point(unit * 3, unit * 2); } else if (_index < 18) { cursorPos = new Point(unit * (5 + _index - 9), unit * 2); } else if (_index == 18) { cursorPos = new Point(unit * 15, unit * 2); } else { cursorPos = new Point(unit * 15, unit * (4 + _index - 19)); } _batch.Draw(_selector, new Rectangle( startX + cursorPos.X, cursorPos.Y, (int)(Border.SCALE * _selector.Width), (int)(Border.SCALE * _selector.Height)), Border.DefaultWhite); // unown letter frame for (var i = 0; i < Controller.ActivePlayer.UnownsCaught.Length; i++) { Point letterPos; if (i < 8) { letterPos = new Point(unit * 4, unit * (11 - i)); } else if (i == 8) { letterPos = new Point(unit * 4, unit * 3); } else if (i < 18) { letterPos = new Point(unit * (5 + i - 9), unit * 3); } else if (i == 18) { letterPos = new Point(unit * 14, unit * 3); } else { letterPos = new Point(unit * 14, unit * (4 + i - 19)); } var letter = Controller.ActivePlayer.UnownsCaught[i]; DrawUnownLetter(letter, startX + letterPos.X, letterPos.Y); } // 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(); // 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(); }
protected static Texture2D GetPokemonPortrait(int id) { return(PokemonTextureManager.GetFront(id, POKEMON_PORTRAIT_PALETTE)); }