[Feat] ReplayPanelItemsController 승패 결과 이미지 설정하는 타입 변경
PlayerA,B비교에서 결과값으로 변경
This commit is contained in:
parent
a81305e261
commit
efa37d0e3d
@ -19,8 +19,7 @@ public class ReplayController : MonoBehaviour
|
||||
|
||||
public void OnclickExitButton()
|
||||
{
|
||||
//TODO: 메인씬으로 다시 넘어갈 때 호출해야하는 함수 등등이 있을지....
|
||||
SceneManager.LoadScene("Main-Jay");
|
||||
SceneManager.LoadScene("Main");
|
||||
}
|
||||
|
||||
public void OnclickFirstButton()
|
||||
@ -57,6 +56,8 @@ public class ReplayController : MonoBehaviour
|
||||
playerBNicknameText.text = ReplayManager.Instance.GetPlayerBNickname();
|
||||
|
||||
//TODO: ReplayManager에서 프로필 인덱스 가져와서 SetUserProfileImages호출하기
|
||||
int playerAProgileIndex = ReplayManager.Instance.GetPlayerAProfileIndex();
|
||||
int playerBProgileIndex = ReplayManager.Instance.GetPlayerBProfileIndex();
|
||||
}
|
||||
|
||||
private void SetUserProfileImages(int imageIndex,GameObject[] profileImages)
|
||||
|
@ -12,11 +12,9 @@ public class ReplayRecord
|
||||
public string playerA;
|
||||
public string playerB;
|
||||
public List<Move> moves = new List<Move>();
|
||||
//TODO: winnerPlayerType삭제
|
||||
public string winnerPlayerType;
|
||||
public string gameResult; //무승부를 반영하기위해 승자가 아닌 게임 결과를 저장.
|
||||
public string playerAPofileImageIndex;
|
||||
public string playerBPofileImageIndex;
|
||||
public int playerAPofileImageIndex;
|
||||
public int playerBPofileImageIndex;
|
||||
}
|
||||
[Serializable]
|
||||
public class Move
|
||||
@ -100,8 +98,8 @@ public class ReplayManager : Singleton<ReplayManager>
|
||||
_recordingReplayData = new ReplayRecord();
|
||||
_recordingReplayData.playerA = playerANickname;
|
||||
_recordingReplayData.playerB = playerBNickname;
|
||||
_recordingReplayData.playerAPofileImageIndex = playerAProfileIndex.ToString();
|
||||
_recordingReplayData.playerBPofileImageIndex = playerAProfileIndex.ToString();
|
||||
_recordingReplayData.playerAPofileImageIndex = playerAProfileIndex;
|
||||
_recordingReplayData.playerBPofileImageIndex = playerAProfileIndex;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
@ -116,29 +114,6 @@ public class ReplayManager : Singleton<ReplayManager>
|
||||
/// <summary>
|
||||
/// 게임 종료 후 호출하여 리플레이 데이터를 저장합니다.
|
||||
/// </summary>
|
||||
public void SaveReplayData(Enums.PlayerType winnerPlayerType)
|
||||
{
|
||||
try
|
||||
{
|
||||
string time = DateTime.Now.ToString(("yyyy-MM-dd HH_mm_ss"));
|
||||
_recordingReplayData.gameDate = time;
|
||||
_recordingReplayData.winnerPlayerType = winnerPlayerType.ToString();
|
||||
|
||||
|
||||
string json = JsonUtility.ToJson(_recordingReplayData, true);
|
||||
|
||||
|
||||
string path = Path.Combine(Application.persistentDataPath, $"{time}.json");
|
||||
File.WriteAllText(path, json);
|
||||
|
||||
//최신 데이터 10개만 유지되도록 저장
|
||||
RecordCountChecker();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Debug.LogError($"An error occurred while saving replay data:{e.Message}");
|
||||
}
|
||||
}
|
||||
public void SaveReplayDataResult(Enums.GameResult gameResultType)
|
||||
{
|
||||
try
|
||||
@ -265,8 +240,16 @@ public class ReplayManager : Singleton<ReplayManager>
|
||||
{
|
||||
return _selectedReplayRecord.playerB;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int GetPlayerAProfileIndex()
|
||||
{
|
||||
return _selectedReplayRecord.playerAPofileImageIndex;
|
||||
}
|
||||
|
||||
public int GetPlayerBProfileIndex()
|
||||
{
|
||||
return _selectedReplayRecord.playerBPofileImageIndex;
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
|
@ -35,7 +35,8 @@ public class ReplayPanelItemsController : ScrollPanelController
|
||||
string opponentNickname = myPlayerType==Enums.PlayerType.PlayerA ? replayRecord.playerB : replayRecord.playerA;
|
||||
|
||||
replayCell.SetMyPlayerType(myPlayerType);
|
||||
replayCell.SetWinImage(myPlayerType.ToString().Equals(replayRecord.winnerPlayerType));
|
||||
replayCell.SetWinImage(Enums.GameResult.Win.ToString() == replayRecord.gameResult);
|
||||
|
||||
replayCell.SetOpponentPlayerNickname(opponentNickname);
|
||||
replayCell.SetRecordDate(replayRecord.gameDate);
|
||||
replayCell.SetReplayRecord(replayRecord);
|
||||
|
Loading…
x
Reference in New Issue
Block a user