test_old_branch
Jérémy Mouyon 11 months ago
parent 87911f1ee0
commit 53559292bb

@ -26,7 +26,7 @@
DropCommand="{Binding OnDrop, Source={x:Reference root}}"
DropCommandParameter="{Binding .}" />
</Border.GestureRecognizers>
<Label Text="{Binding Tile}" />
<controls:TileCircle TileInfo="{Binding Tile}"></controls:TileCircle>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>

@ -2,18 +2,20 @@
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Qwirkle.Views.TileCircle">
x:Class="Qwirkle.Views.TileCircle"
x:Name="root">
<Grid>
<Rectangle HeightRequest="600"
<Label Text="{Binding Shape, Source={x:Reference root}}"></Label>
<Rectangle HeightRequest="70"
Grid.Row="0"
Grid.Column="0"
WidthRequest="600"
WidthRequest="70"
VerticalOptions="Center"
HorizontalOptions="Center"
BackgroundColor="{StaticResource Gray800}"/>
<Ellipse HeightRequest="400"
WidthRequest="400"
BackgroundColor="Red"
BackgroundColor="{Binding BC, Source={x:Reference root}}"/>
<Ellipse HeightRequest="50"
WidthRequest="50"
BackgroundColor="{Binding Color, Source={x:Reference root}}"
VerticalOptions="Center"
HorizontalOptions="Center"/>
</Grid>

@ -3,13 +3,46 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Maui.Controls;
using QwirkleClassLibrary.Games;
using QwirkleClassLibrary.Players;
using QwirkleClassLibrary.Tiles;
using QwirkleClassLibrary.Events;
using QwirkleClassLibrary.Boards;
namespace Qwirkle.Views;
public partial class TileCircle : ContentView
{
public static readonly BindableProperty TileInfoProperty = BindableProperty.Create(nameof(TileInfo), typeof(Tile), typeof(TileCircle), default(Tile));
public Tile TileInfo
{
get => (Tile)GetValue(TileInfoProperty);
set => SetValue(TileInfoProperty, value);
}
public TileCircle()
{
InitializeComponent();
((App)Application.Current!).Game.Board.PropertyChanged += Board_PropertyChanged;
}
private void Board_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (TileInfo == null)
{
return;
}
Shape = TileInfo.GetShape.ToString();
if (Shape != "Round")
{
return;
}
Color = TileInfo.GetColor.ToString();
BC = "Grey300";
}
public string BC { get; set; } = "Transparent";
public string Color { get; set; } = "Transparent";
public string Shape { get; set; } = "None";
}
Loading…
Cancel
Save