更新 VPet.Solution

This commit is contained in:
Hakoyu 2024-01-12 21:34:53 +08:00
parent 7d9d4a9764
commit cae830a086
6 changed files with 111 additions and 133 deletions

View File

@ -233,4 +233,64 @@ public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
set => SetProperty(ref _hideFromTaskControl, value);
}
#endregion
#region MessageBarOutside
private bool _messageBarOutside;
/// <summary>
/// 消息框外置
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MessageBarOutside))]
public bool MessageBarOutside
{
get => _messageBarOutside;
set => SetProperty(ref _messageBarOutside, value);
}
#endregion
#region PetHelper
private bool _petHelper;
/// <summary>
/// 是否显示宠物帮助窗口
/// </summary>
[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
/// <summary>
/// 快捷穿透按钮X坐标
/// </summary>
[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
/// <summary>
/// 快捷穿透按钮Y坐标
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelpTop))]
public double PetHelpTop
{
get => _petHelpTop;
set => SetProperty(ref _petHelpTop, value);
}
#endregion
}

View File

@ -52,20 +52,6 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
new(Enum.GetValues(typeof(GameSave.ModeType)).Cast<GameSave.ModeType>());
#endregion
#region PetHelper
private bool _petHelper;
/// <summary>
/// 是否显示宠物帮助窗口
/// </summary>
[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<InteractiveSettingModel>
}
#endregion
#region PetHelpLeft
private double _petHelpLeft;
/// <summary>
/// 计算间隔
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.PetHelpLeft))]
public double PetHelpLeft
{
get => _petHelpLeft;
set => SetProperty(ref _petHelpLeft, value);
}
#endregion
#region PetHelpTop
private double _petHelpTop;
/// <summary>
/// 计算间隔
/// </summary>
[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<InteractiveSettingModel>
/// 智能移动周期 (秒)
/// </summary>
[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;
/// <summary>
/// 消息框外置
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MessageBarOutside))]
public bool MessageBarOutside
{
get => _messageBarOutside;
set => SetProperty(ref _messageBarOutside, value);
}
public static ObservableCollection<int> SmartMoveIntervals =
new() { 1, 2, 5, 10, 20, 30, 40, 50, 60 };
#endregion
#region PetGraph
@ -279,6 +227,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
#region AutoBuy
private bool _autoBuy;
// TODO 加入 AutoBuy
/// <summary>
/// 允许桌宠自动购买食品
/// </summary>
@ -293,6 +242,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
#region AutoGift
private bool _autoGift;
// TODO 加入 AutoGift
/// <summary>
/// 允许桌宠自动购买礼物
/// </summary>
@ -326,3 +276,19 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
}
#endregion
}
public class SecondToMinuteConverter : ReflectionConverterBase<int, int>
{
public override int Convert(int sourceValue)
{
if (sourceValue == 30)
return 1;
else
return sourceValue / 60;
}
public override int ConvertBack(int targetValue)
{
return targetValue * 60;
}
}

View File

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

View File

@ -52,9 +52,8 @@
<pu:Switch
x:Name="PetHelperBox"
Grid.Column="3"
d:Checked="PetHelperBox_Checked"
d:Unchecked="PetHelperBox_Checked"
Content="{ll:Str '快速切换'}"
IsChecked="{Binding GraphicsSetting.PetHelper}"
Style="{DynamicResource Switch_BaseStyle}"
ToolTip="{ll:Str '添加快速切换小标,切换顶层或穿透'}" />
</Grid>
@ -224,11 +223,12 @@
Value="{Binding GraphicsSetting.StartRecordPoint.Y}" />
</DockPanel>
<Button
x:Name="BtnStartUpGet"
x:Name="Button_StartPoint"
Grid.Column="4"
d:Click="BtnStartUpGet_Click"
Click="Button_StartPoint_Click"
Content="{ll:Str 设为当前位置}"
Style="{DynamicResource Button_BaseStyle}" />
Style="{DynamicResource Button_BaseStyle}"
ToolTip="{ll:Str 设为当前窗口左上角顶点坐标的位置}" />
</Grid>
<Grid MinHeight="40">
<Grid.ColumnDefinitions>
@ -243,9 +243,8 @@
<pu:Switch
x:Name="SwitchMsgOut"
Grid.Column="1"
d:Checked="SwitchMsgOut_Checked"
d:Unchecked="SwitchMsgOut_Checked"
Content="{ll:Str 将消息框置于外部}"
IsChecked="{Binding GraphicsSetting.MessageBarOutside}"
Style="{DynamicResource Switch_BaseStyle}"
ToolTip="{ll:Str 将消息框置于外部}" />
</Grid>

