예제 #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);
        }
예제 #2
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));
     }
 }
예제 #3
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);
        }
예제 #4
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);
         }
     }
 }
예제 #5
0
        public unsafe PartyGUI(SpritedBattlePokemonParty party, Mode mode, Action onClosed)
        {
            _mode             = mode;
            _allowBack        = mode != Mode.BattleReplace; // Disallow back for BattleReplace
            _useGamePartyData = false;
            _sprites          = new();
            _members          = new List <PartyGUIMember>(PkmnConstants.PartyCapacity);
            _battleParty      = new BattlePartyData(party, _members, _sprites);
            _members[0].SetBigBounce();

            if (mode == Mode.BattleSwitchIn)
            {
                SetSelectionVar(-1);
            }
            else if (mode == Mode.BattleReplace)
            {
                SetBattleReplacementMessage();
            }

            _onClosed       = onClosed;
            _fadeTransition = new FadeFromColorTransition(500, 0);
            Game.Instance.SetCallback(CB_FadeInParty);
            Game.Instance.SetRCallback(RCB_Fading);
        }
예제 #6
0
        private void Action_SelectPartyPkmn(int index)
        {
            switch (_mode)
            {
            case Mode.SelectDaycare:
            case Mode.BattleSwitchIn:
            {
                SetSelectionVar((short)index);
                CloseChoices();
                ClosePartyMenu();
                return;
            }

            case Mode.BattleReplace:
            {
                SpritedBattlePokemonParty party = _battleParty.Party;
                PBEBattlePokemon          bPkmn = party.BattleParty[index];
                switch (BattleGUI.Instance.Battle.BattleFormat)
                {
                case PBEBattleFormat.Single:
                {
                    SelectForBattleReplacement(bPkmn, PBEFieldPosition.Center);
                    return;
                }

                case PBEBattleFormat.Double:
                {
                    bool left  = CanUsePositionForBattle(PBEFieldPosition.Left);
                    bool right = CanUsePositionForBattle(PBEFieldPosition.Right);
                    if (left && !right)
                    {
                        SelectForBattleReplacement(bPkmn, PBEFieldPosition.Left);
                        return;
                    }
                    if (!left && right)
                    {
                        SelectForBattleReplacement(bPkmn, PBEFieldPosition.Right);
                        return;
                    }
                    SetUpPositionQuery(index, true, false, true);
                    return;
                }

                case PBEBattleFormat.Triple:
                case PBEBattleFormat.Rotation:
                {
                    bool left   = CanUsePositionForBattle(PBEFieldPosition.Left);
                    bool center = CanUsePositionForBattle(PBEFieldPosition.Center);
                    bool right  = CanUsePositionForBattle(PBEFieldPosition.Right);
                    if (left && !center && !right)
                    {
                        SelectForBattleReplacement(bPkmn, PBEFieldPosition.Left);
                        return;
                    }
                    if (!left && center && !right)
                    {
                        SelectForBattleReplacement(bPkmn, PBEFieldPosition.Center);
                        return;
                    }
                    if (!left && !center && right)
                    {
                        SelectForBattleReplacement(bPkmn, PBEFieldPosition.Right);
                        return;
                    }
                    SetUpPositionQuery(index, left, center, right);
                    return;
                }

                default: throw new Exception();
                }
            }

            default: throw new Exception();
            }
        }