diff --git a/Qwirkle/QwirkleClassLibrary/Games/Game.cs b/Qwirkle/QwirkleClassLibrary/Games/Game.cs
index ea342a1..8487113 100644
--- a/Qwirkle/QwirkleClassLibrary/Games/Game.cs
+++ b/Qwirkle/QwirkleClassLibrary/Games/Game.cs
@@ -160,7 +160,7 @@ namespace QwirkleClassLibrary.Games
/// Board
public Board CreateBoard()
{
- Board = new Board(7, 7);
+ Board = new Board(15, 12);
return Board;
}
diff --git a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs
index cbc692c..9a127a1 100644
--- a/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs
+++ b/Qwirkle/QwirkleViews/Pages/GameBoard.xaml.cs
@@ -1,27 +1,62 @@
using QwirkleClassLibrary.Games;
using QwirkleClassLibrary.Players;
using QwirkleClassLibrary.Tiles;
+using QwirkleClassLibrary.Events;
+using QwirkleClassLibrary.Boards;
using System.Collections.ObjectModel;
-
+using System.Windows.Input;
+using System.ComponentModel;
+using Cell = QwirkleClassLibrary.Boards.Cell;
namespace Qwirkle.Pages;
public partial class Gameboard : ContentPage
{
+ public ICommand OnDrop => new Command(onDrop);
+
+
private Game game = ((App)App.Current!).Game;
+
+ private Tile? tiledrag;
public Gameboard()
- {
- InitializeComponent();
- BindingContext = game;
+ {
+ InitializeComponent();
+ BindingContext = game;
- DisplayAlert("List", ((App)App.Current!).Game.PlayerList[0].Tiles[0].ToString(), "chut");
- }
+ DisplayAlert("List", ((App)App.Current!).Game.PlayerList[0].Tiles[0].ToString(), "chut");
+ }
+
+ public List PlayerCells1 { get; set; } = ((App)App.Current!).Game.PlayerList[0].Tiles.ToList();
- public List PlayerCells1 { get; set; } = ((App)App.Current!).Game.PlayerList[0].Tiles.ToList();
void OnDragOver(object sender, DragEventArgs e)
{
-
+ foreach (var t in PlayerCells1)
+ {
+ if (e.Data.Text == t.ToString())
+ {
+ tiledrag = t;
+ break;
+ }
+ }
+
}
+ private void onDrop(Cell cell)
+ {
+ game.PlaceTileNotified += Game_PlaceTileNotified;
+
+ int x = cell.GetX;
+ int y = cell.GetY;
+
+ game.PlaceTile(game.GetPlayingPlayer(), tiledrag, x, y);
+
+ game.PlaceTileNotified -= Game_PlaceTileNotified;
+
+ }
+
+ private void Game_PlaceTileNotified(object? sender, PlaceTileNotifiedEventArgs args)
+ {
+ DisplayAlert("Tile place notified", args.Reason, "<3");
+ }
}
\ No newline at end of file
diff --git a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml
index 278ec76..a67ee1f 100644
--- a/Qwirkle/QwirkleViews/Pages/Gameboard.xaml
+++ b/Qwirkle/QwirkleViews/Pages/Gameboard.xaml
@@ -18,14 +18,18 @@
-
+
+
-
-
+
+
+
@@ -56,7 +60,5 @@
-
-
\ No newline at end of file
|