타이틀 ui 수정 및 캐릭터 선택 화면 추가
This commit is contained in:
45
Gameton-06/Assets/Gameton/Scripts/UI/CharaterCreateUI.cs
Normal file
45
Gameton-06/Assets/Gameton/Scripts/UI/CharaterCreateUI.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class CharaterCreateUI : UIBase
|
||||
{
|
||||
[SerializeField] private Button createButton; // Create 버튼 참조
|
||||
|
||||
private string selectedCharacter; // 선택한 캐릭터의 타입 저장 (예: "MaleCat", "FemaleCat")
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// 처음에는 버튼을 비활성화
|
||||
createButton.interactable = false;
|
||||
}
|
||||
|
||||
public void SelectCharacter(string characterType)
|
||||
{
|
||||
selectedCharacter = characterType;
|
||||
createButton.interactable = true; // 캐릭터가 선택되면 버튼 활성화
|
||||
|
||||
}
|
||||
|
||||
public void OnClickCreateButton()
|
||||
{
|
||||
if (string.IsNullOrEmpty(selectedCharacter))
|
||||
{
|
||||
Debug.Log("캐릭터를 선택하세요!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 선택된 캐릭터 정보를 저장 (다음 씬에서도 사용할 수 있도록)
|
||||
PlayerPrefs.SetString("SelectedCharacter", selectedCharacter);
|
||||
// TODO: 생성한 캐릭터를 어떻게 저장할지???
|
||||
|
||||
|
||||
// 씬 변경
|
||||
UIManager.Hide<CharaterCreateUI>(UIList.CharaterCreateUI);
|
||||
Main.Singleton?.ChangeScene(SceneType.Ingame);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce1a1854c76bcd140a71eb36d9308221
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -8,7 +8,11 @@ namespace TON
|
||||
{
|
||||
public void OnClickStartButton()
|
||||
{
|
||||
Main.Singleton?.ChangeScene(SceneType.Ingame);
|
||||
// Main.Singleton?.ChangeScene(SceneType.Ingame);
|
||||
|
||||
// TODO: 현재 가지고 있는 캐릭터가 없다면 CharaterCreateUI 를 보여주고
|
||||
UIManager.Show<CharaterCreateUI>(UIList.CharaterCreateUI);
|
||||
// TODO: 캐릭터가 있다면 내 캐릭터 목록에서 선택할 수 있도록 함
|
||||
}
|
||||
|
||||
public void OnClickExitButton()
|
||||
|
||||
Reference in New Issue
Block a user