DO-46 [Feat} 무승부 요청 횟수 제한

This commit is contained in:
Lim0_C 2025-03-27 15:39:10 +09:00
parent eb873e6d13
commit e4a83fc73e
3 changed files with 33 additions and 6 deletions

View File

@ -47,11 +47,19 @@ public class GameUIController : MonoBehaviour
}
public void OnClickDrawRequestButton()
{
if (GameManager.Instance.GetRequestDrawChance())
{
GameManager.Instance.panelManager.OpenConfirmPanel("무승부 신청을 하시겠습니까?", () =>
{
_multiplayManager.RequestDraw();
});
GameManager.Instance.SetRequestDrawChanceFalse();
}
else
{
GameManager.Instance.panelManager.OpenConfirmPanel("무승부 요청이 제한돼있습니다.",()=>{});
}
}
public void OnClickSettingsButton()

View File

@ -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();

View File

@ -90,13 +90,13 @@ public class GameManager : Singleton<GameManager>
_camera = GameObject.FindObjectOfType<Camera>().gameObject;
_gameUIController = GameObject.FindObjectOfType<GameUIController>();
_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<GameManager>
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;
}
}