From 23e15af36eef72357f8c7f7e4e623727d20ef47f Mon Sep 17 00:00:00 2001 From: Steve Halliwell Date: Sun, 6 Jun 2021 20:29:14 +1000 Subject: [PATCH] Merge pull request #952 from breadnone/DialogInput-fix nextLineInputFlagWon't Always Be True On Mouse Clicks --- Assets/Fungus/Docs/CHANGELOG.txt | 1 + Assets/Fungus/Scripts/Components/DialogInput.cs | 7 +++++-- Assets/Fungus/Scripts/Components/Writer.cs | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Assets/Fungus/Docs/CHANGELOG.txt b/Assets/Fungus/Docs/CHANGELOG.txt index a40c2243..7470c41e 100644 --- a/Assets/Fungus/Docs/CHANGELOG.txt +++ b/Assets/Fungus/Docs/CHANGELOG.txt @@ -7,6 +7,7 @@ Unreleased - 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. + - SetNextLineFlag only flags if Dialog is actually active/writing. 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 2c1d48e3..4c264386 100644 --- a/Assets/Fungus/Scripts/Components/DialogInput.cs +++ b/Assets/Fungus/Scripts/Components/DialogInput.cs @@ -84,7 +84,7 @@ namespace Fungus currentStandaloneInputModule = EventSystem.current.GetComponent(); } - if (writer != null && writer.IsWriting) + if (writer != null) { if (Input.GetButtonDown(currentStandaloneInputModule.submitButton) || (cancelEnabled && Input.GetButton(currentStandaloneInputModule.cancelButton))) @@ -149,7 +149,10 @@ namespace Fungus /// public virtual void SetNextLineFlag() { - nextLineInputFlag = true; + if(writer.IsWaitingForInput || writer.IsWriting) + { + nextLineInputFlag = true; + } } /// /// Set the ClickAnywhere click flag. diff --git a/Assets/Fungus/Scripts/Components/Writer.cs b/Assets/Fungus/Scripts/Components/Writer.cs index d3006010..9e5c3a84 100644 --- a/Assets/Fungus/Scripts/Components/Writer.cs +++ b/Assets/Fungus/Scripts/Components/Writer.cs @@ -1009,10 +1009,11 @@ namespace Fungus public virtual void OnNextLineEvent() { - inputFlag = true; + - if (isWriting) + if (isWriting || isWaitingForInput) { + inputFlag = true; NotifyInput(); } }