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(); foreach (var battleResultComp in resultComps) { if (battleResultComp.IsWin() == isWin) { battleResultComp.gameObject.SetActive(true); battleResultComp.SetValue(_gameCore.diamond + ""); } else { battleResultComp.gameObject.SetActive(false); } } } } }