diff --git a/Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs b/Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs index f39b77ea..511ad891 100644 --- a/Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs +++ b/Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs @@ -59,7 +59,7 @@ namespace Fungus.Script } string commandName = commandInfoAttr.CommandName; - GUIStyle commandStyle = new GUIStyle(GUI.skin.box); + GUIStyle commandStyle = new GUIStyle(GUI.skin.button); if (t.enabled) { GUI.backgroundColor = commandInfoAttr.ButtonColor; diff --git a/Assets/Fungus/FungusScript/Editor/FungusCommandListAdaptor.cs b/Assets/Fungus/FungusScript/Editor/FungusCommandListAdaptor.cs index 4c1b69dc..b8c6c70b 100644 --- a/Assets/Fungus/FungusScript/Editor/FungusCommandListAdaptor.cs +++ b/Assets/Fungus/FungusScript/Editor/FungusCommandListAdaptor.cs @@ -146,12 +146,12 @@ namespace Fungus.Script error = true; } - float indentWidth = 20; + float indentSize = 20; for (int i = 0; i < command.indentLevel; ++i) { Rect indentRect = position; - indentRect.x += i * indentWidth; - indentRect.width = indentWidth + 1; + indentRect.x += i * indentSize; + indentRect.width = indentSize + 1; indentRect.y -= 2; indentRect.height += 5; GUI.backgroundColor = new Color(0.8f, 0.8f, 0.8f, 0.25f); @@ -159,18 +159,19 @@ namespace Fungus.Script } string commandName = commandInfoAttr.CommandName; - GUIStyle commandStyle = new GUIStyle(GUI.skin.box); + GUIStyle commandStyle = new GUIStyle(EditorStyles.miniButtonLeft); float buttonWidth = Mathf.Max(commandStyle.CalcSize(new GUIContent(commandName)).x, 80f); + float indentWidth = command.indentLevel * indentSize; Rect buttonRect = position; - buttonRect.x += command.indentLevel * indentWidth; + buttonRect.x += indentWidth; buttonRect.width = buttonWidth; buttonRect.y -= 2; buttonRect.height += 5; - Rect summaryRect = position; - summaryRect.x = buttonRect.x + buttonWidth + 5; - summaryRect.width = position.width - buttonWidth - 5; + Rect summaryRect = buttonRect; + summaryRect.x += buttonWidth - 1; + summaryRect.width = position.width - buttonWidth - indentWidth; if (!Application.isPlaying && Event.current.type == EventType.MouseDown && @@ -181,48 +182,38 @@ namespace Fungus.Script GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus) } + Color buttonBackgroundColor = commandInfoAttr.ButtonColor; + Color summaryBackgroundColor = Color.white; + if ((Application.isPlaying && command.IsExecuting()) || (!Application.isPlaying && fungusScript.selectedCommand == command)) { - Rect boxRect = summaryRect; - boxRect.x -= 6; - boxRect.width += 6 - indentWidth * command.indentLevel; - boxRect.y -= 2; - boxRect.height += 5; - - GUI.backgroundColor = Color.green; - GUI.Box(boxRect, ""); - } - - if (!command.enabled) - { - GUI.backgroundColor = Color.grey; + summaryBackgroundColor = Color.green; + buttonBackgroundColor = Color.green; } else if (error) { - GUI.backgroundColor = Color.red; + summaryBackgroundColor = Color.red; } - else + + if (!command.enabled) { - GUI.backgroundColor = commandInfoAttr.ButtonColor; + buttonBackgroundColor = Color.grey; } - GUI.Box(buttonRect, commandName, commandStyle); + GUI.backgroundColor = buttonBackgroundColor; + GUI.Label(buttonRect, commandName, commandStyle); - GUI.backgroundColor = Color.white; - - GUIStyle labelStyle = new GUIStyle(EditorStyles.miniLabel); - labelStyle.wordWrap = true; + GUIStyle labelStyle = new GUIStyle(EditorStyles.miniButtonRight); + labelStyle.alignment = TextAnchor.MiddleLeft; if (!command.enabled) { labelStyle.normal.textColor = Color.grey; } - else if (error) - { - labelStyle.normal.textColor = Color.red; - } - - GUI.Label(summaryRect, summary, labelStyle); + + GUI.backgroundColor = summaryBackgroundColor; + GUI.Box(summaryRect, summary, labelStyle); + GUI.backgroundColor = Color.white; } public virtual float GetItemHeight(int index) { diff --git a/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs b/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs index 693ced6b..77fe190b 100755 --- a/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs +++ b/Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs @@ -105,8 +105,10 @@ namespace Fungus.Script BeginWindows(); - GUIStyle windowStyle = new GUIStyle(GUI.skin.window); - + GUIStyle windowStyle = new GUIStyle(EditorStyles.toolbarButton); + windowStyle.stretchHeight = true; + windowStyle.fixedHeight = 40; + windowSequenceMap.Clear(); for (int i = 0; i < sequences.Length; ++i) { @@ -132,8 +134,15 @@ namespace Fungus.Script GUI.backgroundColor = Color.white; */ - sequence.nodeRect = GUILayout.Window(i, sequence.nodeRect, DrawWindow, "", GUI.skin.box, GUILayout.Width(windowWidth), GUILayout.Height(20), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); - + if (fungusScript.selectedSequence == sequence || + fungusScript.executingSequence == sequence) + { + GUI.backgroundColor = Color.green; + } + + sequence.nodeRect = GUILayout.Window(i, sequence.nodeRect, DrawWindow, "", windowStyle, GUILayout.Width(windowWidth), GUILayout.Height(20), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); + + GUI.backgroundColor = Color.white; windowSequenceMap.Add(sequence); } @@ -149,7 +158,8 @@ namespace Fungus.Script } EndWindows(); - + + /* if (fungusScript.selectedSequence != null || fungusScript.executingSequence != null) { @@ -168,6 +178,7 @@ namespace Fungus.Script outlineRect.y -= 5; GLDraw.DrawBox(outlineRect, Color.green, 2); } + */ GLDraw.EndScrollView(); } @@ -303,16 +314,16 @@ namespace Fungus.Script } } - GUILayout.Space(10); - Sequence sequence = windowSequenceMap[windowId]; GUIStyle labelStyle = new GUIStyle(GUI.skin.label); labelStyle.alignment = TextAnchor.MiddleCenter; + GUILayout.BeginVertical(); + GUILayout.FlexibleSpace(); GUILayout.Label(sequence.name, labelStyle); - - GUILayout.Space(10); + GUILayout.FlexibleSpace(); + GUILayout.EndVertical(); GUI.DragWindow(); } diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index bfddae3a..729bd122 100644 Binary files a/Assets/Shuttle/ShuttleGame.unity and b/Assets/Shuttle/ShuttleGame.unity differ