diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs index b63e12b..6726657 100644 --- a/VPet-Simulator.Core/Display/MainLogic.cs +++ b/VPet-Simulator.Core/Display/MainLogic.cs @@ -36,7 +36,7 @@ namespace VPet_Simulator.Core /// 说话内容 public void Say(string text, GraphCore.Helper.SayType type = GraphCore.Helper.SayType.Shining) { - OnSay.Invoke(text); + OnSay?.Invoke(text); if (type != GraphCore.Helper.SayType.None && DisplayType == GraphCore.GraphType.Default) Display(GraphCore.Helper.Convert(type, GraphCore.Helper.AnimatType.A_Start), () => { @@ -211,7 +211,7 @@ namespace VPet_Simulator.Core /// 智能移动周期 public void SetMoveMode(bool AllowMove, bool smartMove, int SmartMoveInterval) { - MoveTimer.Enabled = false; ; + MoveTimer.Enabled = false; if (AllowMove) { MoveTimer.AutoReset = true; diff --git a/VPet-Simulator.Windows.Interface/MainPlugin.cs b/VPet-Simulator.Windows.Interface/MainPlugin.cs index d31f4ff..c99708e 100644 --- a/VPet-Simulator.Windows.Interface/MainPlugin.cs +++ b/VPet-Simulator.Windows.Interface/MainPlugin.cs @@ -11,6 +11,10 @@ namespace VPet_Simulator.Windows.Interface /// public abstract class MainPlugin { + /// + /// 通过插件名称定位插件 + /// + public abstract string PluginName { get; } /// /// 主窗体, 主程序提供的各种功能和设置等 大部分参数和调用均在这里 /// diff --git a/VPet-Simulator.Windows.Interface/Setting.cs b/VPet-Simulator.Windows.Interface/Setting.cs index b7c413b..1a8a38a 100644 --- a/VPet-Simulator.Windows.Interface/Setting.cs +++ b/VPet-Simulator.Windows.Interface/Setting.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; namespace VPet_Simulator.Windows.Interface { @@ -283,5 +284,52 @@ namespace VPet_Simulator.Windows.Interface get => this["gameconfig"].GetString("petgraph", "默认虚拟桌宠"); set => this["gameconfig"].SetString("petgraph", value); } + + /// + /// 是否记录游戏退出位置 (默认:是) + /// + public bool StartRecordLast + { + get => !this["gameconfig"].GetBool("startboot"); + set => this["gameconfig"].SetBool("startboot", !value); + } + /// + /// 记录上次退出位置 + /// + public Point StartRecordLastPoint + { + get + { + var line = FindLine("startrecordlast"); + if (line == null) + return new Point(); + return new Point(line.GetDouble("x", 0), line.GetDouble("y", 0)); + } + set + { + var line = FindorAddLine("startrecordlast"); + line.SetDouble("x", value.X); + line.SetDouble("y", value.Y); + } + } + /// + /// 设置中桌宠启动的位置 + /// + public Point StartRecordPoint + { + get + { + var line = FindLine("startrecord"); + if (line == null) + return StartRecordLastPoint; + return new Point(line.GetDouble("x", 0), line.GetDouble("y", 0)); + } + set + { + var line = FindorAddLine("startrecord"); + line.SetDouble("x", value.X); + line.SetDouble("y", value.Y); + } + } } } diff --git a/VPet-Simulator.Windows/Function/CoreMOD.cs b/VPet-Simulator.Windows/Function/CoreMOD.cs index 75d7e19..dd13e59 100644 --- a/VPet-Simulator.Windows/Function/CoreMOD.cs +++ b/VPet-Simulator.Windows/Function/CoreMOD.cs @@ -101,11 +101,11 @@ namespace VPet_Simulator.Windows { try { - var path = tmpfi.FullName; + var path = tmpfi.Name; if (LoadedDLL.Contains(path)) continue; LoadedDLL.Add(path); - Assembly dll = Assembly.LoadFrom(path); + Assembly dll = Assembly.LoadFrom(tmpfi.FullName); var v = dll.GetExportedTypes(); foreach (Type exportedType in v) { diff --git a/VPet-Simulator.Windows/MainWindow.xaml b/VPet-Simulator.Windows/MainWindow.xaml index a054274..ad4e1b9 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml +++ b/VPet-Simulator.Windows/MainWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" ShowInTaskbar="False" xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" WindowStyle="None" Title="MainWindow" Height="250" Width="250" Background="{x:Null}" Topmost="True" Closed="Window_Closed" - pu:WindowXCaption.Height="0"> + pu:WindowXCaption.Height="0" > diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 4c9859f..60dd299 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -70,12 +70,26 @@ namespace VPet_Simulator.Windows CGPTClient = ChatGPTClient.Load(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json")); //this.Width = 400 * ZoomSlider.Value; //this.Height = 450 * ZoomSlider.Value; - InitializeComponent(); this.Height = 500 * Set.ZoomLevel; this.Width = 500 * Set.ZoomLevel; + if (Set.StartRecordLast) + { + var point = Set.StartRecordLastPoint; + if (point.X != 0 || point.Y != 0) + { + this.Left = point.X; + this.Top = point.Y; + } + } + else + { + var point = Set.StartRecordPoint; + Left = point.X; Top = point.Y; + } + //不存在就关掉 var modpath = new DirectoryInfo(ModPath + @"\0000_core\pet\vup"); if (!modpath.Exists) diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml index 791e1ec..889f276 100644 --- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml +++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml @@ -41,6 +41,8 @@ + + @@ -87,9 +89,35 @@ - + Style="{DynamicResource StandardComboBoxStyle}" FontSize="16" Margin="0,2,0,3" /> + + + + + + + + + + +