迁移Solution的Setting引用到自身

This commit is contained in:
ZouJin 2024-03-21 23:40:03 +08:00
parent 6602947ead
commit ec621e1117
12 changed files with 535 additions and 60 deletions

View File

@ -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

View File

@ -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<DiagnosticSettingModel>
/// <summary>
/// 是否启用数据收集
/// </summary>
[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<DiagnosticSettingModel>
/// 数据收集频率
/// </summary>
[DefaultValue(500)]
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.DiagnosisInterval))]
[ReflectionProperty(nameof(VPet.Solution.Models.SettingEditor.Setting.DiagnosisInterval))]
public int DiagnosisInterval
{
get => _diagnosisInterval;

View File

@ -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<GraphicsSettingModel>
/// 缩放倍率
/// </summary>
[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<GraphicsSettingModel>
/// 桌宠图形渲染的分辨率,越高图形越清晰
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 是否为更大的屏幕
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.IsBiggerScreen))]
[ReflectionProperty(nameof(Setting.IsBiggerScreen))]
public bool IsBiggerScreen
{
get => _isBiggerScreen;
@ -84,7 +83,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 是否置于顶层
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.TopMost))]
[ReflectionProperty(nameof(Setting.TopMost))]
public bool TopMost
{
get => _topMost;
@ -98,7 +97,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 是否鼠标穿透
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.HitThrough))]
[ReflectionProperty(nameof(Setting.HitThrough))]
public bool HitThrough
{
get => _hitThrough;
@ -112,7 +111,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 语言
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Language))]
[ReflectionProperty(nameof(Setting.Language))]
public string Language
{
get => _language;
@ -129,7 +128,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 字体
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Font))]
[ReflectionProperty(nameof(Setting.Font))]
public string Font
{
get => _font;
@ -143,7 +142,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 主题
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.Theme))]
[ReflectionProperty(nameof(Setting.Theme))]
public string Theme
{
get => _theme;
@ -157,7 +156,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 开机启动
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.StartUPBoot))]
[ReflectionProperty(nameof(Setting.StartUPBoot))]
public bool StartUPBoot
{
get => _startUPBoot;
@ -171,7 +170,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 开机启动 Steam
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.StartUPBootSteam))]
[ReflectionProperty(nameof(Setting.StartUPBootSteam))]
public bool StartUPBootSteam
{
get => _startUPBootSteam;
@ -186,7 +185,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// 是否记录游戏退出位置
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 在任务切换器(Alt+Tab)中隐藏窗口
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.HideFromTaskControl))]
[ReflectionProperty(nameof(Setting.HideFromTaskControl))]
public bool HideFromTaskControl
{
get => _hideFromTaskControl;
@ -239,7 +238,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 消息框外置
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.MessageBarOutside))]
[ReflectionProperty(nameof(Setting.MessageBarOutside))]
public bool MessageBarOutside
{
get => _messageBarOutside;
@ -253,7 +252,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 是否显示宠物帮助窗口
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetHelper))]
[ReflectionProperty(nameof(Setting.PetHelper))]
public bool PetHelper
{
get => _petHelper;
@ -269,7 +268,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 快捷穿透按钮X坐标
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetHelpLeft))]
[ReflectionProperty(nameof(Setting.PetHelpLeft))]
public double PetHelpLeft
{
get => _petHelpLeft;
@ -285,7 +284,7 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
/// <summary>
/// 快捷穿透按钮Y坐标
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetHelpTop))]
[ReflectionProperty(nameof(Setting.PetHelpTop))]
public double PetHelpTop
{
get => _petHelpTop;

View File

@ -28,7 +28,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 播放声音大小
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.VoiceVolume))]
[ReflectionProperty(nameof(Setting.VoiceVolume))]
public double VoiceVolume
{
get => _voiceVolume;
@ -42,7 +42,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 启用计算等数据功能
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.EnableFunction))]
[ReflectionProperty(nameof(Setting.EnableFunction))]
public bool EnableFunction
{
get => _enableFunction;
@ -56,7 +56,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 非计算模式下默认模式
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 上次清理缓存日期
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.LastCacheDate))]
[ReflectionProperty(nameof(Setting.LastCacheDate))]
public DateTime LastCacheDate
{
get => _lastCacheDate;
@ -87,7 +87,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 储存顺序次数
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.SaveTimes))]
[ReflectionProperty(nameof(Setting.SaveTimes))]
public int SaveTimes
{
get => _saveTimes;
@ -101,7 +101,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 按多久视为长按 单位毫秒
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PressLength))]
[ReflectionProperty(nameof(Setting.PressLength))]
public int PressLength
{
get => _pressLength;
@ -115,7 +115,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 互动周期
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.InteractionCycle))]
[ReflectionProperty(nameof(Setting.InteractionCycle))]
public int InteractionCycle
{
get => _interactionCycle;
@ -129,7 +129,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 计算间隔 (秒)
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.LogicInterval))]
[ReflectionProperty(nameof(Setting.LogicInterval))]
public double LogicInterval
{
get => _logicInterval;
@ -143,7 +143,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 允许移动事件
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AllowMove))]
[ReflectionProperty(nameof(Setting.AllowMove))]
public bool AllowMove
{
get => _allowMove;
@ -157,7 +157,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 智能移动
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.SmartMove))]
[ReflectionProperty(nameof(Setting.SmartMove))]
public bool SmartMove
{
get => _smartMove;
@ -172,7 +172,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// 智能移动周期 (秒)
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 桌宠选择内容
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetGraph))]
[ReflectionProperty(nameof(Setting.PetGraph))]
public string PetGraph
{
get => _petGraph;
@ -204,7 +204,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 当实时播放音量达到该值时运行音乐动作
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 当实时播放音量达到该值时运行特殊音乐动作
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 允许桌宠自动购买食品
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AutoBuy))]
[ReflectionProperty(nameof(Setting.AutoBuy))]
public bool AutoBuy
{
get => _autoBuy;
@ -250,7 +250,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// <summary>
/// 允许桌宠自动购买礼物
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AutoGift))]
[ReflectionProperty(nameof(Setting.AutoGift))]
public bool AutoGift
{
get => _autoGift;
@ -261,7 +261,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
#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<InteractiveSettingModel>
#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;

View File

@ -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
{
/// <summary>
/// 游戏设置
/// </summary>
public class Setting : LPS_D
{
/// <summary>
/// 游戏设置
/// </summary>
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;
/// <summary>
/// 缩放倍率
/// </summary>
public double ZoomLevel
{
get
{
return zoomlevel;
}
set
{
FindorAddLine("zoomlevel").InfoToDouble = value;
zoomlevel = value;
}
}
/// <summary>
/// 播放声音大小
/// </summary>
public double VoiceVolume
{
get => (double)GetFloat("voicevolume", 0.5);
set => SetFloat("voicevolume", value);
}
/// <summary>
/// 是否为更大的屏幕
/// </summary>
public bool IsBiggerScreen
{
get => GetBool("bigscreen");
set => SetBool("bigscreen", value);
}
/// <summary>
/// 是否启用数据收集
/// </summary>
public bool Diagnosis
{
get => this["diagnosis"].GetBool("enable");
set => this["diagnosis"].SetBool("enable", value);
}
///// <summary> //经过测试,储存到内存好处多多,不储存也要占用很多内存,干脆存了吧
///// 是将图片储存到内存
///// </summary>
//public bool StoreInMemory
//{
// get => !this["set"].GetBool("storemem");
// set => this["set"].SetBool("storemem", value);
//}
/// <summary>
/// 非计算模式下默认模式
/// </summary>
public IGameSave.ModeType CalFunState
{
get => (IGameSave.ModeType)this[(gint)"calfunstate"];
set => this[(gint)"calfunstate"] = (int)value;
}
/// <summary>
/// 数据收集频率
/// </summary>
public int DiagnosisInterval
{
get => Math.Max(this["diagnosis"].GetInt("interval", 500), 20000);
set => this["diagnosis"].SetInt("interval", value);
}
/// <summary>
/// 自动保存频率 (min)
/// </summary>
public int AutoSaveInterval
{
get => Math.Max(GetInt("autosave", 10), -1);
set => SetInt("autosave", value);
}
/// <summary>
/// 备份保存最大数量
/// </summary>
public int BackupSaveMaxNum
{
get => Math.Max(GetInt("bakupsave", 50), 1);
set => SetInt("bakupsave", value);
}
/// <summary>
/// 是否置于顶层
/// </summary>
public bool TopMost
{
get => !GetBool("topmost");
set => SetBool("topmost", !value);
}
/// <summary>
/// 是否显示宠物帮助窗口
/// </summary>
public bool PetHelper
{
get => GetBool("pethelper");
set => SetBool("pethelper", value);
}
/// <summary>
/// 是否鼠标穿透
/// </summary>
public bool HitThrough
{
get => GetBool("hitthrough");
set => SetBool("hitthrough", value);
}
/// <summary>
/// 上次清理缓存日期
/// </summary>
public DateTime LastCacheDate
{
get => GetDateTime("lastcachedate", DateTime.MinValue);
set => SetDateTime("lastcachedate", value);
}
/// <summary>
/// 数据收集是否被禁止(当日)
/// </summary>
public bool DiagnosisDayEnable = true;
/// <summary>
/// 语言
/// </summary>
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;
}
}
/// <summary>
/// 当前宠物的储存数据
/// </summary>
public ILine PetData_OLD => this["petdata"];
/// <summary>
/// 储存顺序次数++
/// </summary>
public int SaveTimesPP
{
get
{
int list = GetInt("savetimes", 100000) + 1;
SetInt("savetimes", list);
return list;
}
}
/// <summary>
/// 储存顺序次数
/// </summary>
public int SaveTimes
{
get => GetInt("savetimes", 100000);
set => SetInt("savetimes", value);
}
private int presslength;
private int intercycle;
/// <summary>
/// 按多久视为长按 单位毫秒
/// </summary>
public int PressLength
{
get => presslength;
set
{
presslength = value;
this["gameconfig"].SetInt("presslength", value);
}
}
/// <summary>
/// 互动周期
/// </summary>
public int InteractionCycle
{
get => intercycle;
set
{
intercycle = value;
this["gameconfig"].SetInt("intercycle", value);
}
}
/// <summary>
/// 计算间隔 (秒)
/// </summary>
public double LogicInterval
{
get => this["gameconfig"].GetDouble("logicinterval", 15);
set => this["gameconfig"].SetDouble("logicinterval", value);
}
/// <summary>
/// 计算间隔
/// </summary>
public double PetHelpLeft
{
get => (double)this["pethelp"].GetFloat("left", 0);
set => this["pethelp"].SetFloat("left", value);
}
/// <summary>
/// 计算间隔
/// </summary>
public double PetHelpTop
{
get => (double)this["pethelp"].GetFloat("top", 0);
set => this["pethelp"].SetFloat("top", value);
}
bool allowmove;
/// <summary>
/// 允许移动事件
/// </summary>
public bool AllowMove
{
get => allowmove;
set
{
allowmove = value;
this["gameconfig"].SetBool("allowmove", !value);
}
}
bool smartmove;
/// <summary>
/// 智能移动
/// </summary>
public bool SmartMove
{
get => smartmove;
set
{
smartmove = value;
this["gameconfig"].SetBool("smartmove", value);
}
}
bool enablefunction;
/// <summary>
/// 启用计算等数据功能
/// </summary>
public bool EnableFunction
{
get => enablefunction;
set
{
enablefunction = value;
this["gameconfig"].SetBool("nofunction", !value);
}
}
/// <summary>
/// 智能移动周期 (秒)
/// </summary>
public int SmartMoveInterval
{
get => this["gameconfig"].GetInt("smartmoveinterval", 20 * 60);
set => this["gameconfig"].SetInt("smartmoveinterval", value);
}
/// <summary>
/// 消息框外置
/// </summary>
public bool MessageBarOutside
{
get => this["gameconfig"].GetBool("msgbarout");
set => this["gameconfig"].SetBool("msgbarout", value);
}
/// <summary>
/// 开机启动
/// </summary>
public bool StartUPBoot
{
get => this["gameconfig"].GetBool("startboot");
set => this["gameconfig"].SetBool("startboot", value);
}
/// <summary>
/// 开机启动 Steam
/// </summary>
public bool StartUPBootSteam
{
get => !this["gameconfig"].GetBool("startbootsteam");
set => this["gameconfig"].SetBool("startbootsteam", !value);
}
/// <summary>
/// 桌宠选择内容
/// </summary>
public string PetGraph
{
get => this["gameconfig"].GetString("petgraph", "vup");
set => this["gameconfig"].SetString("petgraph", value);
}
/// <summary>
/// 是否记录游戏退出位置 (默认:是)
/// </summary>
public bool StartRecordLast
{
get => !this["gameconfig"].GetBool("startboot");
set => this["gameconfig"].SetBool("startboot", !value);
}
/// <summary>
/// 记录上次退出位置
/// </summary>
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));
}
}
/// <summary>
/// 设置中桌宠启动的位置
/// </summary>
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));
}
}
/// <summary>
/// 当实时播放音量达到该值时运行音乐动作
/// </summary>
public double MusicCatch
{
get => Math.Max(this["gameconfig"].GetDouble("musiccatch", 0.3), 0.02);
set => this["gameconfig"].SetDouble("musiccatch", value);
}
/// <summary>
/// 当实时播放音量达到该值时运行特殊音乐动作
/// </summary>
public double MusicMax
{
get => Math.Max(this["gameconfig"].GetDouble("musicmax", 0.70), 0.02);
set => this["gameconfig"].SetDouble("musicmax", value);
}
/// <summary>
/// 桌宠图形渲染的分辨率,越高图形越清晰
/// </summary>
public int Resolution
{
get => this["gameconfig"].GetInt("resolution", 500);
set => this["gameconfig"].SetInt("resolution", value);
}
bool autobuy;
/// <summary>
/// 允许桌宠自动购买食品
/// </summary>
public bool AutoBuy
{
get => autobuy;
set
{
autobuy = value;
this["gameconfig"].SetBool("autobuy", value);
}
}
bool autogift;
/// <summary>
/// 允许桌宠自动购买礼物
/// </summary>
public bool AutoGift
{
get => autogift;
set
{
autogift = value;
this["gameconfig"].SetBool("autogift", value);
}
}
/// <summary>
/// 在任务切换器(Alt+Tab)中隐藏窗口
/// </summary>
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");
}
}

