宠物面板

This commit is contained in:
末城via 2023-01-08 10:59:54 +08:00
parent bc3d5ddf42
commit 02ceac885d
13 changed files with 544 additions and 29 deletions

BIN
Refer/Panuon.WPF.UI.dll Normal file

Binary file not shown.

BIN
Refer/Panuon.WPF.dll Normal file

Binary file not shown.

View File

@ -35,4 +35,6 @@
<SolidColorBrush x:Key="DARKPrimaryDark" Color="#FF0290D5" />
<SolidColorBrush x:Key="DARKPrimaryDarker" Color="#FF0286C6" />
<SolidColorBrush x:Key="DARKPrimaryText" Color="#FFffffff" />
<Color x:Key="ShadowColor">#90caf9</Color>
</ResourceDictionary>

View File

@ -8,6 +8,62 @@
<ResourceDictionary Source="Theme.xaml" />
</UserControl.Resources>
<Grid>
<Border x:Name="BdrPanel" Visibility="Collapsed" VerticalAlignment="Bottom" Margin="0,0,0,55" TextBlock.FontSize="24" TextElement.FontSize="24"
BorderBrush="{DynamicResource DARKPrimaryDarker}" BorderThickness="1"
Background="{DynamicResource DARKPrimaryText}" CornerRadius="5" MouseLeave="MenuPanel_MouseLeave">
<Grid Margin="15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="5" />
<ColumnDefinition />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<TextBlock Text="Lv 14" VerticalAlignment="Center" Foreground="{DynamicResource DARKPrimary}"/>
<Button Grid.Column="4" VerticalAlignment="Center" Background="Transparent" Foreground="{DynamicResource DARKPrimary}" Content="详细" Cursor="Hand" Click="MenuPanel_Click">
<Button.ContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"
TextDecorations="Underline" />
</DataTemplate>
</Button.ContentTemplate>
</Button>
<TextBlock x:Name="txtHearth" Grid.Row="1" Grid.ColumnSpan="5" Foreground="#FF4C4C" TextWrapping="Wrap" Text="宠物已经生病。通过服用药物可以恢复。" />
<TextBlock Grid.Row="2" Text="金钱" VerticalAlignment="Center" />
<TextBlock Grid.Row="2" Grid.Column="2" Foreground="{DynamicResource DARKPrimary}" Text="¥100,000" />
<TextBlock Grid.Row="3" Text="经验" VerticalAlignment="Center" />
<ProgressBar Grid.Row="3" Grid.Column="2" Value="40" FontSize="20" Height="20" VerticalAlignment="Center"
pu:ProgressBarHelper.CornerRadius="10" Foreground="{DynamicResource ProgressBarForeground}" pu:ProgressBarHelper.IsPercentVisible="True" pu:ProgressBarHelper.GeneratingPercentText="PgbExperience_GeneratingPercentText" />
<TextBlock Grid.Row="3" Grid.Column="4" HorizontalAlignment="Right" Text="x2倍" Foreground="{DynamicResource DARKPrimary}" />
<TextBlock Grid.Row="4" Text="体力" VerticalAlignment="Center" />
<ProgressBar Grid.Row="4" Grid.Column="2" Value="40" FontSize="20" Height="20" VerticalAlignment="Center"
pu:ProgressBarHelper.CornerRadius="10" Foreground="{DynamicResource ProgressBarForeground}" pu:ProgressBarHelper.IsPercentVisible="True" pu:ProgressBarHelper.GeneratingPercentText="PgbStrength_GeneratingPercentText" />
<TextBlock Grid.Row="4" Grid.Column="4" HorizontalAlignment="Right" Text="+1/m" Foreground="{DynamicResource DARKPrimary}" />
<TextBlock Grid.Row="5" Text="心情" VerticalAlignment="Center" />
<ProgressBar Grid.Row="5" Grid.Column="2" Value="60" FontSize="20" Height="20" VerticalAlignment="Center"
pu:ProgressBarHelper.CornerRadius="10" Foreground="{DynamicResource ProgressBarForeground}" pu:ProgressBarHelper.IsPercentVisible="True" pu:ProgressBarHelper.GeneratingPercentText="PgbSpirit_GeneratingPercentText" />
<TextBlock Grid.Row="5" Grid.Column="4" HorizontalAlignment="Right" Text="+1/m" Foreground="{DynamicResource DARKPrimary}" />
<TextBlock Grid.Row="6" Text="饱腹度" VerticalAlignment="Center" />
<ProgressBar Grid.Row="6" Grid.Column="2" Value="80" FontSize="20" Height="20" VerticalAlignment="Center"
pu:ProgressBarHelper.CornerRadius="10" Foreground="{DynamicResource ProgressBarForeground}" pu:ProgressBarHelper.IsPercentVisible="True" pu:ProgressBarHelper.GeneratingPercentText="PgbHunger_GeneratingPercentText" />
<TextBlock Grid.Row="6" Grid.Column="4" HorizontalAlignment="Right" Text="+1/m" Foreground="{DynamicResource DARKPrimary}" />
<TextBlock Grid.Row="7" Text="口渴度" VerticalAlignment="Center" />
<ProgressBar Grid.Row="7" Grid.Column="2" Value="20" FontSize="20" Height="20" VerticalAlignment="Center"
pu:ProgressBarHelper.CornerRadius="10" Foreground="{DynamicResource ProgressBarForeground}" pu:ProgressBarHelper.IsPercentVisible="True" pu:ProgressBarHelper.GeneratingPercentText="PgbThirsty_GeneratingPercentText" />
<TextBlock Grid.Row="7" Grid.Column="4" HorizontalAlignment="Right" Text="+1/m" Foreground="{DynamicResource DARKPrimary}" />
</Grid>
</Border>
<Menu Width="500"
VerticalAlignment="Bottom"
Style="{DynamicResource ToolBarMenuStyle}">
@ -22,7 +78,9 @@
<MenuItem Header="饮料" />
<MenuItem Header="药品" />
</MenuItem>
<MenuItem Header="面板" />
<MenuItem x:Name="MenuPanel" Header="面板"
MouseEnter="MenuPanel_MouseEnter"
MouseLeave="MenuPanel_MouseLeave"/>
<MenuItem Header="打工" />
<MenuItem Header="睡觉" />
<MenuItem Header="设置"

