40 lines
599 BLFS
C#
40 lines
599 BLFS
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
|
|
public class WarningPanel : MonoBehaviour
|
|
{
|
|
public TMPro.TextMeshProUGUI title;
|
|
|
|
|
|
|
|
private Action onYes;
|
|
private Action onNo;
|
|
|
|
public void OpenWarning(string warning, Action onYes, Action onNo = null)
|
|
{
|
|
gameObject.SetActive(true);
|
|
this.onYes = onYes;
|
|
this.onNo = onNo;
|
|
|
|
title.text = warning;
|
|
}
|
|
|
|
public void OnYes()
|
|
{
|
|
onYes?.Invoke();
|
|
ClosePanel();
|
|
}
|
|
|
|
public void OnNo()
|
|
{
|
|
onNo?.Invoke();
|
|
ClosePanel();
|
|
}
|
|
|
|
public void ClosePanel()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
} |