Beispiel #1
0
        public void ActionsLoop(bool begin)
        {
            if (begin)
            {
                foreach (PBEBattlePokemon pkmn in _trainer.Party)
                {
                    pkmn.TurnAction = null;
                }
                _actions.Clear();
                _actions.AddRange(_trainer.ActiveBattlers);
                StandBy.Clear();
            }
            int i = _actions.FindIndex(p => p.TurnAction == null);

            if (i == -1)
            {
                _actionsGUI.Dispose();
                _actionsGUI = null;
                new Thread(() => PBEBattle.SelectActionsIfValid(_trainer, _actions.Select(p => p.TurnAction).ToArray()))
                {
                    Name = ThreadName
                }.Start();
            }
            else
            {
                AddMessage($"What will {_actions[i].Nickname} do?");
                SpritedBattlePokemonParty party = _spritedParties[_trainer.Id];
                _actionsGUI = new ActionsGUI(this, party, party.SpritedParty[i]);
            }
        }
Beispiel #2
0
        private void SinglePlayerBattle_OnStateChanged(PBEBattle battle)
        {
            switch (battle.BattleState)
            {
            case PBEBattleState.Ended:
            {
                void OnBattleEndedTransitionEnded()
                {
                    _battleEndedTransition = null;
                    if (_actionsGUI != null)
                    {
                        _actionsGUI.Dispose();
                        _actionsGUI = null;
                    }
                    _onClosed.Invoke();
                    _onClosed = null;
                }

                _battleEndedTransition = new FadeToColorTransition(20, 0, OnBattleEndedTransitionEnded);
                break;
            }

            case PBEBattleState.ReadyToRunSwitches: new Thread(battle.RunSwitches)
                {
                    Name = ThreadName
                }.Start(); break;

            case PBEBattleState.ReadyToRunTurn: new Thread(battle.RunTurn)
                {
                    Name = ThreadName
                }.Start(); break;
            }
        }
Beispiel #3
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;
     }
 }