diff --git a/Qwirkle/QwirkleViews/ConverterColor.cs b/Qwirkle/QwirkleViews/ConverterColor.cs
new file mode 100644
index 0000000..8448cde
--- /dev/null
+++ b/Qwirkle/QwirkleViews/ConverterColor.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Globalization;
+
+namespace Qwirkle.Converters
+{
+ public class Int2ColorConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is not string) return Colors.Transparent;
+
+ string colorstring = (string)value;
+
+ if(string.IsNullOrWhiteSpace(colorstring)) return Colors.Transparent;
+
+ if (colorstring == "Yellow") return Colors.Yellow;
+ if (colorstring == "Red") return Colors.Red;
+ if (colorstring == "Blue") return Colors.Blue;
+ if (colorstring == "Green") return Colors.Green;
+ if (colorstring == "Orange") return Colors.Orange;
+ if (colorstring == "Purple") return Colors.Purple;
+ if (colorstring == "Transparent") return Colors.Transparent;
+
+
+ return Colors.Plum;
+ }
+
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml
index 41c00ae..8db9c10 100644
--- a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml
+++ b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml
@@ -26,7 +26,7 @@
DropCommand="{Binding OnDrop, Source={x:Reference root}}"
DropCommandParameter="{Binding .}" />
-
+
diff --git a/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs b/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs
index 2bf0b20..4c5cb4f 100644
--- a/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs
+++ b/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs
@@ -54,6 +54,7 @@ public partial class SetPlayers : ContentPage
game.GiveTilesToPlayers();
game.SetNextPlayer();
Navigation.PushAsync(new Gameboard());
+
}
game.PlayerAddNotified -= Game_PlayerAddNotified;
diff --git a/Qwirkle/QwirkleViews/Resources/Styles/Colors.xaml b/Qwirkle/QwirkleViews/Resources/Styles/Colors.xaml
index 1f21761..309cea3 100644
--- a/Qwirkle/QwirkleViews/Resources/Styles/Colors.xaml
+++ b/Qwirkle/QwirkleViews/Resources/Styles/Colors.xaml
@@ -19,6 +19,12 @@
#190649
#1f1f1f
+ Blue
+ Green
+ Yellow
+ Orange
+ Purple
+
#E1E1E1
#C8C8C8
#ACACAC
diff --git a/Qwirkle/QwirkleViews/Views/TileCircle.xaml b/Qwirkle/QwirkleViews/Views/TileCircle.xaml
index 1c1e0b2..d31ed0a 100644
--- a/Qwirkle/QwirkleViews/Views/TileCircle.xaml
+++ b/Qwirkle/QwirkleViews/Views/TileCircle.xaml
@@ -3,20 +3,27 @@
+ xmlns:conv="clr-namespace:Qwirkle.Converters"
+ x:Name="root">
+
+
+
+
+ BackgroundColor="Transparent"/>
+
+
\ No newline at end of file
diff --git a/Qwirkle/QwirkleViews/Views/TileCircle.xaml.cs b/Qwirkle/QwirkleViews/Views/TileCircle.xaml.cs
index 832fb59..3e65540 100644
--- a/Qwirkle/QwirkleViews/Views/TileCircle.xaml.cs
+++ b/Qwirkle/QwirkleViews/Views/TileCircle.xaml.cs
@@ -9,40 +9,51 @@ using QwirkleClassLibrary.Players;
using QwirkleClassLibrary.Tiles;
using QwirkleClassLibrary.Events;
using QwirkleClassLibrary.Boards;
+using System.Globalization;
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;
+ ColorPush = "Transparent";
}
private void Board_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
- if (TileInfo == null)
+ Console.WriteLine(Shape);
+ if (Shape == "Round")
{
- return;
+ ColorPush = Color;
}
- Shape = TileInfo.GetShape.ToString();
- if (Shape != "Round")
+ else
{
- return;
+ ColorPush = "Transparent";
}
- Color = TileInfo.GetColor.ToString();
- BC = "Grey300";
}
- public string BC { get; set; } = "Transparent";
- public string Color { get; set; } = "Transparent";
- public string Shape { get; set; } = "None";
+
+ public static readonly BindableProperty ColorProperty =
+ BindableProperty.Create("Color", typeof(string), typeof(TileCircle), "");
+
+ public string Color
+ {
+ get => (string)GetValue(ColorProperty);
+ set => SetValue(ColorProperty, value);
+ }
+
+ 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; }
}
\ No newline at end of file