Esempio n. 1
0
 private void SetFadeOut()
 {
     _stringWindow.Close();
     _stringWindow   = null;
     _fadeTransition = new FadeToColorTransition(500, 0);
     _state          = State.FadeOut;
 }
Esempio n. 2
0
 private unsafe void OnPartyReplacementClosed()
 {
     OverworldGUI.ProcessDayTint(true); // Catch up time
     _fadeTransition = new FadeFromColorTransition(500, 0);
     Game.Instance.SetCallback(CB_FadeFromPartyReplacement);
     Game.Instance.SetRCallback(RCB_Fading);
 }
Esempio n. 3
0
 private unsafe void Action_BringUpSummary(int index)
 {
     _selectionForSummary = index;
     _fadeTransition      = new FadeToColorTransition(500, 0);
     Game.Instance.SetCallback(CB_FadeOutToSummary);
     Game.Instance.SetRCallback(RCB_Fading);
 }
Esempio n. 4
0
 private unsafe void OnSummaryClosed()
 {
     _textChoicesWindow.IsInvisible = false;
     _fadeTransition = new FadeFromColorTransition(500, 0);
     Game.Instance.SetCallback(CB_FadeInThenGoToChoicesCB);
     Game.Instance.SetRCallback(RCB_Fading);
 }
Esempio n. 5
0
 private unsafe void TransitionOut()
 {
     SoundControl.FadeOutBattleBGMToOverworldBGM();
     _fadeTransition = new FadeToColorTransition(500, 0);
     Game.Instance.SetCallback(CB_FadeOutBattle);
     Game.Instance.SetRCallback(RCB_Fading);
 }
Esempio n. 6
0
 public unsafe void FadeIn()
 {
     OverworldGUI.ProcessDayTint(true); // Catch up time
     _fadeTransition = new FadeFromColorTransition(500, 0);
     Game.Instance.SetCallback(CB_FadeInBattle);
     Game.Instance.SetRCallback(RCB_Fading);
 }
Esempio n. 7
0
 public unsafe EggHatchGUI()
 {
     _pkmn = Game.Instance.Save.PlayerParty[Game.Instance.Save.Vars[Var.SpecialVar1]];
     LoadPkmnImage();
     _state          = State.FadeIn;
     _fadeTransition = new FadeFromColorTransition(500, 0);
     Game.Instance.SetCallback(CB_EggHatch);
     Game.Instance.SetRCallback(RCB_EggHatch);
 }
Esempio n. 8
0
 private unsafe void CB_FadeOutSummary()
 {
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         _onClosed.Invoke();
         _onClosed = null;
     }
 }
Esempio n. 9
0
 private void CB_FadeToPartyForReplacement()
 {
     OverworldGUI.ProcessDayTint(false);
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         SetMessageWindowVisibility(true);
         _ = new PartyGUI(SpritedParties[Trainer.Id], PartyGUI.Mode.BattleReplace, OnPartyReplacementClosed);
     }
 }
Esempio n. 10
0
 private unsafe void CB_FadeInParty()
 {
     _sprites.DoCallbacks();
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         Game.Instance.SetCallback(CB_LogicTick);
         Game.Instance.SetRCallback(RCB_RenderTick);
     }
 }
Esempio n. 11
0
 private unsafe void CB_FadeOutParty()
 {
     _sprites.DoCallbacks();
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         _onClosed.Invoke();
         _onClosed = null;
     }
 }
Esempio n. 12
0
 private void CB_FadeToParty()
 {
     OverworldGUI.ProcessDayTint(false);
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         BattleGUI.Instance.SetMessageWindowVisibility(true);
         _ = new PartyGUI(_party, PartyGUI.Mode.BattleSwitchIn, OnPartyClosed);
     }
 }
Esempio n. 13
0
 private unsafe void CB_FadeInThenGoToChoicesCB()
 {
     _sprites.DoCallbacks();
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         Game.Instance.SetCallback(CB_Choices);
         Game.Instance.SetRCallback(RCB_RenderTick);
     }
 }
Esempio n. 14
0
 private unsafe void CB_FadeInSummary()
 {
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         PlayPkmnCry();
         SetProperCallback();
         Game.Instance.SetRCallback(RCB_RenderTick);
     }
 }
