diff --git a/Assets/Fungus/Dialog/Commands/Choose.cs b/Assets/Fungus/Dialog/Commands/Choose.cs index 38aecb1a..e695ad53 100644 --- a/Assets/Fungus/Dialog/Commands/Choose.cs +++ b/Assets/Fungus/Dialog/Commands/Choose.cs @@ -9,8 +9,8 @@ namespace Fungus.Script [HelpText("Presents a list of options for the player to choose from, with an optional timeout. Add options using preceding AddOption commands.")] public class Choose : FungusCommand { - public Dialog dialog; - static public Dialog activeDialog; + public ChooseDialog dialog; + static public ChooseDialog activeDialog; public class Option { @@ -54,12 +54,12 @@ namespace Fungus.Script } else { - List dialogOptions = new List(); - foreach (Option sayOption in options) + List dialogOptions = new List(); + foreach (Option option in options) { - Dialog.Option dialogOption = new Dialog.Option(); - dialogOption.text = sayOption.optionText; - Sequence onSelectSequence = sayOption.targetSequence; + ChooseDialog.Option dialogOption = new ChooseDialog.Option(); + dialogOption.text = option.optionText; + Sequence onSelectSequence = option.targetSequence; dialogOption.onSelect = delegate { diff --git a/Assets/Fungus/Dialog/Commands/Say.cs b/Assets/Fungus/Dialog/Commands/Say.cs index 809a01fb..8c5791dc 100644 --- a/Assets/Fungus/Dialog/Commands/Say.cs +++ b/Assets/Fungus/Dialog/Commands/Say.cs @@ -9,9 +9,9 @@ namespace Fungus.Script [HelpText("Writes a line of story text to the dialog. A list of options can be specified for the player to choose from. Use a non-zero timeout to give the player a limited time to choose.")] public class Say : FungusCommand { - public Dialog dialog; + public SayDialog dialog; - static public Dialog activeDialog; + static public SayDialog activeDialog; public Character character; public string storyText; diff --git a/Assets/Fungus/Dialog/Editor/CharacterEditor.cs b/Assets/Fungus/Dialog/Editor/CharacterEditor.cs index 2230ed19..a1e15aed 100644 --- a/Assets/Fungus/Dialog/Editor/CharacterEditor.cs +++ b/Assets/Fungus/Dialog/Editor/CharacterEditor.cs @@ -42,7 +42,7 @@ namespace Fungus.Script typeof(Sprite), true) as Sprite; - Dialog.DialogSide dialogSide = (Dialog.DialogSide)EditorGUILayout.EnumPopup(new GUIContent("Image Side", "Which side to display the image in the dialog"), + SayDialog.DialogSide dialogSide = (SayDialog.DialogSide)EditorGUILayout.EnumPopup(new GUIContent("Image Side", "Which side to display the image in the dialog"), t.dialogSide); EditorGUILayout.Separator(); diff --git a/Assets/Fungus/Dialog/Editor/ChooseEditor.cs b/Assets/Fungus/Dialog/Editor/ChooseEditor.cs index d0fb5a38..271ecc40 100644 --- a/Assets/Fungus/Dialog/Editor/ChooseEditor.cs +++ b/Assets/Fungus/Dialog/Editor/ChooseEditor.cs @@ -26,9 +26,9 @@ namespace Fungus.Script new GUIContent(""), t.character); - Dialog dialog = FungusCommandEditor.ObjectField(new GUIContent("Dialog", "Dialog to use when displaying choices"), - new GUIContent(""), - t.dialog); + ChooseDialog dialog = FungusCommandEditor.ObjectField(new GUIContent("Choose Dialog", "Dialog to use when displaying choices"), + new GUIContent(""), + t.dialog); float timeoutDuration = EditorGUILayout.FloatField(new GUIContent("Timeout Duration", "Time limit for player to make a choice. Set to 0 for no limit."), t.timeoutDuration); diff --git a/Assets/Fungus/Dialog/Editor/SayEditor.cs b/Assets/Fungus/Dialog/Editor/SayEditor.cs index 0dd3ae63..06e87a81 100644 --- a/Assets/Fungus/Dialog/Editor/SayEditor.cs +++ b/Assets/Fungus/Dialog/Editor/SayEditor.cs @@ -27,7 +27,7 @@ namespace Fungus.Script new GUIContent(""), t.character); - Dialog dialog = FungusCommandEditor.ObjectField(new GUIContent("Dialog", "Dialog to use when displaying Say command story text"), + SayDialog dialog = FungusCommandEditor.ObjectField(new GUIContent("Say Dialog", "Dialog to use when displaying Say command story text"), new GUIContent(""), t.dialog); diff --git a/Assets/Fungus/Dialog/Scripts/Character.cs b/Assets/Fungus/Dialog/Scripts/Character.cs index 73ca0ec8..4ca14dbc 100644 --- a/Assets/Fungus/Dialog/Scripts/Character.cs +++ b/Assets/Fungus/Dialog/Scripts/Character.cs @@ -8,7 +8,7 @@ namespace Fungus.Script { public string characterName; public Sprite characterImage; - public Dialog.DialogSide dialogSide; + public SayDialog.DialogSide dialogSide; public Color characterColor; } diff --git a/Assets/Fungus/Dialog/Scripts/ChooseDialog.cs b/Assets/Fungus/Dialog/Scripts/ChooseDialog.cs new file mode 100644 index 00000000..d5474857 --- /dev/null +++ b/Assets/Fungus/Dialog/Scripts/ChooseDialog.cs @@ -0,0 +1,120 @@ +using UnityEngine; +using UnityEngine.UI; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Fungus.Script +{ + + public class ChooseDialog : Dialog + { + public class Option + { + public string text; + public Action onSelect; + } + + public List optionButtons = new List(); + + List optionActions = new List(); + + public void Choose(string text, List