Example #1
0
        private void SetUpPositionQuery(int index, bool left, bool center, bool right)
        {
            SpritedBattlePokemonParty party = _battleParty.Party;
            PBEBattlePokemon          bPkmn = party.BattleParty[index];
            SpritedBattlePokemon      sPkmn = party[bPkmn];
            PartyPokemon pkmn = sPkmn.PartyPkmn;

            _message = string.Format("Send {0} where?", pkmn.Nickname);
            CloseChoices();

            void BackCommand()
            {
                CloseChoices();
                BringUpPkmnActions(index);
            }

            _textChoices = new TextGUIChoices(0, 0, backCommand: BackCommand, font: Font.Default, fontColors: Font.DefaultDarkGray_I, selectedColors: Font.DefaultYellow_O);
            if (left)
            {
                _textChoices.Add(new TextGUIChoice("Send Left", () => SelectForBattleReplacement(bPkmn, PBEFieldPosition.Left)));
            }
            if (center)
            {
                _textChoices.Add(new TextGUIChoice("Send Center", () => SelectForBattleReplacement(bPkmn, PBEFieldPosition.Center)));
            }
            if (right)
            {
                _textChoices.Add(new TextGUIChoice("Send Right", () => SelectForBattleReplacement(bPkmn, PBEFieldPosition.Right)));
            }
            _textChoices.Add(new TextGUIChoice("Cancel", BackCommand));
            _textChoices.GetSize(out int width, out int height);
            _textChoicesWindow = new Window(0.6f, 0.3f, width, height, RenderUtils.Color(255, 255, 255, 255));
            RenderChoicesOntoWindow();
            Game.Instance.SetCallback(CB_Choices);
        }
        private uint GetColor()
        {
            if (_usePartyPkmn)
            {
                PartyPokemon pp = _partyPkmn;
                if (!pp.IsEgg && pp.HP == 0)
                {
                    return(GetFaintedColor());
                }
                return(GetDefaultColor());
            }

            SpritedBattlePokemon s = _battlePkmn;

            if (!s.PartyPkmn.IsEgg && s.Pkmn.HP == 0)
            {
                return(GetFaintedColor());
            }
            if (s.Pkmn.FieldPosition != PBEFieldPosition.None)
            {
                return(GetActiveColor());
            }
            if (BattleGUI.Instance.StandBy.Contains(s.Pkmn))
            {
                return(GetStandByColor());
            }
            return(GetDefaultColor());
        }
Example #3
0
 public BattlePartyData(SpritedBattlePokemonParty party, List <PartyGUIMember> members, SpriteList sprites)
 {
     Party = party;
     foreach (PBEBattlePokemon pkmn in party.BattleParty)
     {
         SpritedBattlePokemon sPkmn = party[pkmn]; // Use battle party's order
         members.Add(new PartyGUIMember(sPkmn, sprites));
     }
 }
