コード例 #1
0
 public SpritedBattlePokemonParty(PBEList <PBEBattlePokemon> party)
 {
     OriginalParty = party;
     SpritedParty  = new SpritedBattlePokemon[party.Count];
     for (int i = 0; i < party.Count; i++)
     {
         SpritedParty[i] = new SpritedBattlePokemon(party[i]);
     }
 }
コード例 #2
0
        private void SetSeen(PBEBattlePokemon pkmn)
        {
            if (pkmn.Trainer == Trainer)
            {
                return;
            }
            SpritedBattlePokemon sPkmn = SpritedParties[pkmn.Trainer.Id][pkmn];

            Game.Instance.Save.Pokedex.SetSeen(pkmn.KnownSpecies, pkmn.KnownForm, pkmn.KnownGender, pkmn.KnownShiny, sPkmn.DisguisedPID);
        }
コード例 #3
0
            public PartyMemberButton(float x, float y, SpritedBattlePokemon sPkmn)
            {
                X      = x;
                Y      = y;
                Width  = 0.48f;
                Height = 0.31f;
                SPkmn  = sPkmn;

                _drawn = new Sprite(_slot.Width, _slot.Height);
                _drawn.Draw(Draw);
            }
コード例 #4
0
        public unsafe void RenderTick(uint *bmpAddress, int bmpWidth, int bmpHeight)
        {
            PBEBattle battle = _battle;

            Font fontDefault = Font.Default;

            uint[] defaultWhite = Font.DefaultWhite;
            _battleBackground.DrawOn(bmpAddress, bmpWidth, bmpHeight, 0, 0, bmpWidth, bmpHeight);
            SpritedBattlePokemon foe  = _spritedParties[1].SpritedParty[0];
            SpritedBattlePokemon ally = _spritedParties[0].SpritedParty[0];

            RenderPkmn(bmpAddress, bmpWidth, bmpHeight, 0.75f, 0.55f, false, foe);
            RenderPkmn(bmpAddress, bmpWidth, bmpHeight, 0.35f, 0.95f, true, ally);

            if (Overworld.ShouldRenderDayTint())
            {
                DayTint.Render(bmpAddress, bmpWidth, bmpHeight);
            }

            if (!_transitionDone)
            {
                float t = _transitionCounter / TransitionDurationF;
                //float t1 = t + 1;
                //_battleBackground.DrawOn(bmpAddress, bmpWidth, bmpHeight, 0, 0, (int)(bmpWidth * t1), (int)(bmpHeight * t1));
                RenderUtils.FillColor(bmpAddress, bmpWidth, bmpHeight, 0, 0, bmpWidth, bmpHeight, (uint)(t * 0xFF) << 24);
                if (--_transitionCounter <= 0)
                {
                    _transitionDone = true;
                    new Thread(battle.Begin)
                    {
                        Name = ThreadName
                    }.Start();
                }
                return;
            }

            RenderPkmnInfo(bmpAddress, bmpWidth, bmpHeight, 0.50f, 0.05f, false, foe);
            RenderPkmnInfo(bmpAddress, bmpWidth, bmpHeight, 0.05f, 0.45f, true, ally);

            string msg = _message;

            if (msg != null)
            {
                RenderUtils.FillColor(bmpAddress, bmpWidth, bmpHeight, 0, (int)(bmpHeight * 0.79f), bmpWidth, (int)(bmpHeight * 0.16f), 0x80313131);
                fontDefault.DrawString(bmpAddress, bmpWidth, bmpHeight, (int)(bmpWidth * 0.10f), (int)(bmpHeight * 0.80f), msg, defaultWhite);
            }

            _actionsGUI?.RenderTick(bmpAddress, bmpWidth, bmpHeight);
            _battleEndedTransition?.RenderTick(bmpAddress, bmpWidth, bmpHeight);
        }
コード例 #5
0
        private void UpdatePokemon(PBEBattlePokemon pkmn, PkmnPosition pos, bool info, bool sprite)
        {
            SpritedBattlePokemon sPkmn = SpritedParties[pkmn.Trainer.Id][pkmn];

            if (info)
            {
                sPkmn.UpdateInfoBar();
            }
            if (sprite)
            {
                sPkmn.UpdateSprites(pos, false);
            }
            pos.SPkmn = sPkmn;
        }
コード例 #6
0
        private static unsafe void RenderPkmn(uint *bmpAddress, int bmpWidth, int bmpHeight, PkmnPosition pos, bool ally)
        {
            SpritedBattlePokemon sPkmn = pos.SPkmn;
            AnimatedImage        img   = sPkmn.AnimImage;
            int width  = img.Width;
            int height = img.Height;

            if (ally)
            {
                width  *= 2;
                height *= 2;
            }
            img.DrawSizedOn(bmpAddress, bmpWidth, bmpHeight,
                            RenderUtils.GetCoordinatesForCentering(bmpWidth, width, pos.MonX), RenderUtils.GetCoordinatesForEndAlign(bmpHeight, height, pos.MonY), width, height);
        }
