From 508e4af3c059f8b7b3dc297318c0dfb85c19c8c5 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Sun, 2 Apr 2023 02:15:50 +1100 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=A3=E7=A0=81=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=9B=B8=E5=85=B3=E6=94=AF=E6=8C=81?= 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/Graph/GraphCore.cs | 3 +- .../IMainWindow.cs | 13 +++ .../ITalkBox.cs | 2 +- .../Properties/AssemblyInfo.cs | 36 ++++++ .../Setting.cs | 2 +- .../VPet-Simulator.Windows.Interface.csproj | 55 ++++++++++ .../packages.config | 4 + .../Function/Reply.mbconfig | 15 +++ VPet-Simulator.Windows/MainWindow.cs | 103 +++++++++++++++++- VPet-Simulator.Windows/MainWindow.xaml | 8 +- VPet-Simulator.Windows/MainWindow.xaml.cs | 12 +- .../VPet-Simulator.Windows.csproj | 1 + .../WinDesign/TalkBox.xaml.cs | 1 + .../WinDesign/TalkBoxAPI.xaml | 4 +- .../WinDesign/TalkBoxAPI.xaml.cs | 1 + .../WinDesign/winConsole.xaml.cs | 74 +------------ .../vup/Say/Shining/A/talkstar_007_250.png | Bin 193225 -> 0 bytes VPet.sln | 28 +++++ 19 files changed, 274 insertions(+), 90 deletions(-) create mode 100644 VPet-Simulator.Windows.Interface/IMainWindow.cs rename {VPet-Simulator.Windows/Function => VPet-Simulator.Windows.Interface}/ITalkBox.cs (86%) create mode 100644 VPet-Simulator.Windows.Interface/Properties/AssemblyInfo.cs rename {VPet-Simulator.Windows/Function => VPet-Simulator.Windows.Interface}/Setting.cs (99%) create mode 100644 VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj create mode 100644 VPet-Simulator.Windows.Interface/packages.config create mode 100644 VPet-Simulator.Windows/Function/Reply.mbconfig delete mode 100644 VPet-Simulator.Windows/mod/0000_core/pet/vup/Say/Shining/A/talkstar_007_250.png diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs index 1e78c7d..a11f26a 100644 --- a/VPet-Simulator.Core/Display/MainLogic.cs +++ b/VPet-Simulator.Core/Display/MainLogic.cs @@ -28,7 +28,7 @@ namespace VPet_Simulator.Core /// 说话 /// /// 说话内容 - public void Say(string text, GraphCore.Helper.SayType type) + public void Say(string text, GraphCore.Helper.SayType type = GraphCore.Helper.SayType.Shining) { if (type != GraphCore.Helper.SayType.None && DisplayType == GraphCore.GraphType.Default) Display(GraphCore.Helper.Convert(type, GraphCore.Helper.AnimatType.A_Start), () => diff --git a/VPet-Simulator.Core/Graph/GraphCore.cs b/VPet-Simulator.Core/Graph/GraphCore.cs index 4f1bacc..ebead78 100644 --- a/VPet-Simulator.Core/Graph/GraphCore.cs +++ b/VPet-Simulator.Core/Graph/GraphCore.cs @@ -529,7 +529,8 @@ namespace VPet_Simulator.Core None, Default, Serious, - Shining + Shining, + Error } public static GraphType Convert(SayType sayType, AnimatType type) { diff --git a/VPet-Simulator.Windows.Interface/IMainWindow.cs b/VPet-Simulator.Windows.Interface/IMainWindow.cs new file mode 100644 index 0000000..9d2a0c7 --- /dev/null +++ b/VPet-Simulator.Windows.Interface/IMainWindow.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VPet_Simulator.Windows.Interface +{ + public interface IMainWindow + { + + } +} diff --git a/VPet-Simulator.Windows/Function/ITalkBox.cs b/VPet-Simulator.Windows.Interface/ITalkBox.cs similarity index 86% rename from VPet-Simulator.Windows/Function/ITalkBox.cs rename to VPet-Simulator.Windows.Interface/ITalkBox.cs index f5847ca..ec82f2b 100644 --- a/VPet-Simulator.Windows/Function/ITalkBox.cs +++ b/VPet-Simulator.Windows.Interface/ITalkBox.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; -namespace VPet_Simulator.Windows +namespace VPet_Simulator.Windows.Interface { public interface ITalkBox { diff --git a/VPet-Simulator.Windows.Interface/Properties/AssemblyInfo.cs b/VPet-Simulator.Windows.Interface/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..adbe26d --- /dev/null +++ b/VPet-Simulator.Windows.Interface/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("VPet-Simulator.Windows.Interface")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("VPet-Simulator.Windows.Interface")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("dcad838a-1a02-4bdf-962c-fd47c6006d28")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/VPet-Simulator.Windows/Function/Setting.cs b/VPet-Simulator.Windows.Interface/Setting.cs similarity index 99% rename from VPet-Simulator.Windows/Function/Setting.cs rename to VPet-Simulator.Windows.Interface/Setting.cs index 654f7c5..b7c413b 100644 --- a/VPet-Simulator.Windows/Function/Setting.cs +++ b/VPet-Simulator.Windows.Interface/Setting.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace VPet_Simulator.Windows +namespace VPet_Simulator.Windows.Interface { public class Setting : LpsDocument { diff --git a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj new file mode 100644 index 0000000..6ff885a --- /dev/null +++ b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj @@ -0,0 +1,55 @@ + + + + + Debug + AnyCPU + {DCAD838A-1A02-4BDF-962C-FD47C6006D28} + Library + Properties + VPet_Simulator.Windows.Interface + VPet-Simulator.Windows.Interface + v4.6.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\LinePutScript.1.6.1\lib\net462\LinePutScript.dll + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/VPet-Simulator.Windows.Interface/packages.config b/VPet-Simulator.Windows.Interface/packages.config new file mode 100644 index 0000000..a12e310 --- /dev/null +++ b/VPet-Simulator.Windows.Interface/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/VPet-Simulator.Windows/Function/Reply.mbconfig b/VPet-Simulator.Windows/Function/Reply.mbconfig new file mode 100644 index 0000000..93fba67 --- /dev/null +++ b/VPet-Simulator.Windows/Function/Reply.mbconfig @@ -0,0 +1,15 @@ +{ + "Scenario": "TextClassification", + "Environment": { + "Type": "LocalCPU", + "Version": 1 + }, + "Type": "TrainingConfig", + "Version": 4, + "TrainingOption": { + "Version": 0, + "Type": "TextClassficationTrainingOption", + "TrainingTime": 0, + "Seed": 0 + } +} \ No newline at end of file diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 8a55a53..f7f17ef 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -7,11 +7,14 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Controls; using VPet_Simulator.Core; +using VPet_Simulator.Windows.Interface; +using ToolBar = VPet_Simulator.Core.ToolBar; namespace VPet_Simulator.Windows { - public partial class MainWindow + public partial class MainWindow : IMainWindow { public readonly string ModPath = Environment.CurrentDirectory + @"\mod"; public readonly bool IsSteamUser; @@ -46,7 +49,7 @@ namespace VPet_Simulator.Windows File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps", Set.ToString()); if (Core != null && Core.Save != null) File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", Core.Save.ToLine().ToString()); - if(CGPTClient != null) + if (CGPTClient != null) File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json", CGPTClient.Save()); } public void LoadDIY() @@ -57,7 +60,7 @@ namespace VPet_Simulator.Windows } public static void RunDIY(string content) { - if(content.Contains("://") || content.Contains(@":\")) + if (content.Contains("://") || content.Contains(@":\")) { Process.Start(content); } @@ -66,5 +69,99 @@ namespace VPet_Simulator.Windows System.Windows.Forms.SendKeys.SendWait(content); } } + + public void RunAction(string action) + { + switch (action) + { + case "DisplayNomal": + Main.DisplayNomal(); + break; + case "DisplayTouchHead": + Main.DisplayTouchHead(); + break; + case "DisplayTouchBody": + Main.DisplayTouchBody(); + break; + case "DisplayBoring": + Main.DisplayBoring(); + break; + case "DisplaySquat": + Main.DisplaySquat(); + break; + case "DisplaySleep": + Main.DisplaySleep(); + break; + case "DisplayRaised": + Main.DisplayRaised(); + break; + case "DisplayFalled_Left": + Main.DisplayFalled_Left(); + break; + case "DisplayFalled_Right": + Main.DisplayFalled_Right(); + break; + case "DisplayWalk": + if (Function.Rnd.Next(2) == 0) + Main.DisplayWalk_Left(); + else + Main.DisplayWalk_Right(); + break; + case "DisplayWalk_Left": + Main.DisplayWalk_Left(); + break; + case "DisplayWalk_Right": + Main.DisplayWalk_Right(); + break; + case "DisplayCrawl": + if (Function.Rnd.Next(2) == 0) + Main.DisplayCrawl_Left(); + else + Main.DisplayCrawl_Right(); + break; + case "DisplayCrawl_Left": + Main.DisplayCrawl_Left(); + break; + case "DisplayCrawl_Right": + Main.DisplayCrawl_Right(); + break; + case "DisplayClimb_Left_UP": + Main.DisplayClimb_Left_UP(); + break; + case "DisplayClimb_Left_DOWN": + Main.DisplayClimb_Left_DOWN(); + break; + case "DisplayClimb_Right_UP": + Main.DisplayClimb_Right_UP(); + break; + case "DisplayClimb_Right_DOWN": + Main.DisplayClimb_Right_DOWN(); + break; + case "DisplayClimb_Top_Right": + Main.DisplayClimb_Top_Right(); + break; + case "DisplayClimb_Top_Left": + Main.DisplayClimb_Top_Left(); + break; + case "DisplayFall": + if (Function.Rnd.Next(2) == 0) + Main.DisplayFall_Left(); + else + Main.DisplayFall_Right(); + break; + case "DisplayFall_Left": + Main.DisplayFall_Left(); + break; + case "DisplayFall_Right": + Main.DisplayFall_Right(); + break; + case "DisplayIdel_StateONE": + Main.DisplayIdel_StateONE(); + break; + case "DisplayIdel_StateTWO": + Main.DisplayIdel_StateTWO(); + break; + } + } } } diff --git a/VPet-Simulator.Windows/MainWindow.xaml b/VPet-Simulator.Windows/MainWindow.xaml index 9783532..a054274 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml +++ b/VPet-Simulator.Windows/MainWindow.xaml @@ -1,9 +1,11 @@ - + Height="250" Width="250" Background="{x:Null}" Topmost="True" Closed="Window_Closed" + pu:WindowXCaption.Height="0"> @@ -12,4 +14,4 @@ Content="桌宠加载中" /> - + diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 2cb0342..015063f 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -16,13 +16,15 @@ using LinePutScript; using System.Diagnostics; using ChatGPT.API.Framework; using static VPet_Simulator.Core.GraphCore; +using Panuon.WPF.UI; +using VPet_Simulator.Windows.Interface; namespace VPet_Simulator.Windows { /// /// MainWindow.xaml 的交互逻辑 /// - public partial class MainWindow : Window + public partial class MainWindow : WindowX { private NotifyIcon notifyIcon; public System.Timers.Timer AutoSaveTimer = new System.Timers.Timer(); @@ -160,7 +162,7 @@ namespace VPet_Simulator.Windows Dispatcher.Invoke(new Action(() => LoadingText.Content = $"尝试加载 MOD数据: {di.Name}")); CoreMODs.Add(new CoreMOD(di, this)); } - Dispatcher.Invoke(new Action(() => LoadingText.Content = "尝试加载游戏内容")); + Dispatcher.Invoke(new Action(() => LoadingText.Content = "尝试加载游戏存档")); //加载游戏内容 Core.Controller = new MWController(this); @@ -182,7 +184,7 @@ namespace VPet_Simulator.Windows LoadingText.Content = "尝试加载动画和生成缓存"; var pl = Pets.Find(x => x.Name == Set.PetGraph); Core.Graph = pl == null ? Pets[0].Graph() : pl.Graph(); - LoadingText.Content = "正在加载游戏"; + LoadingText.Content = "正在加载CGPT"; winSetting = new winGameSetting(this); Main = new Main(Core) { }; @@ -191,12 +193,12 @@ namespace VPet_Simulator.Windows TalkBox = new TalkBox(this); Main.ToolBar.MainGrid.Children.Add(TalkBox.This); } - else if (Set["CGPT"][(gbol)"enable"] && !IsSteamUser) + else if (Set["CGPT"][(gbol)"enable"]) { TalkBox = new TalkBoxAPI(this); Main.ToolBar.MainGrid.Children.Add(TalkBox.This); } - + LoadingText.Content = "正在加载游戏"; Main.DefaultClickAction = () => { if (new TimeSpan(DateTime.Now.Ticks - lastclicktime).TotalSeconds > 20) diff --git a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj index 7fa18dc..0547df6 100644 --- a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj +++ b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj @@ -222,6 +222,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator diff --git a/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs b/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs index c9460ee..0488fef 100644 --- a/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/TalkBox.xaml.cs @@ -23,6 +23,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using VPet_Simulator.Core; +using VPet_Simulator.Windows.Interface; using Timer = System.Timers.Timer; namespace VPet_Simulator.Windows diff --git a/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml b/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml index cb97ba2..52b8ba0 100644 --- a/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml +++ b/VPet-Simulator.Windows/WinDesign/TalkBoxAPI.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Height="500" Width="500"> - @@ -15,7 +15,7 @@