From a1ec4e996ab62692ec482c7e63d3225981706962 Mon Sep 17 00:00:00 2001 From: HaeinLEE Date: Wed, 19 Mar 2025 13:09:37 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20=EA=B8=B0=EB=B3=B4=EC=94=AC=20?= =?UTF-8?q?=EC=9D=B4=EC=A0=84,=20=EB=8B=A4=EC=9D=8C=20=EB=B2=84=ED=8A=BC?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/LIN/Scripts/GameManagerTestLIN.cs | 9 +++++--- Assets/Scenes/Replay.unity | 2 +- Assets/Script/Common/Singleton.cs | 2 +- Assets/Script/Game/GameManager.cs | 26 ++---------------------- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/Assets/LIN/Scripts/GameManagerTestLIN.cs b/Assets/LIN/Scripts/GameManagerTestLIN.cs index cd111c2..c9b7b5d 100644 --- a/Assets/LIN/Scripts/GameManagerTestLIN.cs +++ b/Assets/LIN/Scripts/GameManagerTestLIN.cs @@ -39,9 +39,6 @@ public class GameManagerTestLIN : Singleton //게임 씬에서 확인하기 위한 임시 코드 - _stoneController = GameObject.FindObjectOfType(); - _stoneController.InitStones(); - _gameLogic = new GameLogic(_stoneController, _gameType); } private void TryAutoSignin() @@ -142,6 +139,12 @@ public class GameManagerTestLIN : Singleton _stoneController.InitStones(); _gameLogic = new GameLogic(_stoneController, _gameType); } + else if (scene.name == "Replay") + { + _stoneController = GameObject.FindObjectOfType(); + _stoneController.InitStones(); + _gameLogic = new GameLogic(_stoneController, Enums.GameType.Replay); + } _canvas = GameObject.Find("Canvas").GetComponent(); } } \ No newline at end of file diff --git a/Assets/Scenes/Replay.unity b/Assets/Scenes/Replay.unity index fc54cd4..1281d33 100644 --- a/Assets/Scenes/Replay.unity +++ b/Assets/Scenes/Replay.unity @@ -18567,7 +18567,7 @@ GameObject: - component: {fileID: 1366478885779137686} - component: {fileID: 6113787613455091454} m_Layer: 5 - m_Name: '[Canvas] Replay UI' + m_Name: Canvas m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Script/Common/Singleton.cs b/Assets/Script/Common/Singleton.cs index 1b4cb44..d849b86 100644 --- a/Assets/Script/Common/Singleton.cs +++ b/Assets/Script/Common/Singleton.cs @@ -27,7 +27,7 @@ public abstract class Singleton : MonoBehaviour where T : Component } } - private void Awake() + protected void Awake() { if (_instance == null) { diff --git a/Assets/Script/Game/GameManager.cs b/Assets/Script/Game/GameManager.cs index 4e8eefa..87872d7 100644 --- a/Assets/Script/Game/GameManager.cs +++ b/Assets/Script/Game/GameManager.cs @@ -37,6 +37,8 @@ public class GameManager : Singleton } //게임 씬에서 확인하기 위한 임시 코드 _gameType = Enums.GameType.SinglePlay; + + base.Awake(); } private void Start() @@ -207,18 +209,6 @@ public class GameManager : Singleton public void ReplayNext(Move nextMove ) { - if (_gameLogic == null) - { - _gameLogic = new GameLogic(_stoneController, Enums.GameType.Replay); - } - - if (_stoneController == null) - { - _stoneController = GameObject.FindObjectOfType(); - _stoneController.InitStones(); - Debug.Log("스톤컨트롤러 재할당"); - } - // 보드에 돌을 설정하기 위해 gameLogic의 SetNewBoardValue호출 if (nextMove.stoneType.Equals(Enums.StoneType.Black.ToString())) { @@ -235,18 +225,6 @@ public class GameManager : Singleton public void ReplayUndo(Move targetMove) { - if (_gameLogic == null) - { - _gameLogic = new GameLogic(_stoneController, Enums.GameType.Replay); - } - - if (_stoneController == null) - { - _stoneController = GameObject.FindObjectOfType(); - _stoneController.InitStones(); - Debug.Log("스톤컨트롤러 재할당"); - } - if (targetMove.stoneType.Equals(Enums.StoneType.Black.ToString())) { _gameLogic.SetNewBoardValue(Enums.PlayerType.PlayerA, targetMove.columnIndex, targetMove.rowIndex);