Files
Studio/Assets/TMPFolder/Popup/UIPopupManager.cs
2025-05-22 16:12:56 +09:00

71 lines
2.0 KiB
C#

using System;
using UnityEngine;
using UnityEngine.SceneManagement;
using Studio.Core;
using XRLib;
namespace Studio.UI.Popup
{
public class UIPopupManager : UnitySingleton<UIPopupManager>
{
private GameObject popup;
//public override void AfterAwake()
//{
// base.AfterAwake();
// SceneManager.sceneUnloaded += OnSceneUnloaded;
//}
//private void OnSceneUnloaded(Scene arg0)
//{
// if (popup != null) popup.transform.SetParent(null, false);
// popup = null;
//}
//private UIPopup Create(string prefabPath)
//{
// var prefab = Resources.Load(prefabPath, typeof(GameObject)) as GameObject;
// popup = UnityEngine.Object.Instantiate(prefab);
// var uiPopup = popup.GetComponent<UIPopup>();
// var canvas = FindAnyObjectByType<Canvas_Label>();
// popup.transform.SetParent(canvas.Canvas.rootCanvas.transform, false);
// return uiPopup;
//}
//public async UniTask<object> Show(string prefabPath, string title, string okButtonTitle = "OK", string cancelButtonTitle = "CANCEL", bool showCancelButton = true)
//{
// UIPopup uiPopup = Create(prefabPath);
// bool isClosed = false;
// object result = null;
// uiPopup.Init(title, okButtonTitle, cancelButtonTitle, showCancelButton);
// uiPopup.OnOk += (object sender, UIPopupEventArgs args) =>
// {
// result = args.Data;
// isClosed = true;
// };
// uiPopup.OnCancel += (object sender, EventArgs args) =>
// {
// result = null;
// isClosed = true;
// };
// uiPopup.Open();
// await UniTask.WaitUntil(() => isClosed == true);
// GameObject.Destroy(popup);
// popup = null;
// return result;
//}
}
}