View File

@ -14,6 +14,8 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Timers;
using Timer = System.Timers.Timer;
using Panuon.WPF.UI;
using System.Windows.Threading;
namespace VPet_Simulator.Core
{
@ -25,6 +27,8 @@ namespace VPet_Simulator.Core
Main m;
Timer closetimer;
bool onFocus = false;
DispatcherTimer closePanelTimer;
public ToolBar(Main m)
{
InitializeComponent();
@ -36,6 +40,22 @@ namespace VPet_Simulator.Core
Enabled = false
};
closetimer.Elapsed += Closetimer_Elapsed;
closePanelTimer = new DispatcherTimer()
{
Interval = TimeSpan.FromSeconds(0.1),
};
closePanelTimer.Tick += ClosePanelTimer_Tick;
}
private void ClosePanelTimer_Tick(object sender, EventArgs e)
{
if (BdrPanel.IsMouseOver
|| MenuPanel.IsMouseOver)
{
closePanelTimer.Stop();
return;
}
BdrPanel.Visibility = Visibility.Collapsed;
}
private void Closetimer_Elapsed(object sender, ElapsedEventArgs e)
@ -73,6 +93,11 @@ namespace VPet_Simulator.Core
m.Core.Controller.ShowSetting();
}
private void MenuPanel_Click(object sender, RoutedEventArgs e)
{
m.Core.Controller.ShowPanel();
}
public void AddMenuButton(string parentMenu,
string displayName,
Action clickCallback)
@ -92,5 +117,66 @@ namespace VPet_Simulator.Core
break;
}
}
private void PgbExperience_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
e.Text = $"{e.Value * 10} / {100 * 10}";
}
private void PgbStrength_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
e.Text = $"{e.Value} / 100";
}
private void PgbSpirit_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
var progressBar = (ProgressBar)sender;
progressBar.Foreground = GetForeground(e.Value);
e.Text = $"{e.Value} / 100";
}
private void PgbHunger_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
var progressBar = (ProgressBar)sender;
progressBar.Foreground = GetForeground(e.Value);
e.Text = $"{e.Value} / 100";
}
private void PgbThirsty_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
var progressBar = (ProgressBar)sender;
progressBar.Foreground = GetForeground(e.Value);
e.Text = $"{e.Value} / 100";
if (e.Value <= 20)
{
txtHearth.Visibility = Visibility.Visible;
}
}
private Brush GetForeground(double value)
{
if (value >= 80)
{
return FindResource("SuccessProgressBarForeground") as Brush;
}
else if (value >= 50)
{
return FindResource("WarningProgressBarForeground") as Brush;
}
else
{
return FindResource("DangerProgressBarForeground") as Brush;
}
}
private void MenuPanel_MouseEnter(object sender, MouseEventArgs e)
{
BdrPanel.Visibility = Visibility.Visible;
}
private void MenuPanel_MouseLeave(object sender, MouseEventArgs e)
{
closePanelTimer.Start();
}
}
}

