更新 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); set => SetProperty(ref _hideFromTaskControl, value);
} }
#endregion #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>()); new(Enum.GetValues(typeof(GameSave.ModeType)).Cast<GameSave.ModeType>());
#endregion #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 #region LastCacheDate
private DateTime _lastCacheDate; private DateTime _lastCacheDate;
@ -136,34 +122,6 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
} }
#endregion #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 #region AllowMove
private bool _allowMove; private bool _allowMove;
@ -213,25 +171,15 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
/// 智能移动周期 (秒) /// 智能移动周期 (秒)
/// </summary> /// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.SmartMoveInterval))] [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.SmartMoveInterval))]
[ReflectionPropertyConverter(typeof(SecondToMinuteConverter))]
public int SmartMoveInterval public int SmartMoveInterval
{ {
get => _smartMoveInterval; get => _smartMoveInterval;
set => SetProperty(ref _smartMoveInterval, value); set => SetProperty(ref _smartMoveInterval, value);
} }
#endregion
#region MessageBarOutside public static ObservableCollection<int> SmartMoveIntervals =
private bool _messageBarOutside; new() { 1, 2, 5, 10, 20, 30, 40, 50, 60 };
/// <summary>
/// 消息框外置
/// </summary>
[ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.MessageBarOutside))]
public bool MessageBarOutside
{
get => _messageBarOutside;
set => SetProperty(ref _messageBarOutside, value);
}
#endregion #endregion
#region PetGraph #region PetGraph
@ -279,6 +227,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
#region AutoBuy #region AutoBuy
private bool _autoBuy; private bool _autoBuy;
// TODO 加入 AutoBuy
/// <summary> /// <summary>
/// 允许桌宠自动购买食品 /// 允许桌宠自动购买食品
/// </summary> /// </summary>
@ -293,6 +242,7 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
#region AutoGift #region AutoGift
private bool _autoGift; private bool _autoGift;
// TODO 加入 AutoGift
/// <summary> /// <summary>
/// 允许桌宠自动购买礼物 /// 允许桌宠自动购买礼物
/// </summary> /// </summary>
@ -326,3 +276,19 @@ public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
} }
#endregion #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) 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 <pu:Switch
x:Name="PetHelperBox" x:Name="PetHelperBox"
Grid.Column="3" Grid.Column="3"
d:Checked="PetHelperBox_Checked"
d:Unchecked="PetHelperBox_Checked"
Content="{ll:Str '快速切换'}" Content="{ll:Str '快速切换'}"
IsChecked="{Binding GraphicsSetting.PetHelper}"
Style="{DynamicResource Switch_BaseStyle}" Style="{DynamicResource Switch_BaseStyle}"
ToolTip="{ll:Str '添加快速切换小标,切换顶层或穿透'}" /> ToolTip="{ll:Str '添加快速切换小标,切换顶层或穿透'}" />
</Grid> </Grid>
@ -224,11 +223,12 @@
Value="{Binding GraphicsSetting.StartRecordPoint.Y}" /> Value="{Binding GraphicsSetting.StartRecordPoint.Y}" />
</DockPanel> </DockPanel>
<Button <Button
x:Name="BtnStartUpGet" x:Name="Button_StartPoint"
Grid.Column="4" Grid.Column="4"
d:Click="BtnStartUpGet_Click" Click="Button_StartPoint_Click"
Content="{ll:Str 设为当前位置}" Content="{ll:Str 设为当前位置}"
Style="{DynamicResource Button_BaseStyle}" /> Style="{DynamicResource Button_BaseStyle}"
ToolTip="{ll:Str 设为当前窗口左上角顶点坐标的位置}" />
</Grid> </Grid>
<Grid MinHeight="40"> <Grid MinHeight="40">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -243,9 +243,8 @@
<pu:Switch <pu:Switch
x:Name="SwitchMsgOut" x:Name="SwitchMsgOut"
Grid.Column="1" Grid.Column="1"
d:Checked="SwitchMsgOut_Checked"
d:Unchecked="SwitchMsgOut_Checked"
Content="{ll:Str 将消息框置于外部}" Content="{ll:Str 将消息框置于外部}"
IsChecked="{Binding GraphicsSetting.MessageBarOutside}"
Style="{DynamicResource Switch_BaseStyle}" Style="{DynamicResource Switch_BaseStyle}"
ToolTip="{ll:Str 将消息框置于外部}" /> ToolTip="{ll:Str 将消息框置于外部}" />
</Grid> </Grid>

View File

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