player 데이터 싱글톤 구조로 변경

This commit is contained in:
aube.lee
2025-02-01 21:41:59 +09:00
parent 1a870dde42
commit 0b201267bf
4 changed files with 43 additions and 6 deletions

View File

@@ -23,6 +23,8 @@ namespace TON
private void Start()
{
playerDatas = PlayerDataManager.Singleton.players;
// 캐릭터를 선택한 이후에 버튼 활성화 할 수 있도록 초기 비활성화 적용
playButton.interactable = false;
@@ -45,10 +47,6 @@ namespace TON
}
public void SetPlayerDatas(List<PlayerData> datas)
{
playerDatas = datas;
}
public void SelectCharacter(int index)
{

View File

@@ -13,7 +13,8 @@ namespace TON
// Main.Singleton?.ChangeScene(SceneType.Ingame);
UIManager.Hide<TitleUI>(UIList.TitleUI);
List<PlayerData> players = JSONLoader.LoadFromResources<List<PlayerData>>("Player");
// 플레이어가 가지고 있는 캐릭터들의 데이터 불러옴
List<PlayerData> players = PlayerDataManager.Singleton.players;
if (players == null)
{
@@ -23,7 +24,6 @@ namespace TON
else
{
// 캐릭터가 있다면 내 캐릭터 목록에서 선택할 수 있도록 함
charaterSelectUI.SetPlayerDatas(players);
UIManager.Show<CharaterSelectUI>(UIList.CharaterSelectUI);
}
}