Example #1
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));
        }
Example #2
0
 private unsafe void CB_FadeOutBattle()
 {
     OverworldGUI.ProcessDayTint(false);
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         _stringPrinter?.Close();
         _stringPrinter = null;
         _stringWindow.Close();
         _stringWindow = null;
         _actionsGUI?.Dispose();
         _actionsGUI = null;
         _onClosed.Invoke();
         _onClosed = null;
         Instance  = null;
     }
 }
Example #3
0
        public BattleGUI(PBEBattle battle, Action onClosed, IReadOnlyList <Party> trainerParties)
            : this(battle.BattleFormat) // Init field controller
        {
            Battle            = battle;
            Trainer           = battle.Trainers[0];
            _battleBackground = Image.LoadOrGet($"GUI.Battle.Background.BG_{battle.BattleTerrain}_{battle.BattleFormat}.png");
            SpritedParties    = new SpritedBattlePokemonParty[battle.Trainers.Count];
            for (int i = 0; i < battle.Trainers.Count; i++)
            {
                PBETrainer trainer = battle.Trainers[i];
                SpritedParties[i] = new SpritedBattlePokemonParty(trainer.Party, trainerParties[i], IsBackImage(trainer.Team), ShouldUseKnownInfo(trainer), this);
            }
            _onClosed              = onClosed;
            battle.OnNewEvent     += SinglePlayerBattle_OnNewEvent;
            battle.OnStateChanged += SinglePlayerBattle_OnStateChanged;

            Instance = this;
        }
 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);
     }
 }