fix: 사용하지 않는 UI 및 prefab 삭제
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class CharaterSelectUI : UIBase
|
||||
{
|
||||
|
||||
[SerializeField] private Button createButton; // Create 버튼 참조
|
||||
[SerializeField] private Button playButton; // Play 버튼 참조
|
||||
|
||||
[SerializeField] private List<PlayerData> playerDatas;
|
||||
[SerializeField] private List<HeartData> heartDatas;
|
||||
|
||||
private int currentSelectCharacterIndex;
|
||||
|
||||
public List<CharaterSelectUI_SlotItem> CharacterSlots = new List<CharaterSelectUI_SlotItem>();
|
||||
|
||||
public SerializableDictionary<string, Sprite> CharacterSpriteDict = new SerializableDictionary<string, Sprite>();
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
playerDatas = PlayerDataManager.Singleton.playersData;
|
||||
heartDatas = HeartDataManager.Singleton.heartDatas;
|
||||
|
||||
// 캐릭터를 선택한 이후에 버튼 활성화 할 수 있도록 초기 비활성화 적용
|
||||
playButton.interactable = false;
|
||||
|
||||
if (playerDatas.Count >= 5)
|
||||
{
|
||||
// 캐릭터 슬롯을 모두 사용하고 있다면 버튼 비활성화 적용
|
||||
createButton.interactable = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < playerDatas.Count; i++)
|
||||
{
|
||||
CharacterSpriteDict.TryGetValue(playerDatas[i].type, out Sprite sprite);
|
||||
string name = playerDatas[i].name != null ? playerDatas[i].name : "";
|
||||
|
||||
if (sprite)
|
||||
{
|
||||
CharacterSlots[i].SetCharaterData(sprite, name, i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void SelectCharacter(int index)
|
||||
{
|
||||
Debug.Log("선택한 캐릭터 인덱스" + index);
|
||||
currentSelectCharacterIndex = index;
|
||||
playButton.interactable = true;
|
||||
}
|
||||
|
||||
public void OnClickPlayButton()
|
||||
{
|
||||
PlayerPrefs.SetInt("SelectedPlayerIndex", currentSelectCharacterIndex);
|
||||
PlayerDataManager.Singleton.SetCurrentUserData();
|
||||
HeartDataManager.Singleton.SetCurrentUserHeart();
|
||||
|
||||
UIManager.Hide<CharaterSelectUI>(UIList.CharaterSelectUI);
|
||||
|
||||
Main.Singleton.ChangeScene(SceneType.Intro);
|
||||
}
|
||||
|
||||
public void OnClickCreateButton()
|
||||
{
|
||||
UIManager.Show<CharaterCreateUI>(UIList.CharaterCreateUI);
|
||||
UIManager.Hide<CharaterSelectUI>(UIList.CharaterSelectUI);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d8fff7f63166be4b89de078e1595642
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,39 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class CharaterSelectUI_SlotItem : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Image character_image;
|
||||
[SerializeField] private TextMeshProUGUI charater_name;
|
||||
[SerializeField] private int index;
|
||||
|
||||
private CharaterSelectUI charaterSelectUI;
|
||||
|
||||
public void SetCharaterData(Sprite image, string name, int i)
|
||||
{
|
||||
character_image.sprite = image;
|
||||
character_image.enabled = true;
|
||||
charater_name.text = name;
|
||||
index = i;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// 상위 오브젝트에서 CharacterSelectUI 찾기
|
||||
charaterSelectUI = FindObjectOfType<CharaterSelectUI>();
|
||||
|
||||
// 버튼 클릭 이벤트 등록
|
||||
GetComponent<Button>().onClick.AddListener(OnClickPlayer);
|
||||
}
|
||||
|
||||
public void OnClickPlayer()
|
||||
{
|
||||
charaterSelectUI.SelectCharacter(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 349f3b01eba66bc4c9c86ef4754ab095
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user