From 6bba4fe1a020c7812285e887e5573c5362b92ec4 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Mon, 1 Sep 2014 17:51:41 +0100 Subject: [PATCH] Added tag help to Choose dialog --- Assets/Fungus/Dialog/Editor/ChooseEditor.cs | 15 ++++++++++ Assets/Fungus/Dialog/Editor/SayEditor.cs | 31 ++++++++++++-------- Assets/Shuttle/ShuttleGame.unity | Bin 116860 -> 116860 bytes 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/Assets/Fungus/Dialog/Editor/ChooseEditor.cs b/Assets/Fungus/Dialog/Editor/ChooseEditor.cs index 18c85035..32339b86 100644 --- a/Assets/Fungus/Dialog/Editor/ChooseEditor.cs +++ b/Assets/Fungus/Dialog/Editor/ChooseEditor.cs @@ -11,13 +11,28 @@ namespace Fungus.Script [CustomEditor (typeof(Choose))] public class ChooseEditor : FungusCommandEditor { + static public bool showTagHelp; + public override void DrawCommandGUI() { Choose t = target as Choose; EditorGUI.BeginChangeCheck(); + EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(new GUIContent("Choose Text", "Text to display in dialog")); + GUILayout.FlexibleSpace(); + if (GUILayout.Button(new GUIContent("Tag Help", "Show help info for tags"), new GUIStyle(EditorStyles.miniButton))) + { + showTagHelp = !showTagHelp; + } + EditorGUILayout.EndHorizontal(); + + if (showTagHelp) + { + SayEditor.DrawTagHelpLabel(); + } + GUIStyle sayStyle = new GUIStyle(EditorStyles.textArea); sayStyle.wordWrap = true; string chooseText = EditorGUILayout.TextArea(t.chooseText, sayStyle, GUILayout.MinHeight(30)); diff --git a/Assets/Fungus/Dialog/Editor/SayEditor.cs b/Assets/Fungus/Dialog/Editor/SayEditor.cs index 738487de..b1212882 100644 --- a/Assets/Fungus/Dialog/Editor/SayEditor.cs +++ b/Assets/Fungus/Dialog/Editor/SayEditor.cs @@ -13,6 +13,23 @@ namespace Fungus.Script { static public bool showTagHelp; + static public void DrawTagHelpLabel() + { + string tagsText = "\t{b} Bold Text {/b}\n" + + "\t{i} Italic Text {/i}\n" + + "\t{color=red} Color Text {/color}\n" + + "\t{w}, {w=0.5} Wait \n" + + "\t{wi} Wait for input\n" + + "\t{wc} Wait for input and clear\n" + + "\t{wp}, {wp=0.5} Wait on punctuation\n" + + "\t{c} Clear\n" + + "\t{s}, {s=60} Writing speed (chars per sec)\n" + + "\t{x} Exit"; + + float pixelHeight = EditorStyles.miniLabel.CalcHeight(new GUIContent(tagsText), EditorGUIUtility.currentViewWidth); + EditorGUILayout.SelectableLabel(tagsText, EditorStyles.miniLabel, GUILayout.MinHeight(pixelHeight)); + } + public override void DrawCommandGUI() { Say t = target as Say; @@ -30,19 +47,7 @@ namespace Fungus.Script if (showTagHelp) { - string tagsText = "\t{b} Bold Text {/b}\n" + - "\t{i} Italic Text {/i}\n" + - "\t{color=red} Color Text {/color}\n" + - "\t{w}, {w=0.5} Wait \n" + - "\t{wi} Wait for input\n" + - "\t{wc} Wait for input and clear\n" + - "\t{wp}, {wp=0.5} Wait on punctuation\n" + - "\t{c} Clear\n" + - "\t{s}, {s=60} Writing speed (chars per sec)\n" + - "\t{x} Exit"; - - float pixelHeight = EditorStyles.miniLabel.CalcHeight(new GUIContent(tagsText), EditorGUIUtility.currentViewWidth); - EditorGUILayout.SelectableLabel(tagsText, EditorStyles.miniLabel, GUILayout.MinHeight(pixelHeight)); + DrawTagHelpLabel(); } GUIStyle sayStyle = new GUIStyle(EditorStyles.textArea); diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index 98580b17e16b3d5ec6d05d8f9c044094681f5c63..b178fc0e8343ef9fef29c63f5917f809ef7681ed 100644 GIT binary patch delta 57 zcmew}f&I?}_J%Et4gE3