更新 Setting 结构

This commit is contained in:
ZouJin 2024-03-10 02:05:27 +08:00
parent 6a4d31b0d0
commit 45c4aae1c9
15 changed files with 369 additions and 123 deletions

View File

@ -27,7 +27,7 @@ namespace VPet_Simulator.Windows.Interface
/// <summary>
/// 游戏设置
/// </summary>
Setting Set { get; }
ISetting Set { get; }
/// <summary>
/// 宠物加载器列表
/// </summary>

View File

@ -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
{
/// <summary>
/// 设置方法接口
/// </summary>
public interface ISetting
{
/// <summary>
/// 获取当前缩放倍率
/// </summary>
double ZoomLevel { get; }
/// <summary>
/// 设置缩放倍率
/// </summary>
/// <param name="level">缩放等级</param>
void SetZoomLevel(double level);
/// <summary>
/// 获取当前播放声音的大小
/// </summary>
double VoiceVolume { get; }
/// <summary>
/// 设置播放声音的大小
/// </summary>
/// <param name="volume">声音大小</param>
void SetVoiceVolume(double volume);
/// <summary>
/// 获取当前自动保存的频率(分钟)
/// </summary>
int AutoSaveInterval { get; }
/// <summary>
/// 设置自动保存的频率(分钟)
/// </summary>
/// <param name="interval">保存间隔</param>
void SetAutoSaveInterval(int interval);
/// <summary>
/// 获取或设置备份保存的最大数量
/// </summary>
int BackupSaveMaxNum { get; set; }
/// <summary>
/// 获取当前是否置于顶层
/// </summary>
bool TopMost { get; }
/// <summary>
/// 设置是否置于顶层
/// </summary>
/// <param name="topMost">是否置顶</param>
void SetTopMost(bool topMost);
/// <summary>
/// 获取或设置上次清理缓存的日期
/// </summary>
DateTime LastCacheDate { get; set; }
/// <summary>
/// 获取当前语言
/// </summary>
string Language { get; }
/// <summary>
/// 设置语言
/// </summary>
/// <param name="language">语言代码</param>
void SetLanguage(string language);
/// <summary>
/// 获取或设置按多久视为长按(毫秒)
/// </summary>
int PressLength { get; set; }
/// <summary>
/// 获取或设置互动周期
/// </summary>
int InteractionCycle { get; set; }
/// <summary>
/// 获取当前计算间隔(秒)
/// </summary>
double LogicInterval { get; }
/// <summary>
/// 设置计算间隔(秒)
/// </summary>
/// <param name="interval">计算间隔</param>
void SetLogicInterval(double interval);
/// <summary>
/// 获取当前是否允许移动
/// </summary>
bool AllowMove { get; }
/// <summary>
/// 设置是否允许移动
/// </summary>
/// <param name="allowMove">是否允许移动</param>
void SetAllowMove(bool allowMove);
/// <summary>
/// 获取当前是否启用智能移动
/// </summary>
bool SmartMove { get; }
/// <summary>
/// 设置是否启用智能移动
/// </summary>
/// <param name="smartMove">是否启用智能移动</param>
void SetSmartMove(bool smartMove);
/// <summary>
/// 获取当前是否启用计算等数据功能
/// </summary>
bool EnableFunction { get; }
/// <summary>
/// 设置是否启用计算等数据功能
/// </summary>
/// <param name="enableFunction">是否启用功能</param>
void SetEnableFunction(bool enableFunction);
/// <summary>
/// 获取当前智能移动周期(秒)
/// </summary>
int SmartMoveInterval { get; }
/// <summary>
/// 设置智能移动周期(秒)
/// </summary>
/// <param name="interval">智能移动周期</param>
void SetSmartMoveInterval(int interval);
/// <summary>
/// 获取或设置消息框是否外置
/// </summary>
bool MessageBarOutside { get; set; }
/// <summary>
/// 获取当前是否记录游戏退出位置
/// </summary>
bool StartRecordLast { get; set; }
/// <summary>
/// 获取上次退出位置
/// </summary>
Point StartRecordLastPoint { get; }
/// <summary>
/// 获取或设置桌宠启动的位置
/// </summary>
Point StartRecordPoint { get; set; }
/// <summary>
/// 获取或设置当实时播放音量达到该值时运行音乐动作
/// </summary>
double MusicCatch { get; set; }
/// <summary>
/// 获取或设置当实时播放音量达到该值时运行特殊音乐动作
/// </summary>
double MusicMax { get; set; }
/// <summary>
/// 获取或设置桌宠图形渲染的分辨率,越高图形越清晰,重启后生效
/// </summary>
int Resolution { get; set; }
/// <summary>
/// 获取或设置是否允许桌宠自动购买食品
/// </summary>
bool AutoBuy { get; set; }
/// <summary>
/// 获取或设置是否允许桌宠自动购买礼物
/// </summary>
bool AutoGift { get; set; }
/// <summary>
/// 获取或设置在任务切换器(Alt+Tab)中是否隐藏窗口,重启后生效
/// </summary>
bool HideFromTaskControl { get; set; }
/// <summary>
/// 更好买数据
/// </summary>
ILine BetterBuyData { get; }
/// <summary>
/// 游戏数据
/// </summary>
ILine GameData { get; }
}
}

