コード例 #1
0
        public void Execute(BaseGame game, long tick)
        {
            if (this.m_time <= tick && game.GetWaitTimer() < tick)
            {
                PVEGame pve = game as PVEGame;
                if (pve != null)
                {
                    switch (pve.GameState)
                    {
                    case eGameState.Inited:
                        pve.Prepare();
                        break;

                    case eGameState.Prepared:
                        pve.PrepareNewSession();
                        break;

                    case eGameState.Loading:
                        if (pve.IsAllComplete())
                        {
                            pve.StartGame();
                        }
                        else
                        {
                            game.WaitTime(1000);
                        }
                        break;

                    case eGameState.GameStart:
                        if (game.CurrentActionCount <= 1)
                        {
                            pve.PrepareFightingLivings();
                        }
                        break;

                    case eGameState.Playing:
                        if ((pve.CurrentLiving == null || !pve.CurrentLiving.IsAttacking) && game.CurrentActionCount <= 1)
                        {
                            if (pve.CanGameOver())
                            {
                                pve.PrepareGameOver();
                            }
                            else
                            {
                                pve.NextTurn();
                            }
                        }
                        break;

                    case eGameState.PrepareGameOver:
                        if (pve.CurrentActionCount <= 1)
                        {
                            pve.GameOver();
                        }
                        break;

                    case eGameState.GameOver:
                        if (pve.HasNextSession())
                        {
                            pve.PrepareNewSession();
                        }
                        else
                        {
                            pve.GameOverAllSession();
                        }
                        break;

                    case eGameState.SessionPrepared:
                        if (pve.CanStartNewSession())
                        {
                            pve.StartLoading();
                        }
                        else
                        {
                            game.WaitTime(1000);
                        }
                        break;

                    case eGameState.ALLSessionStopped:
                        if (pve.PlayerCount == 0 || pve.WantTryAgain == 0)
                        {
                            if (pve.PveInfo.Type == 10 && !pve.isTankCard())
                            {
                                return;
                            }
                            pve.Stop();
                        }
                        else
                        {
                            if (pve.WantTryAgain == 1)
                            {
                                pve.SessionId--;
                                pve.PrepareNewSession();
                            }
                            else
                            {
                                game.WaitTime(1000);
                            }
                        }
                        break;
                    }
                }
                this.m_isFinished = true;
            }
        }