From 5cc39bf64ef28b4a3f0821828a810a6dcd19b1f2 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Tue, 19 Aug 2014 14:33:50 +0100 Subject: [PATCH] Wordwrap long summary text --- .../FungusScript/FungusCommandEditor.cs | 8 +++++++- .../Editor/FungusScript/FungusScriptEditor.cs | 4 ++-- .../Fungus/Editor/FungusScript/SayEditor.cs | 5 +++-- Assets/Shuttle/ShuttleGame.unity | Bin 93756 -> 93756 bytes 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs b/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs index d05b3d9a..5df5d869 100644 --- a/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusCommandEditor.cs @@ -45,7 +45,13 @@ namespace Fungus.Script } GUIStyle labelStyle = EditorStyles.miniLabel; - GUILayout.Label(t.GetSummary().Replace("\n", "").Replace("\r", ""), labelStyle); + labelStyle.wordWrap = true; + string summary = t.GetSummary().Replace("\n", "").Replace("\r", ""); + if (summary.Length > 80) + { + summary = summary.Substring(0, 80) + "..."; + } + GUILayout.Label(summary, labelStyle); GUILayout.FlexibleSpace(); diff --git a/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs b/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs index cfaba4e9..61ff755d 100644 --- a/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs @@ -15,7 +15,7 @@ namespace Fungus.Script void OnEnable() { - if (serializedObject != null) + if (this != null && serializedObject != null) { variablesProperty = serializedObject.FindProperty("variables"); } @@ -231,7 +231,7 @@ namespace Fungus.Script { GUIStyle labelStyle = new GUIStyle(EditorStyles.miniLabel); labelStyle.wordWrap = true; - GUILayout.Label(helpTextAttr.HelpText, labelStyle); + EditorGUILayout.HelpBox(helpTextAttr.HelpText, MessageType.Info); break; } } diff --git a/Assets/Fungus/Editor/FungusScript/SayEditor.cs b/Assets/Fungus/Editor/FungusScript/SayEditor.cs index 5dab650a..0e1345cd 100644 --- a/Assets/Fungus/Editor/FungusScript/SayEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/SayEditor.cs @@ -19,8 +19,9 @@ namespace Fungus.Script string character = EditorGUILayout.TextField(new GUIContent("Character", "Character to display in dialog"), t.character); EditorGUILayout.PrefixLabel(new GUIContent("Say Text", "Text to display in dialog")); - EditorStyles.textField.wordWrap = true; - string text = EditorGUILayout.TextArea(t.text, GUILayout.MinHeight(50)); + GUIStyle sayStyle = new GUIStyle(EditorStyles.textArea); + sayStyle.wordWrap = true; + string text = EditorGUILayout.TextArea(t.text, sayStyle, GUILayout.MinHeight(30)); Say.ShowCondition showCondition = (Say.ShowCondition)EditorGUILayout.EnumPopup(new GUIContent("Show Condition", "Condition when this say text should be visible."), t.showCondition); diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index 4feb0250b312231fed968d01ab6b4e876318df1e..59d6e7f959349c3534c1e9afde283847fcc95a94 100644 GIT binary patch delta 57 zcmdmUhjq^#)`l&N9#YdE2r#m2_mN^0(Uf7?*6s9xX^#^F1A{#fGdxy&9tEQPFII?b KuW@EPpalReg%RBV delta 57 zcmdmUhjq^#)`l&N9#Yd2WEcguM@TVpXv!?vw%I9x`Gyk%1A{#fGdxy&9tEO7V0(=- H;{h!I83Pa=