54 lines
1.1 KiB
C#
54 lines
1.1 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
namespace HutongGames.PlayMaker.Actions
|
|
{
|
|
[ActionCategory(ActionCategory.GUILayout)]
|
|
[Tooltip("GUILayout Password Field. Optionally send an event if the text has been edited.")]
|
|
public class GUILayoutEmailField : GUILayoutAction {
|
|
|
|
[UIHint(UIHint.Variable)]
|
|
[Tooltip("The email Text")]
|
|
public FsmString text;
|
|
|
|
[Tooltip("The Maximum Length of the field")]
|
|
public FsmInt maxLength;
|
|
|
|
[Tooltip("The Style of the Field")]
|
|
public FsmString style;
|
|
|
|
[Tooltip("Event sent when field content changed")]
|
|
public FsmEvent changedEvent;
|
|
|
|
[Tooltip("Email valid format flag")]
|
|
public FsmBool valid;
|
|
|
|
public override void Reset()
|
|
{
|
|
text = null;
|
|
maxLength = 25;
|
|
style = "TextField";
|
|
valid = true;
|
|
changedEvent = null;
|
|
}
|
|
|
|
public override void OnGUI()
|
|
{
|
|
var guiChanged = GUI.changed;
|
|
GUI.changed = false;
|
|
|
|
text.Value = GUILayout.TextField(text.Value, style.Value, LayoutOptions);
|
|
|
|
if (GUI.changed)
|
|
{
|
|
Fsm.Event(changedEvent);
|
|
GUIUtility.ExitGUI();
|
|
}
|
|
else
|
|
{
|
|
GUI.changed = guiChanged;
|
|
}
|
|
}
|
|
}
|
|
}
|