From e4a83fc73e8d1e9aee5978be1c877190b14dbd39 Mon Sep 17 00:00:00 2001 From: Lim0_C Date: Thu, 27 Mar 2025 15:39:10 +0900 Subject: [PATCH] =?UTF-8?q?DO-46=20[Feat}=20=EB=AC=B4=EC=8A=B9=EB=B6=80=20?= =?UTF-8?q?=EC=9A=94=EC=B2=AD=20=ED=9A=9F=EC=88=98=20=EC=A0=9C=ED=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/GameUIController.cs | 14 +++++++++++--- Assets/Script/Game/GameLogic.cs | 11 +++++++++-- Assets/Script/Game/GameManager.cs | 14 +++++++++++++- 3 files changed, 33 insertions(+), 6 deletions(-) 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