View File

@ -51,5 +51,9 @@ namespace VPet_Simulator.Core
/// 显示设置窗体
/// </summary>
void ShowSetting();
/// <summary>
/// 显示面板窗体
/// </summary>
void ShowPanel();
}
}

View File

@ -72,10 +72,12 @@
<HintPath>..\packages\LinePutScript.1.5.4\lib\net462\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Refer\Panuon.WPF.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.6.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.6.5\lib\net462\Panuon.WPF.UI.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Refer\Panuon.WPF.UI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />

View File

@ -6,6 +6,115 @@
<pucore:SharedResourceDictionary Source="/Panuon.WPF.UI;component/Control.xaml" />
</ResourceDictionary.MergedDictionaries>
<DrawingBrush x:Key="ProgressBarForeground"
Viewport="0,0,8,22"
ViewportUnits="Absolute"
Stretch="None"
TileMode="Tile">
<DrawingBrush.RelativeTransform>
<RotateTransform Angle="2" />
</DrawingBrush.RelativeTransform>
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource DARKPrimaryTransA}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="5.5,0,2.5,22" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="{DynamicResource DARKPrimary}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,5.5,22" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<DrawingBrush x:Key="SuccessProgressBarForeground"
Viewport="0,0,8,22"
ViewportUnits="Absolute"
Stretch="None"
TileMode="Tile">
<DrawingBrush.RelativeTransform>
<RotateTransform Angle="2" />
</DrawingBrush.RelativeTransform>
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#AAAACC6C">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="5.5,0,2.5,22" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#AACC6C">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,5.5,22" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<DrawingBrush x:Key="WarningProgressBarForeground"
Viewport="0,0,8,22"
ViewportUnits="Absolute"
Stretch="None"
TileMode="Tile">
<DrawingBrush.RelativeTransform>
<RotateTransform Angle="2" />
</DrawingBrush.RelativeTransform>
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#AAFFCC4C">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="5.5,0,2.5,22" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFCC4C">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,5.5,22" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<DrawingBrush x:Key="DangerProgressBarForeground"
Viewport="0,0,8,22"
ViewportUnits="Absolute"
Stretch="None"
TileMode="Tile">
<DrawingBrush.RelativeTransform>
<RotateTransform Angle="2" />
</DrawingBrush.RelativeTransform>
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#AAFF4C4C">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="5.5,0,2.5,22" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FF4C4C">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,5.5,22" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<Style x:Key="BaseWindowXStyle"
TargetType="pu:WindowX">
<Setter Property="pu:WindowXCaption.Background"
@ -150,7 +259,7 @@
<Setter Property="VerticalContentAlignment"
Value="Center" />
<Setter Property="pu:MenuHelper.TopLevelDropDownVerticalOffset"
Value="-20" />
Value="-25" />
<Setter Property="BorderBrush"
Value="{DynamicResource DARKPrimaryDarker}" />
<Setter Property="Background"
@ -160,21 +269,19 @@
<Setter Property="pu:MenuHelper.TopLevelDropDownPlacement"
Value="TopRight" />
<Setter Property="pu:MenuHelper.TopLevelItemsPadding"
Value="20,0" />
<Setter Property="pu:MenuHelper.TopLevelItemsCornerRadius"
Value="7" />
Value="15,0" />
<Setter Property="pu:MenuHelper.TopLevelItemsBackground"
Value="Transparent" />
<Setter Property="pu:MenuHelper.TopLevelItemsHoverBackground"
Value="{DynamicResource SecondaryLight}" />
<!--<Setter Property="pu:MenuHelper.TopLevelItemsHoverForeground"
Value="{DynamicResource DARKPrimaryText}" />-->
Value="{DynamicResource SecondaryLighter}" />
<Setter Property="pu:MenuHelper.TopLevelItemsHoverForeground"
Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:MenuHelper.TopLevelItemsOpenedBackground"
Value="{DynamicResource SecondaryLight}" />
<!--<Setter Property="pu:MenuHelper.TopLevelItemsOpenedForeground"
Value="{DynamicResource DARKPrimaryText}" />-->
Value="{DynamicResource SecondaryLighter}" />
<Setter Property="pu:MenuHelper.TopLevelItemsOpenedForeground"
Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:MenuHelper.SubmenuItemsPadding"
Value="20,0" />
Value="15,0" />
<Setter Property="pu:MenuHelper.SubmenuItemsHeight"
Value="55" />
<Setter Property="pu:MenuHelper.SubmenuItemsIconWidth"
@ -186,23 +293,27 @@
<Setter Property="pu:MenuHelper.SubmenuItemsBackground"
Value="Transparent" />
<Setter Property="pu:MenuHelper.SubmenuItemsHoverBackground"
Value="{DynamicResource SecondaryLight}" />
Value="{DynamicResource SecondaryLighter}" />
<!--<Setter Property="pu:MenuHelper.SubmenuItemsHoverForeground"
Value="{DynamicResource DARKPrimaryText}" />-->
Value="{DynamicResource DARKPrimary}" />-->
<Setter Property="pu:MenuHelper.SubmenuItemsOpenedBackground"
Value="{DynamicResource SecondaryLight}" />
Value="{DynamicResource SecondaryLighter}" />
<!--<Setter Property="pu:MenuHelper.SubmenuItemsOpenedForeground"
Value="{DynamicResource DARKPrimaryText}" />-->
Value="{DynamicResource DARKPrimary}" />-->
<Setter Property="pu:MenuHelper.SubmenuItemsSeparatorVisibility"
Value="Visible" />
<Setter Property="pu:MenuHelper.SubmenuItemsSeparatorBrush"
Value="#CCCECF" />
<Setter Property="pu:MenuHelper.SubmenuItemsSeparatorMargin"
Value="10,0" />
<!--<Setter Property="pu:MenuHelper.ShadowColor"
Value="{DynamicResource ShadowColor}" />-->
<Setter Property="pu:DropDownHelper.ShadowColor"
Value="{DynamicResource ShadowColor}" />
<Setter Property="pu:ShadowHelper.Opacity"
Value="0.7" />
<Setter Property="pu:ShadowHelper.BlurRadius"
Value="15" />
Value="25" />
</Style>
</ResourceDictionary>

