样式优化

This commit is contained in:
末城via 2024-03-28 00:45:14 +08:00
parent 7101a07238
commit 540b76009d
13 changed files with 515 additions and 228 deletions

View File

@ -29,6 +29,7 @@
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<SolidColorBrush x:Key="SuccessBrush">#AACC6C</SolidColorBrush>
<DrawingBrush x:Key="SuccessProgressBarForeground" Stretch="None" TileMode="Tile" Viewport="0,0,8,22"
ViewportUnits="Absolute">
<DrawingBrush.RelativeTransform>
@ -53,6 +54,7 @@
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<SolidColorBrush x:Key="WarningBrush">#FFCC4C</SolidColorBrush>
<DrawingBrush x:Key="WarningProgressBarForeground" Stretch="None" TileMode="Tile" Viewport="0,0,8,22"
ViewportUnits="Absolute">
<DrawingBrush.RelativeTransform>
@ -77,6 +79,7 @@
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<SolidColorBrush x:Key="DangerBrush">#FF4C4C</SolidColorBrush>
<DrawingBrush x:Key="DangerProgressBarForeground" Stretch="None" TileMode="Tile" Viewport="0,0,8,22"
ViewportUnits="Absolute">
<DrawingBrush.RelativeTransform>
@ -236,7 +239,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="Padding" Value="7,0,15,0" />
<Setter Property="pu:TextBoxHelper.CornerRadius" Value="5" />
<Setter Property="pu:TextBoxHelper.WatermarkForeground" Value="#DCDCDC" />
<Setter Property="pu:TextBoxHelper.WatermarkForeground" Value="#AAAAAA" />
<Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
</Style>

View File

@ -12,7 +12,10 @@
<Style x:Key="BaseWindowXStyle" TargetType="pu:WindowX">
<Setter Property="pu:WindowXCaption.Background" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:WindowXCaption.Foreground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:WindowXCaption.Buttons" Value="Close" />
<Setter Property="pu:ScrollBarHelper.ThumbBackground" Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="pu:ScrollBarHelper.HoverThumbBackground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ScrollViewerHelper.ScrollBarThickness" Value="8" />
<Setter Property="pu:ScrollBarHelper.ThumbCornerRadius" Value="4" />
<Setter Property="pu:WindowXCaption.CloseButtonStyle">
<Setter.Value>
<Style BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}" TargetType="Button">
@ -20,6 +23,36 @@
</Style>
</Setter.Value>
</Setter>
<Setter Property="pu:WindowXCaption.MinimizeButtonStyle">
<Setter.Value>
<Style BasedOn="{StaticResource {x:Static pu:WindowXCaption.MinimizeButtonStyleKey}}"
TargetType="Button">
<Setter Property="pu:ButtonHelper.HoverBackground"
Value="{x:Null}" />
</Style>
</Setter.Value>
</Setter>
<Setter Property="pu:WindowXCaption.MaximizeButtonStyle">
<Setter.Value>
<Style BasedOn="{StaticResource {x:Static pu:WindowXCaption.MaximizeButtonStyleKey}}"
TargetType="Button">
<Setter Property="pu:ButtonHelper.HoverBackground"
Value="{x:Null}" />
</Style>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="ResizeMode"
Value="CanMinimize">
<Setter Property="pu:WindowXCaption.Buttons"
Value="MinimizeClose" />
</Trigger>
<Trigger Property="ResizeMode"
Value="NoResize">
<Setter Property="pu:WindowXCaption.Buttons"
Value="Close" />
</Trigger>
</Style.Triggers>
</Style>
<Style

View File

@ -15,6 +15,19 @@
<ResourceDictionary>
<pu:GlobalSettings x:Key="globalSettings" FontFamily="{StaticResource MainFont}" FontSize="14"
IconFontFamily="/VPet-Simulator.Windows;component/Res/#remixicon" IconFontSize="16" />
<pu:MessageBoxXSettings x:Key="messageBoxSettings">
<pu:MessageBoxXSettings.WindowXStyle>
<Style TargetType="pu:WindowX"
BasedOn="{StaticResource {x:Static pu:MessageBoxX.WindowXStyleKey}}">
<Setter Property="pu:WindowXCaption.Background"
Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:WindowXCaption.Foreground"
Value="{DynamicResource DARKPrimaryText}" />
</Style>
</pu:MessageBoxXSettings.WindowXStyle>
</pu:MessageBoxXSettings>
</ResourceDictionary>
<ResourceDictionary Source="/VPet-Simulator.Windows.Interface;component/ResourceStyle.xaml" />
</ResourceDictionary.MergedDictionaries>

View File

@ -482,7 +482,7 @@ namespace VPet_Simulator.Windows
}
else
{
winWorkMenu.tbc.SelectedIndex = (int)type;
winWorkMenu.LsbCategory.SelectedIndex = (int)type;
winWorkMenu.Focus();
winWorkMenu.Topmost = true;
}

View File

