Genesis Game Client Project Setup
This commit is contained in:
16
Assets/02_Scripts/Managers/UI/BaseUIManager.cs
Normal file
16
Assets/02_Scripts/Managers/UI/BaseUIManager.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class BaseUIManager : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/UI/BaseUIManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/UI/BaseUIManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a8f2efec4f0f78418e3d00cd85fc18f
|
||||
43
Assets/02_Scripts/Managers/UI/GlobalUIManager.cs
Normal file
43
Assets/02_Scripts/Managers/UI/GlobalUIManager.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GlobalUIManager : BaseUIManager
|
||||
{
|
||||
public static GlobalUIManager Instance;
|
||||
|
||||
[SerializeField] private Loading _sceneLoading;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this; //만들어진 자신을 인스턴스로 설정
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
SetSceneLoadingActive(false);
|
||||
}
|
||||
|
||||
public void SetSceneLoadingActive(bool flag)
|
||||
{
|
||||
_sceneLoading.gameObject.SetActive(flag);
|
||||
}
|
||||
|
||||
public void SetSceneLoadingProgressValue(float value)
|
||||
{
|
||||
_sceneLoading.LoadingImage.fillAmount = value;
|
||||
_sceneLoading.LoadingTextMeshProUGUI.text = $"{(value * 100):F0}% 로딩 중...";
|
||||
}
|
||||
public void SetSceneLoadingProgressValue(float value,string loadingText)
|
||||
{
|
||||
_sceneLoading.LoadingImage.fillAmount = value;
|
||||
_sceneLoading.LoadingTextMeshProUGUI.text = loadingText;
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/UI/GlobalUIManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/UI/GlobalUIManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b66ac6fc047ff644bac21bdf5b298a9c
|
||||
16
Assets/02_Scripts/Managers/UI/InGameUIManager.cs
Normal file
16
Assets/02_Scripts/Managers/UI/InGameUIManager.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class InGameUIManager : BaseUIManager
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/UI/InGameUIManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/UI/InGameUIManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f347da8e055eeb04bbf40bbcd5d2002f
|
||||
51
Assets/02_Scripts/Managers/UI/IntroUIManager.cs
Normal file
51
Assets/02_Scripts/Managers/UI/IntroUIManager.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class IntroUIManager : MonoBehaviour
|
||||
{
|
||||
[Header("Menu Settings")]
|
||||
public List<MenuButton> MenuButtons; // 인스펙터에서 버튼들을 등록함
|
||||
|
||||
private MenuLogic _menu; // 내부적으로 로직 객체를 들고 있음
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
private void Start()
|
||||
{
|
||||
SetMenuLogic(new MenuLogic(MenuButtons));
|
||||
|
||||
InputManager.Instance.SetUIInputMap("IntroUI");
|
||||
}
|
||||
|
||||
private void SetMenuLogic(MenuLogic menuLogic)
|
||||
{
|
||||
//혹시라도 나중에 이벤트를 재할당할 일이 있다면 반드시 기존 이벤트는 해제하고 연결해야함
|
||||
if(_menu != null)
|
||||
{
|
||||
InputManager.Instance.OnKeyDown_UpArrowEvent -= _menu.MenuMoveUp;
|
||||
InputManager.Instance.OnKeyDown_DownArrowEvent -= _menu.MenuMoveDown;
|
||||
InputManager.Instance.OnKeyDown_EnterEvent -= _menu.MenuConfirm;
|
||||
}
|
||||
|
||||
_menu = menuLogic;
|
||||
|
||||
InputManager.Instance.OnKeyDown_UpArrowEvent += _menu.MenuMoveUp;
|
||||
InputManager.Instance.OnKeyDown_DownArrowEvent += _menu.MenuMoveDown;
|
||||
InputManager.Instance.OnKeyDown_EnterEvent += _menu.MenuConfirm;
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
InputManager.Instance.OnKeyDown_UpArrowEvent -= _menu.MenuMoveUp;
|
||||
InputManager.Instance.OnKeyDown_DownArrowEvent -= _menu.MenuMoveDown;
|
||||
InputManager.Instance.OnKeyDown_EnterEvent -= _menu.MenuConfirm;
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/UI/IntroUIManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/UI/IntroUIManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9184a794080be324daa38d05d5f448da
|
||||
Reference in New Issue
Block a user