From 5fefc4778884b5d60fd177811f0a4062f4b6339a Mon Sep 17 00:00:00 2001 From: Steve Halliwell Date: Sun, 6 Jun 2021 17:31:06 +1000 Subject: [PATCH] Merge pull request #955 from breadnone/DialogInput-ClickAnywhere-fix Make nextClickDelay works with ClickAnywhere --- Assets/Fungus/Docs/CHANGELOG.txt | 1 + .../Fungus/Scripts/Components/DialogInput.cs | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Assets/Fungus/Docs/CHANGELOG.txt b/Assets/Fungus/Docs/CHANGELOG.txt index 3a7d305a..a40c2243 100644 --- a/Assets/Fungus/Docs/CHANGELOG.txt +++ b/Assets/Fungus/Docs/CHANGELOG.txt @@ -6,6 +6,7 @@ Unreleased ## Fixed - Add missing VariableDrawer for ObjectVariable. Thanks to CG-Tespy. - Fix double duplication of blocks in flowchart window. Thanks to ongjinwen. + - Dialog ClickAnywhere not supports ignore click delay. Thanks to breadnone. ## Changed - Block will LogError when an exception is caught from a Command being Executed. diff --git a/Assets/Fungus/Scripts/Components/DialogInput.cs b/Assets/Fungus/Scripts/Components/DialogInput.cs index 514c7e4a..2c1d48e3 100644 --- a/Assets/Fungus/Scripts/Components/DialogInput.cs +++ b/Assets/Fungus/Scripts/Components/DialogInput.cs @@ -100,7 +100,7 @@ namespace Fungus case ClickMode.ClickAnywhere: if (Input.GetMouseButtonDown(0)) { - SetNextLineFlag(); + SetClickAnywhereClickedFlag(); } break; case ClickMode.ClickOnDialog: @@ -151,7 +151,23 @@ namespace Fungus { nextLineInputFlag = true; } + /// + /// Set the ClickAnywhere click flag. + /// + public virtual void SetClickAnywhereClickedFlag() + { + if (ignoreClickTimer > 0f) + { + return; + } + ignoreClickTimer = nextClickDelay; + // Only applies if ClickedAnywhere is selected + if (clickMode == ClickMode.ClickAnywhere) + { + SetNextLineFlag(); + } + } /// /// Set the dialog clicked flag (usually from an Event Trigger component in the dialog UI). ///