You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
52 lines
1.1 KiB
4 years ago
|
using System;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class UIViewMessageBox : UIView {
|
||
|
|
||
|
public CommonButton ButtonEnter;
|
||
|
public CommonButton ButtonCancel;
|
||
|
public Text Content;
|
||
|
public Action EnterCallback;
|
||
|
public Action CancelCallback;
|
||
|
|
||
|
public override UIViewType ViewType
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return UIViewType.Normal;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void Awake()
|
||
|
{
|
||
|
ButtonEnter.OnClicked += ButtonEnter_OnClicked;
|
||
|
ButtonCancel.OnClicked += ButtonCancel_OnClicked;
|
||
|
}
|
||
|
public override void OnDestroy()
|
||
|
{
|
||
|
base.OnDestroy();
|
||
|
ButtonEnter.OnClicked -= ButtonEnter_OnClicked;
|
||
|
ButtonCancel.OnClicked -= ButtonCancel_OnClicked;
|
||
|
}
|
||
|
private void ButtonCancel_OnClicked(CommonButton obj)
|
||
|
{
|
||
|
Hide();
|
||
|
}
|
||
|
|
||
|
private void ButtonEnter_OnClicked(CommonButton obj)
|
||
|
{
|
||
|
if (EnterCallback!=null)
|
||
|
{
|
||
|
EnterCallback();
|
||
|
}
|
||
|
Hide();
|
||
|
}
|
||
|
|
||
|
public void Show(string msg,Action enterCallback)
|
||
|
{
|
||
|
base.Show();
|
||
|
Content.text = msg;
|
||
|
EnterCallback = enterCallback;
|
||
|
}
|
||
|
}
|