Browse Source

Merge pull request #375 from FungusGames/ignore-menu-clicks

Fixed can't click on Say Dialog when a Menu Dialog is active #374
master
Chris Gregan 9 years ago
parent
commit
83ce2b0322
  1. 5
      Assets/Fungus/Narrative/Editor/DialogInputEditor.cs
  2. 16
      Assets/Fungus/Narrative/Scripts/DialogInput.cs

5
Assets/Fungus/Narrative/Editor/DialogInputEditor.cs

@ -14,6 +14,7 @@ namespace Fungus
protected SerializedProperty nextClickDelayProp; protected SerializedProperty nextClickDelayProp;
protected SerializedProperty keyPressModeProp; protected SerializedProperty keyPressModeProp;
protected SerializedProperty shiftKeyEnabledProp; protected SerializedProperty shiftKeyEnabledProp;
protected SerializedProperty ignoreMenuClicksProp;
protected SerializedProperty keyListProp; protected SerializedProperty keyListProp;
protected virtual void OnEnable() protected virtual void OnEnable()
@ -22,6 +23,7 @@ namespace Fungus
nextClickDelayProp = serializedObject.FindProperty ("nextClickDelay"); nextClickDelayProp = serializedObject.FindProperty ("nextClickDelay");
keyPressModeProp = serializedObject.FindProperty ("keyPressMode"); keyPressModeProp = serializedObject.FindProperty ("keyPressMode");
shiftKeyEnabledProp = serializedObject.FindProperty ("shiftKeyEnabled"); shiftKeyEnabledProp = serializedObject.FindProperty ("shiftKeyEnabled");
ignoreMenuClicksProp = serializedObject.FindProperty ("ignoreMenuClicks");
keyListProp = serializedObject.FindProperty ("keyList"); keyListProp = serializedObject.FindProperty ("keyList");
} }
@ -33,6 +35,7 @@ namespace Fungus
EditorGUILayout.PropertyField(clickModeProp); EditorGUILayout.PropertyField(clickModeProp);
EditorGUILayout.PropertyField(nextClickDelayProp); EditorGUILayout.PropertyField(nextClickDelayProp);
EditorGUILayout.PropertyField(ignoreMenuClicksProp);
EditorGUILayout.PropertyField(keyPressModeProp); EditorGUILayout.PropertyField(keyPressModeProp);
if (t.keyPressMode == DialogInput.KeyPressMode.KeyPressed) 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.Title(new GUIContent("Key List", "Keycodes to check for user input"));
ReorderableListGUI.ListField(keyListProp); ReorderableListGUI.ListField(keyListProp);
} }
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
} }
} }

16
Assets/Fungus/Narrative/Scripts/DialogInput.cs

@ -41,6 +41,9 @@ namespace Fungus
[Tooltip("Keycodes to check for key presses")] [Tooltip("Keycodes to check for key presses")]
public KeyCode[] keyList; public KeyCode[] keyList;
[Tooltip("Ignore input if a Menu dialog is currently active")]
public bool ignoreMenuClicks = true;
protected bool dialogClickedFlag; protected bool dialogClickedFlag;
protected bool nextLineInputFlag; protected bool nextLineInputFlag;
@ -141,13 +144,16 @@ namespace Fungus
ignoreClickTimer = Mathf.Max (ignoreClickTimer - Time.deltaTime, 0f); ignoreClickTimer = Mathf.Max (ignoreClickTimer - Time.deltaTime, 0f);
} }
// Ignore input events if a Menu is being displayed if (ignoreMenuClicks)
if (MenuDialog.activeMenuDialog != null)
{ {
if (MenuDialog.activeMenuDialog.gameObject.activeInHierarchy) // Ignore input events if a Menu is being displayed
if (MenuDialog.activeMenuDialog != null)
{ {
dialogClickedFlag = false; if (MenuDialog.activeMenuDialog.gameObject.activeInHierarchy)
nextLineInputFlag = false; {
dialogClickedFlag = false;
nextLineInputFlag = false;
}
} }
} }

Loading…
Cancel
Save