just swap didnt work
continuous-integration/drone/push Build is passing Details

test_old_branch
Jérémy Mouyon 11 months ago
parent 1cb9aa820d
commit d575f0f998

@ -21,7 +21,7 @@ namespace QwirkleClassLibrary.Games
public class Game : IPlayer, IRules
{
[DataMember]
private TileBag? bag = null;
public TileBag? bag = null;
[DataMember]
public bool GameRunning { get; set; }

@ -17,12 +17,12 @@ namespace Qwirkle.Converters
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 == "Orange") return Colors.OrangeRed;
if (colorstring == "Purple") return Colors.Purple;
if (colorstring == "Transparent") return Colors.Transparent;
return Colors.Plum;
return Colors.Transparent;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
@ -133,9 +133,9 @@ namespace Qwirkle.Converters
return sh == "Star";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotSupportedException();
throw new NotImplementedException();
}
}
}

@ -7,6 +7,8 @@ using System.Collections.ObjectModel;
using System.Windows.Input;
using System.ComponentModel;
using Cell = QwirkleClassLibrary.Boards.Cell;
using Color = Microsoft.Maui.Graphics.Color;
using System.Drawing;
namespace Qwirkle.Pages;
@ -18,6 +20,12 @@ public partial class Gameboard : ContentPage
private Tile? tiledrag;
public Color ColorBC1 { get; set; } = Colors.White;
public Color ColorBC2 { get; set; } = Colors.Transparent;
public Color ColorBC3 { get; set; } = Colors.Transparent;
public Color ColorBC4 { get; set; } = Colors.Transparent;
public Gameboard()
{
InitializeComponent();
@ -53,9 +61,68 @@ public partial class Gameboard : ContentPage
{
if(args.Tile != null)
{
DisplayAlert("Tile place notified", args.Tile.ToString() + args.Reason, "<3");
DisplayAlert("Tile place notified", args.Tile.ToString() + " : " + args.Reason, "<3");
return;
}
DisplayAlert("Tile place notified", args.Tile.ToString() + args.Reason, "<3");
DisplayAlert("Tile place notified", args.Reason, "<3");
}
private void OnButtonSkipClicked(object sender, EventArgs e)
{
game.NextPlayerNotified += Game_NextPlayerNotified;
game.GetPlayerScore(game.GetPlayingPlayer(), game.CellsUsed, game.GetBoard()!);
game.EmptyCellUsed();
game.DrawTiles(game.GetPlayingPlayer());
game.CheckGameOver(game.GetPlayingPlayer());
game.SetNextPlayer();
game.NextPlayerNotified -= Game_NextPlayerNotified;
ChangeColorBC();
}
private void ChangeColorBC()
{
if (game.GetPlayingPlayerPosition() == 0)
{
ColorBC1 = Colors.White;
ColorBC4 = Colors.Transparent;
OnPropertyChanged(nameof(ColorBC1));
OnPropertyChanged(nameof(ColorBC4));
}
if (game.GetPlayingPlayerPosition() == 1)
{
ColorBC2 = Colors.White;
ColorBC1 = Colors.Transparent;
OnPropertyChanged(nameof(ColorBC1));
OnPropertyChanged(nameof(ColorBC2));
}
if (game.GetPlayingPlayerPosition() == 2)
{
ColorBC3 = Colors.White;
ColorBC2 = Colors.Transparent;
OnPropertyChanged(nameof(ColorBC3));
OnPropertyChanged(nameof(ColorBC2));
}
if (game.GetPlayingPlayerPosition() == 3)
{
ColorBC4 = Colors.White;
ColorBC3 = Colors.Transparent;
OnPropertyChanged(nameof(ColorBC4));
OnPropertyChanged(nameof(ColorBC3));
}
}
private void Game_NextPlayerNotified(object? sender, NextPlayerNotifiedEventArgs args)
{
DisplayAlert("Player switch !", "It's your turn : " + args.Player.NameTag, "<3");
}
private void OnTileClickedP1(object? sender, EventArgs args)
{
}
}