View File

@ -57,6 +57,12 @@ namespace VPet_Simulator.Windows
settingWindow.ShowDialog();
}
public void ShowPanel()
{
var panelWindow = new winCharacterPanel();
panelWindow.ShowDialog();
}
public double ZoomRatio => 0.5;
}
}

View File

@ -79,10 +79,12 @@
<HintPath>..\packages\LinePutScript.1.6.1\lib\net48\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.1.0.1\lib\net48\Panuon.WPF.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Refer\Panuon.WPF.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.6.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.6.5\lib\net48\Panuon.WPF.UI.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Refer\Panuon.WPF.UI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
@ -104,6 +106,9 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="WinDesign\winCharacterPanel.xaml.cs">
<DependentUpon>winCharacterPanel.xaml</DependentUpon>
</Compile>
<Compile Include="WinDesign\winGameSetting.xaml.cs">
<DependentUpon>winGameSetting.xaml</DependentUpon>
</Compile>
@ -124,6 +129,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="WinDesign\winCharacterPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WinDesign\winGameSetting.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -0,0 +1,153 @@
<pu:WindowX x:Class="VPet_Simulator.Windows.WinDesign.winCharacterPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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.WinDesign"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800"
Title="面板"
Width="400"
Height="650"
Style="{DynamicResource BaseWindowXStyle}"
WindowStartupLocation="CenterScreen">
<Grid Margin="15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="7" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--<Label Grid.Column="3" Width="14" Height="14" Background="Transparent" Foreground="{DynamicResource PrimaryText}" Padding="0" VerticalContentAlignment="Center" FontSize="10"
HorizontalContentAlignment="Center" BorderBrush="{DynamicResource PrimaryText}" BorderThickness="1" pu:LabelHelper.CornerRadius="7" Content="i" />-->
<TextBlock Margin="0,10,0,0" VerticalAlignment="Top" Text="金钱:" FontWeight="Heavy" />
<StackPanel Grid.Column="2">
<TextBlock FontSize="20" Foreground="{DynamicResource DARKPrimary}" Text="¥100,000" />
<TextBlock Margin="5,0,0,10" Text="钱不是万能的,没钱是万万不能的" Foreground="{DynamicResource PrimaryText}" Opacity="0.5" />
</StackPanel>
<TextBlock x:Name="txtHearth" Grid.Row="1" Margin="0,13,0,0" Visibility="Collapsed" VerticalAlignment="Top" Text="健康值:" FontWeight="Heavy" />
<StackPanel x:Name="stkHearth" Grid.Row="1" Grid.Column="2" Margin="0,10,0,0" Visibility="Collapsed">
<ProgressBar FontSize="10" Height="20" Value="50" Foreground="{DynamicResource DangerProgressBarForeground}" Background="Transparent"
BorderBrush="{DynamicResource DangerProgressBarForeground}" BorderThickness="1.5" pu:ProgressBarHelper.IsPercentVisible="True" pu:ProgressBarHelper.CornerRadius="4" pu:ProgressBarHelper.GeneratingPercentText="PgbHearth_GeneratingPercentText">
</ProgressBar>
<TextBlock Margin="0,5,0,10"
Foreground="{DynamicResource PrimaryText}" Opacity="0.5" TextWrapping="Wrap" Text="宠物已经生病。通过服用药物可以恢复健康状态。" />
</StackPanel>
<TextBlock Grid.Row="2" Margin="0,13,0,0" VerticalAlignment="Top" Text="等级:" FontWeight="Heavy" />
<StackPanel Grid.Row="2" Grid.Column="2" Margin="0,10,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock FontSize="16" Foreground="{DynamicResource PrimaryText}" Text="Lv 10" />
<TextBlock Grid.Column="2" VerticalAlignment="Bottom" FontWeight="Bold" FontSize="14" Foreground="{DynamicResource DARKPrimary}" Text="x2 经验速率" />
</Grid>
<ProgressBar Margin="0,5,0,0" FontSize="10" Height="20" Value="50" Foreground="{DynamicResource ProgressBarForeground}" Background="Transparent"
BorderBrush="{DynamicResource ProgressBarForeground}" BorderThickness="1.5" pu:ProgressBarHelper.IsPercentVisible="True" pu:ProgressBarHelper.CornerRadius="4" pu:ProgressBarHelper.GeneratingPercentText="PgbExperience_GeneratingPercentText">
</ProgressBar>
<TextBlock Margin="3,5,0,10" Foreground="{DynamicResource DARKPrimary}" TextDecorations="Underline" Cursor="Hand"
Text="下一级解锁新能力" ToolTip="新的对话内容" />
</StackPanel>
<TextBlock Grid.Row="3" Margin="0,13,0,0" VerticalAlignment="Top" Text="体力:" FontWeight="Heavy" />
<StackPanel Grid.Row="3" Grid.Column="2" Margin="0,10,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Foreground="{DynamicResource PrimaryText}" Text="恢复中(自然恢复)" />
<TextBlock Grid.Column="2" VerticalAlignment="Bottom" FontWeight="Bold" FontSize="14" Foreground="{DynamicResource DARKPrimary}" Text="+1/分钟" />
</Grid>
<ProgressBar Margin="0,5,0,0" FontSize="10" Height="20" Value="50" Foreground="{DynamicResource ProgressBarForeground}" Background="Transparent"
BorderBrush="{DynamicResource ProgressBarForeground}" BorderThickness="1.5" pu:ProgressBarHelper.IsPercentVisible="True" pu:ProgressBarHelper.CornerRadius="4" pu:ProgressBarHelper.GeneratingPercentText="PgbExperience_GeneratingPercentText">
</ProgressBar>
<TextBlock Margin="0,5,0,10"
Foreground="{DynamicResource PrimaryText}" Opacity="0.5" TextWrapping="Wrap" Text="睡觉可以快速恢复体力。饱腹度低于50时无法自然恢复体力。" />
</StackPanel>
<TextBlock Grid.Row="4" Margin="0,13,0,0" VerticalAlignment="Top" Text="心情:" FontWeight="Heavy" />
<StackPanel Grid.Row="4" Grid.Column="2" Margin="0,10,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Foreground="{DynamicResource PrimaryText}" Text="-" />
<TextBlock Grid.Column="2" VerticalAlignment="Bottom" FontWeight="Bold" FontSize="14" Foreground="{DynamicResource DARKPrimary}" Text="+1/每分钟" />
</Grid>
<ProgressBar Margin="0,5,0,0" FontSize="10" Height="20" Value="60" Foreground="{DynamicResource ProgressBarForeground}" Background="Transparent"
BorderBrush="{DynamicResource ProgressBarForeground}" BorderThickness="1.5" pu:ProgressBarHelper.IsPercentVisible="True" pu:ProgressBarHelper.CornerRadius="4" pu:ProgressBarHelper.GeneratingPercentText="PgbSpirit_GeneratingPercentText">
</ProgressBar>
<TextBlock Margin="0,5,0,10"
Foreground="{DynamicResource PrimaryText}" Opacity="0.5" TextWrapping="Wrap" Text="摸头可以恢复心情。心情低于75时无法获得经验加成。" />
</StackPanel>
<TextBlock Grid.Row="5" Margin="0,13,0,0" VerticalAlignment="Top" Text="饱腹度:" FontWeight="Heavy" />
<StackPanel Grid.Row="5" Grid.Column="2" Margin="0,10,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Foreground="{DynamicResource PrimaryText}" Text="下降中(自然下降)" />
<TextBlock Grid.Column="2" VerticalAlignment="Bottom" FontWeight="Bold" FontSize="14" Foreground="{DynamicResource DARKPrimary}" Text="+1/每分钟" />
</Grid>
<ProgressBar Margin="0,5,0,0" FontSize="10" Height="20" Value="80" Foreground="{DynamicResource ProgressBarForeground}" Background="Transparent"
BorderBrush="{DynamicResource ProgressBarForeground}" BorderThickness="1.5" pu:ProgressBarHelper.IsPercentVisible="True" pu:ProgressBarHelper.CornerRadius="4" pu:ProgressBarHelper.GeneratingPercentText="PgbHunger_GeneratingPercentText">
</ProgressBar>
<TextBlock Margin="0,5,0,10"
Foreground="{DynamicResource PrimaryText}" Opacity="0.5" TextWrapping="Wrap" Text="进食可以快速恢复饱腹度。" />
</StackPanel>
<TextBlock Grid.Row="6" Margin="0,13,0,0" VerticalAlignment="Top" Text="口渴度:" FontWeight="Heavy" />
<StackPanel Grid.Row="6"
Grid.Column="2"
Margin="0,10,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Foreground="{DynamicResource PrimaryText}"
Text="下降中(自然下降)" />
<TextBlock Grid.Column="2"
VerticalAlignment="Bottom"
FontWeight="Bold"
FontSize="14"
Foreground="{DynamicResource DARKPrimary}"
Text="+1/每分钟" />
</Grid>
<ProgressBar Margin="0,5,0,0"
FontSize="10"
Height="20"
Value="20"
Foreground="{DynamicResource ProgressBarForeground}"
Background="Transparent"
BorderBrush="{DynamicResource ProgressBarForeground}"
BorderThickness="1.5"
pu:ProgressBarHelper.IsPercentVisible="True"
pu:ProgressBarHelper.CornerRadius="4"
pu:ProgressBarHelper.GeneratingPercentText="PgbThirsty_GeneratingPercentText">
</ProgressBar>
<TextBlock Grid.Column="2"
Margin="0,5,0,10"
Foreground="{DynamicResource PrimaryText}"
Opacity="0.5"
TextWrapping="Wrap"
Text="喝水可以快速恢复口渴度。口渴度低于25时宠物会生病。" />
</StackPanel>
</Grid>
</pu:WindowX>

