76 lines
2.5 KiB
C#
76 lines
2.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Game
|
|
{
|
|
//public class NativeConfirmUI : UIBase
|
|
//{
|
|
// private Text _title;
|
|
// private Text _context;
|
|
// private Button _btnConfirm;
|
|
// private Button _btnCancel;
|
|
|
|
// public override void Awake()
|
|
// {
|
|
// _title = transform.Find("Title").GetChild(0).GetComponent<Text>();
|
|
// _context = transform.Find("Context").GetComponent<Text>();
|
|
// _btnConfirm = transform.Find("btnConfirm").GetComponent<Button>();
|
|
// _btnCancel = transform.Find("btnCancel").GetComponent<Button>();
|
|
// }
|
|
|
|
// public override void Show(params object[] _params)
|
|
// {
|
|
// base.Show(_params);
|
|
// if (_params.Length != 4)
|
|
// return;
|
|
|
|
// _title.text = (string)_params[0];
|
|
// _context.text = (string)_params[1];
|
|
// _btnConfirm.transform.GetChild(0).GetComponent<Text>().text = (string)_params[2];
|
|
// _btnCancel.transform.GetChild(0).GetComponent<Text>().text = (string)_params[3];
|
|
// }
|
|
|
|
// public void AddOnclickListener(UnityAction confirm, UnityAction cancel)
|
|
// {
|
|
// _btnConfirm.onClick.AddListener(confirm);
|
|
// _btnCancel.onClick.AddListener(cancel);
|
|
// }
|
|
//}
|
|
|
|
public class NativeConfirmUI : MonoBehaviour
|
|
{
|
|
private Text _title;
|
|
private Text _context;
|
|
private Button _btnConfirm;
|
|
private Button _btnCancel;
|
|
|
|
private void Awake()
|
|
{
|
|
_title = transform.Find("Title").GetChild(0).GetComponent<Text>();
|
|
_context = transform.Find("Context").GetComponent<Text>();
|
|
_btnConfirm = transform.Find("btnConfirm").GetComponent<Button>();
|
|
_btnCancel = transform.Find("btnCancel").GetComponent<Button>();
|
|
}
|
|
|
|
public void Show(params object[] _params)
|
|
{
|
|
if (_params.Length != 4)
|
|
return;
|
|
|
|
_title.text = (string)_params[0];
|
|
_context.text = (string)_params[1];
|
|
_btnConfirm.transform.GetChild(0).GetComponent<Text>().text = (string)_params[2];
|
|
_btnCancel.transform.GetChild(0).GetComponent<Text>().text = (string)_params[3];
|
|
}
|
|
|
|
public void AddOnclickListener(UnityAction confirm, UnityAction cancel)
|
|
{
|
|
_btnConfirm.onClick.AddListener(confirm);
|
|
_btnCancel.onClick.AddListener(cancel);
|
|
}
|
|
}
|
|
}
|
|
|