@ -1,26 +1,67 @@
<Border x:Class="VPet_Simulator.Windows.MPUserControl" CornerRadius="5" BorderThickness="3"
<Border x:Class="VPet_Simulator.Windows.MPUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:pu="https://opensource.panuon.com/wpf-ui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:VPet_Simulator.Windows"
mc:Ignorable="d" Margin="5" Width="350" Height="80" Background="{DynamicResource SecondaryLight}"
BorderBrush="{DynamicResource Secondary}">
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VPet_Simulator.Windows"
mc:Ignorable="d"
Margin="5"
Background="{DynamicResource SecondaryTrans4}"
CornerRadius="5">
<Grid>
<pu:ContentControlX HorizontalAlignment="Left" Margin="10" CornerRadius="27">
<Image x:Name="uimg" Source="/Res/TopLogo2019.PNG" />
</pu:ContentControlX>
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Margin="70,0,0,0"
Foreground="{DynamicResource DARKPrimaryDarker}" FontSize="16">
<Run Text="{ll:Str 访客}" />: <Run x:Name="rPetName" Text="萝莉斯" FontSize="20" FontWeight="Bold" />
<LineBreak />
<Run Text="{ll:Str 来自}" />: <Run x:Name="hostName" Text="XXX" FontWeight="Bold" /><LineBreak />
<Run x:Name="info" Text="Lv ??" />
</TextBlock>
<Button Style="{DynamicResource ThemedButtonStyle}" HorizontalAlignment="Right" Content="{ll:Str 重置位置}"
VerticalAlignment="Top" Margin="8" Click="btn_ReSetLocal" />
<Button x:Name="Kick" Style="{DynamicResource ThemedButtonStyle}" HorizontalAlignment="Right"
Content="{ll:Str 送客}" VerticalAlignment="Bottom" Margin="8" Click="Kick_Click" Visibility="Collapsed"
d:Visibility="Visible" />
<Grid Margin="7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image x:Name="uimg"
Height="50"
Source="/Res/TopLogo2019.PNG" />
<StackPanel Grid.Column="1"
Margin="15,0,0,0">
<TextBlock>
<Run x:Name="rPetName"
Text="萝莉斯"
FontWeight="Bold"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoublePlusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}" />
<Run x:Name="hostName"
Text="XXX"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}" />
</TextBlock>
<TextBlock x:Name="info"
VerticalAlignment="Center"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}">Lv ??</TextBlock>
<StackPanel Margin="0,3,0,0"
Orientation="Horizontal"
Opacity="0.7">
<TextBlock VerticalAlignment="Center"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}">ID:</TextBlock>
<TextBox VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}" />
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="2">
<Button Padding="7,5"
Style="{DynamicResource ThemedButtonStyle}"
Content="{ll:Str 重置位置}"
Click="btn_ReSetLocal" />
<Button x:Name="Kick"
Padding="7,5"
Click="Kick_Click"
Visibility="Collapsed"
d:Visibility="Visible"
HorizontalAlignment="Center"
Background="Transparent"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}">
<TextBlock TextDecorations="Underline"
Text="{ll:Str 送客}" />
</Button>
</StackPanel>
</Grid>
</Grid>
</Border>

View File

