DO-16 수정

This commit is contained in:
Parkillhwan 2025-03-21 10:01:45 +09:00
parent f05a9dd50a
commit b2ef905efa
4 changed files with 8 additions and 7 deletions

View File

@ -23,9 +23,9 @@ public class ScoreCellController : MonoBehaviour
winText.text = item.win.ToString();
loseText.text = item.lose.ToString();
if (profileImage != null && item.profileImageIndex != null)
if (profileImage != null && item.imageIndex != null)
{
profileImage.sprite = profileSprites[item.profileImageIndex]; // 프로필 이미지 (Sprite 할당)
profileImage.sprite = profileSprites[item.imageIndex]; // 프로필 이미지 (Sprite 할당)
}
}
}

View File

@ -2,9 +2,10 @@ using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
[Serializable]
public class ScoreListWrapper
{
public List<ScoreInfo> scoreInfos; // 여러 개의 ScoreInfo를 담을 리스트
public List<ScoreInfo> leaderboardDatas; // 여러 개의 ScoreInfo를 담을 리스트
}

View File

@ -29,7 +29,7 @@ public struct ScoreInfo
public int win;
public int lose;
public int totalGames;
public int profileImageIndex;
public int imageIndex;
}
[Serializable]

View File

@ -31,7 +31,7 @@ public class LeaderBoardController : MonoBehaviour
private IEnumerator GetLeaderboardData()
{
string url = Constants.ServerURL + "/leaderboard"; // 서버의 리더보드 데이터 URL
string url = Constants.ServerURL + "/leaderboard/"; // 서버의 리더보드 데이터 URL
UnityWebRequest www = UnityWebRequest.Get(url); // GET 요청으로 데이터 받기
yield return www.SendWebRequest(); // 요청 전송 대기
@ -48,7 +48,7 @@ public class LeaderBoardController : MonoBehaviour
// JSON을 ScoreInfo 리스트로 파싱
ScoreListWrapper wrapper = JsonUtility.FromJson<ScoreListWrapper>(jsonResponse);
List<ScoreInfo> leaderboardItems = wrapper.scoreInfos;
List<ScoreInfo> leaderboardItems = wrapper.leaderboardDatas;
// Show 메서드를 통해 데이터를 표시
Show(leaderboardItems);
@ -106,7 +106,7 @@ public class LeaderBoardController : MonoBehaviour
if (!string.IsNullOrEmpty(savedData))
{
// 저장된 JSON 데이터를 파싱하여 리더보드 리스트로 변환
leaderboard = JsonUtility.FromJson<ScoreListWrapper>(savedData).scoreInfos;
leaderboard = JsonUtility.FromJson<ScoreListWrapper>(savedData).leaderboardDatas;
}
return leaderboard;