123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using Comp;
- using UnityEngine;
- namespace Game
- {
- public class GameEndState : GameState
- {
- public override void PlayBattle()
- {
- // 啥都不做
- }
- public override void BattleStart()
- {
- // 啥都不做
- }
- public override void LiftCock()
- {
- // 啥都不做
- }
- public override void ExitBattle()
- {
- _gameCore.Exit();
- }
- public override void EndBattle()
- {
- // 啥都不做
- }
- public override void EnterState()
- {
- Debug.Log("执行结束");
- if (_gameCore.showResultPanel)
- ShowResultPanel();
- _gameCore.pendingState.ExitBattle();
- _gameCore.battleState.ExitBattle();
- _gameCore.liftState.ExitBattle();
- _gameCore.endState.ExitBattle();
- }
- public override void ExitState()
- {
- // 啥都不做
- }
- public GameEndState(GameCore gameCore) : base(gameCore)
- {
- }
- private void ShowResultPanel()
- {
- _gameCore.resultPanel.SetActive(true);
- var isWin = _gameCore.localPlayer.playerId == _gameCore.winPlayerId;
- var resultComps = _gameCore.resultPanel.GetComponentsInChildren<BattleResultComp>();
- foreach (var battleResultComp in resultComps)
- {
- if (battleResultComp.IsWin() == isWin)
- {
- battleResultComp.gameObject.SetActive(true);
- battleResultComp.SetValue(_gameCore.diamond + "");
- }
- else
- {
- battleResultComp.gameObject.SetActive(false);
- }
- }
- }
- }
- }
|