@ -1,51 +1,123 @@
<Window x:Class="VPet_Simulator.Windows.winMutiPlayer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
Title="{ll:Str 访客表}" MinHeight="400" Width="440" Closed="Window_Closed" FontSize="16" SizeToContent="Height"
MaxHeight="800" ResizeMode="CanMinimize" Closing="Window_Closing">
<Grid>
<pu:ContentControlX Margin="20" Width="80" Height="80" HorizontalAlignment="Left" VerticalAlignment="Top"
CornerRadius="20">
<Image x:Name="HostHead" Source="/Res/TopLogo2019.PNG" />
</pu:ContentControlX>
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="120,20,0,0"
Foreground="{DynamicResource DARKPrimaryDarker}">
<Run x:Name="hostPet" Text="萝莉斯" FontSize="24" FontWeight="Bold" /> <Run Text="{ll:Str 的访客表}" />
<LineBreak />
<Run Text="{ll:Str 主持人}" />: <Run x:Name="hostName" Text="XXX" /><LineBreak />
<Run Text="{ll:Str 访客表ID}" />:
</TextBlock>
<TextBox x:Name="lbLid" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="210,70,0,0"
BorderThickness="0" IsReadOnly="True" Text="1145141919" Background="{DynamicResource DARKPrimaryTrans4}"
Foreground="{DynamicResource DARKPrimaryDarker}" Padding="0" />
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Margin="15,135,15,15">
<TabItem Header="{ll:Str 访客列表}">
<StackPanel x:Name="MUUCList" Background="{DynamicResource SecondaryLighter}" />
</TabItem>
<TabItem Header="{ll:Str 消息日志}">
<TextBox x:Name="tbLog" Margin="0" BorderThickness="0" Background="{DynamicResource DARKPrimaryTrans4}"
Foreground="{DynamicResource DARKPrimaryDarker}" IsReadOnly="True" TextWrapping="WrapWithOverflow"
VerticalScrollBarVisibility="Visible" />
</TabItem>
</TabControl>
<pu:Switch x:Name="swAllowJoin" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="120,92,20,0"
Background="Transparent" BorderBrush="{DynamicResource PrimaryDark}" BoxHeight="16" BoxWidth="35"
Foreground="{DynamicResource DARKPrimaryDarker}" CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}" CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str 允许好友加入}" ToggleBrush="{DynamicResource PrimaryDark}" ToggleShadowColor="{x:Null}"
ToggleSize="14" IsChecked="True" Checked="swAllowJoin_Checked" Unchecked="swAllowJoin_Unchecked"
IsEnabled="False" />
<pu:Switch x:Name="swAllowTouch" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="120,110,20,0"
Background="Transparent" BorderBrush="{DynamicResource PrimaryDark}" BoxHeight="16" BoxWidth="35"
Foreground="{DynamicResource DARKPrimaryDarker}" CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}" CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str 允许好友交互}" ToggleBrush="{DynamicResource PrimaryDark}" ToggleShadowColor="{x:Null}"
ToggleSize="14" IsChecked="True" Checked="swAllowTouch_Checked" Unchecked="swAllowTouch_Unchecked" />
</Grid>
</Window>
<pu:WindowX x:Class="VPet_Simulator.Windows.winMutiPlayer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VPet_Simulator.Windows"
mc:Ignorable="d"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
Title="{ll:Str 访客表}"
MinHeight="400"
Height="400"
Width="550"
Closed="Window_Closed"
Style="{DynamicResource BaseWindowXStyle}"
Background="{DynamicResource PrimaryLighter}"
FontSize="{Binding FontSize, Source={x:Static pu:GlobalSettings.Setting}}"
MaxHeight="400"
ResizeMode="CanMinimize"
Closing="Window_Closing">
<TabControl x:Name="tabControl"
TabStripPlacement="Left"
pu:TabControlHelper.ItemsHorizontalHeaderAlignment="Stretch"
pu:TabControlHelper.ItemsWidth="220"
pu:TabControlHelper.ItemsPadding="15,8"
pu:TabControlHelper.ItemsHeight="34"
pu:TabControlHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}"
pu:TabControlHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}">
<pu:TabControlHelper.FrontControl>
<Grid Margin="7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border CornerRadius="5"
Width="55"
Height="55"
BorderBrush="LightGray"
BorderThickness="1">
<Border.Background>
<ImageBrush x:Name="HostHead"
ImageSource="/Res/TopLogo2019.PNG" />
</Border.Background>
</Border>
<StackPanel Grid.Column="1"
Margin="7,0,0,0">
<TextBlock>
<Run x:Name="hostName"
Text="萝莉斯"
FontWeight="Bold"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoublePlusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}" />
<Run x:Name="hostPet"
Text="XXX"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}" />
</TextBlock>
<StackPanel Orientation="Horizontal"
Opacity="0.7">
<TextBlock VerticalAlignment="Center"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}">ID:</TextBlock>
<TextBox x:Name="lbLid"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}" />
</StackPanel>
<Grid Margin="0,2,0,0">
<pu:Switch x:Name="swAllowJoin"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}"
BorderBrush="#AFAFAF"
ToggleBrush="#AFAFAF"
Padding="2,0,0,0"
BoxHeight="13"
BoxWidth="21"
Foreground="#AFAFAF"
CheckedForeground="{DynamicResource PrimaryText}"
CheckedBackground="{DynamicResource PrimaryDarker}"
CheckedBorderBrush="{DynamicResource PrimaryDarker}"
CheckedContent="{ll:Str 好友加入}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
ToggleShadowColor="{x:Null}"
ToggleSize="9"
IsChecked="True"
Checked="swAllowJoin_Checked"
Unchecked="swAllowJoin_Unchecked" />
<pu:Switch x:Name="swAllowTouch"
HorizontalAlignment="Right"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}"
BorderBrush="#AFAFAF"
ToggleBrush="#AFAFAF"
Padding="2,0,0,0"
BoxHeight="13"
BoxWidth="21"
Foreground="#AFAFAF"
CheckedForeground="{DynamicResource PrimaryText}"
CheckedBackground="{DynamicResource PrimaryDarker}"
CheckedBorderBrush="{DynamicResource PrimaryDarker}"
CheckedContent="{ll:Str 好友交互}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
ToggleShadowColor="{x:Null}"
ToggleSize="9"
IsChecked="True"
Checked="swAllowTouch_Checked"
Unchecked="swAllowTouch_Unchecked" />
</Grid>
</StackPanel>
</Grid>
</pu:TabControlHelper.FrontControl>
<TabItem Header="{ll:Str 访客列表}">
<StackPanel x:Name="MUUCList" />
</TabItem>
<TabItem Header="{ll:Str 消息日志}">
<TextBox x:Name="tbLog"
Margin="0"
Padding="7"
VerticalContentAlignment="Stretch"
BorderThickness="0"
Background="Transparent"
Foreground="{DynamicResource DARKPrimaryDarker}"
IsReadOnly="True"
VerticalScrollBarVisibility="Visible" />
</TabItem>
</TabControl>
</pu:WindowX>

View File

