示例#1
0
        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();
        }
        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);
                }
            }
        }
示例#3
0
        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);
            }
        }
示例#4
0
        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, 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();
        }