DO-46 [Feat} 무승부 요청 횟수 제한
This commit is contained in:
parent
eb873e6d13
commit
e4a83fc73e
@ -47,11 +47,19 @@ public class GameUIController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void OnClickDrawRequestButton()
|
public void OnClickDrawRequestButton()
|
||||||
|
{
|
||||||
|
if (GameManager.Instance.GetRequestDrawChance())
|
||||||
{
|
{
|
||||||
GameManager.Instance.panelManager.OpenConfirmPanel("무승부 신청을 하시겠습니까?", () =>
|
GameManager.Instance.panelManager.OpenConfirmPanel("무승부 신청을 하시겠습니까?", () =>
|
||||||
{
|
{
|
||||||
_multiplayManager.RequestDraw();
|
_multiplayManager.RequestDraw();
|
||||||
});
|
});
|
||||||
|
GameManager.Instance.SetRequestDrawChanceFalse();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GameManager.Instance.panelManager.OpenConfirmPanel("무승부 요청이 제한돼있습니다.",()=>{});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClickSettingsButton()
|
public void OnClickSettingsButton()
|
||||||
|
@ -217,7 +217,7 @@ public class MultiPlayerState: BasePlayerState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GameLogic : MonoBehaviour
|
public class GameLogic : IDisposable
|
||||||
{
|
{
|
||||||
private Enums.PlayerType[,] _board;
|
private Enums.PlayerType[,] _board;
|
||||||
public StoneController stoneController;
|
public StoneController stoneController;
|
||||||
@ -226,6 +226,12 @@ public class GameLogic : MonoBehaviour
|
|||||||
//총 착수된 돌 카운터
|
//총 착수된 돌 카운터
|
||||||
public int _totalStoneCounter;
|
public int _totalStoneCounter;
|
||||||
public int TotalStoneCounter{get{return _totalStoneCounter;}}
|
public int TotalStoneCounter{get{return _totalStoneCounter;}}
|
||||||
|
//무승부 요청 가능 여부
|
||||||
|
private bool _requestDrawChance;
|
||||||
|
public bool RequestDrawChance{
|
||||||
|
get { return _requestDrawChance;}
|
||||||
|
set { _requestDrawChance = value;}
|
||||||
|
}
|
||||||
|
|
||||||
public BasePlayerState firstPlayerState;
|
public BasePlayerState firstPlayerState;
|
||||||
public BasePlayerState secondPlayerState;
|
public BasePlayerState secondPlayerState;
|
||||||
@ -244,6 +250,7 @@ public class GameLogic : MonoBehaviour
|
|||||||
public MultiplayManager _multiplayManager;
|
public MultiplayManager _multiplayManager;
|
||||||
private string _roomId;
|
private string _roomId;
|
||||||
|
|
||||||
|
|
||||||
#region Renju Members
|
#region Renju Members
|
||||||
// 렌주룰 금수 검사기
|
// 렌주룰 금수 검사기
|
||||||
private RenjuForbiddenMoveDetector _forbiddenDetector;
|
private RenjuForbiddenMoveDetector _forbiddenDetector;
|
||||||
@ -259,6 +266,7 @@ public class GameLogic : MonoBehaviour
|
|||||||
this.stoneController = stoneController;
|
this.stoneController = stoneController;
|
||||||
this.gameType = gameType;
|
this.gameType = gameType;
|
||||||
_totalStoneCounter = 0;
|
_totalStoneCounter = 0;
|
||||||
|
RequestDrawChance = true;
|
||||||
|
|
||||||
selectedRow = -1;
|
selectedRow = -1;
|
||||||
selectedCol = -1;
|
selectedCol = -1;
|
||||||
@ -539,7 +547,6 @@ public class GameLogic : MonoBehaviour
|
|||||||
return AI_NAMIES[index];
|
return AI_NAMIES[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SwitchToSinglePlayer()
|
public void SwitchToSinglePlayer()
|
||||||
{
|
{
|
||||||
_multiplayManager?.Dispose();
|
_multiplayManager?.Dispose();
|
||||||
|
@ -90,13 +90,13 @@ public class GameManager : Singleton<GameManager>
|
|||||||
_camera = GameObject.FindObjectOfType<Camera>().gameObject;
|
_camera = GameObject.FindObjectOfType<Camera>().gameObject;
|
||||||
_gameUIController = GameObject.FindObjectOfType<GameUIController>();
|
_gameUIController = GameObject.FindObjectOfType<GameUIController>();
|
||||||
_gameLogic = new GameLogic(_stoneController, _gameType, fioTimer);
|
_gameLogic = new GameLogic(_stoneController, _gameType, fioTimer);
|
||||||
|
|
||||||
}
|
}
|
||||||
InitPanels();
|
InitPanels();
|
||||||
}
|
}
|
||||||
//임시 재시작 재대결
|
//임시 재시작 재대결
|
||||||
public void RetryGame()
|
public void RetryGame()
|
||||||
{
|
{
|
||||||
|
if (_gameLogic == null) return;
|
||||||
_gameLogic.ResetBoard();
|
_gameLogic.ResetBoard();
|
||||||
_stoneController.InitStones();
|
_stoneController.InitStones();
|
||||||
_gameLogic.SetState(_gameLogic.firstPlayerState);
|
_gameLogic.SetState(_gameLogic.firstPlayerState);
|
||||||
@ -119,4 +119,16 @@ public class GameManager : Singleton<GameManager>
|
|||||||
if (_gameUIController == null) return;
|
if (_gameUIController == null) return;
|
||||||
_gameUIController.SetTurnIndicator(isFirstPlayer);
|
_gameUIController.SetTurnIndicator(isFirstPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool GetRequestDrawChance()
|
||||||
|
{
|
||||||
|
if (_gameLogic == null){ return false;}
|
||||||
|
return _gameLogic.RequestDrawChance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRequestDrawChanceFalse()
|
||||||
|
{
|
||||||
|
if (_gameLogic == null) return;
|
||||||
|
_gameLogic.RequestDrawChance = false;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user