|
|
|
@ -21,16 +21,15 @@ namespace Fungus.Script
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual void DrawInspectorGUI() |
|
|
|
|
public virtual void DrawCommandRowGUI() |
|
|
|
|
{ |
|
|
|
|
FungusCommand t = target as FungusCommand; |
|
|
|
|
|
|
|
|
|
if (t == null) |
|
|
|
|
{ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GUILayout.BeginVertical(); |
|
|
|
|
FungusScript fungusScript = t.GetFungusScript(); |
|
|
|
|
|
|
|
|
|
GUILayout.BeginHorizontal(); |
|
|
|
|
|
|
|
|
@ -53,7 +52,7 @@ namespace Fungus.Script
|
|
|
|
|
{ |
|
|
|
|
GUI.backgroundColor = Color.red; |
|
|
|
|
} |
|
|
|
|
else if (t.expanded) |
|
|
|
|
else if (fungusScript.selectedCommand == t) |
|
|
|
|
{ |
|
|
|
|
GUI.backgroundColor = Color.yellow; |
|
|
|
|
} |
|
|
|
@ -61,8 +60,7 @@ namespace Fungus.Script
|
|
|
|
|
string commandName = FungusScriptEditor.GetCommandName(t.GetType()); |
|
|
|
|
if (GUILayout.Button(commandName, EditorStyles.miniButton, GUILayout.MinWidth(80))) |
|
|
|
|
{ |
|
|
|
|
Undo.RecordObject(t, "Toggle Expanded"); |
|
|
|
|
t.expanded = !t.expanded; |
|
|
|
|
fungusScript.selectedCommand = t; |
|
|
|
|
GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus) |
|
|
|
|
} |
|
|
|
|
GUI.backgroundColor = Color.white; |
|
|
|
@ -83,10 +81,31 @@ namespace Fungus.Script
|
|
|
|
|
|
|
|
|
|
GUILayout.EndHorizontal(); |
|
|
|
|
|
|
|
|
|
if (t.expanded) |
|
|
|
|
if (Event.current.type == EventType.Repaint && |
|
|
|
|
t.IsExecuting()) |
|
|
|
|
{ |
|
|
|
|
Rect rect = GUILayoutUtility.GetLastRect(); |
|
|
|
|
GLDraw.DrawBox(rect, Color.green, 1.5f); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual void DrawCommandInspectorGUI() |
|
|
|
|
{ |
|
|
|
|
FungusCommand t = target as FungusCommand; |
|
|
|
|
if (t == null) |
|
|
|
|
{ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
FungusScript fungusScript = t.GetFungusScript(); |
|
|
|
|
|
|
|
|
|
GUILayout.BeginVertical(GUI.skin.box); |
|
|
|
|
|
|
|
|
|
GUILayout.BeginHorizontal(); |
|
|
|
|
|
|
|
|
|
string commandName = FungusScriptEditor.GetCommandName(t.GetType()); |
|
|
|
|
GUILayout.Label(commandName, EditorStyles.largeLabel); |
|
|
|
|
|
|
|
|
|
GUILayout.FlexibleSpace(); |
|
|
|
|
|
|
|
|
|
bool enabled = GUILayout.Toggle(t.enabled, ""); |
|
|
|
@ -105,8 +124,6 @@ namespace Fungus.Script
|
|
|
|
|
UnityEditorInternal.ComponentUtility.MoveComponentDown(t); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
FungusScript fungusScript = t.GetFungusScript(); |
|
|
|
|
|
|
|
|
|
if (fungusScript != null) |
|
|
|
|
{ |
|
|
|
|
if (GUILayout.Button("Copy", EditorStyles.miniButtonMid)) |
|
|
|
@ -131,6 +148,8 @@ namespace Fungus.Script
|
|
|
|
|
|
|
|
|
|
GUILayout.EndHorizontal(); |
|
|
|
|
|
|
|
|
|
EditorGUILayout.Separator(); |
|
|
|
|
|
|
|
|
|
DrawCommandGUI(); |
|
|
|
|
|
|
|
|
|
EditorGUILayout.Separator(); |
|
|
|
@ -141,16 +160,8 @@ namespace Fungus.Script
|
|
|
|
|
style.normal.textColor = new Color(1,0,0); |
|
|
|
|
EditorGUILayout.LabelField(new GUIContent("Error: " + t.errorMessage), style); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GUILayout.EndVertical(); |
|
|
|
|
|
|
|
|
|
if (Event.current.type == EventType.Repaint && |
|
|
|
|
t.IsExecuting()) |
|
|
|
|
{ |
|
|
|
|
Rect rect = GUILayoutUtility.GetLastRect(); |
|
|
|
|
GLDraw.DrawBox(rect, Color.green, 1.5f); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual void DrawCommandGUI() |
|
|
|
|