public void Execute(BaseGame game, long tick) { if (this.m_time <= tick && game.GetWaitTimer() < tick) { PVEGame pVEGame = game as PVEGame; if (pVEGame != null) { switch (pVEGame.GameState) { case eGameState.Inited: pVEGame.Prepare(); break; case eGameState.Prepared: pVEGame.PrepareNewSession(); break; case eGameState.Loading: if (!pVEGame.IsAllComplete()) { game.WaitTime(1000); } else { pVEGame.StartGame(); } break; case eGameState.GameStartMovie: if (game.CurrentActionCount > 1) { pVEGame.StartGameMovie(); } else { pVEGame.StartGame(); } break; case eGameState.GameStart: pVEGame.PrepareNewGame(); break; case eGameState.Playing: if ((pVEGame.CurrentLiving == null || !pVEGame.CurrentLiving.IsAttacking) && game.CurrentActionCount <= 1) { if (pVEGame.CanGameOver()) { pVEGame.GameOver(); } else { pVEGame.NextTurn(); } } break; case eGameState.GameOver: if (!pVEGame.HasNextSession()) { pVEGame.GameOverAllSession(); } else { pVEGame.PrepareNewSession(); } break; case eGameState.SessionPrepared: if (!pVEGame.CanStartNewSession()) { game.WaitTime(1000); } else { pVEGame.StartLoading(); } break; case eGameState.ALLSessionStopped: if (pVEGame.PlayerCount == 0 || pVEGame.WantTryAgain == 0) { pVEGame.Stop(); } else { if (pVEGame.WantTryAgain == 1) { pVEGame.SessionId--; pVEGame.PrepareNewSession(); } else { game.WaitTime(1000); } } break; } } this.m_isFinished = true; } }
public void Execute(BaseGame game, long tick) { if (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.SessionPrepared: if (pve.CanStartNewSession()) { pve.StartLoading(); break; } else { game.WaitTime(1000); } break; case eGameState.Loading: if (pve.IsAllComplete()) { pve.StartGame(); break; } else { game.WaitTime(1000); } break; //TODO case eGameState.GameStartMovie: if (game.CurrentActionCount <= 1) { pve.StartGame(); break; } else { pve.StartGameMovie(); } break; case eGameState.GameStart: pve.PrepareNewGame(); break; case eGameState.Playing: if ((pve.CurrentLiving == null || pve.CurrentLiving.IsAttacking == false) && game.CurrentActionCount <= 1) { if (pve.CanGameOver()) { //log.Error(string.Format("stage : {0}", -1)); pve.GameOver(); break; } else { //log.Error(string.Format("stage : {0}", 0)); pve.NextTurn(); } } break; case eGameState.GameOver: if (pve.HasNextSession()) { //log.Error(string.Format("stage : {0}", 1)); pve.PrepareNewSession(); break; } else { //log.Error(string.Format("stage : {0}", 2)); pve.GameOverAllSession(); } break; case eGameState.ALLSessionStopped: if ((pve.PlayerCount != 0) && (pve.WantTryAgain != 0)) { if (pve.WantTryAgain == 1) { pve.SessionId--; pve.PrepareNewSession(); //log.Error(string.Format("stage : {0}", 3)); } else { game.WaitTime(1000); //log.Error(string.Format("stage : {0}", 4)); } break; } pve.Stop(); break; } } m_isFinished = true; } }