From 0e991e94c63d7bd195fde598c1e37d817cf3c87f Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Fri, 29 Jan 2016 20:52:14 +0000 Subject: [PATCH] Fixed can't click on Say Dialog when a Menu Dialog is active #374 --- .../Fungus/Narrative/Editor/DialogInputEditor.cs | 5 ++++- Assets/Fungus/Narrative/Scripts/DialogInput.cs | 16 +++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Assets/Fungus/Narrative/Editor/DialogInputEditor.cs b/Assets/Fungus/Narrative/Editor/DialogInputEditor.cs index 61d552e8..456f7033 100644 --- a/Assets/Fungus/Narrative/Editor/DialogInputEditor.cs +++ b/Assets/Fungus/Narrative/Editor/DialogInputEditor.cs @@ -14,6 +14,7 @@ namespace Fungus protected SerializedProperty nextClickDelayProp; protected SerializedProperty keyPressModeProp; protected SerializedProperty shiftKeyEnabledProp; + protected SerializedProperty ignoreMenuClicksProp; protected SerializedProperty keyListProp; protected virtual void OnEnable() @@ -22,6 +23,7 @@ namespace Fungus nextClickDelayProp = serializedObject.FindProperty ("nextClickDelay"); keyPressModeProp = serializedObject.FindProperty ("keyPressMode"); shiftKeyEnabledProp = serializedObject.FindProperty ("shiftKeyEnabled"); + ignoreMenuClicksProp = serializedObject.FindProperty ("ignoreMenuClicks"); keyListProp = serializedObject.FindProperty ("keyList"); } @@ -33,6 +35,7 @@ namespace Fungus EditorGUILayout.PropertyField(clickModeProp); EditorGUILayout.PropertyField(nextClickDelayProp); + EditorGUILayout.PropertyField(ignoreMenuClicksProp); EditorGUILayout.PropertyField(keyPressModeProp); if (t.keyPressMode == DialogInput.KeyPressMode.KeyPressed) @@ -41,7 +44,7 @@ namespace Fungus ReorderableListGUI.Title(new GUIContent("Key List", "Keycodes to check for user input")); ReorderableListGUI.ListField(keyListProp); } - + serializedObject.ApplyModifiedProperties(); } } diff --git a/Assets/Fungus/Narrative/Scripts/DialogInput.cs b/Assets/Fungus/Narrative/Scripts/DialogInput.cs index c888e545..c14b2b41 100644 --- a/Assets/Fungus/Narrative/Scripts/DialogInput.cs +++ b/Assets/Fungus/Narrative/Scripts/DialogInput.cs @@ -41,6 +41,9 @@ namespace Fungus [Tooltip("Keycodes to check for key presses")] public KeyCode[] keyList; + [Tooltip("Ignore input if a Menu dialog is currently active")] + public bool ignoreMenuClicks = true; + protected bool dialogClickedFlag; protected bool nextLineInputFlag; @@ -141,13 +144,16 @@ namespace Fungus ignoreClickTimer = Mathf.Max (ignoreClickTimer - Time.deltaTime, 0f); } - // Ignore input events if a Menu is being displayed - if (MenuDialog.activeMenuDialog != null) + if (ignoreMenuClicks) { - if (MenuDialog.activeMenuDialog.gameObject.activeInHierarchy) + // Ignore input events if a Menu is being displayed + if (MenuDialog.activeMenuDialog != null) { - dialogClickedFlag = false; - nextLineInputFlag = false; + if (MenuDialog.activeMenuDialog.gameObject.activeInHierarchy) + { + dialogClickedFlag = false; + nextLineInputFlag = false; + } } }