From 79011d666d64b45f4d83115119f99318b5419d35 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 13 Aug 2014 09:26:06 +0100 Subject: [PATCH] Green outline around selected sequence --- .../Editor/FungusScript/FungusEditorWindow.cs | 33 ++++++++++++++---- .../Editor/FungusScript/FungusScriptEditor.cs | 5 ++- .../Editor/FungusScript/SequenceEditor.cs | 18 ++++++---- Assets/Shuttle/ShuttleGame.unity | Bin 81084 -> 81276 bytes 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs b/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs index 2654bb1d..1ba9d4ba 100755 --- a/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs @@ -98,7 +98,17 @@ namespace Fungus.Script float titleWidth = windowStyle.CalcSize(new GUIContent(sequence.name)).x; float windowWidth = Mathf.Max (titleWidth + 10, 100); - sequence.nodeRect = GUILayout.Window(i, sequence.nodeRect, DrawWindow, sequence.name, GUILayout.Width(windowWidth), GUILayout.Height(40), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); + if (Selection.activeGameObject == sequence.gameObject) + { + Rect outlineRect = sequence.nodeRect; + outlineRect.width += 10; + outlineRect.x -= 5; + outlineRect.height += 10; + outlineRect.y -= 5; + GLDraw.DrawBox(outlineRect, Color.green, 2); + } + + sequence.nodeRect = GUILayout.Window(i, sequence.nodeRect, DrawWindow, sequence.name, GUILayout.Width(windowWidth), GUILayout.Height(20), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); windowSequenceMap.Add(sequence); } @@ -172,6 +182,7 @@ namespace Fungus.Script } } + /* if (FungusCommandEditor.selectedCommand != null) { if (Selection.activeGameObject == null) @@ -191,14 +202,24 @@ namespace Fungus.Script } } } + */ Sequence sequence = windowSequenceMap[windowId]; - string description = GUILayout.TextArea(sequence.description, GUILayout.ExpandWidth(true)); - if (description != sequence.description) + if (!Application.isPlaying && sequence.gameObject == Selection.activeGameObject) + { + string description = GUILayout.TextArea(sequence.description, GUILayout.ExpandWidth(true)); + if (description != sequence.description) + { + Undo.RecordObject(sequence, "Set Description"); + sequence.description = description; + } + } + else { - Undo.RecordObject(sequence, "Set Description"); - sequence.description = description; + GUIStyle labelStyle = new GUIStyle(GUI.skin.label); + labelStyle.wordWrap = true; + GUILayout.Label(sequence.description, labelStyle); } /* @@ -244,7 +265,7 @@ namespace Fungus.Script } */ - GUILayout.Space(10); + GUILayout.Space(1); GUI.DragWindow(); } diff --git a/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs b/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs index f7c2782b..73efe6ce 100644 --- a/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs @@ -15,7 +15,10 @@ namespace Fungus.Script void OnEnable() { - variablesProperty = serializedObject.FindProperty("variables"); + if (serializedObject != null) + { + variablesProperty = serializedObject.FindProperty("variables"); + } } public void OnInspectorUpdate() diff --git a/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs b/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs index 43dfc3be..d6038d15 100644 --- a/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs @@ -55,17 +55,19 @@ namespace Fungus.Script return true; } - /* - public void OnInspectorUpdate() - { - Repaint(); - } - */ - public override void OnInspectorGUI() { Sequence t = target as Sequence; + EditorGUILayout.PrefixLabel(new GUIContent("Description", "Sequence description displayed in editor window")); + + string description = GUILayout.TextArea(t.description, GUILayout.ExpandWidth(true)); + if (description != t.description) + { + Undo.RecordObject(t, "Set Description"); + t.description = description; + } + FungusCommand[] commands = t.GetComponents(); /* @@ -82,6 +84,8 @@ namespace Fungus.Script } */ + EditorGUILayout.PrefixLabel("Commands"); + foreach (FungusCommand command in commands) { bool showCommandInspector = false; diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index 1f55a733a7aeb1b6bbcfefa5afb246c5138bec15..dafaed1e2525884bd1fd1686050a34dbb59c7a42 100644 GIT binary patch delta 2143 zcmZA2Urbw790%~9gAwTm&i@xkDq2M96cVVWksV6q36Xu@OXhB{+1qA;NAtl!gnkKRj@)86~J zzjN;S{m!|)H`guMjHQSu`xdd+E)Y>6j)$jnlU{CaQ4ic?#N zR2)Cn?G((vl_&_y>edXKgAE(31=e6C>N8j?Y!;@%#CVgNGtc=jiy;^zQur5r30wfS z;@G0MuVC^M<{N(vOTb1EBPR0=%=x6&S0r*Z(_JzQn?M{NpSN+?j%`G9IBwS4wT#kT zk_KJ`Jkqn9Kw$7GqC>EZZr5Qdj8AY~w>WGK)`<+)bW6beB}6gAt?G6Iwg59GcPZCm zleZIHQ4lC*_&zWNlwhayb{Uq|jjtbXBQV;b#kJ#{w<|CS#;+Ia?E{z!Gv4^-kG^AT zus0FI@2l{y?|{DNwORj!bKbs(&BOTMVoAE1K5dkD;=F+9{wA$`xcWt-yX^k~`FJ0} z5-{V9KZY&A{J4(7>vuk@>S*Q?})W}Rp26yMHMPwBNf`l6y>jk6;*1PEb9~81B<~L z(D!fM_QFyd%n7sZF~?QG6ff|op>s7bu_16DEWN>8Fy~&PIz!+6uprDh-T~OuhPZ>U zCC!xoW-S9{r+L8I!gCHuAXr<_&zu_S@-U*bT&qCH@5_DF@86 zzRLq){Lv8u-h(aZW`Xmz2$K(*`~C_WgQ>VKCVijB$wY%NQH4KXlQ3QxMeKC;Gj+%> zU}qYh?ZE3}Z>u##R)h8YUe`bQ6451e7MYxZ$%oAupM{OU`0f`s4#DVU?H%!#wpq_o z7}#e<>V>6Y#wytEP4~Oq=10s9OTc)XsEh-)1oOjikNh9a@u$DN;C*H0&gv(Y@pN|E zOf);X#o?`=zxBBXF9fu94_=Z~9}P(715#(CHy{lK25SrA{RONv>Dt8Jvy@wZn7?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