using TMPro; using UnityEngine; public class SelectWindows : SingletonMonoBehaviour { [SerializeField] TMP_Text Title; [SerializeField] TMP_Text Body; public delegate void ButtonDelegate(); ButtonDelegate m_okBtnDel; ButtonDelegate m_noBtnDel; public bool Active { get { return gameObject.activeSelf; } } protected override void OnAwake() { gameObject.SetActive(false); } public void SetUI(string body, ButtonDelegate okBtnDel = null, ButtonDelegate NoBtnDel = null) { Title.text = ""; Body.text = body; m_okBtnDel = okBtnDel; m_noBtnDel = NoBtnDel; gameObject.SetActive(true); } public void SetUI(string title, string body, ButtonDelegate okBtnDel = null, ButtonDelegate NoBtnDel = null) { Title.text = title; Body.text = body; m_okBtnDel = okBtnDel; m_noBtnDel = NoBtnDel; gameObject.SetActive(true); } public void OnPressOK() { if (m_okBtnDel != null) { m_okBtnDel(); } gameObject.SetActive(false); } public void OnPressCancel() { if (m_noBtnDel != null) { m_noBtnDel(); } gameObject.SetActive(false); } }