@ -31,7 +31,7 @@ namespace VPet_Simulator.Windows;
/// <summary>
/// winMutiPlayer.xaml 的交互逻辑
/// </summary>
public partial class winMutiPlayer : Window, IMPWindows
public partial class winMutiPlayer : WindowX, IMPWindows
{
public Lobby lb;
MainWindow mw;
@ -147,7 +147,7 @@ public partial class winMutiPlayer : Window, IMPWindows
hostName.Text = lb.Owner.Name;
HostID = lb.Owner.Id.Value;
lbLid.Text = lb.Id.Value.ToString("x");
HostHead.Source = ConvertToImageSource(img.Value);
HostHead.ImageSource = ConvertToImageSource(img.Value);
});
SteamNetworking.AllowP2PPacketRelay(true);

View File

@ -62,27 +62,27 @@
</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}"
ToggleSize="10" 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" />
ToggleBrush="{DynamicResource DARKPrimaryText}" pu:WindowX.IsDragMoveArea="False"
BoxWidth="24" 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}"
ToggleSize="10" 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"
Grid.Row="1" ToggleBrush="{DynamicResource DARKPrimaryText}"
pu:WindowX.IsDragMoveArea="False" BoxWidth="24"
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}"
ToggleSize="10" 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"
Grid.Row="2" ToggleBrush="{DynamicResource DARKPrimaryText}"
pu:WindowX.IsDragMoveArea="False" BoxWidth="24" Visibility="Collapsed"
ToolTip="{ll:Str '当宠物不开心的时候会自己给自己买礼物\&#13;请注意,宠物可能会乱花钱,而且礼物一般都非常贵\&#13;额外加收20%运送费用'}"
Loaded="Switch_Loaded_2" />
</Grid>

View File

@ -16,19 +16,24 @@
</pu:WindowX.Resources>-->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="SettingMenuWidth" Width="150" />
<ColumnDefinition x:Name="SettingMenuWidth" Width="180" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBox x:Name="tb_seach_menu" FontSize="16" pu:TextBoxHelper.Watermark="{ll:Str 搜索设置}"
Style="{DynamicResource StandardTextBoxStyle}" VerticalAlignment="Top" Margin="3,6,6,0"
<TextBox x:Name="tb_seach_menu" FontSize="16" pu:TextBoxHelper.Watermark="{ll:Str 搜索设置}" BorderThickness="0,0,0,1" pu:TextBoxHelper.CornerRadius="0" BorderBrush="LightGray"
Style="{DynamicResource StandardTextBoxStyle}" VerticalAlignment="Top" Margin="3,6,7,0"
TextChanged="tb_seach_menu_textchange" />
<ListBox x:Name="ListMenu" ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto" Margin="3,40,6,3"
BorderBrush="{DynamicResource Primary}" pu:ListBoxHelper.CornerRadius="5" BorderThickness="2"
Background="{DynamicResource SecondaryLighter}"
pu:ListBoxHelper.ItemsHoverBackground="{DynamicResource Primary}"
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource SecondaryLight}" />
<GridSplitter Width="3" Background="{DynamicResource PrimaryDarker}" />
<ListBox x:Name="ListMenu" ScrollViewer.HorizontalScrollBarVisibility="Auto" BorderThickness="0"
ScrollViewer.VerticalScrollBarVisibility="Auto" Margin="0,40,5,3"
pu:ListBoxHelper.ItemsPadding="15,8" pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}" pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}" />
<GridSplitter Margin="0,15" Background="LightGray">
<GridSplitter.Template>
<ControlTemplate TargetType="GridSplitter">
<Border Background="Transparent">
<Rectangle Margin="2,0" Width="1" Fill="{TemplateBinding Background}" />
</Border>
</ControlTemplate>
</GridSplitter.Template>
</GridSplitter>
<TabControl x:Name="MainTab" Margin="5" pu:TabControlHelper.CanHeaderPanelScroll="True"
pu:TabControlHelper.ItemsCornerRadius="4" pu:TabControlHelper.ItemsHeight="NaN"
pu:TabControlHelper.ItemsHoverBackground="{DynamicResource PrimaryLight}"

View File

@ -1,25 +1,26 @@
<Window x:Class="VPet_Simulator.Windows.winInputBox"
<pu:WindowX x:Class="VPet_Simulator.Windows.winInputBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" MinWidth="300"
xmlns:pu="https://opensource.panuon.com/wpf-ui" Title="winInputBox" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen" Topmost="True" Background="{DynamicResource SecondaryLighter}"
WindowStartupLocation="CenterScreen" Topmost="True" Style="{DynamicResource BaseWindowXStyle}" Background="{DynamicResource SecondaryLighter}"
Closing="Window_Closing" Closed="Window_Closed" SizeToContent="WidthAndHeight">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="Text" Text="文本消息内容就显示在这里,无论你是否接受,你也没法接受这样的弹窗?" Margin="20,5,20,5" VerticalAlignment="Top"
HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center" />
<TextBox x:Name="TextBoxInput" Grid.Row="1" Margin="20,5,20,10" FontSize="14"
TextWrapping="Wrap" />
<TextBox x:Name="TextBoxInput" Grid.Row="1" Margin="20,0,20,10" VerticalAlignment="Top" FontSize="14" Style="{DynamicResource StandardTextBoxStyle}"
PreviewKeyDown="TextBoxInput_PreviewKeyDown" />
<Button Grid.Row="2" x:Name="ButtonOK" Content="确定" HorizontalAlignment="Right" Margin="5,0,0,0"
VerticalAlignment="Bottom" Height="26" Width="75" Foreground="{DynamicResource DARKPrimaryText}"
VerticalAlignment="Bottom" Height="30" Width="75" Foreground="{DynamicResource DARKPrimaryText}"
Background="{DynamicResource PrimaryDarker}" Click="ButtonYes_Click" FontSize="12"
pu:ButtonHelper.CornerRadius="5" />
</Grid>
</Window>
</pu:WindowX>

