插件回调问题

关于InputDialog的cancel是否有对应的回调
我看App.Input只有对ok的回调
或者我可以禁止点击cancel吗
已邀请:

谷主

赞同来自:

InputDialog是一个很简单的东西,自己写一个也行。源码都给你。DialogBase其实就是FairyGUI.Window。
 
namespace FairyEditor.Dialog
{
public class InputDialog : DialogBase
{
Action<string> _callback;

public InputDialog()
{
this.contentPane = UIPackage.CreateObject("Builder", "InputDialog").asCom;
this.modal = true;
this.frame.text = App.GetString(84);
contentPane.GetChild("ok").onClick.Add(ActionEventHandler);
contentPane.GetChild("cancel").onClick.Add(closeEventHandler);
}

public void Open(string prompt, string content = null, Action<string> callback = null)
{
Show();
this.contentPane.GetChild("prompt").text = prompt;
this.contentPane.GetChild("input").text = content;
_callback = callback;
this.Center(true);
}

override public void ActionHandler()
{
this.Hide();
Action<string> f = _callback;
_callback = null;
if (f != null)
f(this.contentPane.GetChild("input").text);
}
}
}

要回复问题请先登录注册