캐릭터 생성 UI 내에 이름 입력 모달 추가
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ namespace TON
|
|||||||
[SerializeField] private Button createButton; // Create 버튼 참조
|
[SerializeField] private Button createButton; // Create 버튼 참조
|
||||||
[SerializeField] private List<PlayerData> playerDatas;
|
[SerializeField] private List<PlayerData> playerDatas;
|
||||||
|
|
||||||
|
public GameObject characterCreateUI_Modal;
|
||||||
|
|
||||||
private string selectedCharacter; // 선택한 캐릭터의 타입 저장 (예: "MaleCat", "FemaleCat")
|
private string selectedCharacter; // 선택한 캐릭터의 타입 저장 (예: "MaleCat", "FemaleCat")
|
||||||
|
|
||||||
@@ -38,15 +40,22 @@ namespace TON
|
|||||||
// 선택된 캐릭터 인덱스 정보를 저장 (다음 씬에서도 사용할 수 있도록)
|
// 선택된 캐릭터 인덱스 정보를 저장 (다음 씬에서도 사용할 수 있도록)
|
||||||
PlayerPrefs.SetInt("SelectedPlayerIndex", playerDatas.Count);
|
PlayerPrefs.SetInt("SelectedPlayerIndex", playerDatas.Count);
|
||||||
|
|
||||||
// TODO: 캐릭터 이름 받아서 생성하게끔 로직 변경 필요
|
// 캐릭터 이름 입력 모달 활성화
|
||||||
|
characterCreateUI_Modal.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClickConfirmButton()
|
||||||
|
{
|
||||||
|
TMP_InputField characterName = characterCreateUI_Modal.GetComponentInChildren<TMP_InputField>();
|
||||||
|
Debug.Log("characterName" + characterName.text);
|
||||||
// 생성한 캐릭터를 저장한다
|
// 생성한 캐릭터를 저장한다
|
||||||
PlayerData player = new PlayerData(playerDatas.Count, selectedCharacter, "name");
|
PlayerData player = new PlayerData(playerDatas.Count, selectedCharacter, characterName.text);
|
||||||
playerDatas.Add(player);
|
playerDatas.Add(player);
|
||||||
JSONLoader.SaveToFile(playerDatas, "player");
|
JSONLoader.SaveToFile(playerDatas, "player");
|
||||||
|
|
||||||
|
|
||||||
// 씬 변경
|
// 씬 변경
|
||||||
UIManager.Hide<CharaterCreateUI>(UIList.CharaterCreateUI);
|
UIManager.Hide<CharaterCreateUI>(UIList.CharaterCreateUI);
|
||||||
|
|
||||||
Main.Singleton?.ChangeScene(SceneType.Lobby);
|
Main.Singleton?.ChangeScene(SceneType.Lobby);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user