IndieGame/client/Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/UGUI/ButtonClicked.cs

28 lines
686 B
C#
Raw Normal View History

2024-10-11 10:12:15 +08:00
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine.UI;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Category("UGUI")]
public class ButtonClicked : ConditionTask
{
[RequiredField]
public BBParameter<UnityEngine.UI.Button> button;
protected override string info {
get { return string.Format("Button {0} Clicked", button.ToString()); }
}
protected override string OnInit() {
button.value.onClick.AddListener(OnClick);
return null;
}
protected override bool OnCheck() { return false; }
void OnClick() { YieldReturn(true); }
}
}