54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class SelectWindows : SingletonMonoBehaviour<SelectWindows>
|
|
{
|
|
[SerializeField] Text Title;
|
|
[SerializeField] 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);
|
|
}
|
|
}
|