Merge branch 'main' into DO-37-상점-광고-기능
This commit is contained in:
commit
08db4e5068
8
Assets/LIN/Scenes/Trash.meta
Normal file
8
Assets/LIN/Scenes/Trash.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c43b10ec26b95c7428004596bf4bdf8a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -39,9 +39,6 @@ public class GameManagerTestLIN : Singleton<GameManagerTestLIN>
|
|||||||
|
|
||||||
|
|
||||||
//게임 씬에서 확인하기 위한 임시 코드
|
//게임 씬에서 확인하기 위한 임시 코드
|
||||||
_stoneController = GameObject.FindObjectOfType<StoneController>();
|
|
||||||
_stoneController.InitStones();
|
|
||||||
_gameLogic = new GameLogic(_stoneController, _gameType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryAutoSignin()
|
private void TryAutoSignin()
|
||||||
@ -142,6 +139,12 @@ public class GameManagerTestLIN : Singleton<GameManagerTestLIN>
|
|||||||
_stoneController.InitStones();
|
_stoneController.InitStones();
|
||||||
_gameLogic = new GameLogic(_stoneController, _gameType);
|
_gameLogic = new GameLogic(_stoneController, _gameType);
|
||||||
}
|
}
|
||||||
|
else if (scene.name == "Replay")
|
||||||
|
{
|
||||||
|
_stoneController = GameObject.FindObjectOfType<StoneController>();
|
||||||
|
_stoneController.InitStones();
|
||||||
|
_gameLogic = new GameLogic(_stoneController, Enums.GameType.Replay);
|
||||||
|
}
|
||||||
_canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
|
_canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
19517
Assets/Scenes/Replay.unity
Normal file
19517
Assets/Scenes/Replay.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/Replay.unity.meta
Normal file
7
Assets/Scenes/Replay.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 393dbf55b04641847ae9b882a54856af
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -27,7 +27,7 @@ public abstract class Singleton<T> : MonoBehaviour where T : Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Awake()
|
protected void Awake()
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
{
|
{
|
||||||
|
@ -48,17 +48,17 @@ public class GameManager : Singleton<GameManager>
|
|||||||
|
|
||||||
//게임 씬에서 확인하기 위한 임시 코드
|
//게임 씬에서 확인하기 위한 임시 코드
|
||||||
_gameType = Enums.GameType.SinglePlay;
|
_gameType = Enums.GameType.SinglePlay;
|
||||||
|
|
||||||
if (_canvas == null)
|
if (_canvas == null)
|
||||||
{
|
{
|
||||||
_canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
|
_canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
|
||||||
}
|
}
|
||||||
// 로딩 화면 추가(자동 로그인 응답 전까지)
|
// 로딩 화면 추가(자동 로그인 응답 전까지)
|
||||||
OpenLoadingPanel(false, false, true);
|
OpenLoadingPanel(false, false, true);
|
||||||
|
|
||||||
// 자동 로그인
|
// 자동 로그인
|
||||||
TryAutoSignin();
|
TryAutoSignin();
|
||||||
|
|
||||||
//게임 씬에서 확인하기 위한 임시 코드
|
//게임 씬에서 확인하기 위한 임시 코드
|
||||||
// _canvas = canvas.GetComponent<Canvas>();
|
// _canvas = canvas.GetComponent<Canvas>();
|
||||||
// _stoneController = GameObject.FindObjectOfType<StoneController>();
|
// _stoneController = GameObject.FindObjectOfType<StoneController>();
|
||||||
@ -216,15 +216,18 @@ public class GameManager : Singleton<GameManager>
|
|||||||
{
|
{
|
||||||
if (scene.name == "Game")
|
if (scene.name == "Game")
|
||||||
{
|
{
|
||||||
if (_gameType == Enums.GameType.Replay)
|
|
||||||
{
|
|
||||||
//TODO: 리플레이를 위한 초기화
|
|
||||||
}
|
|
||||||
_stoneController = GameObject.FindObjectOfType<StoneController>();
|
_stoneController = GameObject.FindObjectOfType<StoneController>();
|
||||||
_stoneController.InitStones();
|
_stoneController.InitStones();
|
||||||
var fioTimer = FindObjectOfType<FioTimer>();
|
var fioTimer = FindObjectOfType<FioTimer>();
|
||||||
_gameLogic = new GameLogic(_stoneController, _gameType, fioTimer);
|
_gameLogic = new GameLogic(_stoneController, _gameType, fioTimer);
|
||||||
}
|
}
|
||||||
|
else if (scene.name == "Replay")
|
||||||
|
{
|
||||||
|
_stoneController = GameObject.FindObjectOfType<StoneController>();
|
||||||
|
_stoneController.InitStones();
|
||||||
|
_gameLogic = new GameLogic(_stoneController, Enums.GameType.Replay);
|
||||||
|
}
|
||||||
|
|
||||||
_canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
|
_canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
|
||||||
}
|
}
|
||||||
//임시 재시작 재대결
|
//임시 재시작 재대결
|
||||||
@ -279,4 +282,40 @@ public class GameManager : Singleton<GameManager>
|
|||||||
settingsPanelObject.GetComponent<ReplayPanelController>().Show();
|
settingsPanelObject.GetComponent<ReplayPanelController>().Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region ReplayControll
|
||||||
|
|
||||||
|
public void ReplayNext(Move nextMove )
|
||||||
|
{
|
||||||
|
// 보드에 돌을 설정하기 위해 gameLogic의 SetNewBoardValue호출
|
||||||
|
if (nextMove.stoneType.Equals(Enums.StoneType.Black.ToString()))
|
||||||
|
{
|
||||||
|
_gameLogic.SetNewBoardValue(Enums.PlayerType.PlayerA, nextMove.columnIndex, nextMove.rowIndex);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (nextMove.stoneType.Equals(Enums.StoneType.White.ToString()))
|
||||||
|
{
|
||||||
|
_gameLogic.SetNewBoardValue(Enums.PlayerType.PlayerB, nextMove.columnIndex, nextMove.rowIndex);
|
||||||
|
}
|
||||||
|
// 돌이 놓인 내역을 ReplayManager에도 반영
|
||||||
|
ReplayManager.Instance.PushMove(nextMove);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReplayUndo(Move targetMove)
|
||||||
|
{
|
||||||
|
if (targetMove.stoneType.Equals(Enums.StoneType.Black.ToString()))
|
||||||
|
{
|
||||||
|
_gameLogic.SetNewBoardValue(Enums.PlayerType.PlayerA, targetMove.columnIndex, targetMove.rowIndex);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (targetMove.stoneType.Equals(Enums.StoneType.White.ToString()))
|
||||||
|
{
|
||||||
|
_gameLogic.SetNewBoardValue(Enums.PlayerType.PlayerB, targetMove.columnIndex, targetMove.rowIndex);
|
||||||
|
}
|
||||||
|
ReplayManager.Instance.PushUndoMove(targetMove);
|
||||||
|
//TODO: 화면상에서 돌 치우기
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class ReplayCell : MonoBehaviour
|
public class ReplayCell : MonoBehaviour
|
||||||
@ -83,8 +84,10 @@ public class ReplayCell : MonoBehaviour
|
|||||||
//TODO: storedReplayRecord를 가지고 게임 씬으로 전환
|
//TODO: storedReplayRecord를 가지고 게임 씬으로 전환
|
||||||
public void OnClickReplayButton()
|
public void OnClickReplayButton()
|
||||||
{
|
{
|
||||||
Debug.Log($"Replay Start with {_opponentNickname}\nDate: {_storedReplayRecord.gameDate}\n" +
|
//TODO: 확인 패널 띄우고 밑의 내용 콜백 함수로 옮기기
|
||||||
$"Moves: {_storedReplayRecord.moves}");
|
// GameManager.Instance.OpenConfirmPanel($"{_opponentNickname}님 과의 대결을 다시 보시겠습니까?", () => { });
|
||||||
|
ReplayManager.Instance.SetReplayData(_storedReplayRecord);
|
||||||
|
SceneManager.LoadScene("Replay");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
46
Assets/Script/Replay/ReplayController.cs
Normal file
46
Assets/Script/Replay/ReplayController.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ReplayController : MonoBehaviour
|
||||||
|
{
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
//TODO: 리플레이매니저 데이터로 화면 초기화
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnclickExitButton()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnclickFirstButton()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnclickUndoButton()
|
||||||
|
{
|
||||||
|
Move targetMove = ReplayManager.Instance.PopMove();
|
||||||
|
if (targetMove != null)
|
||||||
|
{
|
||||||
|
GameManager.Instance.ReplayUndo(targetMove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnclickNextButton()
|
||||||
|
{
|
||||||
|
Move nextMove = ReplayManager.Instance.GetNextMove();
|
||||||
|
if (nextMove != null)
|
||||||
|
{
|
||||||
|
GameManager.Instance.ReplayNext(nextMove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClickFinishButton()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
11
Assets/Script/Replay/ReplayController.cs.meta
Normal file
11
Assets/Script/Replay/ReplayController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bda9793c3fea2104199340f907378533
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -35,7 +35,7 @@ public class ReplayManager : Singleton<ReplayManager>
|
|||||||
|
|
||||||
#region 기보 시작 후 데이터를 컨트롤하기
|
#region 기보 시작 후 데이터를 컨트롤하기
|
||||||
|
|
||||||
private ReplayRecord _replayRecord;
|
private ReplayRecord _selectedReplayRecord;
|
||||||
|
|
||||||
//DO, Undo를 위한 스택
|
//DO, Undo를 위한 스택
|
||||||
private Stack<Move> _placedStoneStack;
|
private Stack<Move> _placedStoneStack;
|
||||||
@ -45,7 +45,7 @@ public class ReplayManager : Singleton<ReplayManager>
|
|||||||
|
|
||||||
public void InitReplayBoard(ReplayRecord replayRecord)
|
public void InitReplayBoard(ReplayRecord replayRecord)
|
||||||
{
|
{
|
||||||
_replayRecord = replayRecord;
|
_selectedReplayRecord = replayRecord;
|
||||||
_moveIndex = 0;
|
_moveIndex = 0;
|
||||||
|
|
||||||
_placedStoneStack = new Stack<Move>();
|
_placedStoneStack = new Stack<Move>();
|
||||||
@ -57,10 +57,10 @@ public class ReplayManager : Singleton<ReplayManager>
|
|||||||
if (_undoStack.Count > 0)
|
if (_undoStack.Count > 0)
|
||||||
return _undoStack.Pop();
|
return _undoStack.Pop();
|
||||||
|
|
||||||
if(_moveIndex >= _replayRecord.moves.Count)
|
if(_moveIndex >= _selectedReplayRecord.moves.Count)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Move move = _replayRecord.moves[_moveIndex];
|
Move move = _selectedReplayRecord.moves[_moveIndex];
|
||||||
_moveIndex++;
|
_moveIndex++;
|
||||||
return move;
|
return move;
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ public class ReplayManager : Singleton<ReplayManager>
|
|||||||
///<summary>
|
///<summary>
|
||||||
/// 게임 시작에 호출해서 기보 데이터 초기화
|
/// 게임 시작에 호출해서 기보 데이터 초기화
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void InitReplayData(string playerANickname, string playerBNickname)
|
public void InitReplayData(string playerANickname="", string playerBNickname="")
|
||||||
{
|
{
|
||||||
_recordingReplayData = new ReplayRecord();
|
_recordingReplayData = new ReplayRecord();
|
||||||
_recordingReplayData.playerA = playerANickname;
|
_recordingReplayData.playerA = playerANickname;
|
||||||
@ -181,10 +181,24 @@ public class ReplayManager : Singleton<ReplayManager>
|
|||||||
Debug.LogError($"Replay Directory Error: {e.Message}");
|
Debug.LogError($"Replay Directory Error: {e.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetReplayData(ReplayRecord replayRecord)
|
||||||
|
{
|
||||||
|
_selectedReplayRecord = replayRecord;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||||
{
|
{
|
||||||
|
if (scene.name == "Replay")
|
||||||
|
{
|
||||||
|
if (_selectedReplayRecord != null)
|
||||||
|
{
|
||||||
|
InitReplayBoard(_selectedReplayRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: 데이터 잘못 가져왔을 때 어떻게 처리할지 고민하기
|
||||||
|
// Main으로 강제 전환 ?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region for tests
|
#region for tests
|
||||||
|
File diff suppressed because one or more lines are too long
@ -11,4 +11,7 @@ EditorBuildSettings:
|
|||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/Game.unity
|
path: Assets/Scenes/Game.unity
|
||||||
guid: 90d8e06582d54504c8033aab27b15564
|
guid: 90d8e06582d54504c8033aab27b15564
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/Scenes/Replay.unity
|
||||||
|
guid: 393dbf55b04641847ae9b882a54856af
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user