View File

@ -97,7 +97,7 @@ public class SettingModel : ObservableClass<SettingModel>
private readonly ReflectionOptions _saveReflectionOptions = new() { CheckValueEquals = true };
public SettingModel()
: this(new(null, "Setting#VPET:|\n")) { }
: this(new("Setting#VPET:|\n")) { }
public SettingModel(Setting setting)
{

View File

@ -15,7 +15,7 @@ public class SystemSettingModel : ObservableClass<SystemSettingModel>
/// <summary>
/// 自动保存频率 (min)
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.AutoSaveInterval))]
[ReflectionProperty(nameof(Setting.AutoSaveInterval))]
public int AutoSaveInterval
{
get => _autoSaveInterval;
@ -32,7 +32,7 @@ public class SystemSettingModel : ObservableClass<SystemSettingModel>
/// <summary>
/// 备份保存最大数量
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.BackupSaveMaxNum))]
[ReflectionProperty(nameof(Setting.BackupSaveMaxNum))]
public int BackupSaveMaxNum
{
get => _backupSaveMaxNum;

View File

@ -13,7 +13,6 @@
<ItemGroup>
<ProjectReference Include="..\VPet-Simulator.Core\VPet-Simulator.Core.csproj" />
<ProjectReference Include="..\VPet-Simulator.Windows.Interface\VPet-Simulator.Windows.Interface.csproj" />
<ProjectReference Include="..\VPet-Simulator.Windows\VPet-Simulator.Windows.csproj" />
</ItemGroup>
<ItemGroup>
<Resource Include="icon.ico" />

View File

@ -30,7 +30,6 @@ public class MainWindowVM : ObservableClass<MainWindowVM>
FirstStartFailedCommand.ExecuteCommand += FirstStartFailedCommand_ExecuteCommand;
OpenLocalTextCommand.ExecuteCommand += OpenLocalTextCommand_ExecuteCommand;
}
private void OpenLocalTextCommand_ExecuteCommand()
@ -44,10 +43,10 @@ public class MainWindowVM : ObservableClass<MainWindowVM>
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"
);
}

