diff --git a/VPet-Simulator.Core/Display/MainDisplay.cs b/VPet-Simulator.Core/Display/MainDisplay.cs index fc67719..7bebb93 100644 --- a/VPet-Simulator.Core/Display/MainDisplay.cs +++ b/VPet-Simulator.Core/Display/MainDisplay.cs @@ -126,12 +126,12 @@ namespace VPet_Simulator.Core else if (DisplayType.Animat == AnimatType.B_Loop) if (Dispatcher.Invoke(() => PetGrid.Tag) is IGraph ig && ig.GraphInfo.Type == GraphType.Touch_Head && ig.GraphInfo.Animat == AnimatType.B_Loop) { - ig.IsContinue = true; + ig.SetContinue(); return; } else if (Dispatcher.Invoke(() => PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Type == GraphType.Touch_Head && ig2.GraphInfo.Animat == AnimatType.B_Loop) { - ig2.IsContinue = true; + ig2.SetContinue(); return; } } @@ -164,12 +164,12 @@ namespace VPet_Simulator.Core else if (DisplayType.Animat == AnimatType.B_Loop) if (Dispatcher.Invoke(() => PetGrid.Tag) is IGraph ig && ig.GraphInfo.Type == GraphType.Touch_Body && ig.GraphInfo.Animat == AnimatType.B_Loop) { - ig.IsContinue = true; + ig.SetContinue(); return; } else if (Dispatcher.Invoke(() => PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Type == GraphType.Touch_Body && ig2.GraphInfo.Animat == AnimatType.B_Loop) { - ig2.IsContinue = true; + ig2.SetContinue(); return; } } diff --git a/VPet-Simulator.Core/Graph/FoodAnimation.cs b/VPet-Simulator.Core/Graph/FoodAnimation.cs index 861047d..5725e69 100644 --- a/VPet-Simulator.Core/Graph/FoodAnimation.cs +++ b/VPet-Simulator.Core/Graph/FoodAnimation.cs @@ -63,22 +63,12 @@ namespace VPet_Simulator.Core /// 所有动画帧 /// public List Animations; - /// - /// 当前动画播放状态 - /// - public bool PlayState { get; set; } = false; - /// - /// 当前动画是否执行ENDACTION - /// - private bool DoEndAction = true; + /// /// 是否循环播放 /// public bool IsLoop { get; set; } - /// - /// 是否继续播放 - /// - public bool IsContinue { get; set; } = false; + /// /// 动画信息 /// @@ -87,10 +77,9 @@ namespace VPet_Simulator.Core /// 是否准备完成 /// public bool IsReady => true; - /// - /// 动画停止时运行的方法 - /// - private Action StopAction; + + public TaskControl Control { get; set; } + int nowid; /// /// 图片资源 @@ -153,7 +142,7 @@ namespace VPet_Simulator.Core /// /// 运行该图层 /// - public void Run(FrameworkElement This, Action EndAction = null) + public void Run(FrameworkElement This, TaskControl Control) { //先显示该图层 This.Dispatcher.Invoke(() => @@ -176,53 +165,43 @@ namespace VPet_Simulator.Core //然后等待帧时间毫秒 Thread.Sleep(Time); //判断是否要下一步 - if (parent.PlayState) + switch (Control.Type) { - if (++parent.nowid >= parent.Animations.Count) - if (parent.IsLoop) - parent.nowid = 0; - else if (parent.IsContinue) - { - parent.IsContinue = false; - parent.nowid = 0; - } - else - { - //parent.endwilldo = () => parent.Dispatcher.Invoke(Hidden); - //parent.Dispatcher.Invoke(Hidden); - parent.PlayState = false; - //等待其他两个动画完成 - if (parent.DoEndAction) - EndAction?.Invoke();//运行结束动画时事件 - parent.StopAction?.Invoke(); - parent.StopAction = null; - ////延时隐藏 - //Task.Run(() => - //{ - // Thread.Sleep(25); - // parent.Dispatcher.Invoke(Hidden); - //}); - return; - } - //要下一步,现在就隐藏图层 - //隐藏该图层 - //parent.Dispatcher.Invoke(Hidden); - parent.Animations[parent.nowid].Run(This, EndAction); - return; - } - else - { - parent.IsContinue = false; - //parent.Dispatcher.Invoke(Hidden); - if (parent.DoEndAction) - EndAction?.Invoke();//运行结束动画时事件 - parent.StopAction?.Invoke(); - parent.StopAction = null; - //Task.Run(() => - //{ - // Thread.Sleep(25); - // parent.Dispatcher.Invoke(Hidden); - //}); + case TaskControl.ControlType.Stop: + Control.EndAction?.Invoke(); + return; + case TaskControl.ControlType.Status_Stoped: + return; + case TaskControl.ControlType.Status_Quo: + case TaskControl.ControlType.Continue: + if (++parent.nowid >= parent.Animations.Count) + if (parent.IsLoop) + parent.nowid = 0; + else if (Control.Type == TaskControl.ControlType.Continue) + { + Control.Type = TaskControl.ControlType.Status_Quo; + parent.nowid = 0; + } + else + { + //parent.endwilldo = () => parent.Dispatcher.Invoke(Hidden); + //parent.Dispatcher.Invoke(Hidden); + Control.Type = TaskControl.ControlType.Status_Stoped; + //等待其他两个动画完成 + Control.EndAction?.Invoke(); //运行结束动画时事件 + ////延时隐藏 + //Task.Run(() => + //{ + // Thread.Sleep(25); + // parent.Dispatcher.Invoke(Hidden); + //}); + return; + } + //要下一步,现在就隐藏图层 + //隐藏该图层 + //parent.Dispatcher.Invoke(Hidden); + parent.Animations[parent.nowid].Run(This, Control); + return; } } } @@ -257,15 +236,13 @@ namespace VPet_Simulator.Core public void Run(Decorator parant, ImageSource image, Action EndAction = null) { - if (PlayState) + if (Control?.PlayState == true) {//如果当前正在运行,重置状态 - //IsResetPlay = true; - StopAction = () => Run(parant, image, EndAction); + Control.Stop(() => Run(parant, EndAction)); return; } nowid = 0; - PlayState = true; - DoEndAction = true; + Control = new TaskControl(EndAction); parant.Dispatcher.Invoke(() => { parant.Tag = this; @@ -291,14 +268,8 @@ namespace VPet_Simulator.Core } t1?.Start(); t2?.Start(); - Task.Run(() => Animations[0].Run(FoodGrid.Food, EndAction)); + Task.Run(() => Animations[0].Run(FoodGrid.Food, Control)); }); } - - public void Stop(bool StopEndAction = false) - { - DoEndAction = !StopEndAction; - PlayState = false; - } } } diff --git a/VPet-Simulator.Core/Graph/IGraph.cs b/VPet-Simulator.Core/Graph/IGraph.cs index 6d50e7f..856e7f5 100644 --- a/VPet-Simulator.Core/Graph/IGraph.cs +++ b/VPet-Simulator.Core/Graph/IGraph.cs @@ -12,19 +12,15 @@ namespace VPet_Simulator.Core /// /// 从0开始运行该动画 /// + /// 停止动作 + /// 显示位置 void Run(Decorator parant, Action EndAction = null); - /// - /// 当前动画播放状态 - /// - bool PlayState { get; set; } + /// /// 是否循环播放 /// bool IsLoop { get; set; } - /// - /// 是否继续播放 - /// - bool IsContinue { get; set; } + /// /// 是否准备完成 /// @@ -33,11 +29,31 @@ namespace VPet_Simulator.Core /// 该动画信息 /// GraphInfo GraphInfo { get; } + + /// + /// 当前动画播放状态和控制 + /// + TaskControl Control { get; } + /// /// 停止动画 /// - /// 停止动画时是否允许执行停止帧 - void Stop(bool StopEndAction = false); + /// 停止动画时是否不运行结束动画 + void Stop(bool StopEndAction) + { + if (Control == null) + return; + if (StopEndAction) + Control.EndAction = null; + Control.Type = TaskControl.ControlType.Stop; + } + /// + /// 设置为继续播放 + /// + void SetContinue() + { + Control.Type = TaskControl.ControlType.Continue; + } /// /// 指示该ImageRun支持 /// @@ -51,5 +67,61 @@ namespace VPet_Simulator.Core /// 额外图片 void Run(Decorator parant, ImageSource image, Action EndAction = null); } + /// + /// 动画控制类 + /// + public class TaskControl + { + /// + /// 当前动画播放状态 + /// + public bool PlayState => Type != ControlType.Status_Stoped && Type != ControlType.Stop; + /// + /// 设置为继续播放 + /// + public void SetContinue() { Type = ControlType.Continue; } + /// + /// 停止播放 + /// + public void Stop(Action endAction = null) { EndAction = endAction; Type = ControlType.Stop; } + /// + /// 控制类型 + /// + public enum ControlType + { + /// + /// 维持现状, 不进行任何超控 + /// + Status_Quo, + /// + /// 停止当前动画 + /// + Stop, + /// + /// 播放完成后继续播放,仅生效一次, 之后将恢复为Status_Quo + /// + Continue, + /// + /// 动画已停止 + /// + Status_Stoped, + } + /// + /// 结束动作 + /// + public Action EndAction; + /// + /// 控制类型 + /// + public ControlType Type = ControlType.Status_Quo; + /// + /// 为动画控制类提供操作和结束动作 + /// + /// + public TaskControl(Action endAction = null) + { + EndAction = endAction; + } + } } } diff --git a/VPet-Simulator.Core/Graph/PNGAnimation.cs b/VPet-Simulator.Core/Graph/PNGAnimation.cs index 7e5d6d6..65bb810 100644 --- a/VPet-Simulator.Core/Graph/PNGAnimation.cs +++ b/VPet-Simulator.Core/Graph/PNGAnimation.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Media.Imaging; +using static VPet_Simulator.Core.IGraph; using static VPet_Simulator.Core.Picture; namespace VPet_Simulator.Core @@ -23,21 +24,9 @@ namespace VPet_Simulator.Core /// public List Animations; /// - /// 当前动画播放状态 - /// - public bool PlayState { get; set; } = false; - /// - /// 当前动画是否执行ENDACTION - /// - private bool DoEndAction = true; - /// /// 是否循环播放 /// public bool IsLoop { get; set; } - /// - /// 是否循环播放 - /// - public bool IsContinue { get; set; } = false; /// /// 动画信息 @@ -48,10 +37,9 @@ namespace VPet_Simulator.Core /// 是否准备完成 /// public bool IsReady { get; private set; } = false; - /// - /// 动画停止时运行的方法 - /// - private Action StopAction; + + public TaskControl Control { get; set; } + int nowid; /// /// 图片资源 @@ -80,6 +68,7 @@ namespace VPet_Simulator.Core GraphCore.CommConfig["PA_Setup"] = true; GraphCore.CommUIElements["Image1.PNGAnimation"] = new System.Windows.Controls.Image() { Height = 500 }; GraphCore.CommUIElements["Image2.PNGAnimation"] = new System.Windows.Controls.Image() { Height = 500 }; + GraphCore.CommUIElements["Image3.PNGAnimation"] = new System.Windows.Controls.Image() { Height = 500 }; // 多整个, 防止动画闪烁 } Task.Run(() => startup(path, paths)); } @@ -163,7 +152,6 @@ namespace VPet_Simulator.Core Interlocked.Decrement(ref NowLoading); } - /// /// 单帧动画 /// @@ -194,60 +182,41 @@ namespace VPet_Simulator.Core /// /// 运行该图层 /// - public void Run(FrameworkElement This, Action EndAction = null) + /// 动画控制 + /// 显示的图层 + public void Run(FrameworkElement This, TaskControl Control) { //先显示该图层 This.Dispatcher.Invoke(() => This.Margin = new Thickness(MarginWIX, 0, 0, 0)); //然后等待帧时间毫秒 Thread.Sleep(Time); //判断是否要下一步 - if (parent.PlayState) + switch (Control.Type) { - if (++parent.nowid >= parent.Animations.Count) - if (parent.IsLoop) - parent.nowid = 0; - else if (parent.IsContinue) - { - parent.IsContinue = false; - parent.nowid = 0; - } - else - { - //parent.endwilldo = () => parent.Dispatcher.Invoke(Hidden); - //parent.Dispatcher.Invoke(Hidden); - parent.PlayState = false; - if (parent.DoEndAction) - EndAction?.Invoke();//运行结束动画时事件 - parent.StopAction?.Invoke(); - parent.StopAction = null; - ////延时隐藏 - //Task.Run(() => - //{ - // Thread.Sleep(25); - // parent.Dispatcher.Invoke(Hidden); - //}); - return; - } - //要下一步,现在就隐藏图层 - //隐藏该图层 - //parent.Dispatcher.Invoke(Hidden); - parent.Animations[parent.nowid].Run(This, EndAction); - return; - } - else - { - parent.IsContinue = false; - //不运行结束事件 - ////parent.Dispatcher.Invoke(Hidden); - //if (parent.DoEndAction) - // EndAction?.Invoke();//运行结束动画时事件 - //parent.StopAction?.Invoke(); - //parent.StopAction = null; - ////Task.Run(() => - ////{ - //// Thread.Sleep(25); - //// parent.Dispatcher.Invoke(Hidden); - ////}); + case TaskControl.ControlType.Stop: + Control.EndAction?.Invoke(); + return; + case TaskControl.ControlType.Status_Stoped: + return; + case TaskControl.ControlType.Status_Quo: + case TaskControl.ControlType.Continue: + if (++parent.nowid >= parent.Animations.Count) + if (parent.IsLoop) + parent.nowid = 0; + else if (Control.Type == TaskControl.ControlType.Continue) + { + Control.Type = TaskControl.ControlType.Status_Quo; + parent.nowid = 0; + } + else + { + Control.Type = TaskControl.ControlType.Status_Stoped; + Control.EndAction?.Invoke(); //运行结束动画时事件 + return; + } + //要下一步 + parent.Animations[parent.nowid].Run(This, Control); + return; } } } @@ -256,31 +225,23 @@ namespace VPet_Simulator.Core /// public void Run(Decorator parant, Action EndAction = null) { - //if(endwilldo != null && nowid != Animations.Count) - //{ - // endwilldo.Invoke(); - // endwilldo = null; - //} if (!IsReady) { EndAction?.Invoke(); return; } - if (PlayState) + if (Control?.PlayState == true) {//如果当前正在运行,重置状态 - //IsResetPlay = true; - Stop(); - StopAction = () => Run(parant, EndAction); + Control.Stop(() => Run(parant, EndAction)); return; } nowid = 0; - PlayState = true; - DoEndAction = true; + Control = new TaskControl(EndAction); parant.Dispatcher.Invoke(() => { if (parant.Tag == this) { - Task.Run(() => Animations[0].Run((System.Windows.Controls.Image)parant.Child, EndAction)); + Task.Run(() => Animations[0].Run((System.Windows.Controls.Image)parant.Child, Control)); return; } System.Windows.Controls.Image img; @@ -289,6 +250,10 @@ namespace VPet_Simulator.Core { img = (System.Windows.Controls.Image)GraphCore.CommUIElements["Image1.PNGAnimation"]; } + else if (parant.Child == GraphCore.CommUIElements["Image3.PNGAnimation"]) + { + img = (System.Windows.Controls.Image)GraphCore.CommUIElements["Image3.PNGAnimation"]; + } else { img = (System.Windows.Controls.Image)GraphCore.CommUIElements["Image2.PNGAnimation"]; @@ -308,16 +273,9 @@ namespace VPet_Simulator.Core } } parant.Tag = this; - //var bitmap = new BitmapImage(); - //bitmap.BeginInit(); - //stream.Seek(0, SeekOrigin.Begin); - //bitmap.StreamSource = stream; - //bitmap.CacheOption = BitmapCacheOption.OnLoad; - //bitmap.EndInit(); img.Source = new BitmapImage(new Uri(Path)); - img.Width = Width; - Task.Run(() => Animations[0].Run((System.Windows.Controls.Image)parant.Child, EndAction)); + Task.Run(() => Animations[0].Run((System.Windows.Controls.Image)parant.Child, Control)); }); } /// @@ -328,26 +286,30 @@ namespace VPet_Simulator.Core /// 准备好的线程 public Task Run(System.Windows.Controls.Image img, Action EndAction = null) { + if (!IsReady) + { + EndAction?.Invoke(); + return Task.CompletedTask; + } + if (Control?.PlayState == true) + {//如果当前正在运行,重置状态 + Control.EndAction = null; + Control.Type = TaskControl.ControlType.Stop; + } nowid = 0; - PlayState = true; - DoEndAction = true; + Control = new TaskControl(EndAction); return img.Dispatcher.Invoke(() => - { - if (img.Tag == this) - { - return new Task(() => Animations[0].Run(img, EndAction)); - } - img.Tag = this; - img.Source = new BitmapImage(new Uri(Path)); - img.Width = Width; - return new Task(() => Animations[0].Run(img, EndAction)); - }); - } - public void Stop(bool StopEndAction = false) - { - DoEndAction = !StopEndAction; - PlayState = false; - //IsResetPlay = false; + { + if (img.Tag == this) + { + return new Task(() => Animations[0].Run(img, Control)); + } + img.Tag = this; + img.Source = new BitmapImage(new Uri(Path)); + img.Width = Width; + return new Task(() => Animations[0].Run(img, Control)); + }); } + } } diff --git a/VPet-Simulator.Core/Graph/Picture.cs b/VPet-Simulator.Core/Graph/Picture.cs index 9a92fad..df46ae4 100644 --- a/VPet-Simulator.Core/Graph/Picture.cs +++ b/VPet-Simulator.Core/Graph/Picture.cs @@ -6,6 +6,8 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Controls; using System.Windows.Media.Imaging; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox; +using static VPet_Simulator.Core.IGraph; using static VPet_Simulator.Core.Picture; @@ -32,6 +34,7 @@ namespace VPet_Simulator.Core GraphCore.CommConfig["PIC_Setup"] = true; GraphCore.CommUIElements["Image1.Picture"] = new Image() { Width = 500, Height = 500 }; GraphCore.CommUIElements["Image2.Picture"] = new Image() { Width = 500, Height = 500 }; + GraphCore.CommUIElements["Image3.Picture"] = new Image() { Width = 500, Height = 500 }; } } public static void LoadGraph(GraphCore graph, FileSystemInfo path, ILine info) @@ -56,11 +59,12 @@ namespace VPet_Simulator.Core /// public string Path; private GraphCore GraphCore; - public bool PlayState { get; set; } public bool IsLoop { get; set; } + /// + /// 播放持续时间 毫秒 + /// public int Length { get; set; } //public bool StoreMemory => true;//经过测试,储存到内存好处多多,不储存也要占用很多内存,干脆存了吧 - public bool IsContinue { get; set; } /// /// 动画信息 @@ -69,15 +73,18 @@ namespace VPet_Simulator.Core public bool IsReady => true; + public TaskControl Control { get; set; } + public void Run(Decorator parant, Action EndAction = null) { - if (PlayState) - { - IsContinue = true; + if (Control?.PlayState == true) + {//如果当前正在运行,重置状态 + Control.SetContinue(); + Control.EndAction = EndAction; return; } - PlayState = true; - DoEndAction = true; + Control = new TaskControl(EndAction); + parant.Dispatcher.Invoke(() => { if (parant.Tag != this) @@ -87,6 +94,10 @@ namespace VPet_Simulator.Core { img = (Image)GraphCore.CommUIElements["Image1.Picture"]; } + else if (parant.Child == GraphCore.CommUIElements["Image3.Picture"]) + { + img = (Image)GraphCore.CommUIElements["Image3.Picture"]; + } else { img = (Image)GraphCore.CommUIElements["Image2.Picture"]; @@ -94,7 +105,6 @@ namespace VPet_Simulator.Core { if (img.Parent == null) { - parant.Child = null; parant.Child = img; } else @@ -106,78 +116,65 @@ namespace VPet_Simulator.Core } } } - //var bitmap = new BitmapImage(); - //bitmap.BeginInit(); - //stream.Seek(0, SeekOrigin.Begin); - //bitmap.StreamSource = stream; - //bitmap.CacheOption = BitmapCacheOption.OnLoad; - //bitmap.EndInit(); img.Width = 500; img.Source = new BitmapImage(new Uri(Path)); parant.Tag = this; } - Task.Run(() => - { - Thread.Sleep(Length); - if (IsLoop && PlayState) - { - Run(parant, EndAction); - } - else - { - PlayState = false; - if (DoEndAction) - EndAction?.Invoke();//运行结束动画时事件 - } - }); + Task.Run(() => Run(Control)); }); } bool DoEndAction = true; - public void Stop(bool StopEndAction = false) + /// + /// 通过控制器运行 + /// + /// + public void Run(TaskControl Control) { - PlayState = false; - this.DoEndAction = !StopEndAction; + Thread.Sleep(Length); + //判断是否要下一步 + switch (Control.Type) + { + case TaskControl.ControlType.Stop: + Control.EndAction?.Invoke(); + return; + case TaskControl.ControlType.Status_Stoped: + return; + case TaskControl.ControlType.Continue: + Control.Type = TaskControl.ControlType.Status_Quo; + Run(Control); + return; + case TaskControl.ControlType.Status_Quo: + if (IsLoop) + { + Run(Control); + } + else + { + Control.Type = TaskControl.ControlType.Status_Stoped; + Control.EndAction?.Invoke(); //运行结束动画时事件 + } + return; + } } - public Task Run(System.Windows.Controls.Image img, Action EndAction = null) + + public Task Run(Image img, Action EndAction = null) { - PlayState = true; - DoEndAction = true; + if (Control?.PlayState == true) + {//如果当前正在运行,重置状态 + Control.EndAction = null; + Control.Type = TaskControl.ControlType.Stop; + } + Control = new TaskControl(EndAction); return img.Dispatcher.Invoke(() => { if (img.Tag == this) { - return new Task(() => - { - Thread.Sleep(Length); - if (IsLoop && PlayState) - { - Run(img, EndAction); - } - else - { - PlayState = false; - if (DoEndAction) - EndAction?.Invoke();//运行结束动画时事件 - } - }); + return new Task(() => Run(Control)); } img.Tag = this; img.Source = new BitmapImage(new Uri(Path)); img.Width = 500; - return new Task(() => - { - Thread.Sleep(Length); - if (IsLoop && PlayState) - { - Run(img, EndAction); - } - else - { - PlayState = false; - if (DoEndAction) - EndAction?.Invoke();//运行结束动画时事件 - } - }); + return new Task(() => Run(Control)); }); } public interface IImageRun : IGraph diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 7a47fb5..4ef6698 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -2193,12 +2193,12 @@ namespace VPet_Simulator.Windows else if (Main.DisplayType.Animat == AnimatType.B_Loop) if (Dispatcher.Invoke(() => Main.PetGrid.Tag) is IGraph ig && ig.GraphInfo.Name == "pinch" && ig.GraphInfo.Animat == AnimatType.B_Loop) { - ig.IsContinue = true; + ig.SetContinue(); return true; } else if (Dispatcher.Invoke(() => Main.PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Name == "pinch" && ig2.GraphInfo.Animat == AnimatType.B_Loop) { - ig2.IsContinue = true; + ig2.SetContinue(); return true; } } diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index a6efa68..8eb9333 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -404,7 +404,7 @@ namespace VPet_Simulator.Windows { foreach (var ig3 in ig2) { - ig3.Stop(); + ig3.Stop(true); } } } @@ -455,7 +455,7 @@ namespace VPet_Simulator.Windows { foreach (var ig3 in ig2) { - ig3.Stop(); + ig3.Stop(true); } } } diff --git a/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs b/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs index 9166d3f..ecc869b 100644 --- a/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs +++ b/VPet-Simulator.Windows/MutiPlayer/MPFriends.xaml.cs @@ -482,12 +482,12 @@ public partial class MPFriends : WindowX, IMPFriend else if (Main.DisplayType.Animat == AnimatType.B_Loop) if (Dispatcher.Invoke(() => Main.PetGrid.Tag) is IGraph ig && ig.GraphInfo.Name == "pinch" && ig.GraphInfo.Animat == AnimatType.B_Loop) { - ig.IsContinue = true; + ig.SetContinue(); return true; } else if (Dispatcher.Invoke(() => Main.PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Name == "pinch" && ig2.GraphInfo.Animat == AnimatType.B_Loop) { - ig2.IsContinue = true; + ig2.SetContinue(); return true; } } @@ -522,12 +522,12 @@ public partial class MPFriends : WindowX, IMPFriend else if (Main.DisplayType.Animat == AnimatType.B_Loop) if (Dispatcher.Invoke(() => Main.PetGrid.Tag) is IGraph ig && ig.GraphInfo.Type == GraphType.Touch_Head && ig.GraphInfo.Animat == AnimatType.B_Loop) { - ig.IsContinue = true; + ig.SetContinue(); return; } else if (Dispatcher.Invoke(() => Main.PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Type == GraphType.Touch_Head && ig2.GraphInfo.Animat == AnimatType.B_Loop) { - ig2.IsContinue = true; + ig2.SetContinue(); return; } } @@ -548,12 +548,12 @@ public partial class MPFriends : WindowX, IMPFriend else if (Main.DisplayType.Animat == AnimatType.B_Loop) if (Dispatcher.Invoke(() => Main.PetGrid.Tag) is IGraph ig && ig.GraphInfo.Type == GraphType.Touch_Body && ig.GraphInfo.Animat == AnimatType.B_Loop) { - ig.IsContinue = true; + ig.SetContinue(); return; } else if (Dispatcher.Invoke(() => Main.PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Type == GraphType.Touch_Body && ig2.GraphInfo.Animat == AnimatType.B_Loop) { - ig2.IsContinue = true; + ig2.SetContinue(); return; } } @@ -574,12 +574,12 @@ public partial class MPFriends : WindowX, IMPFriend else if (Main.DisplayType.Animat == AnimatType.B_Loop) if (Dispatcher.Invoke(() => Main.PetGrid.Tag) is IGraph ig && ig.GraphInfo.Type == GraphType.Touch_Body && ig.GraphInfo.Animat == AnimatType.B_Loop) { - ig.IsContinue = true; + ig.SetContinue(); return; } else if (Dispatcher.Invoke(() => Main.PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Type == GraphType.Touch_Body && ig2.GraphInfo.Animat == AnimatType.B_Loop) { - ig2.IsContinue = true; + ig2.SetContinue(); return; } } @@ -723,7 +723,7 @@ public partial class MPFriends : WindowX, IMPFriend { foreach (var ig3 in ig2) { - ig3.Stop(); + ig3.Stop(true); } } } diff --git a/VPet-Simulator.Windows/MutiPlayer/winMutiPlayer.xaml.cs b/VPet-Simulator.Windows/MutiPlayer/winMutiPlayer.xaml.cs index 4ee3ce7..7cca5f6 100644 --- a/VPet-Simulator.Windows/MutiPlayer/winMutiPlayer.xaml.cs +++ b/VPet-Simulator.Windows/MutiPlayer/winMutiPlayer.xaml.cs @@ -486,12 +486,12 @@ public partial class winMutiPlayer : WindowX, IMPWindows else if (mw.Main.DisplayType.Animat == AnimatType.B_Loop) if (Dispatcher.Invoke(() => mw.Main.PetGrid.Tag) is IGraph ig && ig.GraphInfo.Type == GraphType.Touch_Head && ig.GraphInfo.Animat == AnimatType.B_Loop) { - ig.IsContinue = true; + ig.SetContinue(); return; } else if (Dispatcher.Invoke(() => mw.Main.PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Type == GraphType.Touch_Head && ig2.GraphInfo.Animat == AnimatType.B_Loop) { - ig2.IsContinue = true; + ig2.SetContinue(); return; } } @@ -512,12 +512,12 @@ public partial class winMutiPlayer : WindowX, IMPWindows else if (mw.Main.DisplayType.Animat == AnimatType.B_Loop) if (Dispatcher.Invoke(() => mw.Main.PetGrid.Tag) is IGraph ig && ig.GraphInfo.Type == GraphType.Touch_Body && ig.GraphInfo.Animat == AnimatType.B_Loop) { - ig.IsContinue = true; + ig.SetContinue(); return; } else if (Dispatcher.Invoke(() => mw.Main.PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Type == GraphType.Touch_Body && ig2.GraphInfo.Animat == AnimatType.B_Loop) { - ig2.IsContinue = true; + ig2.SetContinue(); return; } } @@ -538,12 +538,12 @@ public partial class winMutiPlayer : WindowX, IMPWindows else if (mw.Main.DisplayType.Animat == AnimatType.B_Loop) if (Dispatcher.Invoke(() => mw.Main.PetGrid.Tag) is IGraph ig && ig.GraphInfo.Type == GraphType.Touch_Head && ig.GraphInfo.Animat == AnimatType.B_Loop) { - ig.IsContinue = true; + ig.SetContinue(); return; } else if (Dispatcher.Invoke(() => mw.Main.PetGrid2.Tag) is IGraph ig2 && ig2.GraphInfo.Type == GraphType.Touch_Head && ig2.GraphInfo.Animat == AnimatType.B_Loop) { - ig2.IsContinue = true; + ig2.SetContinue(); return; } }