修复频繁说话导致说话动作不停止 fix #358

This commit is contained in:
ZouJin 2024-04-18 14:43:07 +08:00
parent b54df8fae4
commit 7207d14284
2 changed files with 6 additions and 9 deletions

View File

@ -65,7 +65,7 @@ namespace VPet_Simulator.Core
{
Dispatcher.Invoke(() =>
{
MsgBar.Show(Core.Save.Name, text, msgcontent: (string.IsNullOrWhiteSpace(desc) ? null :
MsgBar.Show(Core.Save.Name, text, graphname, msgcontent: (string.IsNullOrWhiteSpace(desc) ? null :
new TextBlock() { Text = desc, FontSize = 20, ToolTip = desc, HorizontalAlignment = HorizontalAlignment.Right }));
});
}

View File

@ -68,10 +68,10 @@ namespace VPet_Simulator.Core
{
Dispatcher.Invoke(() =>
{
Opacity = 1;
this.Visibility = Visibility.Collapsed;
MessageBoxContent.Children.Clear();
});
EndAction?.Invoke();
}
else
@ -114,12 +114,6 @@ namespace VPet_Simulator.Core
}
}
}
Task.Run(() =>
{
Thread.Sleep(timeleft * 50);
if (!string.IsNullOrEmpty(graphName) && m.DisplayType.Type == GraphInfo.GraphType.Say)
m.DisplayCEndtoNomal(graphName);
});
ShowTimer.Stop();
EndTimer.Start();
}
@ -130,9 +124,10 @@ namespace VPet_Simulator.Core
public event Action EndAction;
private void EndTimer_Elapsed(object sender, ElapsedEventArgs e)
{
if (--timeleft <= 0)
{
if ((m.DisplayType.Name == graphName || m.DisplayType.Type == GraphInfo.GraphType.Say) && m.DisplayType.Animat != GraphInfo.AnimatType.C_End)
m.DisplayCEndtoNomal(graphName);
EndTimer.Stop();
CloseTimer.Start();
}
@ -194,6 +189,8 @@ namespace VPet_Simulator.Core
EndTimer.Stop(); ShowTimer.Stop(); CloseTimer.Close();
this.Visibility = Visibility.Collapsed;
MessageBoxContent.Children.Clear();
if ((m.DisplayType.Name == graphName || m.DisplayType.Type == GraphInfo.GraphType.Say) && m.DisplayType.Animat != GraphInfo.AnimatType.C_End)
m.DisplayCEndtoNomal(graphName);
EndAction?.Invoke();
}
public void Dispose()