diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4d670e6..21bd3e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## [0.2.9] 2024-06-30
+
+* Set LineView's MouseFilter to 'ignore' to avoid interfering with clicks.
+* Fix an issue where 'use fade effect' would cause the ConvertBBCodeToHTML feature to stop working while the text was fading out.
+* Set the LineView to Visible=False when marking its alpha as 0.
+
## [0.2.8] 2024-05-24
* Fix Yarn commands not supporting methods with optional arguments (by @spirifoxy)
* Update Visual Novel sample to make use of this fix
diff --git a/addons/YarnSpinner-Godot/Runtime/Views/LineView.cs b/addons/YarnSpinner-Godot/Runtime/Views/LineView.cs
index cc19016..1686aa7 100644
--- a/addons/YarnSpinner-Godot/Runtime/Views/LineView.cs
+++ b/addons/YarnSpinner-Godot/Runtime/Views/LineView.cs
@@ -280,6 +280,7 @@ private void SetViewAlpha(float alpha)
var color = viewControl.Modulate;
color.A = alpha;
viewControl.Modulate = color;
+ viewControl.Visible = alpha != 0f;
}
///
@@ -292,9 +293,6 @@ public void DismissLine(Action onDismissalComplete)
private async void DismissLineInternal(Action onDismissalComplete)
{
- // disabling interaction temporarily while dismissing the line
- // we don't want people to interrupt a dismissal
- var interactable = viewControl.Visible;
SetCanvasInteractable(false);
// If we're using a fade effect, run it, and wait for it to finish.
@@ -305,7 +303,6 @@ private async void DismissLineInternal(Action onDismissalComplete)
}
SetViewAlpha(0f);
- SetCanvasInteractable(interactable);
if (onDismissalComplete != null)
{
onDismissalComplete();
@@ -342,6 +339,7 @@ public void InterruptLine(LocalizedLine dialogueLine, Action onInterruptLineFini
characterNameText.Text = dialogueLine.CharacterName;
lineText.Text = dialogueLine.TextWithoutCharacterName.Text;
}
+ ConvertHTMLToBBCodeIfConfigured();
// Show the entire line's text immediately.
@@ -369,9 +367,10 @@ public void RunLine(LocalizedLine dialogueLine, Action onDialogueLineFinished)
{
errorMessage = failedTask.Exception.ToString();
}
+
GD.PushError($"Error while running {nameof(RunLineInternal)}: {errorMessage}");
- },
- TaskContinuationOptions.OnlyOnFaulted);
+ },
+ TaskContinuationOptions.OnlyOnFaulted);
}
private async Task RunLineInternal(LocalizedLine dialogueLine, Action onDialogueLineFinished)
@@ -379,10 +378,8 @@ private async Task RunLineInternal(LocalizedLine dialogueLine, Action onDialogue
async Task PresentLine()
{
lineText.Visible = true;
- viewControl.Visible = true;
- var color = viewControl.Modulate;
- color.A = 1f;
- viewControl.Modulate = color;
+ SetCanvasInteractable(true);
+ SetViewAlpha(1f);
// Hide the continue button until presentation is complete (if
// we have one).
@@ -437,17 +434,7 @@ async Task PresentLine()
lineText.Text = text.Text;
}
- if (ConvertHTMLToBBCode)
- {
- const string htmlTagPattern = @"<(.*?)>";
- if (characterNameText != null)
- {
- characterNameText.Text = Regex.Replace(characterNameText.Text, htmlTagPattern, "[$1]");
- }
-
- lineText.Text = Regex.Replace(lineText.Text, htmlTagPattern, "[$1]");
- }
-
+ ConvertHTMLToBBCodeIfConfigured();
if (useTypewriterEffect)
{
// If we're using the typewriter effect, hide all of the
@@ -481,9 +468,7 @@ async Task PresentLine()
{
var pauses = LineView.GetPauseDurationsInsideLine(text);
// setting the canvas all back to its defaults because if we didn't also fade we don't have anything visible
- color = viewControl.Modulate;
- color.A = 1f;
- viewControl.Modulate = color;
+ SetViewAlpha(1f);
SetCanvasInteractable(true);
await Effects.PausableTypewriter(
lineText,
@@ -501,7 +486,7 @@ await Effects.PausableTypewriter(
// Run any presentations as a single async Task. If this is stopped,
// which UserRequestedViewAdvancement can do, then we will stop all
- // of the animations at once.
+ // the animations at once.
await PresentLine();
if (!IsInstanceValid(this))
@@ -551,6 +536,25 @@ await Effects.PausableTypewriter(
onDialogueLineFinished();
}
+ ///
+ /// If is true, replace any HTML tags in the line text and
+ /// character name text with BBCode tags.
+ ///
+ private void ConvertHTMLToBBCodeIfConfigured()
+ {
+ if (ConvertHTMLToBBCode)
+ {
+ const string htmlTagPattern = @"<(.*?)>";
+ if (characterNameText != null)
+ {
+ characterNameText.Text = Regex.Replace(characterNameText.Text, htmlTagPattern, "[$1]");
+ }
+
+ lineText.Text = Regex.Replace(lineText.Text, htmlTagPattern, "[$1]");
+ }
+
+ }
+
private void SetCanvasInteractable(bool b)
{
if (!IsInstanceValid(viewControl))
@@ -560,7 +564,6 @@ private void SetCanvasInteractable(bool b)
viewControl.MouseFilter = b ? Control.MouseFilterEnum.Pass : Control.MouseFilterEnum.Ignore;
viewControl.SetProcessInput(b);
- viewControl.Visible = b;
}
///
diff --git a/addons/YarnSpinner-Godot/Scenes/DefaultDialogueSystem.tscn b/addons/YarnSpinner-Godot/Scenes/DefaultDialogueSystem.tscn
index c378e28..ffaac70 100644
--- a/addons/YarnSpinner-Godot/Scenes/DefaultDialogueSystem.tscn
+++ b/addons/YarnSpinner-Godot/Scenes/DefaultDialogueSystem.tscn
@@ -32,6 +32,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
+mouse_filter = 2
script = ExtResource("3")
viewControlPath = NodePath("ViewControl")
useFadeEffect = false
diff --git a/addons/YarnSpinner-Godot/plugin.cfg b/addons/YarnSpinner-Godot/plugin.cfg
index 3a1bfd3..2ed4ae5 100644
--- a/addons/YarnSpinner-Godot/plugin.cfg
+++ b/addons/YarnSpinner-Godot/plugin.cfg
@@ -3,5 +3,5 @@
name="YarnSpinner-Godot"
description="Yarn language based dialogue system plugin for Godot"
author="dogboydog"
-version="0.2.8"
+version="0.2.9"
script="YarnSpinnerPlugin.cs"