merge projects and arrange script folders
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class QuestionDialogUI : MonoBehaviour
|
||||
{
|
||||
//public static QuestionDialogUI Instance { get; private set; }
|
||||
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _textMeshPro;
|
||||
[SerializeField]
|
||||
private Button _yesBtn;
|
||||
[SerializeField]
|
||||
private Button _noBtn;
|
||||
private void Awake()
|
||||
{
|
||||
// Instance = this;
|
||||
ShowQuestion("Are you sure ?", () =>
|
||||
{
|
||||
Debug.Log("Yes");
|
||||
}, () =>
|
||||
{
|
||||
Debug.Log("No");
|
||||
});
|
||||
}
|
||||
|
||||
public void ShowQuestion(string questionText, Action yesAction, Action noAction)
|
||||
{
|
||||
_textMeshPro.text = questionText;
|
||||
_yesBtn.onClick.AddListener(() =>
|
||||
{
|
||||
Hide();
|
||||
yesAction();
|
||||
});
|
||||
_noBtn.onClick.AddListener(() =>
|
||||
{
|
||||
Hide();
|
||||
noAction();
|
||||
});
|
||||
}
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user