View File

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

View File

@ -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
{
/// <summary>
/// 游戏设置
/// </summary>
public class Setting : LPS_D
public class Setting : LPS_D, ISetting
{
MainWindow mw;
/// <summary>
/// 游戏设置
/// </summary>
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();
//}
///// <summary>
///// 统计数据信息(旧)
///// </summary>
//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;
/// <summary>
/// 缩放倍率
@ -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);
}
}
}

View File

@ -63,6 +63,8 @@ namespace VPet_Simulator.Windows
}
}
public Setting Set { get; set; }
ISetting IMainWindow.Set => Set;
public List<PetLoader> Pets { get; set; } = new List<PetLoader>();
public List<CoreMOD> CoreMODs = new List<CoreMOD>();
public GameCore Core { get; set; } = new GameCore();
@ -1121,6 +1123,7 @@ namespace VPet_Simulator.Windows
return TalkAPI[TalkAPIIndex];
}
}
/// <summary>
/// 移除所有聊天对话框
/// </summary>
@ -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);
//加载字体

View File

@ -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<double> 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();
mw.Set.SetLanguage((string)LanguageBox.SelectedItem);
TextBoxPetName.Text = mw.Core.Save.Name;
if (mw.IsSteamUser)
SteamFriends.SetRichPresence("username", mw.Core.Save.Name);
}
}
private void MainTab_SelectionChanged(object sender, SelectionChangedEventArgs e)

View File

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

View File

@ -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<GraphicsSettingModel>
/// 缩放倍率
/// </summary>
[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<GraphicsSettingModel>
/// 桌宠图形渲染的分辨率,越高图形越清晰
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 是否为更大的屏幕
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 是否置于顶层
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 是否鼠标穿透
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 语言
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 字体
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 主题
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 开机启动
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 开机启动 Steam
/// </summary>
[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<GraphicsSettingModel>
/// 是否记录游戏退出位置
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 在任务切换器(Alt+Tab)中隐藏窗口
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 消息框外置
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 是否显示宠物帮助窗口
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 快捷穿透按钮X坐标
/// </summary>
[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<GraphicsSettingModel>
/// <summary>
/// 快捷穿透按钮Y坐标
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelpTop))]
[ReflectionProperty(nameof(VPet_Simulator.Windows.Setting.PetHelpTop))]
public double PetHelpTop
{
get => _petHelpTop;

View File

@ -14,7 +14,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
///// <summary>
///// 宠物名称
///// </summary>
//[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<InteractiveSettingModel>
/// <summary>
/// 播放声音大小
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 启用计算等数据功能
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 非计算模式下默认模式
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 上次清理缓存日期
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 储存顺序次数
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 按多久视为长按 单位毫秒
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 互动周期
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 计算间隔 (秒)
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 允许移动事件
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 智能移动
/// </summary>
[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<InteractiveSettingModel>
/// 智能移动周期 (秒)
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 桌宠选择内容
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 当实时播放音量达到该值时运行音乐动作
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 当实时播放音量达到该值时运行特殊音乐动作
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 允许桌宠自动购买食品
/// </summary>
[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<InteractiveSettingModel>
/// <summary>
/// 允许桌宠自动购买礼物
/// </summary>
[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<InteractiveSettingModel>
#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<InteractiveSettingModel>
#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;

View File

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

View File

@ -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<SettingModel>
private readonly ReflectionOptions _saveReflectionOptions = new() { CheckValueEquals = true };
public SettingModel()
: this(new("")) { }
: this(new(null, "")) { }
public SettingModel(Setting setting)
{

View File

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

View File

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

View File

@ -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<SettingWindowVM>
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);
}

View File

@ -32,6 +32,7 @@ public partial class MainWindow : WindowX
private void MainWindow_Closed(object? sender, EventArgs e)
{
if (ModSettingModel.LocalMods != null)
foreach (var mod in ModSettingModel.LocalMods)
mod.Value.Image?.CloseStream();
SettingWindow.CloseX();