# VPet.Solution

## 修复
- 自动计算超标 `AutoCal` 错误
- 捕获音量`MusicCatch`和高潮音量`MusicMax`错误
This commit is contained in:
Hakoyu 2024-02-13 15:15:43 +08:00
parent 00a920d354
commit 83c4ed2446
2 changed files with 12 additions and 6 deletions

View File

@ -205,7 +205,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// 当实时播放音量达到该值时运行音乐动作
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MusicCatch))]
[ReflectionPropertyConverter(typeof(DoubleToInt32Converter))]
[ReflectionPropertyConverter(typeof(PercentageConverter))]
public int MusicCatch
{
get => _musicCatch;
@ -220,7 +220,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// 当实时播放音量达到该值时运行特殊音乐动作
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MusicMax))]
[ReflectionPropertyConverter(typeof(DoubleToInt32Converter))]
[ReflectionPropertyConverter(typeof(PercentageConverter))]
public int MusicMax
{
get => _musicMax;
@ -297,15 +297,15 @@ public class SecondToMinuteConverter : ReflectionConverterBase<int, int>
}
}
public class DoubleToInt32Converter : ReflectionConverterBase<int, double>
public class PercentageConverter : ReflectionConverterBase<int, double>
{
public override double Convert(int sourceValue)
{
return sourceValue;
return sourceValue / 100.0;
}
public override int ConvertBack(double targetValue)
{
return System.Convert.ToInt32(targetValue);
return System.Convert.ToInt32(targetValue * 100);
}
}

View File

@ -102,14 +102,20 @@ public class SettingModel : ObservableClass<SettingModel>
public SettingModel(Setting setting)
{
_setting = setting;
GraphicsSetting = LoadSetting<GraphicsSettingModel>();
if (string.IsNullOrWhiteSpace(GraphicsSetting.Language))
GraphicsSetting.Language = LocalizeCore.CurrentCulture;
InteractiveSetting = LoadSetting<InteractiveSettingModel>();
SystemSetting = LoadSetting<SystemSettingModel>();
CustomizedSetting = LoadCustomizedSetting(setting);
DiagnosticSetting = LoadSetting<DiagnosticSettingModel>();
DiagnosticSetting.SetAutoCalToSetting(setting);
DiagnosticSetting.GetAutoCalFromSetting(setting);
ModSetting = LoadModSetting(setting);
//MergeNotify();
}