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. 3
      Assets/Fungus/Narrative/Editor/DialogInputEditor.cs
  2. 6
      Assets/Fungus/Narrative/Scripts/DialogInput.cs

3
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)

6
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,6 +144,8 @@ namespace Fungus
ignoreClickTimer = Mathf.Max (ignoreClickTimer - Time.deltaTime, 0f); ignoreClickTimer = Mathf.Max (ignoreClickTimer - Time.deltaTime, 0f);
} }
if (ignoreMenuClicks)
{
// Ignore input events if a Menu is being displayed // Ignore input events if a Menu is being displayed
if (MenuDialog.activeMenuDialog != null) if (MenuDialog.activeMenuDialog != null)
{ {
@ -150,6 +155,7 @@ namespace Fungus
nextLineInputFlag = false; nextLineInputFlag = false;
} }
} }
}
// Tell any listeners to move to the next line // Tell any listeners to move to the next line
if (nextLineInputFlag) if (nextLineInputFlag)

Loading…
Cancel
Save