Skip to content

Commit

Permalink
Hotfix: Last dialog never got cancelled because call to cancel was mi…
Browse files Browse the repository at this point in the history
…ssing.
  • Loading branch information
RenNagasaki committed Aug 10, 2024
1 parent d032048 commit 717b1ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Echokraut/Echokraut.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="Dalamud.Plugin.Bootstrap.targets" />

<PropertyGroup>
<Version>0.10.5.5</Version>
<Version>0.10.5.6</Version>
<Description>A TTS Dalamud Plugin that breaks the silence! For self hosted TTS Services.</Description>
<PackageProjectUrl>https://github.com/RenNagasaki/Echokraut</PackageProjectUrl>
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>
Expand Down
14 changes: 7 additions & 7 deletions Echokraut/Helper/AddonTalkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public AddonTalkHelper(Echokraut plugin, IAddonLifecycle addonLifecycle, IClient
private void HookIntoFrameworkUpdate()
{
addonLifecycle.RegisterListener(AddonEvent.PostDraw, "Talk", OnPostDraw);
addonLifecycle.RegisterListener(AddonEvent.PreFinalize, "Talk", OnPreFinalize);
}

private void OnPreFinalize(AddonEvent type, AddonArgs args)
{
echokraut.Cancel(new EKEventId(0, Enums.TextSource.AddonTalk));
}

private unsafe void OnPostDraw(AddonEvent type, AddonArgs args)
Expand Down Expand Up @@ -90,13 +96,6 @@ private void HandleChange(AddonTalkState state)
if (voiceNext && DateTime.Now > timeNextVoice.AddSeconds(1))
voiceNext = false;

if (state == default)
{
PlayingHelper.InDialog = false;
// The addon was closed
echokraut.Cancel(new EKEventId(0, Enums.TextSource.AddonTalk));
return;
}
var eventId = DataHelper.EventId(MethodBase.GetCurrentMethod().Name, TextSource.AddonTalk);

// Notify observers that the addon state was advanced
Expand Down Expand Up @@ -156,5 +155,6 @@ public void Click(EKEventId eventId)
public void Dispose()
{
addonLifecycle.UnregisterListener(AddonEvent.PostDraw, "Talk", OnPostDraw);
addonLifecycle.UnregisterListener(AddonEvent.PreFinalize, "Talk", OnPreFinalize);
}
}

0 comments on commit 717b1ff

Please sign in to comment.