diff --git a/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs b/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs index 2dc815c..ea6047a 100644 --- a/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs +++ b/VPet.Solution/Models/SettingEditor/GraphicsSettingModel.cs @@ -233,4 +233,64 @@ public class GraphicsSettingModel : ObservableClass set => SetProperty(ref _hideFromTaskControl, value); } #endregion + + #region MessageBarOutside + private bool _messageBarOutside; + + /// + /// 消息框外置 + /// + [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MessageBarOutside))] + public bool MessageBarOutside + { + get => _messageBarOutside; + set => SetProperty(ref _messageBarOutside, value); + } + #endregion + + #region PetHelper + private bool _petHelper; + + /// + /// 是否显示宠物帮助窗口 + /// + [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelper))] + public bool PetHelper + { + get => _petHelper; + set => SetProperty(ref _petHelper, value); + } + #endregion + + #region PetHelpLeft + private double _petHelpLeft; + + // TODO 加入 PetHelpLeft + + /// + /// 快捷穿透按钮X坐标 + /// + [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelpLeft))] + public double PetHelpLeft + { + get => _petHelpLeft; + set => SetProperty(ref _petHelpLeft, value); + } + #endregion + + #region PetHelpTop + private double _petHelpTop; + + // TODO 加入 PetHelpTop + + /// + /// 快捷穿透按钮Y坐标 + /// + [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelpTop))] + public double PetHelpTop + { + get => _petHelpTop; + set => SetProperty(ref _petHelpTop, value); + } + #endregion } diff --git a/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs b/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs index 5815bdb..725d4e3 100644 --- a/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs +++ b/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs @@ -52,20 +52,6 @@ public class InteractiveSettingModel : ObservableClass new(Enum.GetValues(typeof(GameSave.ModeType)).Cast()); #endregion - #region PetHelper - private bool _petHelper; - - /// - /// 是否显示宠物帮助窗口 - /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelper))] - public bool PetHelper - { - get => _petHelper; - set => SetProperty(ref _petHelper, value); - } - #endregion - #region LastCacheDate private DateTime _lastCacheDate; @@ -136,34 +122,6 @@ public class InteractiveSettingModel : ObservableClass } #endregion - #region PetHelpLeft - private double _petHelpLeft; - - /// - /// 计算间隔 - /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelpLeft))] - public double PetHelpLeft - { - get => _petHelpLeft; - set => SetProperty(ref _petHelpLeft, value); - } - #endregion - - #region PetHelpTop - private double _petHelpTop; - - /// - /// 计算间隔 - /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelpTop))] - public double PetHelpTop - { - get => _petHelpTop; - set => SetProperty(ref _petHelpTop, value); - } - #endregion - #region AllowMove private bool _allowMove; @@ -213,25 +171,15 @@ public class InteractiveSettingModel : ObservableClass /// 智能移动周期 (秒) /// [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.SmartMoveInterval))] + [ReflectionPropertyConverter(typeof(SecondToMinuteConverter))] public int SmartMoveInterval { get => _smartMoveInterval; set => SetProperty(ref _smartMoveInterval, value); } - #endregion - #region MessageBarOutside - private bool _messageBarOutside; - - /// - /// 消息框外置 - /// - [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MessageBarOutside))] - public bool MessageBarOutside - { - get => _messageBarOutside; - set => SetProperty(ref _messageBarOutside, value); - } + public static ObservableCollection SmartMoveIntervals = + new() { 1, 2, 5, 10, 20, 30, 40, 50, 60 }; #endregion #region PetGraph @@ -279,6 +227,7 @@ public class InteractiveSettingModel : ObservableClass #region AutoBuy private bool _autoBuy; + // TODO 加入 AutoBuy /// /// 允许桌宠自动购买食品 /// @@ -293,6 +242,7 @@ public class InteractiveSettingModel : ObservableClass #region AutoGift private bool _autoGift; + // TODO 加入 AutoGift /// /// 允许桌宠自动购买礼物 /// @@ -326,3 +276,19 @@ public class InteractiveSettingModel : ObservableClass } #endregion } + +public class SecondToMinuteConverter : ReflectionConverterBase +{ + public override int Convert(int sourceValue) + { + if (sourceValue == 30) + return 1; + else + return sourceValue / 60; + } + + public override int ConvertBack(int targetValue) + { + return targetValue * 60; + } +} diff --git a/VPet.Solution/Utils/ReflectionUtils.cs b/VPet.Solution/Utils/ReflectionUtils.cs index 3bedeca..0c2cebb 100644 --- a/VPet.Solution/Utils/ReflectionUtils.cs +++ b/VPet.Solution/Utils/ReflectionUtils.cs @@ -121,7 +121,9 @@ public class ReflectionObjectInfo public ReflectionObjectInfo(Type type) { - PropertyNames = new(type.GetProperties().Select(p => p.Name)); + PropertyNames = new( + type.GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(p => p.Name) + ); } } diff --git a/VPet.Solution/Views/SettingEditor/GraphicsSettingPage.xaml b/VPet.Solution/Views/SettingEditor/GraphicsSettingPage.xaml index dc250cb..f249265 100644 --- a/VPet.Solution/Views/SettingEditor/GraphicsSettingPage.xaml +++ b/VPet.Solution/Views/SettingEditor/GraphicsSettingPage.xaml @@ -52,9 +52,8 @@ @@ -224,11 +223,12 @@ Value="{Binding GraphicsSetting.StartRecordPoint.Y}" />