View File

@ -13,12 +13,13 @@ using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using static System.Net.Mime.MediaTypeNames;
using VPet_Simulator.Core;
using Panuon.WPF.UI;
namespace VPet_Simulator.Windows;
/// <summary>
/// winInputBox.xaml 的交互逻辑
/// </summary>
public partial class winInputBox : Window
public partial class winInputBox : WindowX
{
MainWindow mw;
public winInputBox(MainWindow mainw, string title, string text, string defaulttext, bool AllowMutiLine = false, bool CanHide = false, bool TextCenter = true)

View File

@ -1,61 +1,135 @@
<Window x:Class="VPet_Simulator.Windows.winWorkMenu" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<pu:WindowX x:Class="VPet_Simulator.Windows.winWorkMenu" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:pu="https://opensource.panuon.com/wpf-ui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" Title="{ll:Str 工作面板}" Height="550"
Width="680" ResizeMode="CanMinimize" FontSize="16" Closed="Window_Closed">
xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" Title="{ll:Str 工作面板}" Height="350" Style="{DynamicResource BaseWindowXStyle}"
Background="{DynamicResource PrimaryLighter}" Width="580" ResizeMode="CanMinimize" Closed="Window_Closed">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<TabControl x:Name="tbc" Grid.RowSpan="2" SelectionChanged="tbc_SelectionChanged">
<TabItem x:Name="tiw" Header="{ll:Str '工作'}">
<ListBox x:Name="lbWork" SelectionChanged="lbWork_SelectionChanged" />
</TabItem>
<TabItem x:Name="tis" Header="{ll:Str '学习'}">
<ListBox x:Name="lbStudy" SelectionChanged="lbStudy_SelectionChanged" />
</TabItem>
<TabItem x:Name="tip" Header="{ll:Str '玩耍'}">
<ListBox x:Name="lbPlay" SelectionChanged="lbPlay_SelectionChanged" />
</TabItem>
<TabItem x:Name="tstar" Header="{ll:Str '收藏'}">
<ListBox x:Name="lbStar" SelectionChanged="lbStar_SelectionChanged" />
</TabItem>
</TabControl>
<Image x:Name="WorkViewImage" Grid.Column="1" Margin="10,10,10,33" Source="/Res/img/r_singlemoney_1.png" />
<Button x:Name="btnStart" Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom" Margin="5" Height="30"
Content="{ll:Str 开始工作}" Background="{DynamicResource DARKPrimary}" BorderThickness="1"
pu:ButtonHelper.CornerRadius="5" BorderBrush="{DynamicResource DARKPrimaryDarker}"
Foreground="{DynamicResource DARKPrimaryText}" FontWeight="Bold" FontSize="20" IsEnabled="False"
Click="btnStart_Click" />
<Label x:Name="lName" Background="{x:Null}" Grid.Column="1" VerticalAlignment="Bottom"
Content="{ll:Str 请从侧边栏选择}" FontSize="24" Foreground="{DynamicResource DARKPrimaryDark}"
FontWeight="Bold" />
<ToggleButton x:Name="tbtn_star" Grid.Column="1" VerticalAlignment="Bottom" HorizontalAlignment="Right"
Content="&#xF18B;" FontFamily="remixicon" Style="{DynamicResource TextToggleButtonStyle}" FontSize="24"
Margin="6" pu:ToggleButtonHelper.CheckedContent="&#xF186;" Click="tbtn_star_Click"/>
<TextBlock Grid.Column="1" VerticalAlignment="Top" Grid.Row="1" Margin="10,5,0,0" HorizontalAlignment="Left">
<Run Text="{ll:Str '获得内容'}" /> : <LineBreak />
<Run Text="{ll:Str '获取效率'}" /> : <LineBreak />
<Run Text="{ll:Str '饱腹消耗'}" /> : <LineBreak />
<Run Text="{ll:Str '口渴消耗'}" /> : <LineBreak />
<Run Text="{ll:Str '心情消耗'}" /> : <LineBreak />
<Run Text="{ll:Str '等级限制'}" /> : <LineBreak />
<Run Text="{ll:Str '花费时间'}" /> : <LineBreak />
<Run Text="{ll:Str '奖励倍率'}" /> : <LineBreak />
<Run Text="{ll:Str '倍率调整'}" /> :
</TextBlock>
<TextBlock x:Name="tbDisplay" Grid.Column="1" VerticalAlignment="Top" Grid.Row="1" Margin="150,5,0,0"
HorizontalAlignment="Left" />
<Slider x:Name="wDouble" Grid.Column="1" Margin="20,190,20,0" Grid.Row="1" VerticalAlignment="Top"
SmallChange="1" Value="1" Minimum="1" IsEnabled="False" TickFrequency="1" IsSnapToTickEnabled="True"
ValueChanged="wDouble_ValueChanged" LargeChange="1" Style="{DynamicResource StandardSliderStyle}"
TickPlacement="Both" />
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Background="{DynamicResource DARKPrimaryText}" />
<StackPanel Margin="12, 10">
<TextBlock Text="工作和娱乐"
FontSize="18"
Margin="5"
Foreground="{DynamicResource DARKPrimary}" />
<ListBox x:Name="LsbCategory"
Grid.Row="1"
Margin="-12,10,-12,0"
Background="Transparent"
BorderThickness="0"
SelectedIndex="0"
pu:ListBoxHelper.ItemsPadding="15,8"
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}"
pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
SelectionChanged="LsbCategory_SelectionChanged">
<ListBoxItem x:Name="LsbiWork" Content="{ll:Str '工作'}" />
<ListBoxItem x:Name="LsbiStudy" Content="{ll:Str '学习'}" />
<ListBoxItem x:Name="LsbiPlay" Content="{ll:Str '玩耍'}" />
<ListBoxItem x:Name="LsbiStar" Content="{ll:Str '收藏'}" />
</ListBox>
</StackPanel>
<Grid Grid.Column="1"
Margin="15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="15"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="工作内容"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoubleMinusConverter}, ConverterParameter=2, Source={x:Static pu:GlobalSettings.Setting}}" />
<Grid Grid.Row="1"
Margin="0,3,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ComboBox x:Name="detailTypes"
Style="{DynamicResource StandardComboBoxStyle}" SelectionChanged="detailTypes_SelectionChanged" />
<ToggleButton x:Name="tbtn_star" Grid.Column="1" VerticalAlignment="Bottom" HorizontalAlignment="Right"
Content="&#xF18B;" FontFamily="remixicon" Style="{DynamicResource TextToggleButtonStyle}" FontSize="24"
Margin="6" pu:ToggleButtonHelper.CheckedContent="&#xF186;" Click="tbtn_star_Click"/>
</Grid>
<Image x:Name="WorkViewImage"
RenderOptions.BitmapScalingMode="HighQuality"
Grid.Row="2"
Margin="-20,0"
Stretch="Uniform"
Source="/Res/img/r_singlemoney_1.png" />
</Grid>
<Border Grid.Column="2"
Background="White"
CornerRadius="4" />
<Grid Grid.Column="2"
Margin="15">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="15" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="75" />
<ColumnDefinition Width="15" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock x:Name="tbGain" VerticalAlignment="Bottom" Foreground="{DynamicResource PrimaryDarker}"
FontSize="{Binding FontSize, Converter={x:Static pu:Converters.DoublePlusConverter}, ConverterParameter=6, Source={x:Static pu:GlobalSettings.Setting}}">$金钱</TextBlock>
<TextBlock x:Name="tbSpeed" Grid.Column="2" VerticalAlignment="Bottom" Foreground="{DynamicResource PrimaryDarker}" Text="+ 4/t"/>
<TextBlock Grid.Row="2">饱腹度</TextBlock>
<TextBlock x:Name="tbFood" Grid.Row="2" Grid.Column="2" Foreground="{DynamicResource DangerBrush}" Text="- 1/t"/>
<TextBlock Grid.Row="3">口渴度</TextBlock>
<TextBlock x:Name="tbDrink" Grid.Row="3" Grid.Column="2" Foreground="{DynamicResource DangerBrush}" Text="- 4/t"/>
<TextBlock Grid.Row="4">心情</TextBlock>
<TextBlock x:Name="tbSpirit" Grid.Row="4" Grid.Column="2" Foreground="{DynamicResource DangerBrush}" Text="- 4/t"/>
<TextBlock Grid.Row="5">等级限制</TextBlock>
<TextBlock x:Name="tbLvLimit"
Grid.Row="5"
Grid.Column="2"
Foreground="{DynamicResource PrimaryDarker}" Text="- 4/t"/>
<TextBlock Grid.Row="6">花费时间</TextBlock>
<TextBlock x:Name="tbTime" Grid.Row="6" Grid.Column="2" Foreground="{DynamicResource PrimaryDarker}" Text="10 t"/>
<TextBlock Grid.Row="7">奖励倍率</TextBlock>
<TextBlock x:Name="tbBonus" Grid.Row="7" Grid.Column="2" Foreground="{DynamicResource PrimaryDarker}" Text="x2"/>
<TextBlock Grid.Row="8">倍率调整</TextBlock>
<TextBlock x:Name="tbRatio" Grid.Row="8" Grid.Column="2" Foreground="{DynamicResource PrimaryDarker}" Text="x2"/>
<Slider x:Name="wDouble" pu:SliderHelper.ThumbWidth="10" pu:SliderHelper.ThumbCornerRadius="2" pu:SliderHelper.ThumbHeight="16" pu:SliderHelper.ThumbBorderThickness="2"
Grid.Row="9" Grid.Column="2" Grid.ColumnSpan="2"
SmallChange="1" Value="1" Minimum="1" IsEnabled="False" TickFrequency="1" IsSnapToTickEnabled="True"
ValueChanged="wDouble_ValueChanged" LargeChange="1" Style="{DynamicResource StandardSliderStyle}" TickPlacement="Both" />
</Grid>
<Button x:Name="btnStart"
Grid.Row="1"
Height="30"
Content="{ll:Str 开始工作}"
Style="{DynamicResource ThemedButtonStyle}"
Background="{DynamicResource PrimaryDarker}"
Click="btnStart_Click" />
</Grid>
</Grid>
</Grid>
</Grid>
</Window>
</pu:WindowX>

