featL add skill component

This commit is contained in:
k0t9i
2023-02-01 14:48:59 +04:00
parent 32fdef9b1c
commit 9a0204c6ed
10 changed files with 257 additions and 76 deletions

View File

@@ -5,9 +5,9 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Client"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:ctrls="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
xmlns:converters="clr-namespace:Client.Application.Converters"
xmlns:components="clr-namespace:Client.Application.Components"
xmlns:views="clr-namespace:Client.Application.Views"
mc:Ignorable="d"
Title="L2Bot 2.0 Client" Height="600" Width="1024">
<Window.Resources>
@@ -22,7 +22,6 @@
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/>
<ctrls:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
@@ -105,74 +104,13 @@
<TabItem>
<TabItem.Header>Active</TabItem.Header>
<TabItem.Content>
<ItemsControl ItemsSource="{Binding ActiveSkills,Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button IsEnabled="{Binding Path=IsReadyToUse,Mode=OneWay}">
<Button.Content>
<Grid>
<Image Source="{Binding Path=IconName}" Height="32" Width="32" />
<Rectangle Fill="Black" Opacity=".5" Visibility="{Binding Path=IsBusy,Converter={StaticResource BooleanToVisibilityConverter},Mode=OneWay}"/>
</Grid>
</Button.Content>
<Button.ToolTip>
<StackPanel MaxWidth="300">
<TextBlock TextWrapping="Wrap" FontWeight="Bold" FontSize="14" Margin="0,0,0,5">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} Lv {1}">
<Binding Path="Name" Mode="OneWay"/>
<Binding Path="Level" Mode="OneWay"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{Binding Path=Cost,Mode=OneWay,StringFormat='MP Cost {0}'}" />
<TextBlock TextWrapping="Wrap" Text="{Binding Path=Range,Mode=OneWay,StringFormat='Range {0}'}" />
<TextBlock TextWrapping="Wrap" Text="{Binding Path=Description,Mode=OneWay}" />
</StackPanel>
</Button.ToolTip>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<views:SkillPanel ItemsSource="{Binding ActiveSkills,Mode=OneWay}" />
</TabItem.Content>
</TabItem>
<TabItem>
<TabItem.Header>Passive</TabItem.Header>
<TabItem.Content>
<ItemsControl ItemsSource="{Binding PassiveSkills,Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button IsEnabled="False" ToolTipService.ShowOnDisabled="True">
<Button.Content>
<Image Source="{Binding Path=IconName}" Height="32" Width="32" />
</Button.Content>
<Button.ToolTip>
<StackPanel MaxWidth="300">
<TextBlock TextWrapping="Wrap" FontWeight="Bold" FontSize="14" Margin="0,0,0,5">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} Lv {1}">
<Binding Path="Name" Mode="OneWay"/>
<Binding Path="Level" Mode="OneWay"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{Binding Path=Description,Mode=OneWay}" />
</StackPanel>
</Button.ToolTip>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<views:SkillPanel ItemsSource="{Binding PassiveSkills,Mode=OneWay}" />
</TabItem.Content>
</TabItem>
</TabControl>
@@ -201,7 +139,7 @@
</TextBlock.Text>
</TextBlock>
</StackPanel>
<components:StatsPanel DataContext="{Binding ., Mode=OneWay}" Margin="4" Grid.Row="1" />
<views:StatsPanel DataContext="{Binding ., Mode=OneWay}" Margin="4" Grid.Row="1" />
<DockPanel Grid.Row="2" Margin="4">
<StackPanel DockPanel.Dock="Left" Margin="0 0 5 0">
<TextBlock Padding="0 0 0 3">Position:</TextBlock>

View File

@@ -0,0 +1,28 @@
<ItemsControl x:Class="Client.Application.Views.SkillPanel"
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:Client.Application.Views"
xmlns:components="clr-namespace:Client.Application.Components"
mc:Ignorable="d">
<ItemsControl.ItemTemplate>
<DataTemplate>
<components:Skill
ImageSource="{Binding Path=IconName,Mode=OneWay}"
IsReadyToUse="{Binding Path=IsReadyToUse,Mode=OneWay}"
IsActive="{Binding Path=IsActive,Mode=OneWay}"
SkillName="{Binding Path=Name,Mode=OneWay}"
Level="{Binding Path=Level,Mode=OneWay}"
Cost="{Binding Path=Cost,Mode=OneWay}"
Range="{Binding Path=Range,Mode=OneWay}"
Description="{Binding Path=Description,Mode=OneWay}"
/>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>

View File

@@ -0,0 +1,27 @@
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.Shapes;
namespace Client.Application.Views
{
/// <summary>
/// Interaction logic for SkillPanel.xaml
/// </summary>
public partial class SkillPanel : ItemsControl
{
public SkillPanel()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,40 @@
<StackPanel x:Class="Client.Application.Views.StatsPanel"
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:components="clr-namespace:Client.Application.Components"
mc:Ignorable="d">
<components:StatsBar
BackgroundSource="/Assets/icons/ps_cpbar_back.png"
ForegroundSource="/Assets/icons/ps_cpbar.png"
Current="{Binding VitalStats.Cp}"
Total="{Binding VitalStats.MaxCp}"
Height="15"
Margin="0 0 0 2"
/>
<components:StatsBar
BackgroundSource="/Assets/icons/ps_hpbar_back.png"
ForegroundSource="/Assets/icons/ps_hpbar.png"
Current="{Binding VitalStats.Hp}"
Total="{Binding VitalStats.MaxHp}"
Height="15"
Margin="0 0 0 2"
/>
<components:StatsBar
BackgroundSource="/Assets/icons/ps_mpbar_back.png"
ForegroundSource="/Assets/icons/ps_mpbar.png"
Current="{Binding VitalStats.Mp}"
Total="{Binding VitalStats.MaxMp}"
Height="15"
Margin="0 0 0 2"
/>
<components:StatsBar
BackgroundSource="/Assets/icons/ps_expbar_back.png"
ForegroundSource="/Assets/icons/ps_expbar.png"
Current="{Binding Experience.ExpPercent}"
Format="{}{0:F2}%"
Height="15"
Margin="0 0 0 2"
/>
</StackPanel>

View File

@@ -0,0 +1,27 @@
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.Shapes;
namespace Client.Application.Views
{
/// <summary>
/// Interaction logic for StatsPanel.xaml
/// </summary>
public partial class StatsPanel : StackPanel
{
public StatsPanel()
{
InitializeComponent();
}
}
}