38 lines
1012 B
C#
38 lines
1012 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class UIPopupMessage : MonoBehaviour
|
|
{
|
|
public UnityEngine.Events.UnityEvent OnConfirm;
|
|
public UnityEngine.Events.UnityEvent OnDeny;
|
|
public TMPro.TextMeshProUGUI Text;
|
|
|
|
public static UIPopupMessage Create(string message, System.Action onConfirm, System.Action onDeny)
|
|
{
|
|
var popup = Instantiate(SharedResources.Instance.PopupMessage, ModelViewerInterface.GetInstance().MainCanvas.transform);
|
|
popup.transform.SetAsLastSibling();
|
|
popup.SetMessage(message);
|
|
popup.OnConfirm.AddListener(() => onConfirm.Invoke());
|
|
popup.OnDeny.AddListener(() => onDeny.Invoke());
|
|
return popup;
|
|
}
|
|
|
|
public void SetMessage(string text)
|
|
{
|
|
Text.text = text;
|
|
}
|
|
|
|
public void Deny()
|
|
{
|
|
OnDeny?.Invoke();
|
|
Destroy(this.gameObject);
|
|
}
|
|
|
|
public void Confirm()
|
|
{
|
|
OnConfirm?.Invoke();
|
|
Destroy(this.gameObject);
|
|
}
|
|
}
|