@ -6,19 +6,21 @@
x:Name="root">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="150" />
<RowDefinition Height="4*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button HorizontalOptions="End" Grid.Row="0" Grid.Column="1" Text="Settings" WidthRequest="200" HeightRequest="10" FontSize="20" Margin="20"></Button>
<Button HorizontalOptions="Start" Grid.Row="0" Grid.Column="1" Text="Skip turn" WidthRequest="200" HeightRequest="10" FontSize="20" Margin="20"></Button>
<Label Text="{Binding bag.TilesBag.Count}"></Label>
<Button HorizontalOptions="End" Grid.Row="2" Grid.Column="1" Text="Skip / End Turn" WidthRequest="200" HeightRequest="10" FontSize="20" Margin="20" Clicked="OnButtonSkipClicked"></Button>
<Button HorizontalOptions="Start" Grid.Row="2" Grid.Column="1" Text="Settings" WidthRequest="200" HeightRequest="10" FontSize="20" Margin="20" ></Button>
<CollectionView Grid.Row="0" Grid.Column="1" ItemsSource="{Binding PlayerList[0].Tiles}"
HorizontalOptions="Center"
@ -30,12 +32,13 @@
<DataTemplate>
<Border WidthRequest="70" HeightRequest="70"
BackgroundColor="WhiteSmoke"
Margin="0">
BackgroundColor="{Binding ColorBC1, Source={x:Reference root}}"
Margin="0"
>
<Border.GestureRecognizers>
<DragGestureRecognizer CanDrag="True" DragStarting="OnDragStarting"/>
</Border.GestureRecognizers>
<controls:TileView Shape="{Binding GetShape}" Color="{Binding GetColor}"></controls:TileView>
<controls:TileView Shape="{Binding GetShape}" Color="{Binding GetColor}" InfoClicked="OnTileClickedP1"></controls:TileView>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
@ -50,7 +53,7 @@
<CollectionView.ItemTemplate>
<DataTemplate>
<Border WidthRequest="70" HeightRequest="70"
BackgroundColor="WhiteSmoke"
BackgroundColor="{Binding ColorBC3, Source={x:Reference root}}"
Margin="0">
<Border.GestureRecognizers>
<DragGestureRecognizer CanDrag="True" DragStarting="OnDragStarting"/>
@ -70,7 +73,7 @@
<CollectionView.ItemTemplate>
<DataTemplate>
<Border WidthRequest="70" HeightRequest="70"
BackgroundColor="WhiteSmoke"
BackgroundColor="{Binding ColorBC4, Source={x:Reference root}}"
Margin="0">
<Border.GestureRecognizers>
<DragGestureRecognizer CanDrag="True" DragStarting="OnDragStarting"/>
@ -90,7 +93,7 @@
<CollectionView.ItemTemplate>
<DataTemplate>
<Border WidthRequest="70" HeightRequest="70"
BackgroundColor="WhiteSmoke"
BackgroundColor="{Binding ColorBC2, Source={x:Reference root}}"
Margin="0">
<Border.GestureRecognizers>
<DragGestureRecognizer CanDrag="True" DragStarting="OnDragStarting"/>
@ -111,7 +114,7 @@
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Border WidthRequest="70" HeightRequest="70"
<Border WidthRequest="80" HeightRequest="80"
BackgroundColor="WhiteSmoke"
Margin="0" >
<Border.GestureRecognizers >
@ -119,7 +122,7 @@
DropCommand="{Binding OnDrop, Source={x:Reference root}}"
DropCommandParameter="{Binding .}"/>
</Border.GestureRecognizers>
<controls:TileView Shape="{Binding Tile.GetShape}" Color="{Binding Tile.GetColor}"></controls:TileView>
<controls:TileView HorizontalOptions="Start" Shape="{Binding Tile.GetShape}" Color="{Binding Tile.GetColor}"></controls:TileView>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>

@ -25,6 +25,8 @@
HorizontalOptions="Center"
BackgroundColor="Transparent"/>
<!--Rond / round-->
<Ellipse HeightRequest="50"
WidthRequest="50"
Fill="{Binding Color, Source={x:Reference root}, Converter={StaticResource int2ColorConverter}}"
@ -32,6 +34,7 @@
HorizontalOptions="Center"
IsVisible="{Binding Shape, Source={x:Reference root}, Converter={StaticResource roundToVisibilityConverter}}" />
<!--Losange / Rhombus-->
<Rectangle HeightRequest="35"
Grid.Row="0"
Grid.Column="0"
@ -42,6 +45,7 @@
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"
@ -49,14 +53,15 @@
VerticalOptions="Center"
HorizontalOptions="Center"
Fill="{Binding Color, Source={x:Reference root}, Converter={StaticResource int2ColorConverter}}"
IsVisible="{Binding Shape, Source={x:Reference root}, Converter={StaticResource clubToVisibilityConverter}}" />
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 squareToVisibilityConverter}}">
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>
@ -85,5 +90,6 @@
</Image>
</Grid>
</ContentView>

@ -53,4 +53,11 @@ public partial class TileView : ContentView
set => SetValue(ShapeProperty, value);
}
public event EventHandler InfoClicked;
void OnInfoClicked(object sender, EventArgs args)
{
InfoClicked?.Invoke(this, args);
}
}
Loading…
Cancel
Save