自动买礼物单独区分按钮

This commit is contained in:
ZouJin 2023-09-13 00:36:30 +08:00
parent 381ab87878
commit c1d9eb6770
6 changed files with 82 additions and 26 deletions

View File

@ -35,6 +35,7 @@ namespace VPet_Simulator.Windows.Interface
enablefunction = !this["gameconfig"].GetBool("nofunction");
Statistics = new Statistics(this["statistics"].ToList());
autobuy = this["gameconfig"].GetBool("autobuy");
autogift = this["gameconfig"].GetBool("autogift");
}
public override string ToString()
{
@ -430,6 +431,19 @@ namespace VPet_Simulator.Windows.Interface
this["gameconfig"].SetBool("autobuy", value);
}
}
bool autogift;
/// <summary>
/// 允许桌宠自动购买礼物
/// </summary>
public bool AutoGift
{
get => autogift;
set
{
autogift = value;
this["gameconfig"].SetBool("autogift", value);
}
}
public bool MoveAreaDefault
{

View File

@ -52,28 +52,40 @@
<Run Text="{ll:Str 金钱}" />: $ <Run x:Name="rMoney" Loaded="rMoney_Loaded" Text="" />
</TextBlock>
</StackPanel>
<Grid HorizontalAlignment="Right">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<pu:Switch Content="{ll:Str 购买后不自动关闭窗口}" Grid.Column="2" FontSize="14" Margin="10,0,5,0" Height="20"
VerticalAlignment="Center" HorizontalAlignment="Left" BoxHeight="14" ToggleSize="18"
CheckedBackground="{DynamicResource Primary}" CheckedBorderBrush="{DynamicResource Primary}"
Background="Transparent" ToggleShadowColor="{x:Null}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
ToggleBrush="{DynamicResource PrimaryDark}" pu:WindowX.IsDragMoveArea="False" BoxWidth="30"
Loaded="Switch_Loaded" />
<pu:Switch Content="{ll:Str 让宠物自己买东西吃}" Grid.Column="2" FontSize="14" Margin="10,0,5,0" Height="20"
VerticalAlignment="Center" HorizontalAlignment="Left" BoxHeight="14" ToggleSize="18"
CheckedBackground="{DynamicResource Primary}" CheckedBorderBrush="{DynamicResource Primary}"
Background="Transparent" ToggleShadowColor="{x:Null}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" Grid.Row="1"
ToggleBrush="{DynamicResource PrimaryDark}" pu:WindowX.IsDragMoveArea="False" BoxWidth="30"
ToolTip="{ll:Str '当宠物口渴或者饥饿的时候会自己买东西吃\&#13;请注意,宠物可能会乱花钱和吃错误的东西\&#13;额外加收20%外卖运送费用'}"
Loaded="Switch_Loaded_1" />
</Grid>
<Viewbox HorizontalAlignment="Right">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<pu:Switch Content="{ll:Str 购买后不自动关闭窗口}" Grid.Column="2" FontSize="14" Margin="10,0,5,0"
Height="20" VerticalAlignment="Center" HorizontalAlignment="Left" BoxHeight="14"
ToggleSize="18" CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}" Background="Transparent"
ToggleShadowColor="{x:Null}" CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
ToggleBrush="{DynamicResource PrimaryDark}" pu:WindowX.IsDragMoveArea="False"
BoxWidth="30" Loaded="Switch_Loaded" />
<pu:Switch Content="{ll:Str 让宠物自己买东西吃}" Grid.Column="2" FontSize="14" Margin="10,0,5,0"
Height="20" VerticalAlignment="Center" HorizontalAlignment="Left" BoxHeight="14"
ToggleSize="18" CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}" Background="Transparent"
ToggleShadowColor="{x:Null}" CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Grid.Row="1" ToggleBrush="{DynamicResource PrimaryDark}"
pu:WindowX.IsDragMoveArea="False" BoxWidth="30"
ToolTip="{ll:Str '当宠物口渴或者饥饿的时候会自己买东西吃\&#13;请注意,宠物可能会乱花钱和吃错误的东西\&#13;额外加收20%外卖运送费用'}"
Loaded="Switch_Loaded_1" />
<pu:Switch Content="{ll:Str 让宠物自己买礼物}" Grid.Column="2" FontSize="14" Margin="10,0,5,0"
Height="20" VerticalAlignment="Center" HorizontalAlignment="Left" BoxHeight="14"
ToggleSize="18" CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}" Background="Transparent"
ToggleShadowColor="{x:Null}" CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Grid.Row="2" ToggleBrush="{DynamicResource PrimaryDark}"
pu:WindowX.IsDragMoveArea="False" BoxWidth="30" Visibility="Collapsed"
ToolTip="{ll:Str '当宠物不开心的时候会自己给自己买礼物\&#13;请注意,宠物可能会乱花钱,而且礼物一般都非常贵\&#13;额外加收20%运送费用'}"
Loaded="Switch_Loaded_2" />
</Grid>
</Viewbox>
</Grid>
</DataTemplate>
</pu:WindowXCaption.HeaderTemplate>