Esempio n. 15
0
        private unsafe void OnSummaryClosed()
        {
            _stringWindow.IsInvisible = false;
            _forgetMove = Game.Instance.Save.Vars[Var.SpecialVar_Result];

            _fadeTransition = new FadeFromColorTransition(500, 0);
            Game.Instance.SetCallback(CB_Evolution);
            Game.Instance.SetRCallback(RCB_Evolution);
            _state = State.LearnMove_FadeFromSummary;
        }
Esempio n. 16
0
 public unsafe EvolutionGUI(PartyPokemon pkmn, EvolutionData.EvoData evo)
 {
     _pkmn        = pkmn;
     _evo         = evo;
     _oldNickname = pkmn.Nickname;
     _canCancel   = Evolution.CanCancelEvolution(evo.Method);
     LoadPkmnImage();
     _state          = State.FadeIn;
     _fadeTransition = new FadeFromColorTransition(500, 0);
     Game.Instance.SetCallback(CB_Evolution);
     Game.Instance.SetRCallback(RCB_Evolution);
 }
Esempio n. 17
0
 private unsafe void CB_FadeFromPartyReplacement()
 {
     OverworldGUI.ProcessDayTint(false);
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         SetMessageWindowVisibility(false);
         Game.Instance.SetCallback(CB_LogicTick);
         Game.Instance.SetRCallback(RCB_RenderTick);
         new Thread(() => Trainer.SelectSwitchesIfValid(Switches))
         {
             Name = ThreadName
         }.Start();
     }
 }
Esempio n. 18
0
 private unsafe void CB_FadeInBattle()
 {
     OverworldGUI.ProcessDayTint(false);
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         _stringWindow   = new Window(0, 0.79f, 1, 0.16f, RenderUtils.Color(49, 49, 49, 128));
         _battleThread   = new Thread(Battle.Begin)
         {
             Name = ThreadName
         };
         _battleThread.Start();
         Game.Instance.SetCallback(CB_LogicTick);
         Game.Instance.SetRCallback(RCB_RenderTick);
     }
 }
Esempio n. 19
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;
     }
 }
Esempio n. 20
0
        private unsafe void OnPartyClosed()
        {
            OverworldGUI.ProcessDayTint(true); // Catch up time
            _fadeTransition = new FadeFromColorTransition(500, 0);
            Game.Instance.SetCallback(CB_FadeFromParty);
            short result = Game.Instance.Save.Vars[Var.SpecialVar_Result];

            if (result == -1) // No selection, display actions
            {
                Game.Instance.SetRCallback(RCB_FadingParty);
            }
            else
            {
                BattleGUI.Instance.AddMessage(null, false); // Clear message
                Game.Instance.SetRCallback(RCB_FadingPartyNoChoices);
            }
        }
Esempio n. 21
0
 private void ShouldLearnMoveAction(bool value)
 {
     if (value)
     {
         _fadeTransition = new FadeToColorTransition(1_000, 0);
         _state          = State.LearnMove_FadeToSummary;
     }
     else
     {
         _textChoicesWindow.Close();
         _textChoicesWindow = null;
         _textChoices.Dispose();
         _textChoices = null;
         _stringPrinter.Close();
         _stringPrinter = null;
         SetGiveUpLearningMove();
     }
 }
Esempio n. 22
0
        public unsafe PartyGUI(Party party, Mode mode, Action onClosed)
        {
            _mode             = mode;
            _allowBack        = true;
            _useGamePartyData = true;
            _sprites          = new();
            _members          = new List <PartyGUIMember>(PkmnConstants.PartyCapacity);
            _gameParty        = new GamePartyData(party, _members, _sprites);
            _members[0].SetBigBounce();

            if (mode == Mode.SelectDaycare)
            {
                SetSelectionVar(-1);
            }

            _onClosed       = onClosed;
            _fadeTransition = new FadeFromColorTransition(500, 0);
            Game.Instance.SetCallback(CB_FadeInParty);
            Game.Instance.SetRCallback(RCB_Fading);
        }
Esempio n. 23
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);
         }
     }
 }
Esempio n. 24
0
 private void CB_FadeFromParty()
 {
     OverworldGUI.ProcessDayTint(false);
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         short result = Game.Instance.Save.Vars[Var.SpecialVar_Result];
         BattleGUI.Instance.SetMessageWindowVisibility(false);
         if (result == -1) // No selection, display actions
         {
             SetCallbacksForAllChoices();
         }
         else
         {
             PBEBattlePokemon p = _party.BattleParty[result];
             _pkmn.TurnAction = new PBETurnAction(_pkmn, p);
             BattleGUI.Instance.StandBy.Add(p);
             BattleGUI.Instance.ActionsLoop(false);
         }
     }
 }
