diff --git a/Qwirkle/QwirkleClassLibrary/Boards/Board.cs b/Qwirkle/QwirkleClassLibrary/Boards/Board.cs
index 107b20a..00a2506 100644
--- a/Qwirkle/QwirkleClassLibrary/Boards/Board.cs
+++ b/Qwirkle/QwirkleClassLibrary/Boards/Board.cs
@@ -26,7 +26,7 @@ namespace QwirkleClassLibrary.Boards
///
/// The numbers of rows in the board.
/// The number of columns in the board.
- public Board(int rows, int cols)
+ public Board(int cols, int rows)
{
Rows = rows;
Columns = cols;
diff --git a/Qwirkle/QwirkleClassLibrary/Games/Game.cs b/Qwirkle/QwirkleClassLibrary/Games/Game.cs
index 4a82dd7..88ae11f 100644
--- a/Qwirkle/QwirkleClassLibrary/Games/Game.cs
+++ b/Qwirkle/QwirkleClassLibrary/Games/Game.cs
@@ -23,7 +23,15 @@ namespace QwirkleClassLibrary.Games
private TileBag? bag = null;
public bool GameRunning { get; private set; }
- private Board? board = null;
+
+ private Board _board = new Board(15, 12);
+ public Board Board
+ {
+ get { return _board; }
+ private set { _board = value; }
+ }
+
+ public ObservableCollection GetCellsInBoard => new ObservableCollection(Board!.GetCells());
public ReadOnlyCollection PlayerList => players.AsReadOnly();
private readonly List players = new();
@@ -135,10 +143,10 @@ namespace QwirkleClassLibrary.Games
}
///
- /// Returns the board of the game
+ /// Returns the Board of the game
///
/// Board
- public Board? GetBoard() { return board; }
+ public Board? GetBoard() { return Board; }
///
/// Returns the tile bag of the game
@@ -147,13 +155,13 @@ namespace QwirkleClassLibrary.Games
public TileBag? GetTileBag() { return bag; }
///
- /// Creates a board with a number of columns and rows
+ /// Creates a Board with a number of columns and rows
///
/// Board
public Board CreateBoard()
{
- board = new Board(7, 7);
- return board;
+ Board = new Board(15, 12);
+ return Board;
}
///
@@ -173,7 +181,7 @@ namespace QwirkleClassLibrary.Games
public void StartGame()
{
if (players.Count < 2 || players.Count >= 5) return;
- board = CreateBoard();
+ Board = CreateBoard();
bag = CreateTileBag(3);
GameRunning = true;
}
@@ -293,7 +301,7 @@ namespace QwirkleClassLibrary.Games
}
///
- /// Allows the player to place a tile on the board at a (x, y) position
+ /// Allows the player to place a tile on the Board at a (x, y) position
///
///
///
@@ -302,11 +310,11 @@ namespace QwirkleClassLibrary.Games
/// bool
public bool PlaceTile(Player player, Tile tile, int x, int y)
{
- if (!IsMoveCorrect(tile, x, y, board!)) return false;
- if (board!.AddTileInCell(x, y, tile))
+ if (!IsMoveCorrect(tile, x, y, Board!)) return false;
+ if (Board!.AddTileInCell(x, y, tile))
{
OnPlaceTile(new PlaceTileNotifiedEventArgs(tile, "was correctly placed !"));
- AddCellUsed(board.GetCell(x, y));
+ AddCellUsed(Board.GetCell(x, y));
return player.RemoveTileToPlayer(tile);
}
@@ -689,7 +697,7 @@ namespace QwirkleClassLibrary.Games
}
///
- /// Returns a boolean to check if the player can play a tile on the board
+ /// Returns a boolean to check if the player can play a tile on the Board
///
///
///
@@ -699,12 +707,12 @@ namespace QwirkleClassLibrary.Games
{
for (int j = 0; j < players[playerTilesBagPos[i]].Tiles.Count; j++)
{
- for (int b = 0; b < board!.ReadCells.Count; b++)
+ for (int b = 0; b < Board!.ReadCells.Count; b++)
{
- int x = board.ReadCells[b].GetX;
- int y = board.ReadCells[b].GetY;
+ int x = Board.ReadCells[b].GetX;
+ int y = Board.ReadCells[b].GetY;
- if (IsMoveCorrect(players[playerTilesBagPos[i]].Tiles[j], x, y, board))
+ if (IsMoveCorrect(players[playerTilesBagPos[i]].Tiles[j], x, y, Board))
{
return true;
}
@@ -742,7 +750,7 @@ namespace QwirkleClassLibrary.Games
scoreBoard.Clear();
cellUsed.Clear();
bag = null;
- board = CreateBoard();
+ Board = CreateBoard();
GameRunning = false;
}
}
diff --git a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs
index 79df361..951ea4e 100644
--- a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs
+++ b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs
@@ -1,9 +1,21 @@
+using QwirkleClassLibrary.Games;
+using QwirkleClassLibrary.Players;
+using QwirkleClassLibrary.Tiles;
+using System.Collections.ObjectModel;
+using WinRT;
+
namespace Qwirkle.Pages;
public partial class Gameboard : ContentPage
{
- public Gameboard()
+
+ private Game game = ((App)App.Current!).Game;
+ public Gameboard()
{
InitializeComponent();
+ BindingContext = game;
}
+
+ public List PlayerCells1 { get; set; } = ((App)App.Current!).Game.PlayerList[0].Tiles.ToList();
+
}
\ No newline at end of file
diff --git a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml
index bc080ff..4f8fe95 100644
--- a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml
+++ b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml
@@ -3,37 +3,31 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Qwirkle.Pages.Gameboard"
xmlns:controls="clr-namespace:Qwirkle.Views"
- Title="Gameboard">
-
+ Title="Gameboard"
+ x:Name="root">
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/Qwirkle/QwirkleViews/Pages/Leaderboard.xaml b/Qwirkle/QwirkleViews/Pages/Leaderboard.xaml
index eb157c3..ec7623a 100644
--- a/Qwirkle/QwirkleViews/Pages/Leaderboard.xaml
+++ b/Qwirkle/QwirkleViews/Pages/Leaderboard.xaml
@@ -68,10 +68,13 @@
-
-
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/Qwirkle/QwirkleViews/Views/ScoreboardLine.xaml b/Qwirkle/QwirkleViews/Views/ScoreboardLine.xaml
index a3181cb..3be52f5 100644
--- a/Qwirkle/QwirkleViews/Views/ScoreboardLine.xaml
+++ b/Qwirkle/QwirkleViews/Views/ScoreboardLine.xaml
@@ -8,7 +8,7 @@
+ HeightRequest="600"
+ BackgroundColor="AntiqueWhite"/>
\ No newline at end of file