You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mastermind/Sources/MauiSpark/Pages/Plateau.xaml

176 lines
10 KiB

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:conv="clr-namespace:MauiSpark.Convertisseurs"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiSpark.Pages.Plateau"
Title="Plateau">
<ContentPage.Resources>
<conv:CouleurVersCouleurMAUI x:Key="CouleurVersCouleurMAUI"/>
<conv:IndicateurVersCouleurMAUI x:Key="IndicateurVersCouleurMAUI"/>
<conv:JetonVersTexte x:Key="JetonVersTexte"/>
</ContentPage.Resources>
<Grid RowDefinitions="*" ColumnDefinitions="*, *,auto">
<ImageButton
Grid.Column="2"
Style="{StaticResource AccueilBouton}"
Source="pointinterrogation.png"
HorizontalOptions="End"
VerticalOptions="Start"
Clicked="QuandReglesClique"
/>
<Grid RowDefinitions="*" ColumnDefinitions="*" Margin="50">
<Border
Stroke="#000000"
StrokeThickness="2"
StrokeShape="RoundRectangle 10"
HorizontalOptions="Center">
<FlexLayout
Direction="Column"
Wrap="Wrap"
JustifyContent="SpaceBetween"
AlignItems="Stretch"
BindableLayout.ItemsSource="{Binding Plateau}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Grid
FlexLayout.Grow="1"
FlexLayout.AlignSelf="Stretch"
RowDefinitions="*, auto"
ColumnDefinitions="*, 5*">
<FlexLayout
VerticalOptions="Center"
Direction="Row"
Wrap="Wrap"
JustifyContent="SpaceAround"
AlignItems="Center"
BindableLayout.ItemsSource="{Binding [1]}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Label
Text="*"
TextColor="{Binding ., Converter={StaticResource IndicateurVersCouleurMAUI}}"
VerticalOptions="Center"
HorizontalOptions="Center" />
</DataTemplate>
</BindableLayout.ItemTemplate>
</FlexLayout>
<FlexLayout
VerticalOptions="Center"
Grid.Column="1"
Direction="Row"
Wrap="Wrap"
JustifyContent="SpaceAround"
AlignItems="Center"
BindableLayout.ItemsSource="{Binding [0]}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Label Text="O"
TextColor="{Binding Couleur, Converter={StaticResource CouleurVersCouleurMAUI}}"
VerticalOptions="Center"
HorizontalOptions="Center" />
</DataTemplate>
</BindableLayout.ItemTemplate>
</FlexLayout>
<BoxView Grid.Row="1" Grid.ColumnSpan="2" HeightRequest="1" BackgroundColor="#000000" VerticalOptions="End"/>
</Grid>
</DataTemplate>
</BindableLayout.ItemTemplate>
</FlexLayout>
</Border>
</Grid>
<Grid Grid.Column="1" RowDefinitions="*, 2*, *" ColumnDefinitions="*" Margin="50">
<Label Text="{Binding Joueur}" FontSize="Large" VerticalOptions="Center" HorizontalOptions="Center"/>
<Border
HorizontalOptions="FillAndExpand"
Grid.Row="1"
Stroke="#000000"
StrokeThickness="2"
StrokeShape="RoundRectangle 10">
<Grid
RowDefinitions="*, auto, *, *"
ColumnDefinitions="*, *, *, *, *, *">
<Label FontSize="Medium" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Text="X">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="SupprimerDernierJeton"/>
</Label.GestureRecognizers>
</Label>
<FlexLayout
VerticalOptions="Center"
Grid.Column="1"
Grid.ColumnSpan="4"
Direction="Row"
Wrap="Wrap"
JustifyContent="SpaceAround"
AlignItems="Center"
BindableLayout.ItemsSource="{Binding Code.Jetons}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Label
FontSize="Medium"
HorizontalOptions="Center"
VerticalOptions="Center"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
TextColor="{Binding Couleur, Converter={StaticResource CouleurVersCouleurMAUI}}"
Text="{Binding ., Converter={StaticResource JetonVersTexte}}"/>
</DataTemplate>
</BindableLayout.ItemTemplate>
</FlexLayout>
<Label FontSize="Medium" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Column="5" Text="V">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="ValiderCode"/>
</Label.GestureRecognizers>
</Label>
<BoxView Grid.Row="1" Grid.ColumnSpan="6" HeightRequest="1" BackgroundColor="#000000" VerticalOptions="Center"/>
<Label x:Name="JetonRouge" FontSize="Medium" TextColor="{x:Static conv:CouleurVersCouleurMAUI.Rouge}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Text="O">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="CouleurPresee"/>
</Label.GestureRecognizers>
</Label>
<Label x:Name="JetonVert" FontSize="Medium" TextColor="{x:Static conv:CouleurVersCouleurMAUI.Vert}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Column="2" Grid.Row="2" Grid.ColumnSpan="2" Text="O">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="CouleurPresee"/>
</Label.GestureRecognizers>
</Label>
<Label x:Name="JetonBleu" FontSize="Medium" TextColor="{x:Static conv:CouleurVersCouleurMAUI.Bleu}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Column="4" Grid.Row="2" Grid.ColumnSpan="2" Text="O">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="CouleurPresee"/>
</Label.GestureRecognizers>
</Label>
<Label x:Name="JetonJaune" FontSize="Medium" TextColor="{x:Static conv:CouleurVersCouleurMAUI.Jaune}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Text="O">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="CouleurPresee"/>
</Label.GestureRecognizers>
</Label>
<Label x:Name="JetonNoir" FontSize="Medium" TextColor="{x:Static conv:CouleurVersCouleurMAUI.Noir}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Column="2" Grid.Row="3" Grid.ColumnSpan="2" Text="O">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="CouleurPresee"/>
</Label.GestureRecognizers>
</Label>
<Label x:Name="JetonBlanc" FontSize="Medium" TextColor="{x:Static conv:CouleurVersCouleurMAUI.Blanc}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Column="4" Grid.Row="3" Grid.ColumnSpan="2" Text="O">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="CouleurPresee"/>
</Label.GestureRecognizers>
</Label>
</Grid>
</Border>
<Label Grid.Row="2" Text="{Binding Numero}" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="Center"/>
</Grid>
</Grid>
</ContentPage>