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" />