게임 진입 지점 UI 추가
This commit is contained in:
@@ -151,8 +151,7 @@ Transform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1410665148}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &384034829
|
||||
@@ -167,74 +166,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 364865c88d1f27e45b5697a007bcba78, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1410665147
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1410665148}
|
||||
- component: {fileID: 1410665150}
|
||||
- component: {fileID: 1410665149}
|
||||
m_Layer: 0
|
||||
m_Name: EventSystem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1410665148
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1410665147}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 384034828}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1410665149
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1410665147}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SendPointerHoverToParent: 1
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
m_CancelButton: Cancel
|
||||
m_InputActionsPerSecond: 10
|
||||
m_RepeatDelay: 0.5
|
||||
m_ForceModuleActive: 0
|
||||
--- !u!114 &1410665150
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1410665147}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_FirstSelected: {fileID: 0}
|
||||
m_sendNavigationEvents: 1
|
||||
m_DragThreshold: 10
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -1,19 +1,29 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class UIBase : MonoBehaviour
|
||||
{
|
||||
public Object eventSystem;
|
||||
private static EventSystem globalEventSystem;
|
||||
|
||||
public virtual void Show()
|
||||
{
|
||||
// eventSystem이 현재 씬에 존재하지 않는 경우
|
||||
if (eventSystem == null)
|
||||
// 🔹 실행 중인 모든 씬에서 EventSystem 확인 (DontDestroyOnLoad 포함)
|
||||
if (globalEventSystem == null)
|
||||
{
|
||||
// UI EventSystem 정상 동작 되도록 GameObject Load
|
||||
eventSystem = Instantiate(Resources.Load("EventSystem/Prefabs/TON.EventSystem"));
|
||||
globalEventSystem = FindExistingEventSystem();
|
||||
if (globalEventSystem == null)
|
||||
{
|
||||
// 🔹 없으면 새로운 EventSystem 생성
|
||||
GameObject obj = Instantiate(Resources.Load<GameObject>("EventSystem/Prefabs/TON.EventSystem"));
|
||||
globalEventSystem = obj.GetComponent<EventSystem>();
|
||||
|
||||
// 🔹 새로 만든 EventSystem을 DontDestroyOnLoad로 유지
|
||||
DontDestroyOnLoad(obj);
|
||||
}
|
||||
}
|
||||
|
||||
gameObject.SetActive(true);
|
||||
@@ -23,5 +33,12 @@ namespace TON
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private EventSystem FindExistingEventSystem()
|
||||
{
|
||||
// 🔹 모든 씬을 포함하여 EventSystem 검색 (씬 이동해도 유지되는 객체 포함)
|
||||
EventSystem[] eventSystems = Resources.FindObjectsOfTypeAll<EventSystem>();
|
||||
return eventSystems.Length > 0 ? eventSystems[0] : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace TON
|
||||
public void OnClickStartButton()
|
||||
{
|
||||
// Main.Singleton?.ChangeScene(SceneType.Ingame);
|
||||
UIManager.Hide<TitleUI>(UIList.TitleUI);
|
||||
|
||||
// TODO: 현재 가지고 있는 캐릭터가 없다면 CharaterCreateUI 를 보여주고
|
||||
UIManager.Show<CharaterCreateUI>(UIList.CharaterCreateUI);
|
||||
|
||||
Reference in New Issue
Block a user