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.
sae201_qwirkle/Qwirkle/QwirkleViews/Views/TileView.xaml

93 lines
3.9 KiB

<?xml version="1.0" encoding="utf-8"?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Qwirkle.Views.TileView"
xmlns:conv="clr-namespace:Qwirkle.Converters"
x:Name="Root"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">
<ContentView.Resources>
<conv:Int2ColorConverter x:Key="Int2ColorConverter"/>
<conv:RhombusToVisibilityConverter x:Key="RhombusToVisibilityConverter"/>
<conv:RoundToVisibilityConverter x:Key="RoundToVisibilityConverter"/>
<conv:SquareToVisibilityConverter x:Key="SquareToVisibilityConverter"/>
<conv:ClubToVisibilityConverter x:Key="ClubToVisibilityConverter"/>
<conv:ShurikenToVisibilityConverter x:Key="ShurikenToVisibilityConverter"/>
<conv:StarToVisibilityConverter x:Key="StarToVisibilityConverter"/>
</ContentView.Resources>
<Grid>
<Rectangle HeightRequest="70"
Grid.Row="0"
Grid.Column="0"
WidthRequest="70"
VerticalOptions="Center"
HorizontalOptions="Center"
BackgroundColor="Transparent"/>
<!--Rond / round-->
<Ellipse HeightRequest="50"
WidthRequest="50"
Fill="{Binding Color, Source={x:Reference Root}, Converter={StaticResource Int2ColorConverter}}"
VerticalOptions="Center"
HorizontalOptions="Center"
IsVisible="{Binding Shape, Source={x:Reference Root}, Converter={StaticResource RoundToVisibilityConverter}}" />
<!--Losange / Rhombus-->
<Rectangle HeightRequest="35"
Grid.Row="0"
Grid.Column="0"
Rotation="45"
WidthRequest="35"
VerticalOptions="Center"
HorizontalOptions="Center"
Fill="{Binding Color, Source={x:Reference Root}, Converter={StaticResource Int2ColorConverter}}"
IsVisible="{Binding Shape, Source={x:Reference Root}, Converter={StaticResource RhombusToVisibilityConverter}}" />
<!--Carre / Square-->
<Rectangle HeightRequest="40"
Grid.Row="0"
Grid.Column="0"
WidthRequest="40"
VerticalOptions="Center"
HorizontalOptions="Center"
Fill="{Binding Color, Source={x:Reference Root}, Converter={StaticResource Int2ColorConverter}}"
IsVisible="{Binding Shape, Source={x:Reference Root}, Converter={StaticResource SquareToVisibilityConverter}}" />
<!--Trefle / Club-->
<Image Source="club.png"
Grid.Row="0"
Grid.Column="0"
WidthRequest="100"
HeightRequest="100"
IsVisible="{Binding Shape, Source={x:Reference Root}, Converter={StaticResource ClubToVisibilityConverter}}">
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="{Binding Color, Source={x:Reference Root}, Converter={StaticResource Int2ColorConverter}}"/>
</Image.Behaviors>
</Image>
<Image Source="shuriken.png"
Grid.Row="0"
Grid.Column="0"
WidthRequest="60"
HeightRequest="60"
IsVisible="{Binding Shape, Source={x:Reference Root}, Converter={StaticResource ShurikenToVisibilityConverter}}">
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="{Binding Color, Source={x:Reference Root}, Converter={StaticResource Int2ColorConverter}}"/>
</Image.Behaviors>
</Image>
<Image Source="star.png"
Grid.Row="0"
Grid.Column="0"
WidthRequest="60"
HeightRequest="60"
IsVisible="{Binding Shape, Source={x:Reference Root}, Converter={StaticResource StarToVisibilityConverter}}">
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="{Binding Color, Source={x:Reference Root}, Converter={StaticResource Int2ColorConverter}}"/>
</Image.Behaviors>
</Image>
</Grid>
</ContentView>