public override void DrawGUI(Intelligence intelligence, CallbackCollection callbacks) { #if UNITY_EDITOR invert = EditorGUILayout.Toggle("Invert:", invert); GUILayout.Label(string.Format("If{0}:", invert ? " not" : "")); if (ifAction == null) { Type res = callbacks.TriggerActionPopup(); if (res != null) { ifAction = CreateInstance(res) as TriggerAction; ifAction.name = res.Name; callbacks.AddAsset(ifAction); } } else { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(); GUILayout.Label(ifAction.name); if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(20))) { callbacks.RemoveAsset(ifAction); } EditorGUILayout.EndHorizontal(); ifAction.DrawGUI(intelligence, callbacks); EditorGUILayout.EndVertical(); } GUILayout.Label("Then:"); if (thenAction == null) { Type res = callbacks.TriggerActionPopup(); if (res != null) { thenAction = CreateInstance(res) as TriggerAction; thenAction.name = res.Name; callbacks.AddAsset(thenAction); } } else { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(); GUILayout.Label(thenAction.name); if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(20))) { callbacks.RemoveAsset(thenAction); } EditorGUILayout.EndHorizontal(); thenAction.DrawGUI(intelligence, callbacks); EditorGUILayout.EndVertical(); } #endif }
public override void DrawGUI(Intelligence intelligence, CallbackCollection callbacks) { #if UNITY_EDITOR handledType = (NotificationType)EditorGUILayout.EnumPopup("Type:", handledType); savePosition = EditorGUILayout.Toggle("Save position", savePosition); if (savePosition) { EditorGUILayout.BeginHorizontal(); GUILayout.Label("var name:", GUILayout.Width(60)); varName = EditorGUILayout.TextField(varName); EditorGUILayout.EndHorizontal(); } saveSender = EditorGUILayout.Toggle("Save sender", saveSender); if (saveSender) { EditorGUILayout.BeginHorizontal(); GUILayout.Label("var name:", GUILayout.Width(80)); senderVarName = EditorGUILayout.TextField(senderVarName); EditorGUILayout.EndHorizontal(); } GUILayout.Label("Then:"); if (action == null) { System.Type res = callbacks.TriggerActionPopup(); if (res != null) { action = CreateInstance(res) as TriggerAction; action.name = res.Name; callbacks.AddAsset(action); } } else { if (action is HandleMessage) { callbacks.RemoveAsset(action); return; } EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(); GUILayout.Label(action.name); if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(20))) { callbacks.RemoveAsset(action); } EditorGUILayout.EndHorizontal(); action.DrawGUI(intelligence, callbacks); EditorGUILayout.EndVertical(); } #endif }
public override void DrawGUI(IntelligenceState parentState, Intelligence intelligence, CallbackCollection callbacks) { #if UNITY_EDITOR GUILayout.Label("If:"); if (ifAction == null) { Type res = callbacks.ConditionalActionPopup(); if (res != null) { ifAction = CreateInstance(res) as AIAction; ifAction.name = res.Name; callbacks.AddAsset(ifAction); } } else { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(); GUILayout.Label(ifAction.name); if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(20))) { callbacks.RemoveAsset(ifAction); } EditorGUILayout.EndHorizontal(); ifAction.DrawGUI(parentState, intelligence, callbacks); EditorGUILayout.EndVertical(); } GUILayout.Label("Then:"); if (thenAction == null) { Type res = callbacks.ContinuousActionPopup(); if (res != null) { thenAction = CreateInstance(res) as AIAction; thenAction.name = res.Name; callbacks.AddAsset(thenAction); } } else { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(); GUILayout.Label(thenAction.name); if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(20))) { callbacks.RemoveAsset(thenAction); } EditorGUILayout.EndHorizontal(); thenAction.DrawGUI(parentState, intelligence, callbacks); EditorGUILayout.EndVertical(); } GUILayout.Label("Else:"); if (elseAction == null) { Type res = callbacks.ContinuousActionPopup(); if (res != null) { elseAction = CreateInstance(res) as AIAction; elseAction.name = res.Name; callbacks.AddAsset(elseAction); } } else { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(); GUILayout.Label(elseAction.name); if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(20))) { callbacks.RemoveAsset(elseAction); } EditorGUILayout.EndHorizontal(); elseAction.DrawGUI(parentState, intelligence, callbacks); EditorGUILayout.EndVertical(); } #endif }