コード例 #7
0
 public SpritedBattlePokemonParty(PBEList <PBEBattlePokemon> pBattle, Party p, bool backImage, bool useKnownInfo, BattleGUI battleGUI)
 {
     Party        = p;
     BattleParty  = pBattle;
     SpritedParty = new SpritedBattlePokemon[pBattle.Count];
     for (int i = 0; i < pBattle.Count; i++)
     {
         PkmnPosition     wildPos = null;
         PBEBattlePokemon pPkmn   = pBattle[i];
         if (pPkmn.IsWild)
         {
             wildPos = battleGUI.GetStuff(pPkmn, pPkmn.FieldPosition);
         }
         SpritedParty[i] = new SpritedBattlePokemon(pBattle[i], p[i], backImage, useKnownInfo, wildPos);
     }
 }
コード例 #8
0
        public ActionsGUI(BattleGUI parent, SpritedBattlePokemonParty party, SpritedBattlePokemon sPkmn)
        {
            _parent = parent;
            _party  = party;
            _pkmn   = sPkmn;

            _fightChoices = new GUIChoices(0.8f, 0.7f, 0.06f,
                                           font: Font.Default, fontColors: Font.DefaultWhite, selectedColors: Font.DefaultSelected, disabledColors: Font.DefaultDisabled)
            {
                new GUIChoice("Fight", FightChoice)
            };
            PBEBattlePokemon pkmn    = _pkmn.Pkmn;
            bool             enabled = pkmn.CanSwitchOut();
            Action           command = enabled ? PokemonChoice : (Action)null;

            _fightChoices.Add(new GUIChoice("Pokémon", command, isEnabled: enabled));
        }
コード例 #9
0
        private unsafe void RenderPkmnInfo(uint *bmpAddress, int bmpWidth, int bmpHeight, float x, float y, bool ally, SpritedBattlePokemon sPkmn)
        {
            Font fontDefault = Font.Default;

            PBEBattlePokemon pkmn = sPkmn.Pkmn;

            fontDefault.DrawString(bmpAddress, bmpWidth, bmpHeight, (int)(bmpWidth * x), (int)(bmpHeight * (y + 0.00f)), pkmn.KnownNickname, Font.DefaultWhite);
            string prefix = ally ? pkmn.HP.ToString() + "/" + pkmn.MaxHP.ToString() + " - " : string.Empty;

            fontDefault.DrawString(bmpAddress, bmpWidth, bmpHeight, (int)(bmpWidth * x), (int)(bmpHeight * (y + 0.06f)), prefix + pkmn.HPPercentage.ToString("P2"), Font.DefaultWhite);
            fontDefault.DrawString(bmpAddress, bmpWidth, bmpHeight, (int)(bmpWidth * x), (int)(bmpHeight * (y + 0.12f)), "Level " + pkmn.Level.ToString(), Font.DefaultWhite);
            fontDefault.DrawString(bmpAddress, bmpWidth, bmpHeight, (int)(bmpWidth * x), (int)(bmpHeight * (y + 0.18f)), "Status: " + pkmn.Status1.ToString(), Font.DefaultWhite);
            PBEGender gender = pkmn.KnownGender;

            if (gender != PBEGender.Genderless)
            {
                fontDefault.DrawString(bmpAddress, bmpWidth, bmpHeight, (int)(bmpWidth * x), (int)(bmpHeight * (y + 0.24f)), gender.ToSymbol(), gender == PBEGender.Male ? Font.DefaultMale : Font.DefaultFemale);
            }
        }
コード例 #10
0
        private unsafe void RenderPkmn(uint *bmpAddress, int bmpWidth, int bmpHeight, float x, float y, bool ally, SpritedBattlePokemon sPkmn)
        {
            Sprite sprite = ally ? sPkmn.BackSprite : sPkmn.FrontSprite; // TODO: Substitute
            int    width  = sprite.Width;
            int    height = sprite.Height;

            if (ally)
            {
                width  *= 2;
                height *= 2;
            }
            sprite.DrawOn(bmpAddress, bmpWidth, bmpHeight, (int)(bmpWidth * x) - (width / 2), (int)(bmpHeight * y) - height, width, height);
        }
コード例 #11
0
        private void UpdateAnimationSpeed(PBEBattlePokemon pkmn)
        {
            SpritedBattlePokemon sPkmn = SpritedParties[pkmn.Trainer.Id][pkmn];

            sPkmn.UpdateAnimationSpeed();
        }