View File

@ -0,0 +1,90 @@
using Panuon.WPF.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace VPet_Simulator.Windows.WinDesign
{
/// <summary>
/// winCharacterPanel.xaml 的交互逻辑
/// </summary>
public partial class winCharacterPanel : WindowX
{
public winCharacterPanel()
{
InitializeComponent();
}
private void PgbExperience_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
e.Text = $"{e.Value * 10} / {100 * 10}";
}
private void PgbStrength_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
e.Text = $"{e.Value} / 100";
}
private void PgbSpirit_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
var progressBar = (ProgressBar)sender;
progressBar.Foreground = GetForeground(e.Value);
progressBar.BorderBrush = GetForeground(e.Value);
e.Text = $"{e.Value} / 100";
}
private void PgbHunger_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
var progressBar = (ProgressBar)sender;
progressBar.Foreground = GetForeground(e.Value);
progressBar.BorderBrush = GetForeground(e.Value);
e.Text = $"{e.Value} / 100";
}
private void PgbThirsty_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
var progressBar = (ProgressBar)sender;
progressBar.Foreground = GetForeground(e.Value);
progressBar.BorderBrush = GetForeground(e.Value);
e.Text = $"{e.Value} / 100";
if(e.Value <= 20)
{
txtHearth.Visibility = Visibility.Visible;
stkHearth.Visibility = Visibility.Visible;
}
}
private void PgbHearth_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e)
{
e.Text = $"{e.Value} / 100";
}
private Brush GetForeground(double value)
{
if(value >= 80)
{
return FindResource("SuccessProgressBarForeground") as Brush;
}
else if(value >= 50)
{
return FindResource("WarningProgressBarForeground") as Brush;
}
else
{
return FindResource("DangerProgressBarForeground") as Brush;
}
}
}
}

View File

@ -5,14 +5,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VPet_Simulator.Windows.WinDesign"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800"
Title="设置"
Width="350"
Height="450"
Style="{DynamicResource BaseWindowXStyle}"
WindowStartupLocation="CenterScreen">
mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"
Title="设置" Width="350" Height="450" Style="{DynamicResource BaseWindowXStyle}" WindowStartupLocation="CenterScreen">
<Grid>
<TabControl Margin="5" BorderThickness="0" pu:TabControlHelper.ItemsHeight="NaN"
pu:TabControlHelper.ItemsFontSize="14" Background="Transparent" pu:TabControlHelper.ItemsPadding="10,7"