diff --git a/Assets/GameUIController.cs b/Assets/GameUIController.cs index 423b1df..9ce3324 100644 --- a/Assets/GameUIController.cs +++ b/Assets/GameUIController.cs @@ -48,10 +48,18 @@ public class GameUIController : MonoBehaviour public void OnClickDrawRequestButton() { - GameManager.Instance.panelManager.OpenConfirmPanel("무승부 신청을 하시겠습니까?", () => + if (GameManager.Instance.GetRequestDrawChance()) { - _multiplayManager.RequestDraw(); - }); + GameManager.Instance.panelManager.OpenConfirmPanel("무승부 신청을 하시겠습니까?", () => + { + _multiplayManager.RequestDraw(); + }); + GameManager.Instance.SetRequestDrawChanceFalse(); + } + else + { + GameManager.Instance.panelManager.OpenConfirmPanel("무승부 요청이 제한돼있습니다.",()=>{}); + } } public void OnClickSettingsButton() diff --git a/Assets/Script/Game/GameLogic.cs b/Assets/Script/Game/GameLogic.cs index 4ecd89e..d2d0037 100644 --- a/Assets/Script/Game/GameLogic.cs +++ b/Assets/Script/Game/GameLogic.cs @@ -217,7 +217,7 @@ public class MultiPlayerState: BasePlayerState } } -public class GameLogic : MonoBehaviour +public class GameLogic : IDisposable { private Enums.PlayerType[,] _board; public StoneController stoneController; @@ -226,6 +226,12 @@ public class GameLogic : MonoBehaviour //총 착수된 돌 카운터 public int _totalStoneCounter; public int TotalStoneCounter{get{return _totalStoneCounter;}} + //무승부 요청 가능 여부 + private bool _requestDrawChance; + public bool RequestDrawChance{ + get { return _requestDrawChance;} + set { _requestDrawChance = value;} + } public BasePlayerState firstPlayerState; public BasePlayerState secondPlayerState; @@ -244,6 +250,7 @@ public class GameLogic : MonoBehaviour public MultiplayManager _multiplayManager; private string _roomId; + #region Renju Members // 렌주룰 금수 검사기 private RenjuForbiddenMoveDetector _forbiddenDetector; @@ -259,6 +266,7 @@ public class GameLogic : MonoBehaviour this.stoneController = stoneController; this.gameType = gameType; _totalStoneCounter = 0; + RequestDrawChance = true; selectedRow = -1; selectedCol = -1; @@ -539,7 +547,6 @@ public class GameLogic : MonoBehaviour return AI_NAMIES[index]; } - public void SwitchToSinglePlayer() { _multiplayManager?.Dispose(); diff --git a/Assets/Script/Game/GameManager.cs b/Assets/Script/Game/GameManager.cs index 90bacf5..b2dca0b 100644 --- a/Assets/Script/Game/GameManager.cs +++ b/Assets/Script/Game/GameManager.cs @@ -90,13 +90,13 @@ public class GameManager : Singleton _camera = GameObject.FindObjectOfType().gameObject; _gameUIController = GameObject.FindObjectOfType(); _gameLogic = new GameLogic(_stoneController, _gameType, fioTimer); - } InitPanels(); } //임시 재시작 재대결 public void RetryGame() { + if (_gameLogic == null) return; _gameLogic.ResetBoard(); _stoneController.InitStones(); _gameLogic.SetState(_gameLogic.firstPlayerState); @@ -119,4 +119,16 @@ public class GameManager : Singleton if (_gameUIController == null) return; _gameUIController.SetTurnIndicator(isFirstPlayer); } + + public bool GetRequestDrawChance() + { + if (_gameLogic == null){ return false;} + return _gameLogic.RequestDrawChance; + } + + public void SetRequestDrawChanceFalse() + { + if (_gameLogic == null) return; + _gameLogic.RequestDrawChance = false; + } } \ No newline at end of file