Characteristiques et compétences dans le détail

master
Mathis RIBEMONT 2 years ago
parent 1bb2c2824b
commit c4042c3c6c

@ -407,4 +407,8 @@
<Setter Property="FontAttributes" Value="Bold"/>
</Style>
<Style TargetType="Label" x:Key="h3">
<Setter Property="FontSize" Value="28"/>
</Style>
</ResourceDictionary>

@ -21,6 +21,37 @@
<Label Text="{Binding Name}" Style="{StaticResource h1}"/>
</HorizontalStackLayout>
<Label Text="{Binding Bio}"/>
<Label Text="Caractéristiques" Style="{StaticResource h3}" Padding="0,10,0,0"/>
<CollectionView ItemsSource="{Binding Characteristics}">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="3"
HorizontalItemSpacing="10"
VerticalItemSpacing="10"/>
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Border StrokeThickness="1">
<VerticalStackLayout Padding="10">
<Label Text="{Binding Key}" HorizontalTextAlignment="Center"/>
<Label Text="{Binding Value}" HorizontalTextAlignment="Center"/>
</VerticalStackLayout>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Label Text="Compétences" Style="{StaticResource h3}" Padding="0,10,0,0"/>
<CollectionView ItemsSource="{Binding Skills}">
<CollectionView.ItemTemplate>
<DataTemplate>
<VerticalStackLayout Padding="10">
<Label Text="{Binding Name}" FontAttributes="Bold"/>
<Label Text="{Binding Description}"/>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</ContentPage>

@ -1,18 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ClientMAUI.Views.Pages.ChampionEditPage"
Title="ChampionEditPage">
<VerticalStackLayout>
<HorizontalStackLayout>
<Label Text="Name"/>
<Entry Text="{Binding Name}"/>
</HorizontalStackLayout>
<HorizontalStackLayout>
<Label Text="Bio"/>
<ScrollView Orientation="Horizontal">
<Editor Text="{Binding Bio}"/>
</ScrollView>
</HorizontalStackLayout>
<Grid ColumnDefinitions="Auto,*"
RowDefinitions="Auto, Auto, Auto"
ColumnSpacing="10"
RowSpacing="5">
<Label Text="Name" Grid.Row="0" Grid.Column="0" VerticalTextAlignment="Center"/>
<Entry Text="{Binding Name}" Grid.Row="0" Grid.Column="1"/>
<Label Text="Bio" Grid.Row="1" Grid.Column="0" VerticalTextAlignment="Center"/>
<Editor Text="{Binding Bio}" Grid.Row="1" Grid.Column="1"/>
<Label Text="Class" Grid.Row="2" Grid.Column="0" VerticalTextAlignment="Center"/>
<Editor Text="Classe" Grid.Row="2" Grid.Column="1"/>
</Grid>
</VerticalStackLayout>
</ContentPage>

@ -63,6 +63,24 @@ namespace LolVM
}
}
public IReadOnlyDictionary<String, int> Characteristics
{
get => Model.Characteristics;
}
public HashSet<SkillVM> Skills
{
get
{
HashSet<SkillVM> skillVMs = new HashSet<SkillVM>();
foreach(Skill s in Model.Skills)
{
skillVMs.Add(new SkillVM(s));
}
return skillVMs;
}
}
public string Class { get => Model.Class.ToString(); }
public ChampionVM(Champion model)

@ -0,0 +1,49 @@
using System;
using LolToolkit;
using Model;
namespace LolVM
{
public class SkillVM : PropertyChangedSender
{
public SkillType Type { get => Model.Type; }
public Skill Model
{
get => _model;
set
{
if (value != _model)
{
_model = value;
OnPropertyChanged();
}
}
}
private Skill _model;
public string Name
{
get => Model.Name;
}
public string Description
{
get => Model.Description;
set
{
if(value != Model.Description)
{
Model.Description = value;
OnPropertyChanged();
}
}
}
public SkillVM(Skill model)
{
this.Model = model;
}
}
}
Loading…
Cancel
Save