|
|
@ -36,80 +36,6 @@ namespace Fungus.Script |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public virtual void DrawCommandRowGUI() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
FungusCommand t = target as FungusCommand; |
|
|
|
|
|
|
|
if (t == null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FungusScript fungusScript = t.GetFungusScript(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GUILayout.BeginHorizontal(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool error = false; |
|
|
|
|
|
|
|
string summary = t.GetSummary().Replace("\n", "").Replace("\r", ""); |
|
|
|
|
|
|
|
if (summary.Length > 80) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
summary = summary.Substring(0, 80) + "..."; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (summary.StartsWith("Error:")) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
error = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!t.enabled) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GUI.backgroundColor = Color.grey; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (error) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GUI.backgroundColor = Color.red; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (fungusScript.selectedCommand == t) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GUI.backgroundColor = Color.yellow; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CommandInfoAttribute commandInfoAttr = FungusCommandEditor.GetCommandInfo(t.GetType()); |
|
|
|
|
|
|
|
if (commandInfoAttr == null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string commandName = commandInfoAttr.CommandName; |
|
|
|
|
|
|
|
if (GUILayout.Button(commandName, EditorStyles.miniButton, GUILayout.MinWidth(80))) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
fungusScript.selectedCommand = t; |
|
|
|
|
|
|
|
GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
GUI.backgroundColor = Color.white; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GUIStyle labelStyle = new GUIStyle(EditorStyles.whiteMiniLabel); |
|
|
|
|
|
|
|
labelStyle.wordWrap = true; |
|
|
|
|
|
|
|
if (!t.enabled) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
labelStyle.normal.textColor = Color.grey; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (error) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
labelStyle.normal.textColor = Color.red; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GUILayout.Label(summary, labelStyle); |
|
|
|
|
|
|
|
GUILayout.FlexibleSpace(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GUILayout.EndHorizontal(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Event.current.type == EventType.Repaint && |
|
|
|
|
|
|
|
t.IsExecuting()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Rect rect = GUILayoutUtility.GetLastRect(); |
|
|
|
|
|
|
|
GLDraw.DrawBox(rect, Color.green, 1.5f); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public virtual void DrawCommandInspectorGUI() |
|
|
|
public virtual void DrawCommandInspectorGUI() |
|
|
|
{ |
|
|
|
{ |
|
|
|
FungusCommand t = target as FungusCommand; |
|
|
|
FungusCommand t = target as FungusCommand; |
|
|
|