diff --git a/VPet-Simulator.Windows/mklink.bat b/VPet-Simulator.Windows/mklink.bat index 331bdb1..dada308 100644 --- a/VPet-Simulator.Windows/mklink.bat +++ b/VPet-Simulator.Windows/mklink.bat @@ -1,7 +1,6 @@ %1 mshta vbscript:createobject("shell.application").shellexecute("%~s0","::","","runas",1)(window.close)&exit cd /d %~dp0 -mklink /d "%~dp0\bin\x64\Debug\net8.0-windows\mod" "%~dp0\mod" mklink /d "%~dp0\bin\x64\Debug\net8.0-windows\mod" "%~dp0\mod" echo The following is the automatic link generation for other related MODs. If an error is prompted, it is a normal phenomenon and can be ignored diff --git a/VPet.Solution/Models/SettingEditor/DiagnosticSettingModel.cs b/VPet.Solution/Models/SettingEditor/DiagnosticSettingModel.cs index 3daa7e6..3394628 100644 --- a/VPet.Solution/Models/SettingEditor/DiagnosticSettingModel.cs +++ b/VPet.Solution/Models/SettingEditor/DiagnosticSettingModel.cs @@ -6,8 +6,7 @@ using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; -using VPet_Simulator.Windows; -using VPet_Simulator.Windows.Interface; +using VPet.Solution.Models.SettingEditor; namespace VPet.Solution.Models.SettingEditor; @@ -32,7 +31,7 @@ public class DiagnosticSettingModel : ObservableClass /// /// 是否启用数据收集 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Diagnosis))] + [ReflectionProperty(nameof(VPet.Solution.Models.SettingEditor.Setting.Diagnosis))] public bool Diagnosis { get => _diagnosis; @@ -47,7 +46,7 @@ public class DiagnosticSettingModel : ObservableClass /// 数据收集频率 /// [DefaultValue(500)] - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.DiagnosisInterval))] + [ReflectionProperty(nameof(VPet.Solution.Models.SettingEditor.Setting.DiagnosisInterval))] public int DiagnosisInterval { get => _diagnosisInterval; diff --git a/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs b/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs index 9c76811..a72682a 100644 --- a/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs +++ b/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs @@ -3,7 +3,6 @@ using LinePutScript.Localization.WPF; using System.Collections.ObjectModel; using System.ComponentModel; using System.Windows; -using VPet_Simulator.Windows; namespace VPet.Solution.Models.SettingEditor; @@ -16,7 +15,7 @@ public class GraphicsSettingModel : ObservableClass /// 缩放倍率 /// [DefaultValue(1)] - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.ZoomLevel))] + [ReflectionProperty(nameof(Setting.ZoomLevel))] public double ZoomLevel { get => _zoomLevel; @@ -49,7 +48,7 @@ public class GraphicsSettingModel : ObservableClass /// 桌宠图形渲染的分辨率,越高图形越清晰 /// [DefaultValue(1000)] - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Resolution))] + [ReflectionProperty(nameof(Setting.Resolution))] public int Resolution { get => _resolution; @@ -63,7 +62,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 是否为更大的屏幕 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.IsBiggerScreen))] + [ReflectionProperty(nameof(Setting.IsBiggerScreen))] public bool IsBiggerScreen { get => _isBiggerScreen; @@ -84,7 +83,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 是否置于顶层 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.TopMost))] + [ReflectionProperty(nameof(Setting.TopMost))] public bool TopMost { get => _topMost; @@ -98,7 +97,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 是否鼠标穿透 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.HitThrough))] + [ReflectionProperty(nameof(Setting.HitThrough))] public bool HitThrough { get => _hitThrough; @@ -112,7 +111,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 语言 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Language))] + [ReflectionProperty(nameof(Setting.Language))] public string Language { get => _language; @@ -129,7 +128,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 字体 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Font))] + [ReflectionProperty(nameof(Setting.Font))] public string Font { get => _font; @@ -143,7 +142,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 主题 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Theme))] + [ReflectionProperty(nameof(Setting.Theme))] public string Theme { get => _theme; @@ -157,7 +156,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 开机启动 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.StartUPBoot))] + [ReflectionProperty(nameof(Setting.StartUPBoot))] public bool StartUPBoot { get => _startUPBoot; @@ -171,7 +170,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 开机启动 Steam /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.StartUPBootSteam))] + [ReflectionProperty(nameof(Setting.StartUPBootSteam))] public bool StartUPBootSteam { get => _startUPBootSteam; @@ -186,7 +185,7 @@ public class GraphicsSettingModel : ObservableClass /// 是否记录游戏退出位置 /// [DefaultValue(true)] - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.StartRecordLast))] + [ReflectionProperty(nameof(Setting.StartRecordLast))] public bool StartRecordLast { get => _startRecordLast; @@ -225,7 +224,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 在任务切换器(Alt+Tab)中隐藏窗口 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.HideFromTaskControl))] + [ReflectionProperty(nameof(Setting.HideFromTaskControl))] public bool HideFromTaskControl { get => _hideFromTaskControl; @@ -239,7 +238,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 消息框外置 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.MessageBarOutside))] + [ReflectionProperty(nameof(Setting.MessageBarOutside))] public bool MessageBarOutside { get => _messageBarOutside; @@ -253,7 +252,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 是否显示宠物帮助窗口 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetHelper))] + [ReflectionProperty(nameof(Setting.PetHelper))] public bool PetHelper { get => _petHelper; @@ -269,7 +268,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 快捷穿透按钮X坐标 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetHelpLeft))] + [ReflectionProperty(nameof(Setting.PetHelpLeft))] public double PetHelpLeft { get => _petHelpLeft; @@ -285,7 +284,7 @@ public class GraphicsSettingModel : ObservableClass /// /// 快捷穿透按钮Y坐标 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetHelpTop))] + [ReflectionProperty(nameof(Setting.PetHelpTop))] public double PetHelpTop { get => _petHelpTop; diff --git a/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs b/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs index e5b56f3..561a61c 100644 --- a/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs +++ b/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs @@ -28,7 +28,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 播放声音大小 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.VoiceVolume))] + [ReflectionProperty(nameof(Setting.VoiceVolume))] public double VoiceVolume { get => _voiceVolume; @@ -42,7 +42,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 启用计算等数据功能 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.EnableFunction))] + [ReflectionProperty(nameof(Setting.EnableFunction))] public bool EnableFunction { get => _enableFunction; @@ -56,7 +56,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 非计算模式下默认模式 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.CalFunState))] + [ReflectionProperty(nameof(Setting.CalFunState))] public IGameSave.ModeType CalFunState { get => _calFunState; @@ -73,7 +73,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 上次清理缓存日期 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.LastCacheDate))] + [ReflectionProperty(nameof(Setting.LastCacheDate))] public DateTime LastCacheDate { get => _lastCacheDate; @@ -87,7 +87,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 储存顺序次数 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.SaveTimes))] + [ReflectionProperty(nameof(Setting.SaveTimes))] public int SaveTimes { get => _saveTimes; @@ -101,7 +101,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 按多久视为长按 单位毫秒 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PressLength))] + [ReflectionProperty(nameof(Setting.PressLength))] public int PressLength { get => _pressLength; @@ -115,7 +115,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 互动周期 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.InteractionCycle))] + [ReflectionProperty(nameof(Setting.InteractionCycle))] public int InteractionCycle { get => _interactionCycle; @@ -129,7 +129,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 计算间隔 (秒) /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.LogicInterval))] + [ReflectionProperty(nameof(Setting.LogicInterval))] public double LogicInterval { get => _logicInterval; @@ -143,7 +143,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 允许移动事件 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AllowMove))] + [ReflectionProperty(nameof(Setting.AllowMove))] public bool AllowMove { get => _allowMove; @@ -157,7 +157,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 智能移动 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.SmartMove))] + [ReflectionProperty(nameof(Setting.SmartMove))] public bool SmartMove { get => _smartMove; @@ -172,7 +172,7 @@ public class InteractiveSettingModel : ObservableClass /// 智能移动周期 (秒) /// [DefaultValue(1)] - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.SmartMoveInterval))] + [ReflectionProperty(nameof(Setting.SmartMoveInterval))] [ReflectionPropertyConverter(typeof(SecondToMinuteConverter))] public int SmartMoveInterval { @@ -190,7 +190,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 桌宠选择内容 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetGraph))] + [ReflectionProperty(nameof(Setting.PetGraph))] public string PetGraph { get => _petGraph; @@ -204,7 +204,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 当实时播放音量达到该值时运行音乐动作 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.MusicCatch))] + [ReflectionProperty(nameof(Setting.MusicCatch))] [ReflectionPropertyConverter(typeof(PercentageConverter))] public int MusicCatch { @@ -219,7 +219,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 当实时播放音量达到该值时运行特殊音乐动作 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.MusicMax))] + [ReflectionProperty(nameof(Setting.MusicMax))] [ReflectionPropertyConverter(typeof(PercentageConverter))] public int MusicMax { @@ -235,7 +235,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 允许桌宠自动购买食品 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AutoBuy))] + [ReflectionProperty(nameof(Setting.AutoBuy))] public bool AutoBuy { get => _autoBuy; @@ -250,7 +250,7 @@ public class InteractiveSettingModel : ObservableClass /// /// 允许桌宠自动购买礼物 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AutoGift))] + [ReflectionProperty(nameof(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.Setting.MoveAreaDefault))] + [ReflectionProperty(nameof(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.Setting.MoveArea))] + [ReflectionProperty(nameof(Setting.MoveArea))] public System.Drawing.Rectangle MoveArea { get => _moveArea; diff --git a/VPet.Solution/Models/SettingEditor/Setting.cs b/VPet.Solution/Models/SettingEditor/Setting.cs new file mode 100644 index 0000000..773a84d --- /dev/null +++ b/VPet.Solution/Models/SettingEditor/Setting.cs @@ -0,0 +1,492 @@ +using LinePutScript; +using LinePutScript.Dictionary; +using LinePutScript.Localization.WPF; +using System.Windows; +using System.Windows.Controls; +using VPet_Simulator.Core; +using VPet_Simulator.Windows.Interface; + +namespace VPet.Solution.Models.SettingEditor +{ + /// + /// 游戏设置 + /// + public class Setting : LPS_D + { + /// + /// 游戏设置 + /// + public Setting(string lps) : base(lps) + { + var line = FindLine("zoomlevel"); + if (line == null) + zoomlevel = 0.5; + else + { + zoomlevel = line.InfoToDouble; + if (zoomlevel < 0.1 || zoomlevel > 8) + { + zoomlevel = 0.5; + } + } + presslength = this["gameconfig"].GetInt("presslength", 500); + intercycle = this["gameconfig"].GetInt("intercycle", 200); + allowmove = !this["gameconfig"].GetBool("allowmove"); + smartmove = this["gameconfig"].GetBool("smartmove"); + enablefunction = !this["gameconfig"].GetBool("nofunction"); + autobuy = this["gameconfig"].GetBool("autobuy"); + autogift = this["gameconfig"].GetBool("autogift"); + } + + + private double zoomlevel = 0; + /// + /// 缩放倍率 + /// + public double ZoomLevel + { + get + { + return zoomlevel; + } + set + { + FindorAddLine("zoomlevel").InfoToDouble = value; + zoomlevel = value; + } + } + /// + /// 播放声音大小 + /// + public double VoiceVolume + { + get => (double)GetFloat("voicevolume", 0.5); + set => SetFloat("voicevolume", value); + } + /// + /// 是否为更大的屏幕 + /// + public bool IsBiggerScreen + { + get => GetBool("bigscreen"); + set => SetBool("bigscreen", value); + } + /// + /// 是否启用数据收集 + /// + public bool Diagnosis + { + get => this["diagnosis"].GetBool("enable"); + set => this["diagnosis"].SetBool("enable", value); + } + ///// //经过测试,储存到内存好处多多,不储存也要占用很多内存,干脆存了吧 + ///// 是将图片储存到内存 + ///// + //public bool StoreInMemory + //{ + // get => !this["set"].GetBool("storemem"); + // set => this["set"].SetBool("storemem", value); + //} + /// + /// 非计算模式下默认模式 + /// + public IGameSave.ModeType CalFunState + { + get => (IGameSave.ModeType)this[(gint)"calfunstate"]; + set => this[(gint)"calfunstate"] = (int)value; + } + /// + /// 数据收集频率 + /// + public int DiagnosisInterval + { + get => Math.Max(this["diagnosis"].GetInt("interval", 500), 20000); + set => this["diagnosis"].SetInt("interval", value); + } + + /// + /// 自动保存频率 (min) + /// + public int AutoSaveInterval + { + get => Math.Max(GetInt("autosave", 10), -1); + set => SetInt("autosave", value); + } + /// + /// 备份保存最大数量 + /// + public int BackupSaveMaxNum + { + get => Math.Max(GetInt("bakupsave", 50), 1); + set => SetInt("bakupsave", value); + } + /// + /// 是否置于顶层 + /// + public bool TopMost + { + get => !GetBool("topmost"); + set => SetBool("topmost", !value); + } + /// + /// 是否显示宠物帮助窗口 + /// + public bool PetHelper + { + get => GetBool("pethelper"); + set => SetBool("pethelper", value); + } + /// + /// 是否鼠标穿透 + /// + public bool HitThrough + { + get => GetBool("hitthrough"); + set => SetBool("hitthrough", value); + } + /// + /// 上次清理缓存日期 + /// + public DateTime LastCacheDate + { + get => GetDateTime("lastcachedate", DateTime.MinValue); + set => SetDateTime("lastcachedate", value); + } + /// + /// 数据收集是否被禁止(当日) + /// + public bool DiagnosisDayEnable = true; + /// + /// 语言 + /// + public string Language + { + get => GetString("language", "null"); + set => this[(gstr)"language"] = value; + } + public string Font + { + get => GetString("font", "OPPOSans R"); + set => this[(gstr)"font"] = value; + } + public string Theme + { + get + { + var line = FindLine("theme"); + if (line == null) + return "default"; + return line.Info; + } + set + { + FindorAddLine("theme").Info = value; + } + } + /// + /// 当前宠物的储存数据 + /// + public ILine PetData_OLD => this["petdata"]; + /// + /// 储存顺序次数++ + /// + public int SaveTimesPP + { + get + { + int list = GetInt("savetimes", 100000) + 1; + SetInt("savetimes", list); + return list; + } + } + /// + /// 储存顺序次数 + /// + public int SaveTimes + { + get => GetInt("savetimes", 100000); + set => SetInt("savetimes", value); + } + + private int presslength; + private int intercycle; + /// + /// 按多久视为长按 单位毫秒 + /// + public int PressLength + { + get => presslength; + set + { + presslength = value; + this["gameconfig"].SetInt("presslength", value); + } + } + /// + /// 互动周期 + /// + public int InteractionCycle + { + get => intercycle; + set + { + intercycle = value; + this["gameconfig"].SetInt("intercycle", value); + } + } + /// + /// 计算间隔 (秒) + /// + public double LogicInterval + { + get => this["gameconfig"].GetDouble("logicinterval", 15); + set => this["gameconfig"].SetDouble("logicinterval", value); + } + + /// + /// 计算间隔 + /// + public double PetHelpLeft + { + get => (double)this["pethelp"].GetFloat("left", 0); + set => this["pethelp"].SetFloat("left", value); + } + /// + /// 计算间隔 + /// + public double PetHelpTop + { + get => (double)this["pethelp"].GetFloat("top", 0); + set => this["pethelp"].SetFloat("top", value); + } + + bool allowmove; + /// + /// 允许移动事件 + /// + public bool AllowMove + { + get => allowmove; + set + { + allowmove = value; + this["gameconfig"].SetBool("allowmove", !value); + } + } + bool smartmove; + /// + /// 智能移动 + /// + public bool SmartMove + { + get => smartmove; + set + { + smartmove = value; + this["gameconfig"].SetBool("smartmove", value); + } + } + bool enablefunction; + /// + /// 启用计算等数据功能 + /// + public bool EnableFunction + { + get => enablefunction; + set + { + enablefunction = value; + this["gameconfig"].SetBool("nofunction", !value); + } + } + /// + /// 智能移动周期 (秒) + /// + public int SmartMoveInterval + { + get => this["gameconfig"].GetInt("smartmoveinterval", 20 * 60); + set => this["gameconfig"].SetInt("smartmoveinterval", value); + } + /// + /// 消息框外置 + /// + public bool MessageBarOutside + { + get => this["gameconfig"].GetBool("msgbarout"); + set => this["gameconfig"].SetBool("msgbarout", value); + } + /// + /// 开机启动 + /// + public bool StartUPBoot + { + get => this["gameconfig"].GetBool("startboot"); + set => this["gameconfig"].SetBool("startboot", value); + } + /// + /// 开机启动 Steam + /// + public bool StartUPBootSteam + { + get => !this["gameconfig"].GetBool("startbootsteam"); + set => this["gameconfig"].SetBool("startbootsteam", !value); + } + /// + /// 桌宠选择内容 + /// + public string PetGraph + { + get => this["gameconfig"].GetString("petgraph", "vup"); + 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(100, 100); + return new Point(line.GetDouble("x", 0), line.GetDouble("y", 0)); + } + set + { + var line = FindorAddLine("startrecordlast"); + line.SetDouble("x", Math.Min(Math.Max(value.X, -65000), 65000)); + line.SetDouble("y", Math.Min(Math.Max(value.Y, -65000), 65000)); + } + } + /// + /// 设置中桌宠启动的位置 + /// + 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", Math.Min(Math.Max(value.X, -65000), 65000)); + line.SetDouble("y", Math.Min(Math.Max(value.Y, -65000), 65000)); + } + } + /// + /// 当实时播放音量达到该值时运行音乐动作 + /// + public double MusicCatch + { + get => Math.Max(this["gameconfig"].GetDouble("musiccatch", 0.3), 0.02); + set => this["gameconfig"].SetDouble("musiccatch", value); + } + /// + /// 当实时播放音量达到该值时运行特殊音乐动作 + /// + public double MusicMax + { + get => Math.Max(this["gameconfig"].GetDouble("musicmax", 0.70), 0.02); + set => this["gameconfig"].SetDouble("musicmax", value); + } + /// + /// 桌宠图形渲染的分辨率,越高图形越清晰 + /// + public int Resolution + { + get => this["gameconfig"].GetInt("resolution", 500); + set => this["gameconfig"].SetInt("resolution", value); + } + + bool autobuy; + /// + /// 允许桌宠自动购买食品 + /// + public bool AutoBuy + { + get => autobuy; + set + { + autobuy = value; + this["gameconfig"].SetBool("autobuy", value); + } + } + bool autogift; + /// + /// 允许桌宠自动购买礼物 + /// + public bool AutoGift + { + get => autogift; + set + { + autogift = value; + this["gameconfig"].SetBool("autogift", value); + } + } + /// + /// 在任务切换器(Alt+Tab)中隐藏窗口 + /// + public bool HideFromTaskControl + { + get => this["gameconfig"].GetBool("hide_from_task_control"); + set => this["gameconfig"].SetBool("hide_from_task_control", value); + } + + public bool MoveAreaDefault + { + get + { + var line = FindLine("movearea"); + if (line == null) + return true; + return line.GetBool("set"); + } + set + { + var line = FindorAddLine("movearea"); + line.SetBool("set", value); + } + } + public System.Drawing.Rectangle MoveArea + { + get + { + var line = FindLine("movearea"); + if (line == null) + return default(System.Drawing.Rectangle); + return new System.Drawing.Rectangle( + line.GetInt("x", 0), + line.GetInt("y", 0), + line.GetInt("w", 114), + line.GetInt("h", 514) + ); + } + set + { + var line = FindorAddLine("movearea"); + line.SetInt("x", value.X); + line.SetInt("y", value.Y); + line.SetInt("w", value.Width); + line.SetInt("h", value.Height); + } + } + + public ILine BetterBuyData => FindorAddLine("betterbuy"); + + public ILine GameData => FindorAddLine("gamedata"); + } +} diff --git a/VPet.Solution/Models/SettingEditor/SettingModel.cs b/VPet.Solution/Models/SettingEditor/SettingModel.cs index 67e2f7d..95d7395 100644 --- a/VPet.Solution/Models/SettingEditor/SettingModel.cs +++ b/VPet.Solution/Models/SettingEditor/SettingModel.cs @@ -97,7 +97,7 @@ public class SettingModel : ObservableClass private readonly ReflectionOptions _saveReflectionOptions = new() { CheckValueEquals = true }; public SettingModel() - : this(new(null, "Setting#VPET:|\n")) { } + : this(new("Setting#VPET:|\n")) { } public SettingModel(Setting setting) { diff --git a/VPet.Solution/Models/SettingEditor/SystemSettingModel.cs b/VPet.Solution/Models/SettingEditor/SystemSettingModel.cs index c078855..1556e94 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.Setting.AutoSaveInterval))] + [ReflectionProperty(nameof(Setting.AutoSaveInterval))] public int AutoSaveInterval { get => _autoSaveInterval; @@ -32,7 +32,7 @@ public class SystemSettingModel : ObservableClass /// /// 备份保存最大数量 /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.BackupSaveMaxNum))] + [ReflectionProperty(nameof(Setting.BackupSaveMaxNum))] public int BackupSaveMaxNum { get => _backupSaveMaxNum; diff --git a/VPet.Solution/VPet.Solution.csproj b/VPet.Solution/VPet.Solution.csproj index 6ba5633..d03917d 100644 --- a/VPet.Solution/VPet.Solution.csproj +++ b/VPet.Solution/VPet.Solution.csproj @@ -13,7 +13,6 @@ - diff --git a/VPet.Solution/ViewModels/MainWindowVM.cs b/VPet.Solution/ViewModels/MainWindowVM.cs index 80f6e7b..549d43c 100644 --- a/VPet.Solution/ViewModels/MainWindowVM.cs +++ b/VPet.Solution/ViewModels/MainWindowVM.cs @@ -30,7 +30,6 @@ public class MainWindowVM : ObservableClass FirstStartFailedCommand.ExecuteCommand += FirstStartFailedCommand_ExecuteCommand; OpenLocalTextCommand.ExecuteCommand += OpenLocalTextCommand_ExecuteCommand; - } private void OpenLocalTextCommand_ExecuteCommand() @@ -44,10 +43,10 @@ public class MainWindowVM : ObservableClass private void FirstStartFailedCommand_ExecuteCommand() { if (LocalizeCore.CurrentCulture == "zh-Hans") - HKWUtils.OpenLink("https://www.bilibili.com/read/cv31370459/"); + HKWUtils.OpenLink("https://www.bilibili.com/read/cv26510496/"); else HKWUtils.OpenLink( - "https://store.steampowered.com/news/app/1920960/view/7950611950256749982" + "https://steamcommunity.com/games/1920960/announcements/detail/3681184905256253203" ); } diff --git a/VPet.Solution/ViewModels/SettingEditor/SettingWindowVM.cs b/VPet.Solution/ViewModels/SettingEditor/SettingWindowVM.cs index e561e5d..2194a08 100644 --- a/VPet.Solution/ViewModels/SettingEditor/SettingWindowVM.cs +++ b/VPet.Solution/ViewModels/SettingEditor/SettingWindowVM.cs @@ -215,7 +215,7 @@ public class SettingWindowVM : ObservableClass var fileName = Path.GetFileNameWithoutExtension(file); try { - var setting = new Setting(null, File.ReadAllText(file)); + var setting = new Setting(File.ReadAllText(file)); var settingModel = new SettingModel(setting) { Name = fileName, FilePath = file }; Settings.Add(settingModel); } diff --git a/VPet.Solution/Views/MainWindow.xaml b/VPet.Solution/Views/MainWindow.xaml index b009d2e..1fba1ae 100644 --- a/VPet.Solution/Views/MainWindow.xaml +++ b/VPet.Solution/Views/MainWindow.xaml @@ -32,8 +32,6 @@ Content="{ll:Str 打开设置编辑器}" FontSize="16" Style="{DynamicResource Button_BaseStyle}" />