View File

@ -29,4 +29,12 @@ public partial class GraphicsSettingPage : Page
InitializeComponent();
this.SetViewModel<GraphicsSettingPageVM>();
}
private void Button_StartPoint_Click(object sender, RoutedEventArgs e)
{
ViewModel.GraphicsSetting.StartRecordPoint = new(
SettingWindow.Instance.Left,
SettingWindow.Instance.Top
);
}
}

View File

@ -73,14 +73,13 @@
x:Name="PressLengthSlider"
Grid.Column="1"
VerticalAlignment="Center"
d:ValueChanged="PressLengthSlider_ValueChanged"
LargeChange="0.1"
Maximum="5"
Minimum="0.05"
SmallChange=".05"
Style="{DynamicResource Slider_BaseStyle}"
TickFrequency="0.01"
Value="0.5" />
Value="{Binding InteractiveSetting.PressLength}" />
<pu:NumberInput
Grid.Column="2"
Interval="0.1"
@ -106,14 +105,13 @@
x:Name="Slider_Cal"
Grid.Column="1"
VerticalAlignment="Center"
d:ValueChanged="CalSlider_ValueChanged"
LargeChange="1"
Maximum="60"
Minimum="5"
SmallChange=".5"
Style="{DynamicResource Slider_BaseStyle}"
TickFrequency="0.1"
Value="15" />
Value="{Binding InteractiveSetting.LogicInterval}" />
<pu:NumberInput
Grid.Column="2"
Interval="0.5"
@ -145,7 +143,6 @@
</Grid.RowDefinitions>
<Slider
x:Name="Slider_Interaction"
d:ValueChanged="Slider_Interaction_ValueChanged"
LargeChange="5"
Maximum="1000"
Minimum="30"
@ -153,7 +150,7 @@
Style="{DynamicResource Slider_BaseStyle}"
TickFrequency="1"
ToolTip="{ll:Str '数据计算和互动计算时间间隔,间隔越短需要互动的频率可能会增加.\&#13;间隔越大越不容易打扰到当前工作'}"
Value="200" />
Value="{Binding InteractiveSetting.InteractionCycle}" />
<pu:NumberInput
Grid.Column="1"
Interval="1"
@ -188,84 +185,32 @@
<pu:Switch
x:Name="Switch_PetMove"
Grid.Column="1"
d:Checked="Switch_PetMove_Checked"
d:Unchecked="Switch_PetMove_Checked"
Content="{ll:Str 启用桌宠移动}"
IsChecked="{Binding InteractiveSetting.AllowMove}"
Style="{DynamicResource Switch_BaseStyle}"
ToolTip="{ll:Str '启用移动互动,桌宠会在屏幕上乱动,移动互动概率为普通互动的一半.\&#13;如果嫌麻烦可以关掉'}" />
<pu:Switch
x:Name="Switch_SmartPetMove"
Grid.Column="2"
d:Checked="SmartSwitch_PetMove_Checked"
d:Unchecked="SmartSwitch_PetMove_Checked"
Content="{ll:Str '智能移动'}"
IsChecked="{Binding InteractiveSetting.SmartMove}"
IsEnabled="{Binding ElementName=Switch_PetMove, Path=IsChecked}"
Style="{DynamicResource Switch_BaseStyle}" />
<ComboBox
x:Name="CBSmartMove"
Grid.Column="3"
d:SelectionChanged="CBSmartMove_SelectionChanged"
IsEnabled="{Binding IsChecked, ElementName=Switch_SmartPetMove}"
SelectedIndex="5"
ItemsSource="{Binding InteractiveSetting.SmartMoveIntervals}"
SelectedItem="{Binding InteractiveSetting.SmartMoveInterval}"
Style="{DynamicResource StandardComboBoxStyle}"
ToolTip="{ll:Str 智能移动判断时间间隔}">
<!--<ComboBoxItem Content="{ll:Str '30 秒'}">
<ComboBoxItem.Tag>
<sys:Int32>30</sys:Int32>
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="{ll:Str '1 分钟'}">
<ComboBoxItem.Tag>
<sys:Int32>60</sys:Int32>
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="{ll:Str '2 分钟'}">
<ComboBoxItem.Tag>
<sys:Int32>120</sys:Int32>
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="{ll:Str '5 分钟'}">
<ComboBoxItem.Tag>
<sys:Int32>300</sys:Int32>
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="{ll:Str '10 分钟'}">
<ComboBoxItem.Tag>
<sys:Int32>600</sys:Int32>
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="{ll:Str '20 分钟'}">
<ComboBoxItem.Tag>
<sys:Int32>1200</sys:Int32>
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="{ll:Str '30 分钟'}">
<ComboBoxItem.Tag>
<sys:Int32>1800</sys:Int32>
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="{ll:Str '40 分钟'}">
<ComboBoxItem.Tag>
<sys:Int32>2400</sys:Int32>
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="{ll:Str '50 分钟'}">
<ComboBoxItem.Tag>
<sys:Int32>3000</sys:Int32>
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="{ll:Str '60 分钟'}">
<ComboBoxItem.Tag>
<sys:Int32>3600</sys:Int32>
</ComboBoxItem.Tag>
</ComboBoxItem>-->
</ComboBox>
ToolTip="{ll:Str 智能移动判断时间间隔}" />
<TextBlock
Grid.Column="4"
Style="{DynamicResource TextBlock_BaseStyle}"
Text="{ll:Str 分钟}" />
</Grid>
<Grid MinHeight="40">
<!-- TODO: 移动范围设置 -->
<!--<Grid MinHeight="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
@ -309,7 +254,7 @@
Style="{DynamicResource Button_BaseStyle}"
ToolTip="{ll:Str '手动设置桌宠可移动范围'}" />
</Grid>
</Grid>
</Grid>-->
<Label
Margin="5"
HorizontalAlignment="Left"
@ -331,7 +276,6 @@
<Slider
x:Name="VoiceCatchSilder"
Grid.Column="1"
d:ValueChanged="VoiceCatchSilder_ValueChanged"
LargeChange="5"
Maximum="100"
Minimum="0"
@ -339,7 +283,7 @@
Style="{DynamicResource Slider_BaseStyle}"
TickFrequency="1"
ToolTip="{ll:Str 当实时播放音量达到该值时运行音乐动作}"
Value="30" />
Value="{Binding InteractiveSetting.MusicCatch}" />
<pu:NumberInput
Grid.Column="2"
Interval="1"
@ -367,7 +311,6 @@
<Slider
x:Name="VoiceMaxSilder"
Grid.Column="1"
d:ValueChanged="VoiceCatchSilder_ValueChanged"
LargeChange="1"
Maximum="100"
Minimum="{Binding ElementName=VoiceCatchSilder, Path=Value}"
@ -375,7 +318,7 @@
Style="{DynamicResource Slider_BaseStyle}"
TickFrequency="1"
ToolTip="{ll:Str 当实时播放音量达到该值时运行特殊音乐动作}"
Value="75" />
Value="{Binding InteractiveSetting.MusicMax}" />
<pu:NumberInput
Grid.Column="2"
Foreground="{DynamicResource DARKPrimaryDarker}"