97 lines
2.6 KiB
C#
97 lines
2.6 KiB
C#
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using Studio.Core;
|
|
using XRLib;
|
|
|
|
namespace Studio.UI.Modal
|
|
{
|
|
public class UIModalManager : UnitySingleton<UIModalManager>
|
|
{
|
|
private GameObject modal;
|
|
|
|
|
|
//public ove()
|
|
//{
|
|
// SceneManager.sceneUnloaded += OnSceneUnloaded;
|
|
//}
|
|
|
|
//private void OnSceneUnloaded(Scene arg0)
|
|
//{
|
|
// if (modal != null) modal.transform.SetParent(null, false);
|
|
// modal = null;
|
|
//}
|
|
|
|
//private UIModal Create(string prefabPath)
|
|
//{
|
|
|
|
// //var prefab = Resources.Load(prefabPath, typeof(GameObject)) as GameObject;
|
|
|
|
// //modal = UnityEngine.Object.Instantiate(prefab);
|
|
// var uiModal = modal.GetComponent<UIModal>();
|
|
|
|
// //var canvas = FindAnyObjectByType<Canvas_Label>();
|
|
// //modal.transform.SetParent(canvas.Canvas.rootCanvas.transform, false);
|
|
|
|
// return uiModal;
|
|
//}
|
|
|
|
//public async UniTask<object> Show(string contentPrefabPath, object contentData, string title, string okButtonText = "저장하기", string cancelButtonText = "취소")
|
|
//{
|
|
// UIModal uiModal = Create(UIModal.PrefabPath);
|
|
|
|
// bool isClosed = false;
|
|
// object result = null;
|
|
|
|
// uiModal.Init(title, contentPrefabPath, contentData, okButtonText, cancelButtonText);
|
|
|
|
|
|
// uiModal.OnOk += (object sender, UIModalEventArgs args) =>
|
|
// {
|
|
// result = args.Data;
|
|
// isClosed = true;
|
|
// };
|
|
|
|
// uiModal.OnClose += (object sender, UIModalEventArgs args) =>
|
|
// {
|
|
// result = args.Data;
|
|
// isClosed = true;
|
|
// };
|
|
|
|
// uiModal.Open();
|
|
|
|
// await UniTask.WaitUntil(() => isClosed == true);
|
|
// GameObject.Destroy(modal);
|
|
// modal = null;
|
|
// return result;
|
|
//}
|
|
|
|
|
|
//public async UniTask<object> Show(UIModal uiModal)
|
|
//{
|
|
|
|
// bool isClosed = false;
|
|
// object result = null;
|
|
|
|
// uiModal.OnOk += (object sender, UIModalEventArgs args) =>
|
|
// {
|
|
// result = args.Data;
|
|
// isClosed = true;
|
|
// };
|
|
|
|
// uiModal.OnClose += (object sender, UIModalEventArgs args) =>
|
|
// {
|
|
// result = args.Data;
|
|
// isClosed = true;
|
|
// };
|
|
|
|
// uiModal.Open();
|
|
|
|
// await UniTask.WaitUntil(() => isClosed == true);
|
|
// GameObject.Destroy(modal);
|
|
// modal = null;
|
|
// return result;
|
|
//}
|
|
|
|
}
|
|
}
|