View File

@ -1,4 +1,5 @@
using LinePutScript.Localization.WPF;
using Panuon.WPF.UI;
using System;
using System.Collections.Generic;
using System.Linq;
@ -12,6 +13,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using VPet_Simulator.Core;
using VPet_Simulator.Windows.Interface;
using static VPet_Simulator.Core.GraphHelper;
@ -20,44 +22,57 @@ namespace VPet_Simulator.Windows;
/// <summary>
/// winWorkMenu.xaml 的交互逻辑
/// </summary>
public partial class winWorkMenu : Window
public partial class winWorkMenu : WindowX
{
MainWindow mw;
List<Work> ws;
List<Work> ss;
List<Work> ps;
public void ShowImageDefault(Work.WorkType type) => WorkViewImage.Source = mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_t_" + type.ToString(), "work_" + type.ToString());
private readonly List<string> _workDetails = new List<string>();
private readonly List<string> _studyDetails = new List<string>();
private readonly List<string> _playDetails = new List<string>();
private readonly List<string> _starDetails = new List<string>();
public void ShowImageDefault(Work.WorkType type)
{
Dispatcher.BeginInvoke(() =>
{
WorkViewImage.Source = mw.ImageSources.FindImage("work_" + mw.Set.PetGraph + "_t_" + type.ToString(), "work_" + type.ToString());
}, DispatcherPriority.Loaded);
}
public winWorkMenu(MainWindow mw, Work.WorkType type)
{
InitializeComponent();
this.mw = mw;
mw.Main.WorkList(out ws, out ss, out ps);
if (ws.Count == 0)
tbc.Items.Remove(tiw);
LsbCategory.Items.Remove(LsbiWork);
else
foreach (var v in ws)
{
lbWork.Items.Add(v.NameTrans);
_workDetails.Add(v.NameTrans);
}
if (ss.Count == 0)
tbc.Items.Remove(tis);
LsbCategory.Items.Remove(LsbiStudy);
else
foreach (var v in ss)
{
lbStudy.Items.Add(v.NameTrans);
_studyDetails.Add(v.NameTrans);
}
if (ps.Count == 0)
tbc.Items.Remove(tip);
LsbCategory.Items.Remove(LsbiPlay);
else
foreach (var v in ps)
{
lbPlay.Items.Add(v.NameTrans);
_playDetails.Add(v.NameTrans);
}
foreach (var v in mw.WorkStar())
{
lbStar.Items.Add(v.NameTrans);
_starDetails.Add(v.NameTrans);
}
tbc.SelectedIndex = (int)type;
LsbCategory.SelectedIndex = (int)type;
ShowImageDefault(type);
}
public bool IsWorkStar(Work work) => mw.Set["work_star"].GetBool(work.Name);
@ -99,7 +114,7 @@ public partial class winWorkMenu : Window
public void ShowWork(Work work)
{
nowworkdisplay = work;
lName.Content = work.NameTrans;
//显示图像
string source = mw.ImageSources.FindSource("work_" + mw.Set.PetGraph + "_" + work.Graph) ?? mw.ImageSources.FindSource("work_" + mw.Set.PetGraph + "_" + work.Name);
if (source == null)
@ -111,44 +126,60 @@ public partial class winWorkMenu : Window
{
WorkViewImage.Source = Interface.ImageResources.NewSafeBitmapImage(source);
}
StringBuilder sb = new StringBuilder();
if (work.Type == Work.WorkType.Work)
sb.AppendLine("金钱".Translate());
tbGain.Text = $"${"".Translate()}";
else
sb.AppendLine("经验".Translate());
sb.AppendLine(work.Get().ToString("f2"));
sb.AppendLine(work.StrengthFood.ToString("f2"));
sb.AppendLine(work.StrengthDrink.ToString("f2"));
sb.AppendLine(work.Feeling.ToString("f2"));
sb.AppendLine(work.LevelLimit.ToString("f0"));
tbGain.Text = $"Exp{"".Translate()}";
tbSpeed.Text = "+" + work.Get().ToString("f2");
tbFood.Text = "-" + work.StrengthFood.ToString("f2");
tbDrink.Text = "-" + work.StrengthDrink.ToString("f2");
tbSpirit.Text = "-" + work.Feeling.ToString("f2");
tbLvLimit.Text = work.LevelLimit.ToString("f0");
if (work.Time > 100)
sb.AppendLine((work.Time / 60).ToString("f2") + 'h');
tbTime.Text = (work.Time / 60).ToString("f2") + 'h';
else
sb.AppendLine(work.Time.ToString() + 'm');
sb.AppendLine('x' + (1 + work.FinishBonus).ToString("f2"));
sb.AppendLine('x' + wDouble.Value.ToString("f0"));
tbDisplay.Text = sb.ToString();
tbTime.Text = work.Time.ToString() + 'm';
tbBonus.Text = 'x' + (1 + work.FinishBonus).ToString("f2");
tbRatio.Text = 'x' + wDouble.Value.ToString("f0");
tbtn_star.IsChecked = IsWorkStar(work);
}
private void tbc_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void LsbCategory_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
switch (tbc.SelectedIndex)
Dispatcher.BeginInvoke(() =>
{
case 0:
btnStart.Content = "开始工作".Translate();
break;
case 1:
btnStart.Content = "开始学习".Translate();
break;
case 2:
btnStart.Content = "开始玩耍".Translate();
break;
case 3:
btnStart.Content = "开始工作".Translate();
return;
}
ShowImageDefault((Work.WorkType)tbc.SelectedIndex);
ShowImageDefault((Work.WorkType)LsbCategory.SelectedIndex);
tbtn_star.Visibility = Visibility.Visible;
var lastIndex = detailTypes.SelectedIndex;
switch (LsbCategory.SelectedIndex)
{
case 0:
detailTypes.ItemsSource = _workDetails;
btnStart.Content = "开始工作".Translate();
break;
case 1:
detailTypes.ItemsSource = _studyDetails;
btnStart.Content = "开始学习".Translate();
break;
case 2:
detailTypes.ItemsSource = _playDetails;
btnStart.Content = "开始玩耍".Translate();
break;
case 3:
tbtn_star.Visibility = Visibility.Collapsed;
detailTypes.ItemsSource = _starDetails;
btnStart.Content = "开始工作".Translate();
break;
}
if(detailTypes.SelectedIndex == -1)
{
detailTypes.SelectedIndex = 0;
}
else if(detailTypes.SelectedIndex == lastIndex)
{
detailTypes_SelectionChanged(null, null);
}
}, System.Windows.Threading.DispatcherPriority.Loaded);
}
private void wDouble_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
@ -158,25 +189,43 @@ public partial class winWorkMenu : Window
ShowWork(nowwork.Double((int)wDouble.Value));
}
private void lbWork_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void detailTypes_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
nowwork = (ws[lbWork.SelectedIndex]);
ShowWork();
e.Handled = true;
}
private void lbStudy_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
nowwork = (ss[lbStudy.SelectedIndex]);
ShowWork();
e.Handled = true;
}
private void lbPlay_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
nowwork = (ps[lbPlay.SelectedIndex]);
ShowWork();
e.Handled = true;
Dispatcher.BeginInvoke(() =>
{
if (detailTypes.SelectedIndex < 0)
{
tbGain.Text = "??";
tbSpeed.Text = "??";
tbFood.Text = "??";
tbDrink.Text = "??";
tbSpirit.Text = "??";
tbLvLimit.Text = "??";
tbTime.Text = "??";
tbBonus.Text = "??";
tbRatio.Text = "??";
return;
}
switch (LsbCategory.SelectedIndex)
{
case 0:
nowwork = (ws[detailTypes.SelectedIndex]);
break;
case 1:
nowwork = (ss[detailTypes.SelectedIndex]);
break;
case 2:
nowwork = (ps[detailTypes.SelectedIndex]);
break;
case 3:
if (!AllowChange) return;
var works = mw.WorkStar();
if (works.Count <= detailTypes.SelectedIndex) return;
nowwork = (works[detailTypes.SelectedIndex]);
break;
}
ShowWork();
}, System.Windows.Threading.DispatcherPriority.Loaded);
}
private void Window_Closed(object sender, EventArgs e)
@ -193,26 +242,16 @@ public partial class winWorkMenu : Window
}
}
private void lbStar_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!AllowChange) return;
var works = mw.WorkStar();
if (works.Count <= lbStar.SelectedIndex) return;
nowwork = (works[lbStar.SelectedIndex]);
ShowWork();
e.Handled = true;
}
private void tbtn_star_Click(object sender, RoutedEventArgs e)
{
SetWorkStar(nowwork, tbtn_star.IsChecked == true);
AllowChange = false;
lbStar.Items.Clear();
_starDetails.Clear();
mw.WorkStarMenu.Items.Clear();
//更新星标
foreach (var v in mw.WorkStar())
{
lbStar.Items.Add(v.NameTrans);
_starDetails.Add(v.NameTrans);
var mi = new System.Windows.Controls.MenuItem()
{
Header = nowwork.NameTrans
@ -220,6 +259,11 @@ public partial class winWorkMenu : Window
mi.Click += (s, e) => mw.Main.ToolBar.StartWork(nowwork.Double(mw.Set["workmenu"].GetInt("double_" + nowwork.Name, 1)));
mw.WorkStarMenu.Items.Add(mi);
}
if(detailTypes.ItemsSource == _starDetails
&& detailTypes.SelectedIndex == -1)
{
detailTypes.SelectedIndex = 0;
}
AllowChange = true;
}
}