View File

@ -215,7 +215,7 @@ public class SettingWindowVM : ObservableClass<SettingWindowVM>
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);
}

View File

@ -32,8 +32,6 @@
Content="{ll:Str 打开设置编辑器}" FontSize="16" Style="{DynamicResource Button_BaseStyle}" />
<Button MinWidth="150" x:Name="Button_OpenSaveViewer" Click="Button_OpenSaveViewer_Click"
Content="{ll:Str 打开存档查看器}" FontSize="16" Style="{DynamicResource Button_BaseStyle}" />
<Button MinWidth="150" x:Name="Button_CleanCache" Click="Button_CleanCache_Click"
Content="{ll:Str 清理缓存}" FontSize="16" Style="{DynamicResource Button_BaseStyle}" />
</StackPanel>
<Button Grid.Row="1" Command="{Binding FirstStartFailedCommand}" Content="{ll:Str '第一次启动桌宠打不开?'}"
FontSize="16" Style="{DynamicResource LinkButtonStyle}" />

View File

@ -9,7 +9,6 @@ using VPet.Solution.Models.SettingEditor;
using VPet.Solution.ViewModels;
using VPet.Solution.Views.SaveViewer;
using VPet.Solution.Views.SettingEditor;
using VPet_Simulator.Core;
using VPet_Simulator.Windows.Interface;
namespace VPet.Solution.Views;
@ -49,13 +48,4 @@ public partial class MainWindow : WindowX
{
SaveWindow.ShowOrActivate();
}
private void Button_CleanCache_Click(object sender, RoutedEventArgs e)
{
if(Directory.Exists(GraphCore.CachePath))
{
Directory.Delete(GraphCore.CachePath, true);
}
MessageBox.Show("缓存清理完成".Translate());
}
}