Esempio n. 25
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);
        }
Esempio n. 26
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);
        }
Esempio n. 27
0
        private void CB_EggHatch()
        {
            switch (_state)
            {
            case State.FadeIn:
            {
                if (_fadeTransition.IsDone)
                {
                    _fadeTransition = null;
                    _stringWindow   = new Window(0, 0.79f, 1, 0.16f, RenderUtils.Color(255, 255, 255, 255));
                    CreateMessage("An egg is hatching!");
                    _state = State.AnEggIsHatchingMsg;
                }
                return;
            }

            case State.AnEggIsHatchingMsg:
            {
                if (ReadMessage())
                {
                    _stringPrinter.Close();
                    _stringPrinter  = null;
                    _fadeTransition = new FadeToColorTransition(1_000, RenderUtils.ColorNoA(200, 200, 200));
                    _state          = State.FadeToWhite;
                }
                return;
            }

            case State.FadeToWhite:
            {
                if (_fadeTransition.IsDone)
                {
                    _fadeTransition = null;
                    _pkmn.HatchEgg();
                    LoadPkmnImage();
                    _fadeTransition = new FadeFromColorTransition(1_000, RenderUtils.ColorNoA(200, 200, 200));
                    _state          = State.FadeToHatched;
                }
                return;
            }

            case State.FadeToHatched:
            {
                if (_fadeTransition.IsDone)
                {
                    _fadeTransition = null;
                    SoundControl.PlayCry(_pkmn.Species, _pkmn.Form);
                    CreateMessage(string.Format("{0} hatched from the egg!", _pkmn.Nickname));
                    _state = State.PkmnHatchedMsg;
                }
                return;
            }

            case State.PkmnHatchedMsg:
            {
                if (ReadMessage())
                {
                    _stringPrinter.Close();
                    _stringPrinter = null;
                    _stringWindow.Close();
                    _stringWindow   = null;
                    _fadeTransition = new FadeToColorTransition(500, 0);
                    _state          = State.FadeOut;
                }
                return;
            }

            case State.FadeOut:
            {
                if (_fadeTransition.IsDone)
                {
                    _fadeTransition = null;
                    OverworldGUI.Instance.ReturnToFieldWithFadeIn();
                }
                return;
            }
            }
        }
Esempio n. 28
0
 private unsafe void PokemonChoice()
 {
     _fadeTransition = new FadeToColorTransition(500, 0);
     Game.Instance.SetCallback(CB_FadeToParty);
     Game.Instance.SetRCallback(RCB_FadingParty);
 }
Esempio n. 29
0
 private unsafe void CloseSummaryMenu()
 {
     _fadeTransition = new FadeToColorTransition(500, 0);
     Game.Instance.SetCallback(CB_FadeOutSummary);
     Game.Instance.SetRCallback(RCB_Fading);
 }
