From b7034e7a1b49d43a3c03610c0d231bb43765721d Mon Sep 17 00:00:00 2001 From: ZouJin Date: Thu, 10 Aug 2023 21:34:11 +1000 Subject: [PATCH] =?UTF-8?q?=E9=9F=B3=E4=B9=90=E8=AF=86=E5=88=AB=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E7=89=B9=E6=AE=8A=E5=8A=A8=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Display/Main.xaml.cs | 4 +- VPet-Simulator.Core/Display/MainDisplay.cs | 2 +- VPet-Simulator.Core/Display/MainLogic.cs | 17 ++-- VPet-Simulator.Core/Display/ToolBar.xaml | 2 +- .../IMainWindow.cs | 7 +- VPet-Simulator.Windows.Interface/Setting.cs | 16 ++++ .../Function/MWController.cs | 2 +- VPet-Simulator.Windows/MainWindow.cs | 93 +++++++++++++++++++ VPet-Simulator.Windows/MainWindow.xaml.cs | 13 ++- .../VPet-Simulator.Windows.csproj | 3 + .../WinDesign/winGameSetting.xaml | 48 +++++++++- .../WinDesign/winGameSetting.xaml.cs | 53 ++++++++++- VPet-Simulator.Windows/packages.config | 1 + 13 files changed, 241 insertions(+), 20 deletions(-) diff --git a/VPet-Simulator.Core/Display/Main.xaml.cs b/VPet-Simulator.Core/Display/Main.xaml.cs index 5922333..1218431 100644 --- a/VPet-Simulator.Core/Display/Main.xaml.cs +++ b/VPet-Simulator.Core/Display/Main.xaml.cs @@ -395,14 +395,14 @@ namespace VPet_Simulator.Core if (wavetimes++ > 4) if (wavetop == true) { - if (wavetimes >= 10 || DisplayType.Type == GraphType.Default || DisplayType.Type == GraphType.Touch_Head) + if (wavetimes >= 10 || IsIdel || DisplayType.Type == GraphType.Touch_Head) DisplayTouchHead(); //Console.WriteLine(wavetimes); LastInteractionTime = DateTime.Now; } else { - if (wavetimes >= 10 || DisplayType.Type == GraphType.Default || DisplayType.Type == GraphType.Touch_Body) + if (wavetimes >= 10 || IsIdel || DisplayType.Type == GraphType.Touch_Body) DisplayTouchBody(); LastInteractionTime = DateTime.Now; } diff --git a/VPet-Simulator.Core/Display/MainDisplay.cs b/VPet-Simulator.Core/Display/MainDisplay.cs index 36a6189..e84609e 100644 --- a/VPet-Simulator.Core/Display/MainDisplay.cs +++ b/VPet-Simulator.Core/Display/MainDisplay.cs @@ -433,7 +433,7 @@ namespace VPet_Simulator.Core /// 动画名称 /// 动画结束后操作(附带名字) /// 动画的动作 Start Loop End - public void Display(string name, AnimatType animat, Action EndAction = null) + public void Display(string name, AnimatType animat, Action EndAction) { Display(Core.Graph.FindGraph(name, animat, Core.Save.Mode), new Action(() => EndAction.Invoke(name))); } diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs index 86bdcc3..e044eb6 100644 --- a/VPet-Simulator.Core/Display/MainLogic.cs +++ b/VPet-Simulator.Core/Display/MainLogic.cs @@ -45,7 +45,7 @@ namespace VPet_Simulator.Core Task.Run(() => { OnSay?.Invoke(text); - if (force || !string.IsNullOrWhiteSpace(graphname) && DisplayType.Type == GraphType.Default) + if (force || !string.IsNullOrWhiteSpace(graphname) && IsIdel) Display(graphname, AnimatType.A_Start, () => { Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text, graphname)); @@ -278,6 +278,9 @@ namespace VPet_Simulator.Core /// 想要随机显示的接口 (return:是否成功) /// public List> RandomInteractionAction = new List>(); + + public bool IsIdel => (DisplayType.Type == GraphType.Default || DisplayType.Type == GraphType.Work) && !isPress; + /// /// 每隔指定时间自动触发计算 可以关闭EventTimer后手动计算 /// @@ -297,9 +300,9 @@ namespace VPet_Simulator.Core } //UIHandle - Dispatcher.Invoke(() => TimeUIHandle.Invoke(this)); + Dispatcher.Invoke(() => TimeUIHandle?.Invoke(this)); - if (DisplayType.Type == GraphType.Default && !isPress) + if (IsIdel) switch (Function.Rnd.Next(Math.Max(20, Core.Controller.InteractionCycle - CountNomal))) { case 0: @@ -308,7 +311,7 @@ namespace VPet_Simulator.Core //显示移动 DisplayMove(); break; - case 3: + case 3: case 4: case 5: //显示待机 @@ -321,8 +324,8 @@ namespace VPet_Simulator.Core DisplaySleep(); break; case 8: - case 9: - case 10: + case 9: + case 10: //给其他显示留个机会 var list = RandomInteractionAction.ToList(); for (int i = Function.Rnd.Next(list.Count); 0 != list.Count; i = Function.Rnd.Next(list.Count)) @@ -337,7 +340,7 @@ namespace VPet_Simulator.Core list.RemoveAt(i); } } - break; + break; } } diff --git a/VPet-Simulator.Core/Display/ToolBar.xaml b/VPet-Simulator.Core/Display/ToolBar.xaml index 0c17820..b795a85 100644 --- a/VPet-Simulator.Core/Display/ToolBar.xaml +++ b/VPet-Simulator.Core/Display/ToolBar.xaml @@ -40,7 +40,7 @@ Foreground="{DynamicResource DARKPrimary}" Grid.ColumnSpan="3" />