Files
Simulation/Assets/Scripts/AlertManager.cs
준학 노 0be41c12cd 카메라 이동범위 설정 -0.2(노준학)
기즈모 고정 -0.5(노준학) 완료
MQTT 재연결 로직 -0.2(노준학) - 작업중
2025-07-15 11:00:11 +09:00

70 lines
1.8 KiB
C#

using Cysharp.Threading.Tasks;
using UnityEngine;
public class AlertManager : UnitySingleton<AlertManager>
{
private GameObject prefab;
private UIAlert alert;
private void Create()
{
if (alert == null)
{
if (prefab == null)
{
prefab = Resources.Load("Prefabs/Popup/UIAlert", typeof(GameObject)) as GameObject;
}
GameObject go = UnityEngine.Object.Instantiate(prefab);
alert = go.GetComponent<UIAlert>();
}
//var canvas = FindAnyObjectByType<Canvas_Label>();
//alert.transform.SetParent(canvas.Canvas.rootCanvas.transform, false);
}
//public async UniTask ShowAlert(string title, string message, string okButtonTitle = "OK")
//{
// Create();
// bool isClosed = false;
// alert.Init(title: title, message: message, okButtonText: okButtonTitle, showCancelButton: false);
// alert.OnOk.AddListener(() =>
// {
// isClosed = true;
// });
// alert.Open();
// await UniTask.WaitUntil(() => isClosed == true);
//}
//public async UniTask<bool> ShowConfirm(string title, string message, string okButtonTitle = "OK", string cancelButtonTitle = "CANCEL")
//{
// Create();
// bool isClosed = false;
// bool result = false;
// alert.Init(title, message, okButtonTitle, cancelButtonTitle, true);
// alert.OnOk.AddListener(() =>
// {
// result = true;
// isClosed = true;
// });
// alert.OnCancel.AddListener(() =>
// {
// result = false;
// isClosed = true;
// });
// alert.Open();
// await UniTask.WaitUntil(() => isClosed == true);
// return result;
//}
}