diff --git a/VPet-Simulator.Windows.Interface/IMainWindow.cs b/VPet-Simulator.Windows.Interface/IMainWindow.cs
index 37f3e7e..d4db6fc 100644
--- a/VPet-Simulator.Windows.Interface/IMainWindow.cs
+++ b/VPet-Simulator.Windows.Interface/IMainWindow.cs
@@ -27,7 +27,7 @@ namespace VPet_Simulator.Windows.Interface
///
/// 游戏设置
///
- Setting Set { get; }
+ ISetting Set { get; }
///
/// 宠物加载器列表
///
diff --git a/VPet-Simulator.Windows.Interface/ISetting.cs b/VPet-Simulator.Windows.Interface/ISetting.cs
new file mode 100644
index 0000000..19adfc7
--- /dev/null
+++ b/VPet-Simulator.Windows.Interface/ISetting.cs
@@ -0,0 +1,206 @@
+using LinePutScript;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace VPet_Simulator.Windows.Interface
+{
+ ///
+ /// 设置方法接口
+ ///
+ public interface ISetting
+ {
+ ///
+ /// 获取当前缩放倍率
+ ///
+ double ZoomLevel { get; }
+
+ ///
+ /// 设置缩放倍率
+ ///
+ /// 缩放等级
+ void SetZoomLevel(double level);
+
+ ///
+ /// 获取当前播放声音的大小
+ ///
+ double VoiceVolume { get; }
+
+ ///
+ /// 设置播放声音的大小
+ ///
+ /// 声音大小
+ void SetVoiceVolume(double volume);
+
+ ///
+ /// 获取当前自动保存的频率(分钟)
+ ///
+ int AutoSaveInterval { get; }
+
+ ///
+ /// 设置自动保存的频率(分钟)
+ ///
+ /// 保存间隔
+ void SetAutoSaveInterval(int interval);
+
+ ///
+ /// 获取或设置备份保存的最大数量
+ ///
+ int BackupSaveMaxNum { get; set; }
+
+ ///
+ /// 获取当前是否置于顶层
+ ///
+ bool TopMost { get; }
+
+ ///
+ /// 设置是否置于顶层
+ ///
+ /// 是否置顶
+ void SetTopMost(bool topMost);
+
+ ///
+ /// 获取或设置上次清理缓存的日期
+ ///
+ DateTime LastCacheDate { get; set; }
+
+ ///
+ /// 获取当前语言
+ ///
+ string Language { get; }
+
+ ///
+ /// 设置语言
+ ///
+ /// 语言代码
+ void SetLanguage(string language);
+
+ ///
+ /// 获取或设置按多久视为长按(毫秒)
+ ///
+ int PressLength { get; set; }
+
+ ///
+ /// 获取或设置互动周期
+ ///
+ int InteractionCycle { get; set; }
+
+ ///
+ /// 获取当前计算间隔(秒)
+ ///
+ double LogicInterval { get; }
+
+ ///
+ /// 设置计算间隔(秒)
+ ///
+ /// 计算间隔
+ void SetLogicInterval(double interval);
+
+ ///
+ /// 获取当前是否允许移动
+ ///
+ bool AllowMove { get; }
+
+ ///
+ /// 设置是否允许移动
+ ///
+ /// 是否允许移动
+ void SetAllowMove(bool allowMove);
+
+ ///
+ /// 获取当前是否启用智能移动
+ ///
+ bool SmartMove { get; }
+
+ ///
+ /// 设置是否启用智能移动
+ ///
+ /// 是否启用智能移动
+ void SetSmartMove(bool smartMove);
+
+ ///
+ /// 获取当前是否启用计算等数据功能
+ ///
+ bool EnableFunction { get; }
+
+ ///
+ /// 设置是否启用计算等数据功能
+ ///
+ /// 是否启用功能
+ void SetEnableFunction(bool enableFunction);
+
+ ///
+ /// 获取当前智能移动周期(秒)
+ ///
+ int SmartMoveInterval { get; }
+
+ ///
+ /// 设置智能移动周期(秒)
+ ///
+ /// 智能移动周期
+ void SetSmartMoveInterval(int interval);
+
+ ///
+ /// 获取或设置消息框是否外置
+ ///
+ bool MessageBarOutside { get; set; }
+
+ ///
+ /// 获取当前是否记录游戏退出位置
+ ///
+ bool StartRecordLast { get; set; }
+
+ ///
+ /// 获取上次退出位置
+ ///
+ Point StartRecordLastPoint { get; }
+
+ ///
+ /// 获取或设置桌宠启动的位置
+ ///
+ Point StartRecordPoint { get; set; }
+
+ ///
+ /// 获取或设置当实时播放音量达到该值时运行音乐动作
+ ///
+ double MusicCatch { get; set; }
+
+ ///
+ /// 获取或设置当实时播放音量达到该值时运行特殊音乐动作
+ ///
+ double MusicMax { get; set; }
+
+ ///
+ /// 获取或设置桌宠图形渲染的分辨率,越高图形越清晰,重启后生效
+ ///
+ int Resolution { get; set; }
+
+ ///
+ /// 获取或设置是否允许桌宠自动购买食品
+ ///
+ bool AutoBuy { get; set; }
+
+ ///
+ /// 获取或设置是否允许桌宠自动购买礼物
+ ///
+ bool AutoGift { get; set; }
+
+ ///
+ /// 获取或设置在任务切换器(Alt+Tab)中是否隐藏窗口,重启后生效
+ ///
+ bool HideFromTaskControl { get; set; }
+
+ ///
+ /// 更好买数据
+ ///
+ ILine BetterBuyData { get; }
+ ///
+ /// 游戏数据
+ ///
+ ILine GameData { get; }
+ }
+
+}
diff --git a/VPet-Simulator.Windows.Interface/Mod/Food.cs b/VPet-Simulator.Windows.Interface/Mod/Food.cs
index cecf865..fe2f576 100644
--- a/VPet-Simulator.Windows.Interface/Mod/Food.cs
+++ b/VPet-Simulator.Windows.Interface/Mod/Food.cs
@@ -171,7 +171,7 @@ namespace VPet_Simulator.Windows.Interface
public void LoadImageSource(IMainWindow imw)
{
ImageSource = imw.ImageSources.FindImage(Image ?? Name, "food");
- Star = imw.Set["betterbuy"]["star"].GetInfos().Contains(Name);
+ Star = imw.Set.BetterBuyData["star"].GetInfos().Contains(Name);
LoadEatTimeSource(imw);
}
public void LoadEatTimeSource(IMainWindow imw)
diff --git a/VPet-Simulator.Windows.Interface/Setting.cs b/VPet-Simulator.Windows/Function/Setting.cs
similarity index 83%
rename from VPet-Simulator.Windows.Interface/Setting.cs
rename to VPet-Simulator.Windows/Function/Setting.cs
index cc27149..55959c4 100644
--- a/VPet-Simulator.Windows.Interface/Setting.cs
+++ b/VPet-Simulator.Windows/Function/Setting.cs
@@ -1,21 +1,29 @@
using LinePutScript;
using LinePutScript.Dictionary;
+using LinePutScript.Localization.WPF;
+using NAudio.Gui;
+using Steamworks;
using System;
using System.Collections.ObjectModel;
+using System.IO;
using System.Windows;
+using System.Windows.Controls;
using VPet_Simulator.Core;
+using VPet_Simulator.Windows.Interface;
+using static VPet_Simulator.Windows.Win32;
-namespace VPet_Simulator.Windows.Interface
+namespace VPet_Simulator.Windows
{
///
/// 游戏设置
///
- public class Setting : LPS_D
+ public class Setting : LPS_D, ISetting
{
+ MainWindow mw;
///
/// 游戏设置
///
- public Setting(string lps) : base(lps)
+ public Setting(MainWindow mw, string lps) : base(lps)
{
var line = FindLine("zoomlevel");
if (line == null)
@@ -33,41 +41,12 @@ namespace VPet_Simulator.Windows.Interface
allowmove = !this["gameconfig"].GetBool("allowmove");
smartmove = this["gameconfig"].GetBool("smartmove");
enablefunction = !this["gameconfig"].GetBool("nofunction");
- //Statistics_OLD = new Statistics(this["statistics"].ToList());
autobuy = this["gameconfig"].GetBool("autobuy");
autogift = this["gameconfig"].GetBool("autogift");
+ this.mw = mw;
}
- //public override string ToString()
- //{//留作备份,未来版本删了
- // this["statistics"] = new Line("statistics", "", "", Statistics_OLD.ToSubs().ToArray());
- // return base.ToString();
- //}
- /////
- ///// 统计数据信息(旧)
- /////
- //public Statistics Statistics_OLD;
-
- //public Size WindowsSize
- //{
- // get
- // {
- // var line = FindLine("windowssize");
- // if (line == null)
- // return new Size(1366, 799);
- // var strs = line.GetInfos();
- // if (int.TryParse(strs[0], out int x))
- // x = 1366;
- // if (int.TryParse(strs[0], out int y))
- // y = 799;
- // return new Size(x, y);
- // }
- // set
- // {
- // FindorAddLine("windowssize").info = $"{value.Width},{value.Height}";
- // }
- //}
private double zoomlevel = 0;
///
/// 缩放倍率
@@ -513,5 +492,85 @@ namespace VPet_Simulator.Windows.Interface
line.SetInt("h", value.Height);
}
}
+
+ public ILine BetterBuyData => FindorAddLine("betterbuy");
+
+ public ILine GameData => FindorAddLine("gamedata");
+
+ public void SetZoomLevel(double level) => mw.SetZoomLevel(level);
+
+ public void SetVoiceVolume(double volume) { VoiceVolume = volume; mw.Main.PlayVoiceVolume = volume; }
+
+ public void SetAutoSaveInterval(int interval)
+ {
+ AutoSaveInterval = interval;
+ if (AutoSaveInterval > 0)
+ {
+ mw.AutoSaveTimer.Interval = AutoSaveInterval * 60000;
+ mw.AutoSaveTimer.Start();
+ }
+ else
+ {
+ mw.AutoSaveTimer.Stop();
+ }
+ }
+
+ public void SetTopMost(bool topMost)
+ {
+ TopMost = true;
+ mw.Topmost = topMost;
+ }
+
+ public void SetLanguage(string language)
+ {
+ var petloader = mw.Pets.Find(x => x.Name == PetGraph);
+ petloader ??= mw.Pets[0];
+ bool ischangename = mw.Core.Save.Name == petloader.PetName.Translate();
+ LocalizeCore.LoadCulture(language);
+ Language = LocalizeCore.CurrentCulture;
+ if (ischangename)
+ {
+ mw.Core.Save.Name = petloader.PetName.Translate();
+ if (mw.IsSteamUser)
+ SteamFriends.SetRichPresence("username", mw.Core.Save.Name);
+ }
+ }
+
+ public void SetLogicInterval(double interval)
+ {
+ LogicInterval = interval;
+ mw.Main.SetLogicInterval((int)(interval * 1000));
+ }
+
+ public void SetAllowMove(bool allowMove)
+ {
+ AllowMove = allowMove;
+ mw.Main.SetMoveMode(AllowMove, SmartMove, SmartMoveInterval * 1000);
+ }
+
+ public void SetSmartMove(bool smartMove)
+ {
+ SmartMove = smartMove;
+ mw.Main.SetMoveMode(AllowMove, SmartMove, SmartMoveInterval * 1000);
+ }
+
+ public void SetEnableFunction(bool enableFunction)
+ {
+ EnableFunction = enableFunction;
+ if (!enableFunction)
+ {
+ if (mw.Main.State != Main.WorkingState.Nomal)
+ {
+ mw.Main.WorkTimer.Visibility = Visibility.Collapsed;
+ mw.Main.State = Main.WorkingState.Nomal;
+ }
+ }
+ }
+
+ public void SetSmartMoveInterval(int interval)
+ {
+ SmartMoveInterval = interval;
+ mw.Main.SetMoveMode(AllowMove, SmartMove, SmartMoveInterval * 1000);
+ }
}
}
diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs
index 0ef00fc..f052e33 100644
--- a/VPet-Simulator.Windows/MainWindow.cs
+++ b/VPet-Simulator.Windows/MainWindow.cs
@@ -63,6 +63,8 @@ namespace VPet_Simulator.Windows
}
}
public Setting Set { get; set; }
+ ISetting IMainWindow.Set => Set;
+
public List Pets { get; set; } = new List();
public List CoreMODs = new List();
public GameCore Core { get; set; } = new GameCore();
@@ -1121,6 +1123,7 @@ namespace VPet_Simulator.Windows
return TalkAPI[TalkAPIIndex];
}
}
+
///
/// 移除所有聊天对话框
///
@@ -1176,10 +1179,10 @@ namespace VPet_Simulator.Windows
//加载游戏设置
if (new FileInfo(ExtensionValue.BaseDirectory + @$"\Setting{PrefixSave}.lps").Exists)
{
- Set = new Setting(File.ReadAllText(ExtensionValue.BaseDirectory + @$"\Setting{PrefixSave}.lps"));
+ Set = new Setting(this,File.ReadAllText(ExtensionValue.BaseDirectory + @$"\Setting{PrefixSave}.lps"));
}
else
- Set = new Setting("Setting#VPET:|\n");
+ Set = new Setting(this, "Setting#VPET:|\n");
var visualTree = new FrameworkElementFactory(typeof(Border));
visualTree.SetValue(Border.BackgroundProperty, new TemplateBindingExtension(BackgroundProperty));
@@ -1506,6 +1509,11 @@ namespace VPet_Simulator.Windows
Main = new Main(Core);
Main.NoFunctionMOD = Set.CalFunState;
+ //清空资源
+ Main.Resources = Application.Current.Resources;
+ Main.MsgBar.Resources = Application.Current.Resources;
+ Main.ToolBar.Resources = Application.Current.Resources;
+
//加载主题:
LoadTheme(Set.Theme);
//加载字体
diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
index 0848d55..92778fa 100644
--- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
+++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
@@ -509,16 +509,7 @@ namespace VPet_Simulator.Windows
{
if (!AllowChange)
return;
- mw.Set.AutoSaveInterval = (int)((ComboBoxItem)CBAutoSave.SelectedItem).Tag;
- if (mw.Set.AutoSaveInterval > 0)
- {
- mw.AutoSaveTimer.Interval = mw.Set.AutoSaveInterval * 60000;
- mw.AutoSaveTimer.Start();
- }
- else
- {
- mw.AutoSaveTimer.Stop();
- }
+ mw.Set.SetAutoSaveInterval((int)((ComboBoxItem)CBAutoSave.SelectedItem).Tag);
}
@@ -808,8 +799,6 @@ namespace VPet_Simulator.Windows
if (!AllowChange)
return;
mw.SetZoomLevel(ZoomSlider.Value / 2);
- //this.Width = 400 * Math.Sqrt(ZoomSlider.Value);
- //this.Height = 450 * Math.Sqrt(ZoomSlider.Value);
}
private void PressLengthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
@@ -884,8 +873,7 @@ namespace VPet_Simulator.Windows
{
if (!AllowChange)
return;
- mw.Set.LogicInterval = CalSlider.Value;
- mw.Main.SetLogicInterval((int)(CalSlider.Value * 1000));
+ mw.Set.SetLogicInterval(CalSlider.Value);
CalTimeInteraction();
}
@@ -893,32 +881,24 @@ namespace VPet_Simulator.Windows
{
if (!AllowChange)
return;
- mw.Set.AllowMove = MoveEventBox.IsChecked == true;
- SetSmartMove();
+ mw.Set.SetAllowMove(MoveEventBox.IsChecked == true);
}
private void SmartMoveEventBox_Checked(object sender, RoutedEventArgs e)
{
if (!AllowChange)
return;
- mw.Set.SmartMove = SmartMoveEventBox.IsChecked == true;
- SetSmartMove();
+ mw.Set.SetSmartMove(SmartMoveEventBox.IsChecked == true);
}
private void CBSmartMove_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!AllowChange)
return;
- mw.Set.SmartMoveInterval = (int)((ComboBoxItem)CBSmartMove.SelectedItem).Tag;
- SetSmartMove();
- }
- public void SetSmartMove()
- {
- if (!AllowChange)
- return;
- mw.Main.SetMoveMode(mw.Set.AllowMove, mw.Set.SmartMove, mw.Set.SmartMoveInterval * 1000);
+ mw.Set.SetSmartMoveInterval((int)((ComboBoxItem)CBSmartMove.SelectedItem).Tag);
}
+
public void GenStartUP()
{
mw.Set["v"][(gbol)"newverstartup"] = true;
@@ -1383,18 +1363,8 @@ namespace VPet_Simulator.Windows
{
if (!AllowChange)
return;
- var petloader = mw.Pets.Find(x => x.Name == mw.Set.PetGraph);
- petloader ??= mw.Pets[0];
- bool ischangename = mw.Core.Save.Name == petloader.PetName.Translate();
- LocalizeCore.LoadCulture((string)LanguageBox.SelectedItem);
- mw.Set.Language = LocalizeCore.CurrentCulture;
- if (ischangename)
- {
- mw.Core.Save.Name = petloader.PetName.Translate();
- TextBoxPetName.Text = mw.Core.Save.Name;
- if (mw.IsSteamUser)
- SteamFriends.SetRichPresence("username", mw.Core.Save.Name);
- }
+ mw.Set.SetLanguage((string)LanguageBox.SelectedItem);
+ TextBoxPetName.Text = mw.Core.Save.Name;
}
private void MainTab_SelectionChanged(object sender, SelectionChangedEventArgs e)
diff --git a/VPet.Solution/Models/SettingEditor/DiagnosticSettingModel.cs b/VPet.Solution/Models/SettingEditor/DiagnosticSettingModel.cs
index b070ba9..3daa7e6 100644
--- a/VPet.Solution/Models/SettingEditor/DiagnosticSettingModel.cs
+++ b/VPet.Solution/Models/SettingEditor/DiagnosticSettingModel.cs
@@ -6,6 +6,7 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using VPet_Simulator.Windows;
using VPet_Simulator.Windows.Interface;
namespace VPet.Solution.Models.SettingEditor;
@@ -31,7 +32,7 @@ public class DiagnosticSettingModel : ObservableClass
///
/// 是否启用数据收集
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.Diagnosis))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Diagnosis))]
public bool Diagnosis
{
get => _diagnosis;
@@ -46,7 +47,7 @@ public class DiagnosticSettingModel : ObservableClass
/// 数据收集频率
///
[DefaultValue(500)]
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.DiagnosisInterval))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.DiagnosisInterval))]
public int DiagnosisInterval
{
get => _diagnosisInterval;
diff --git a/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs b/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs
index a43e136..9c76811 100644
--- a/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs
+++ b/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs
@@ -3,6 +3,7 @@ using LinePutScript.Localization.WPF;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
+using VPet_Simulator.Windows;
namespace VPet.Solution.Models.SettingEditor;
@@ -15,7 +16,7 @@ public class GraphicsSettingModel : ObservableClass
/// 缩放倍率
///
[DefaultValue(1)]
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.ZoomLevel))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.ZoomLevel))]
public double ZoomLevel
{
get => _zoomLevel;
@@ -48,7 +49,7 @@ public class GraphicsSettingModel : ObservableClass
/// 桌宠图形渲染的分辨率,越高图形越清晰
///
[DefaultValue(1000)]
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.Resolution))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Resolution))]
public int Resolution
{
get => _resolution;
@@ -62,7 +63,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 是否为更大的屏幕
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.IsBiggerScreen))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.IsBiggerScreen))]
public bool IsBiggerScreen
{
get => _isBiggerScreen;
@@ -83,7 +84,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 是否置于顶层
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.TopMost))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.TopMost))]
public bool TopMost
{
get => _topMost;
@@ -97,7 +98,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 是否鼠标穿透
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.HitThrough))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.HitThrough))]
public bool HitThrough
{
get => _hitThrough;
@@ -111,7 +112,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 语言
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.Language))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Language))]
public string Language
{
get => _language;
@@ -128,7 +129,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 字体
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.Font))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Font))]
public string Font
{
get => _font;
@@ -142,7 +143,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 主题
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.Theme))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Theme))]
public string Theme
{
get => _theme;
@@ -156,7 +157,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 开机启动
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.StartUPBoot))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.StartUPBoot))]
public bool StartUPBoot
{
get => _startUPBoot;
@@ -170,7 +171,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 开机启动 Steam
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.StartUPBootSteam))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.StartUPBootSteam))]
public bool StartUPBootSteam
{
get => _startUPBootSteam;
@@ -185,7 +186,7 @@ public class GraphicsSettingModel : ObservableClass
/// 是否记录游戏退出位置
///
[DefaultValue(true)]
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.StartRecordLast))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.StartRecordLast))]
public bool StartRecordLast
{
get => _startRecordLast;
@@ -224,7 +225,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 在任务切换器(Alt+Tab)中隐藏窗口
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.HideFromTaskControl))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.HideFromTaskControl))]
public bool HideFromTaskControl
{
get => _hideFromTaskControl;
@@ -238,7 +239,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 消息框外置
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MessageBarOutside))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.MessageBarOutside))]
public bool MessageBarOutside
{
get => _messageBarOutside;
@@ -252,7 +253,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 是否显示宠物帮助窗口
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelper))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetHelper))]
public bool PetHelper
{
get => _petHelper;
@@ -268,7 +269,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 快捷穿透按钮X坐标
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelpLeft))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetHelpLeft))]
public double PetHelpLeft
{
get => _petHelpLeft;
@@ -284,7 +285,7 @@ public class GraphicsSettingModel : ObservableClass
///
/// 快捷穿透按钮Y坐标
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelpTop))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetHelpTop))]
public double PetHelpTop
{
get => _petHelpTop;
diff --git a/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs b/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs
index 74e1c1b..e5b56f3 100644
--- a/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs
+++ b/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs
@@ -14,7 +14,7 @@ public class InteractiveSettingModel : ObservableClass
/////
///// 宠物名称
/////
- //[ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetName))]
+ //[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetName))]
//public string PetName
//{
// get => _petName;
@@ -28,7 +28,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 播放声音大小
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.VoiceVolume))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.VoiceVolume))]
public double VoiceVolume
{
get => _voiceVolume;
@@ -42,7 +42,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 启用计算等数据功能
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.EnableFunction))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.EnableFunction))]
public bool EnableFunction
{
get => _enableFunction;
@@ -56,7 +56,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 非计算模式下默认模式
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.CalFunState))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.CalFunState))]
public IGameSave.ModeType CalFunState
{
get => _calFunState;
@@ -73,7 +73,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 上次清理缓存日期
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.LastCacheDate))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.LastCacheDate))]
public DateTime LastCacheDate
{
get => _lastCacheDate;
@@ -87,7 +87,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 储存顺序次数
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.SaveTimes))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.SaveTimes))]
public int SaveTimes
{
get => _saveTimes;
@@ -101,7 +101,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 按多久视为长按 单位毫秒
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PressLength))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PressLength))]
public int PressLength
{
get => _pressLength;
@@ -115,7 +115,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 互动周期
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.InteractionCycle))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.InteractionCycle))]
public int InteractionCycle
{
get => _interactionCycle;
@@ -129,7 +129,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 计算间隔 (秒)
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.LogicInterval))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.LogicInterval))]
public double LogicInterval
{
get => _logicInterval;
@@ -143,7 +143,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 允许移动事件
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.AllowMove))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AllowMove))]
public bool AllowMove
{
get => _allowMove;
@@ -157,7 +157,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 智能移动
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.SmartMove))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.SmartMove))]
public bool SmartMove
{
get => _smartMove;
@@ -172,7 +172,7 @@ public class InteractiveSettingModel : ObservableClass
/// 智能移动周期 (秒)
///
[DefaultValue(1)]
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.SmartMoveInterval))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.SmartMoveInterval))]
[ReflectionPropertyConverter(typeof(SecondToMinuteConverter))]
public int SmartMoveInterval
{
@@ -190,7 +190,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 桌宠选择内容
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetGraph))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetGraph))]
public string PetGraph
{
get => _petGraph;
@@ -204,7 +204,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 当实时播放音量达到该值时运行音乐动作
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MusicCatch))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.MusicCatch))]
[ReflectionPropertyConverter(typeof(PercentageConverter))]
public int MusicCatch
{
@@ -219,7 +219,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 当实时播放音量达到该值时运行特殊音乐动作
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MusicMax))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.MusicMax))]
[ReflectionPropertyConverter(typeof(PercentageConverter))]
public int MusicMax
{
@@ -235,7 +235,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 允许桌宠自动购买食品
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.AutoBuy))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AutoBuy))]
public bool AutoBuy
{
get => _autoBuy;
@@ -250,7 +250,7 @@ public class InteractiveSettingModel : ObservableClass
///
/// 允许桌宠自动购买礼物
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.AutoGift))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AutoGift))]
public bool AutoGift
{
get => _autoGift;
@@ -261,7 +261,7 @@ public class InteractiveSettingModel : ObservableClass
#region MoveAreaDefault
private bool _moveAreaDefault;
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MoveAreaDefault))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.MoveAreaDefault))]
public bool MoveAreaDefault
{
get => _moveAreaDefault;
@@ -272,7 +272,7 @@ public class InteractiveSettingModel : ObservableClass
#region MoveArea
private System.Drawing.Rectangle _moveArea;
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MoveArea))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.MoveArea))]
public System.Drawing.Rectangle MoveArea
{
get => _moveArea;
diff --git a/VPet.Solution/Models/SettingEditor/ModSettingModel.cs b/VPet.Solution/Models/SettingEditor/ModSettingModel.cs
index 98eac13..76d2a7a 100644
--- a/VPet.Solution/Models/SettingEditor/ModSettingModel.cs
+++ b/VPet.Solution/Models/SettingEditor/ModSettingModel.cs
@@ -10,7 +10,7 @@ using HKW.HKWUtils.Observable;
using LinePutScript;
using LinePutScript.Localization.WPF;
using VPet.Solution.Views.SettingEditor;
-using VPet_Simulator.Windows.Interface;
+using VPet_Simulator.Windows;
namespace VPet.Solution.Models.SettingEditor;
diff --git a/VPet.Solution/Models/SettingEditor/SettingModel.cs b/VPet.Solution/Models/SettingEditor/SettingModel.cs
index 361e034..9374628 100644
--- a/VPet.Solution/Models/SettingEditor/SettingModel.cs
+++ b/VPet.Solution/Models/SettingEditor/SettingModel.cs
@@ -7,7 +7,7 @@ using HKW.HKWUtils.Observable;
using LinePutScript;
using LinePutScript.Localization.WPF;
using VPet.Solution.Properties;
-using VPet_Simulator.Windows.Interface;
+using VPet_Simulator.Windows;
namespace VPet.Solution.Models.SettingEditor;
@@ -97,7 +97,7 @@ public class SettingModel : ObservableClass
private readonly ReflectionOptions _saveReflectionOptions = new() { CheckValueEquals = true };
public SettingModel()
- : this(new("")) { }
+ : this(new(null, "")) { }
public SettingModel(Setting setting)
{
diff --git a/VPet.Solution/Models/SettingEditor/SystemSettingModel.cs b/VPet.Solution/Models/SettingEditor/SystemSettingModel.cs
index 87b974a..c078855 100644
--- a/VPet.Solution/Models/SettingEditor/SystemSettingModel.cs
+++ b/VPet.Solution/Models/SettingEditor/SystemSettingModel.cs
@@ -15,7 +15,7 @@ public class SystemSettingModel : ObservableClass
///
/// 自动保存频率 (min)
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.AutoSaveInterval))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AutoSaveInterval))]
public int AutoSaveInterval
{
get => _autoSaveInterval;
@@ -32,7 +32,7 @@ public class SystemSettingModel : ObservableClass
///
/// 备份保存最大数量
///
- [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.BackupSaveMaxNum))]
+ [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.BackupSaveMaxNum))]
public int BackupSaveMaxNum
{
get => _backupSaveMaxNum;
diff --git a/VPet.Solution/ViewModels/MainWindowVM.cs b/VPet.Solution/ViewModels/MainWindowVM.cs
index be386f6..549d43c 100644
--- a/VPet.Solution/ViewModels/MainWindowVM.cs
+++ b/VPet.Solution/ViewModels/MainWindowVM.cs
@@ -8,7 +8,7 @@ using LinePutScript.Localization.WPF;
using Panuon.WPF.UI;
using VPet.Solution.Models.SettingEditor;
using VPet.Solution.ViewModels.SettingEditor;
-using VPet_Simulator.Windows.Interface;
+using VPet_Simulator.Windows;
namespace VPet.Solution.ViewModels;
diff --git a/VPet.Solution/ViewModels/SettingEditor/SettingWindowVM.cs b/VPet.Solution/ViewModels/SettingEditor/SettingWindowVM.cs
index d943839..e561e5d 100644
--- a/VPet.Solution/ViewModels/SettingEditor/SettingWindowVM.cs
+++ b/VPet.Solution/ViewModels/SettingEditor/SettingWindowVM.cs
@@ -13,7 +13,7 @@ using Panuon.WPF;
using VPet.Solution.Models;
using VPet.Solution.Models.SettingEditor;
using VPet.Solution.Views.SettingEditor;
-using VPet_Simulator.Windows.Interface;
+using VPet_Simulator.Windows;
namespace VPet.Solution.ViewModels.SettingEditor;
@@ -215,7 +215,7 @@ public class SettingWindowVM : ObservableClass
var fileName = Path.GetFileNameWithoutExtension(file);
try
{
- var setting = new Setting(File.ReadAllText(file));
+ var setting = new Setting(null, File.ReadAllText(file));
var settingModel = new SettingModel(setting) { Name = fileName, FilePath = file };
Settings.Add(settingModel);
}
diff --git a/VPet.Solution/Views/MainWindow.xaml.cs b/VPet.Solution/Views/MainWindow.xaml.cs
index 71cdde2..14be4ea 100644
--- a/VPet.Solution/Views/MainWindow.xaml.cs
+++ b/VPet.Solution/Views/MainWindow.xaml.cs
@@ -24,7 +24,7 @@ public partial class MainWindow : WindowX
public SaveWindow SaveWindow { get; } = new();
public MainWindow()
- {
+ {
InitializeComponent();
this.SetViewModel();
Closed += MainWindow_Closed;
@@ -32,8 +32,9 @@ public partial class MainWindow : WindowX
private void MainWindow_Closed(object? sender, EventArgs e)
{
- foreach (var mod in ModSettingModel.LocalMods)
- mod.Value.Image?.CloseStream();
+ if (ModSettingModel.LocalMods != null)
+ foreach (var mod in ModSettingModel.LocalMods)
+ mod.Value.Image?.CloseStream();
SettingWindow.CloseX();
SaveWindow.CloseX();
}