DO-33 [Style] GameLogic 코드 정리
타임아웃 무명함수를 밖으로 뺌 게임이 끝나면 리플레이 저장 함수 호출 추가
This commit is contained in:
parent
3d6655e6e3
commit
f488359af9
@ -170,7 +170,7 @@ MonoBehaviour:
|
||||
signinPanel: {fileID: 925522282249935710, guid: e14c9b2925f0ddb4192af743e5cc166a, type: 3}
|
||||
signupPanel: {fileID: 3181524094944658765, guid: 8827fe7caa3145e40b1369cc42f8697d, type: 3}
|
||||
settingsPanel: {fileID: 0}
|
||||
confirmPanel: {fileID: 0}
|
||||
confirmPanel: {fileID: 8145365568262946399, guid: 76f1fe6b5243faf4f9b8caee7312d336, type: 3}
|
||||
rankingPanel: {fileID: 0}
|
||||
shopPanel: {fileID: 0}
|
||||
giboPanel: {fileID: 0}
|
||||
|
@ -170,22 +170,7 @@ public class GameLogic : MonoBehaviour
|
||||
{
|
||||
this.fioTimer = fioTimer;
|
||||
this.fioTimer.InitTimer();
|
||||
//timer 시간초과시 진행 함수
|
||||
this.fioTimer.OnTimeout = () =>
|
||||
{
|
||||
if (currentTurn == Enums.PlayerType.PlayerA)
|
||||
{
|
||||
GameManager.Instance.OpenConfirmPanel($"Game Over: {Enums.PlayerType.PlayerB} Win",
|
||||
() =>{});
|
||||
EndGame();
|
||||
}
|
||||
else if (currentTurn == Enums.PlayerType.PlayerB)
|
||||
{
|
||||
GameManager.Instance.OpenConfirmPanel($"Game Over: {Enums.PlayerType.PlayerA} Win",
|
||||
() =>{});
|
||||
EndGame();
|
||||
}
|
||||
};
|
||||
this.fioTimer.OnTimeout = OnTimeout;
|
||||
}
|
||||
|
||||
//TODO: 기보 매니저에게 플레이어 닉네임 넘겨주기
|
||||
@ -206,6 +191,24 @@ public class GameLogic : MonoBehaviour
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//타임아웃 시 할 행동
|
||||
private void OnTimeout()
|
||||
{
|
||||
if (currentTurn == Enums.PlayerType.PlayerA)
|
||||
{
|
||||
GameManager.Instance.OpenConfirmPanel($"Game Over: {Enums.PlayerType.PlayerB} Win",
|
||||
() =>{});
|
||||
EndGame();
|
||||
}
|
||||
else if (currentTurn == Enums.PlayerType.PlayerB)
|
||||
{
|
||||
GameManager.Instance.OpenConfirmPanel($"Game Over: {Enums.PlayerType.PlayerA} Win",
|
||||
() =>{});
|
||||
EndGame();
|
||||
}
|
||||
}
|
||||
|
||||
//착수 버튼 클릭시 호출되는 함수
|
||||
public void OnConfirm()
|
||||
{
|
||||
@ -298,7 +301,7 @@ public class GameLogic : MonoBehaviour
|
||||
public void EndGame()
|
||||
{
|
||||
SetState(null);
|
||||
|
||||
ReplayManager.Instance.SaveReplayData(currentTurn);
|
||||
}
|
||||
|
||||
//승리 확인 함수
|
||||
|
@ -49,11 +49,11 @@ public class GameManager : Singleton<GameManager>
|
||||
// TryAutoSignin();
|
||||
|
||||
//게임 씬에서 확인하기 위한 임시 코드
|
||||
_canvas = canvas.GetComponent<Canvas>();
|
||||
_stoneController = GameObject.FindObjectOfType<StoneController>();
|
||||
_stoneController.InitStones();
|
||||
var fioTimer = FindObjectOfType<FioTimer>();
|
||||
_gameLogic = new GameLogic(_stoneController, _gameType, fioTimer);
|
||||
// _canvas = canvas.GetComponent<Canvas>();
|
||||
// _stoneController = GameObject.FindObjectOfType<StoneController>();
|
||||
// _stoneController.InitStones();
|
||||
// var fioTimer = FindObjectOfType<FioTimer>();
|
||||
// _gameLogic = new GameLogic(_stoneController, _gameType, fioTimer);
|
||||
}
|
||||
|
||||
private void TryAutoSignin()
|
||||
|
Loading…
x
Reference in New Issue
Block a user