Example #4
0
        private void BringUpPkmnActions(int index)
        {
            string nickname;

            _textChoices = new TextGUIChoices(0, 0, backCommand: CloseChoicesThenGoToLogicTick, font: Font.Default, fontColors: Font.DefaultDarkGray_I, selectedColors: Font.DefaultYellow_O);
            switch (_mode)
            {
            case Mode.PkmnMenu:
            {
                PartyPokemon pkmn = _gameParty.Party[index];
                nickname = pkmn.Nickname;
                _textChoices.Add(new TextGUIChoice("Check summary", () => Action_BringUpSummary(index)));
                AddFieldMovesToActions(pkmn, index);
                break;
            }

            case Mode.SelectDaycare:
            {
                PartyPokemon pkmn = _gameParty.Party[index];
                nickname = pkmn.Nickname;
                if (!pkmn.IsEgg)
                {
                    _textChoices.Add(new TextGUIChoice("Select", () => Action_SelectPartyPkmn(index)));
                }
                _textChoices.Add(new TextGUIChoice("Check summary", () => Action_BringUpSummary(index)));
                break;
            }

            case Mode.BattleSwitchIn:
            case Mode.BattleReplace:     // Currently same logic
            {
                SpritedBattlePokemonParty party = _battleParty.Party;
                PBEBattlePokemon          bPkmn = party.BattleParty[index];
                SpritedBattlePokemon      sPkmn = party[bPkmn];
                PartyPokemon pkmn = sPkmn.PartyPkmn;
                nickname = pkmn.Nickname;
                // Cannot switch in if active already or fainted, or in the switch stand by
                if (!pkmn.IsEgg && bPkmn.FieldPosition == PBEFieldPosition.None && bPkmn.HP > 0 && !BattleGUI.Instance.StandBy.Contains(bPkmn))
                {
                    _textChoices.Add(new TextGUIChoice("Switch In", () => Action_SelectPartyPkmn(index)));
                }
                _textChoices.Add(new TextGUIChoice("Check summary", () => Action_BringUpSummary(index)));
                break;
            }

            default: throw new Exception();
            }

            _textChoices.Add(new TextGUIChoice("Cancel", CloseChoicesThenGoToLogicTick));
            _textChoices.GetSize(out int width, out int height);
            _textChoicesWindow = new Window(0.6f, 0.3f, width, height, RenderUtils.Color(255, 255, 255, 255));
            RenderChoicesOntoWindow();
            _message = string.Format("Do what with {0}?", nickname);
            Game.Instance.SetCallback(CB_Choices);
        }
 public PartyGUIMember(SpritedBattlePokemon pkmn, SpriteList sprites)
 {
     _usePartyPkmn = false;
     _battlePkmn   = pkmn;
     _color        = GetColor();
     _mini         = new Sprite()
     {
         Image    = pkmn.Mini,
         Y        = Sprite_BounceDefY,
         Callback = Sprite_Bounce,
         Data     = new Sprite_BounceData()
     };
     sprites.Add(_mini);
     _background = new Image((UI.Program.RenderWidth / 2) - (UI.Program.RenderWidth / 20), (UI.Program.RenderHeight / 4) - (UI.Program.RenderHeight / 20));
     UpdateBackground();
 }
Example #6
0
 private unsafe void CB_FadeOutToSummary()
 {
     _sprites.DoCallbacks();
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         _textChoicesWindow.IsInvisible = true;
         if (_useGamePartyData)
         {
             _ = new SummaryGUI(_gameParty.Party[_selectionForSummary], SummaryGUI.Mode.JustView, OnSummaryClosed);
         }
         else
         {
             SpritedBattlePokemonParty party = _battleParty.Party;
             PBEBattlePokemon          bPkmn = party.BattleParty[_selectionForSummary];
             SpritedBattlePokemon      sPkmn = party[bPkmn];
             _ = new SummaryGUI(sPkmn, SummaryGUI.Mode.JustView, OnSummaryClosed);
         }
     }
 }
Example #7
0
        public unsafe SummaryGUI(object pkmn, Mode mode, Action onClosed, PBEMove learningMove = PBEMove.None)
        {
            _mode = mode;
            if (mode == Mode.LearnMove)
            {
                SetSelectionVar(-1);
                _page          = Page.Moves;
                _selectingMove = 0;
                _learningMove  = learningMove;
            }
            else
            {
                _page = Page.Info;
            }

            _pageImage = new Image((int)(Program.RenderWidth * PageImageWidth), (int)(Program.RenderHeight * PageImageHeight));

            if (pkmn is PartyPokemon pPkmn)
            {
                _pPkmn = pPkmn;
            }
            else if (pkmn is BoxPokemon pcPkmn)
            {
                _pcPkmn = pcPkmn;
            }
            else
            {
                _bPkmn = (SpritedBattlePokemon)pkmn;
            }
            LoadPkmnImage();
            UpdatePageImage();

            _onClosed       = onClosed;
            _fadeTransition = new FadeFromColorTransition(500, 0);
            Game.Instance.SetCallback(CB_FadeInSummary);
            Game.Instance.SetRCallback(RCB_Fading);
        }