From 7207d142842e3a0d05fed9187431e607375f42c7 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Thu, 18 Apr 2024 14:43:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A2=91=E7=B9=81=E8=AF=B4?= =?UTF-8?q?=E8=AF=9D=E5=AF=BC=E8=87=B4=E8=AF=B4=E8=AF=9D=E5=8A=A8=E4=BD=9C?= =?UTF-8?q?=E4=B8=8D=E5=81=9C=E6=AD=A2=20fix=20#358?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Display/MainLogic.cs | 2 +- VPet-Simulator.Core/Display/MessageBar.xaml.cs | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs index db8fb8b..21b0d08 100644 --- a/VPet-Simulator.Core/Display/MainLogic.cs +++ b/VPet-Simulator.Core/Display/MainLogic.cs @@ -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 })); }); } diff --git a/VPet-Simulator.Core/Display/MessageBar.xaml.cs b/VPet-Simulator.Core/Display/MessageBar.xaml.cs index 8b29cd4..33f3119 100644 --- a/VPet-Simulator.Core/Display/MessageBar.xaml.cs +++ b/VPet-Simulator.Core/Display/MessageBar.xaml.cs @@ -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()