Esempio n. 30
0
        private void CB_Evolution()
        {
            switch (_state)
            {
            case State.FadeIn:
            {
                if (_fadeTransition.IsDone)
                {
                    _fadeTransition = null;
                    _stringWindow   = new Window(0, 0.79f, 1, 0.16f, RenderUtils.Color(255, 255, 255, 255));
                    CreateMessage(string.Format("{0} is evolving!", _oldNickname));
                    _state = State.IsEvolvingMsg;
                }
                return;
            }

            case State.IsEvolvingMsg:
            {
                if (ReadMessage())
                {
                    _stringPrinter.Close();
                    _stringPrinter  = null;
                    _fadeTransition = new FadeToColorTransition(1_000, RenderUtils.ColorNoA(200, 200, 200));
                    _state          = State.FadeToWhite;
                }
                return;
            }

            case State.FadeToWhite:
            {
                if (TryCancelEvolution())
                {
                    _fadeTransition = null;
                    CreateMessage(string.Format("{0} stopped evolving!", _oldNickname));
                    _state = State.CancelledMsg;
                    return;
                }
                if (_fadeTransition.IsDone)
                {
                    _fadeTransition = null;
                    if (_evo.Method == EvoMethod.Ninjask_LevelUp)
                    {
                        Evolution.TryCreateShedinja(_pkmn);
                    }
                    _pkmn.Evolve(_evo);
                    LoadPkmnImage();
                    _fadeTransition = new FadeFromColorTransition(1_000, RenderUtils.ColorNoA(200, 200, 200));
                    _state          = State.FadeToEvo;
                }
                return;
            }

            case State.FadeToEvo:
            {
                if (_fadeTransition.IsDone)
                {
                    _fadeTransition = null;
                    SoundControl.PlayCry(_pkmn.Species, _pkmn.Form);
                    CreateMessage(string.Format("{0} evolved into {1}!", _oldNickname, PBELocalizedString.GetSpeciesName(_pkmn.Species).English));
                    _state = State.EvolvedIntoMsg;
                }
                return;
            }

            case State.EvolvedIntoMsg:
            {
                if (ReadMessage())
                {
                    _stringPrinter.Close();
                    _stringPrinter = null;
                    // Check for moves to learn
                    _learningMoves = new Queue <PBEMove>(new LevelUpData(_pkmn.Species, _pkmn.Form).GetNewMoves(_pkmn.Level));
                    CheckForLearnMoves();
                }
                return;
            }

            case State.FadeOut:
            {
                if (_fadeTransition.IsDone)
                {
                    _fadeTransition = null;
                    OverworldGUI.Instance.ReturnToFieldWithFadeInAfterEvolutionCheck();
                }
                return;
            }

            case State.CancelledMsg:
            {
                if (ReadMessage())
                {
                    _stringPrinter.Close();
                    _stringPrinter = null;
                    SetFadeOut();
                }
                return;
            }

            // Learning moves
            case State.LearnMove_WantsToLearnMoveMsg:
            {
                if (ReadMessageEnded())
                {
                    TextGUIChoices.CreateStandardYesNoChoices(ShouldLearnMoveAction, out _textChoices, out _textChoicesWindow);
                    _state = State.LearnMove_WantsToLearnMoveChoice;
                }
                return;
            }

            case State.LearnMove_WantsToLearnMoveChoice:
            case State.LearnMove_GiveUpLearningChoice:
            {
                HandleMultichoice();
                return;
            }

            case State.LearnMove_FadeToSummary:
            {
                if (_fadeTransition.IsDone)
                {
                    _fadeTransition           = null;
                    _stringWindow.IsInvisible = true;
                    _textChoicesWindow.Close();
                    _textChoicesWindow = null;
                    _textChoices.Dispose();
                    _textChoices = null;
                    _stringPrinter.Close();
                    _stringPrinter = null;
                    _ = new SummaryGUI(_pkmn, SummaryGUI.Mode.LearnMove, OnSummaryClosed, learningMove: _learningMoves.Peek());
                }
                return;
            }

            case State.LearnMove_FadeFromSummary:
            {
                if (_fadeTransition.IsDone)
                {
                    // Give up on learning
                    if (_forgetMove == -1 || _forgetMove == PkmnConstants.NumMoves)
                    {
                        SetGiveUpLearningMove();
                    }
                    else
                    {
                        Moveset.MovesetSlot slot    = _pkmn.Moveset[_forgetMove];
                        PBEMove             oldMove = slot.Move;
                        string  oldMoveStr          = PBELocalizedString.GetMoveName(oldMove).English;
                        PBEMove move    = _learningMoves.Dequeue();  // Remove from queue
                        string  moveStr = PBELocalizedString.GetMoveName(move).English;
                        slot.Move = move;
                        PBEMoveData mData = PBEMoveData.Data[move];
                        slot.PP    = PBEDataUtils.CalcMaxPP(mData.PPTier, 0, PkmnConstants.PBESettings);
                        slot.PPUps = 0;
                        CreateMessage(string.Format("{0} forgot {1}\nand learned {2}!", _pkmn.Nickname, oldMoveStr, moveStr));
                        _state = State.LearnMove_ForgotMsg;
                    }
                }
                return;
            }

            case State.LearnMove_GiveUpLearningMsg:
            {
                if (ReadMessageEnded())
                {
                    TextGUIChoices.CreateStandardYesNoChoices(ShouldGiveUpMoveAction, out _textChoices, out _textChoicesWindow);
                    _state = State.LearnMove_GiveUpLearningChoice;
                }
                return;
            }

            case State.LearnMove_DidNotLearnMsg:
            case State.LearnMove_ForgotMsg:
            {
                if (ReadMessage())
                {
                    _stringPrinter.Close();
                    _stringPrinter = null;
                    CheckForLearnMoves();
                }
                return;
            }
            }
        }