From 151d59529498fb6fb85559501da511b3b456d33b Mon Sep 17 00:00:00 2001 From: ZouJin Date: Sat, 27 May 2023 02:05:59 +1000 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=A3=85=E8=AF=B4=E8=AF=9D=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Display/MainLogic.cs | 5 +++++ VPet-Simulator.Core/Graph/PNGAnimation.cs | 4 ++-- VPet-Simulator.Core/Graph/Picture.cs | 21 ++++++++++++------ VPet-Simulator.Windows/MainWindow.xaml.cs | 16 ++++++------- .../WinDesign/TalkBox.xaml.cs | 4 ++-- .../WinDesign/TalkBoxAPI.xaml.cs | 2 +- ....png => 不眨眼不翻书4B_000_1250.png} | Bin 7 files changed, 32 insertions(+), 20 deletions(-) rename VPet-Simulator.Windows/mod/0000_core/pet/vup/Study/B_4_Nomal/{不眨眼不翻书4B.png_000_1250.png => 不眨眼不翻书4B_000_1250.png} (100%) diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs index 05a4067..31961af 100644 --- a/VPet-Simulator.Core/Display/MainLogic.cs +++ b/VPet-Simulator.Core/Display/MainLogic.cs @@ -32,6 +32,11 @@ namespace VPet_Simulator.Core AutoReset = true, Enabled = true }; + readonly GraphCore.Helper.SayType[] sayTypes = new GraphCore.Helper.SayType[] { GraphCore.Helper.SayType.Serious, GraphCore.Helper.SayType.Shining, GraphCore.Helper.SayType.Self }; + public void SayRnd(string text) + { + Say(text, sayTypes[Function.Rnd.Next(sayTypes.Length)]); + } /// /// 说话 /// diff --git a/VPet-Simulator.Core/Graph/PNGAnimation.cs b/VPet-Simulator.Core/Graph/PNGAnimation.cs index f6cf011..98c004f 100644 --- a/VPet-Simulator.Core/Graph/PNGAnimation.cs +++ b/VPet-Simulator.Core/Graph/PNGAnimation.cs @@ -310,7 +310,7 @@ namespace VPet_Simulator.Core { if (parant.Tag == this) { - new Thread(() => Animations[0].Run(parant, EndAction)).Start(); + new Thread(() => Animations[0].Run((System.Windows.Controls.Image)parant.Child, EndAction)).Start(); return; } System.Windows.Controls.Image img; @@ -345,7 +345,7 @@ namespace VPet_Simulator.Core img.Source = new BitmapImage(new Uri(Path)); img.Width = Width; - Task.Run(() => Animations[0].Run(parant, EndAction)); + Task.Run(() => Animations[0].Run((System.Windows.Controls.Image)parant.Child, EndAction)); }); } diff --git a/VPet-Simulator.Core/Graph/Picture.cs b/VPet-Simulator.Core/Graph/Picture.cs index 0699945..a5ea2c0 100644 --- a/VPet-Simulator.Core/Graph/Picture.cs +++ b/VPet-Simulator.Core/Graph/Picture.cs @@ -53,8 +53,13 @@ namespace VPet_Simulator.Core public void Run(Border parant, Action EndAction = null) { + if (PlayState) + { + IsLoop = true; + return; + } PlayState = true; - StopEndAction = false; + DoEndAction = true; parant.Dispatcher.Invoke(() => { if (parant.Tag != this) @@ -67,15 +72,17 @@ namespace VPet_Simulator.Core else { img = (Image)GraphCore.CommUIElements["Image2.Picture"]; - if (parant.Child != GraphCore.CommUIElements["Image2.Picture"]) + if (parant.Child != img) { if (img.Parent == null) { + parant.Child = null; parant.Child = img; } else { img = (Image)GraphCore.CommUIElements["Image3.Picture"]; + parant.Child = null; parant.Child = img; } } @@ -86,8 +93,8 @@ namespace VPet_Simulator.Core //bitmap.StreamSource = stream; //bitmap.CacheOption = BitmapCacheOption.OnLoad; //bitmap.EndInit(); - img.Source = new BitmapImage(new Uri(Path)); - parant.Tag = this; + img.Source = new BitmapImage(new Uri(Path)); + parant.Tag = this; } Task.Run(() => { @@ -99,17 +106,17 @@ namespace VPet_Simulator.Core else { PlayState = false; - if (!StopEndAction) + if (DoEndAction) EndAction?.Invoke();//运行结束动画时事件 } }); }); } - bool StopEndAction = false; + bool DoEndAction = true; public void Stop(bool StopEndAction = false) { PlayState = false; - this.StopEndAction = StopEndAction; + this.DoEndAction = !StopEndAction; } public void WaitForReadyRun(Border parant, Action EndAction = null) => Run(parant, EndAction); diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 133c552..ee616b2 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -242,7 +242,7 @@ namespace VPet_Simulator.Windows { lastclicktime = DateTime.Now.Ticks; var v = rndtext[Function.Rnd.Next(rndtext.Count)]; - Dispatcher.Invoke(() => Main.Say(v.Item1, v.Item2)); + Main.Say(v.Item1, v.Item2); } }; Main.PlayVoiceVolume = Set.VoiceVolume; @@ -322,14 +322,14 @@ namespace VPet_Simulator.Windows Main.Say("欢迎使用虚拟桌宠模拟器\n这是个早期的测试版,若有bug请多多包涵\n欢迎在菜单栏-管理-反馈中提交bug或建议", GraphCore.Helper.SayType.Shining); }); } - else if (Set["SingleTips"].GetDateTime("update") <= new DateTime(2023, 3, 27)) + else if (Set["SingleTips"].GetDateTime("update") <= new DateTime(2023, 5, 26)) { - if (Set["SingleTips"].GetDateTime("update") <= new DateTime(2023, 3, 4)) - notifyIcon.ShowBalloonTip(10, "更新通知 03/04", - "现已接入ChatGPT, 右键和桌宠说话吧.\n已根据steamID独立创建的聊天API,调教你独属的桌宠吧", ToolTipIcon.Info); - else - notifyIcon.ShowBalloonTip(10, "更新通知 03/27", - "全新图形核心引擎,现在桌宠对内存的占用更小!", ToolTipIcon.Info); + // if (Set["SingleTips"].GetDateTime("update") <= new DateTime(2023, 3, 4)) + // notifyIcon.ShowBalloonTip(10, "更新通知 05/26", + //"现已接入ChatGPT, 右键和桌宠说话吧.\n已根据steamID独立创建的聊天API,调教你独属的桌宠吧", ToolTipIcon.Info); + // else + notifyIcon.ShowBalloonTip(10, "更新通知 05/26", + "新增学习打工等互动,新增开心的默认状态\n新增语音插件,请在设置中MOD管理开启", ToolTipIcon.Info); Set["SingleTips"].SetDateTime("update", DateTime.Now); } Save(); diff --git a/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs b/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs index a077dea..5313e64 100644 --- a/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs @@ -116,11 +116,11 @@ namespace VPet_Simulator.Windows responseString += "\n检测到模型错误,已重置桌宠聊天系统"; ChatGPT_Reset(); } - m.Say(responseString, GraphCore.Helper.SayType.Serious);//todo + m.SayRnd(responseString);//todo } catch (Exception exp) { - m.Say(exp.ToString(), GraphCore.Helper.SayType.Serious);//todo + m.Say(exp.ToString(), GraphCore.Helper.SayType.Serious); rettype = false; } Dispatcher.Invoke(() => this.IsEnabled = true); diff --git a/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml.cs b/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml.cs index caffc5c..91a3b42 100644 --- a/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml.cs @@ -70,7 +70,7 @@ namespace VPet_Simulator.Windows Dispatcher.Invoke(() => this.IsEnabled = false); try { - m.Say(mw.CGPTClient.Ask("vpet", content).GetMessageContent(), GraphCore.Helper.SayType.Serious); + m.SayRnd(mw.CGPTClient.Ask("vpet", content).GetMessageContent()); } catch (Exception exp) { diff --git a/VPet-Simulator.Windows/mod/0000_core/pet/vup/Study/B_4_Nomal/不眨眼不翻书4B.png_000_1250.png b/VPet-Simulator.Windows/mod/0000_core/pet/vup/Study/B_4_Nomal/不眨眼不翻书4B_000_1250.png similarity index 100% rename from VPet-Simulator.Windows/mod/0000_core/pet/vup/Study/B_4_Nomal/不眨眼不翻书4B.png_000_1250.png rename to VPet-Simulator.Windows/mod/0000_core/pet/vup/Study/B_4_Nomal/不眨眼不翻书4B_000_1250.png