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.
66 lines
1.7 KiB
66 lines
1.7 KiB
using System;
|
|
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;
|
|
using System.Globalization;
|
|
|
|
namespace Qwirkle.Views;
|
|
|
|
public partial class TileCircle : ContentView
|
|
{
|
|
|
|
|
|
public TileCircle()
|
|
{
|
|
InitializeComponent();
|
|
((App)Application.Current!).Game.Board.PropertyChanged += Board_PropertyChanged;
|
|
ColorPush = "Transparent";
|
|
}
|
|
|
|
private void Board_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
|
{
|
|
Console.WriteLine(Shape);
|
|
if (Shape == "Round")
|
|
{
|
|
ColorPush = Color;
|
|
}
|
|
else
|
|
{
|
|
ColorPush = "Transparent";
|
|
}
|
|
}
|
|
|
|
public static readonly BindableProperty ColorProperty =
|
|
BindableProperty.Create(nameof(Color), typeof(string), typeof(TileCircle), "", propertyChanged: OnColorChanged);
|
|
|
|
public string Color
|
|
{
|
|
get => (string)GetValue(ColorProperty);
|
|
set => SetValue(ColorProperty, value);
|
|
}
|
|
|
|
private static void OnColorChanged(BindableObject bindable, object oldValue, object newValue)
|
|
{
|
|
var bin = (TileCircle)bindable;
|
|
bin.OnPropertyChanged(nameof(Color));
|
|
}
|
|
|
|
|
|
public static readonly BindableProperty ShapeProperty =
|
|
BindableProperty.Create("Shape", typeof(string), typeof(TileCircle), "");
|
|
|
|
public string Shape
|
|
{
|
|
get => (string)GetValue(ShapeProperty);
|
|
set => SetValue(ShapeProperty, value);
|
|
}
|
|
|
|
public string? ColorPush { get; set; }
|
|
} |