View File

@ -348,7 +348,31 @@ namespace VPet_Simulator.Windows
MessageBoxX.Show(mw, "余额不足100无法开启自动购买".Translate(), "更好买".Translate());
return;
}
mw.Set.AutoBuy = _puswitchautobuy.IsChecked.Value;
if (_puswitchautobuy.IsChecked.Value)
{
mw.Set.AutoBuy = true;
_puswitchautogift.Visibility = Visibility.Visible;
}
else
{
mw.Set.AutoBuy = false;
_puswitchautogift.Visibility = Visibility.Collapsed;
}
}
private Switch _puswitchautogift;
private void Switch_Loaded_2(object sender, RoutedEventArgs e)
{
_puswitchautogift = sender as Switch;
_puswitchautogift.IsChecked = mw.Set.AutoGift;
_puswitchautogift.Click += Switch_AutoGift_Checked;
if (mw.Set.AutoBuy)
{
_puswitchautogift.Visibility = Visibility.Visible;
}
}
private void Switch_AutoGift_Checked(object sender, RoutedEventArgs e)
{
mw.Set.AutoGift = _puswitchautogift.IsChecked.Value;
}
}
}

View File

@ -26,3 +26,5 @@ EXP#EXP:|
开机启动重要消息#Important news about startup.:|
我已确认,并在卸载游戏前会关闭该功能#I have confirmed and will disable it before uninstalling the game.:|
没有需要提交的翻译的内容#There are no translations that need to be submitted:|
当宠物不开心的时候会自己给自己买礼物\r请注意,宠物可能会乱花钱,而且礼物一般都非常贵\r额外加收20%运送费用#When the pet is unhappy, it will buy gifts for itself\rPlease note that pets may spend money indiscriminately, and gifts are generally very expensive\rAdditional 20% shipping costs:|
让宠物自己买礼物#Let the pet buy gifts for itself:|

View File

@ -26,3 +26,5 @@ EXP#EXP:|
开机启动重要消息#开机启动重要消息:|
我已确认,并在卸载游戏前会关闭该功能#我已确认,并在卸载游戏前会关闭该功能:|
没有需要提交的翻译的内容#没有需要提交的翻译的内容:|
当宠物不开心的时候会自己给自己买礼物\r请注意,宠物可能会乱花钱,而且礼物一般都非常贵\r额外加收20%运送费用#当宠物不开心的时候会自己给自己买礼物\r请注意,宠物可能会乱花钱,而且礼物一般都非常贵\r额外加收20%运送费用:|
让宠物自己买礼物#让宠物自己买礼物:|

View File

@ -26,3 +26,5 @@ EXP#EXP:|
开机启动重要消息#開機啟動重要消息:|
我已确认,并在卸载游戏前会关闭该功能#我已確認,並在卸載遊戲前會關閉該功能:|
没有需要提交的翻译的内容#沒有需要提交的翻譯的內容:|
当宠物不开心的时候会自己给自己买礼物\r请注意,宠物可能会乱花钱,而且礼物一般都非常贵\r额外加收20%运送费用#當寵物不開心的時候會自己給自己買禮物\r請注意寵物可能會亂花錢而且禮物一般都非常貴\r額外加收20%運送費用:|
让宠物自己买礼物#讓寵物自己買禮物:|