ReplayManager 주석 추가
This commit is contained in:
parent
74b18a073d
commit
70eb7d3268
@ -15,6 +15,8 @@ public class ReplayCell : MonoBehaviour
|
||||
private string _myPlayerType;
|
||||
private string _opponentNickname;
|
||||
|
||||
|
||||
//유저가 이겼을 경우 '승'(파랑)이미지 졌을 경우'패'(빨강)이미지
|
||||
public void SetWinImage(bool isWin)
|
||||
{
|
||||
if (isWin == true)
|
||||
@ -28,7 +30,7 @@ public class ReplayCell : MonoBehaviour
|
||||
winImage.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetMyPlayerType(string myPlayerType)
|
||||
{
|
||||
_myPlayerType = myPlayerType;
|
||||
@ -50,6 +52,8 @@ public class ReplayCell : MonoBehaviour
|
||||
_storedReplayRecord = record;
|
||||
}
|
||||
|
||||
|
||||
//TODO: storedReplayRecord를 가지고 게임 씬으로 전환
|
||||
public void OnClickReplayButton()
|
||||
{
|
||||
Debug.Log($"Replay Start with {_opponentNickname}\nDate: {_storedReplayRecord.gameDate}\n" +
|
||||
|
@ -50,7 +50,9 @@ public class ReplayManager : Singleton<ReplayManager>
|
||||
_recordingReplayData.playerB = playerBNickname;
|
||||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
/// 게임 씬에서 착수를 할 때마다 호출해서 기록
|
||||
/// </summary>
|
||||
public void RecordStonePlaced(StoneType stoneType,int row, int col)
|
||||
{
|
||||
string stoneColor = stoneType == StoneType.Black ? "Black" : "White";
|
||||
@ -61,11 +63,12 @@ public class ReplayManager : Singleton<ReplayManager>
|
||||
/// <summary>
|
||||
/// 게임 종료 후 호출하여 리플레이 데이터를 저장합니다.
|
||||
/// </summary>
|
||||
public void SaveReplayData(string winnerPlayerType)
|
||||
public void SaveReplayData(PlayerType winnerPlayerType)
|
||||
{
|
||||
string time = DateTime.Now.ToString(("yyyy-MM-dd HH_mm_ss"));
|
||||
_recordingReplayData.gameDate = time;
|
||||
_recordingReplayData.winnerPlayerType = winnerPlayerType;
|
||||
string winner = winnerPlayerType == PlayerType.PlayerA ? "PlayerA" : "PlayerB";
|
||||
|
||||
|
||||
string json = JsonUtility.ToJson(_recordingReplayData, true);
|
||||
|
||||
@ -75,10 +78,10 @@ public class ReplayManager : Singleton<ReplayManager>
|
||||
|
||||
//최신 데이터 10개만 유지되도록 저장
|
||||
RecordCountChecker();
|
||||
Debug.Log("기보 저장 완료: " + path);
|
||||
}
|
||||
|
||||
|
||||
//폴더내 기보 파일을 전부 읽어옵니다.
|
||||
public List<ReplayRecord> LoadReplayDatas()
|
||||
{
|
||||
List<ReplayRecord> records = new List<ReplayRecord>();
|
||||
|
@ -13,17 +13,20 @@ public class ReplayPanelController : MonoBehaviour
|
||||
|
||||
public delegate void PanelControllerHideDelegate();
|
||||
|
||||
//TODO:Test용 닉네임 나중에 삭제하고 PlayerInfo에서 가져올 것
|
||||
private string _myNickname;
|
||||
private void Awake()
|
||||
{
|
||||
_backgroundCanvasGroup = GetComponent<CanvasGroup>();
|
||||
|
||||
//TODO:Test용 닉네임 나중에 삭제하고 PlayerInfo에서 가져올 것
|
||||
_myNickname = "Gildong";
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
List<ReplayRecord> records = new List<ReplayRecord>();
|
||||
|
||||
// ReplayManager에서 가져온 기보 데이터들을 패널 셀에 초기화
|
||||
records = ReplayManager.Instance.LoadReplayDatas();
|
||||
foreach (var replayRecord in records)
|
||||
{
|
||||
@ -37,9 +40,6 @@ public class ReplayPanelController : MonoBehaviour
|
||||
replayCell.SetOpponentPlayerNickname(opponentNickname);
|
||||
replayCell.SetRecordDate(replayRecord.gameDate);
|
||||
replayCell.SetReplayRecord(replayRecord);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user