private void BoardChoice(object sender, System.Windows.Input.MouseButtonEventArgs e) { BoardHexagon control = (BoardHexagon)sender; int choice = this.board[control]; game.ChooseTurn(choice, this.playerId); foreach (int i in this.choiceList) { int p = i; this.board[i].Dispatcher.BeginInvoke( (Action)(() => { this.board[p].SetTileType(TileType.board); this.board[p].MouseLeftButtonDown -= BoardChoice; })); } control.SetTileType(TileType.board); UpdateBoard(); lock (semaphor) { Monitor.Pulse(semaphor); } }
private void ReplaceEditSpot(HexagonTile tile) { BoardHexagon control = hexagonList[tile]; control.MouseLeftButtonDown -= AddHexagonTile; control.MouseLeftButtonDown += AddNewColour; control.MouseRightButtonDown += RemoveHexagonTile; tile.TileType = TileType.board; tile.TileValue = defaultTileValue; control.SetTileType(TileType.board); }
private ITileControl GetBoardTile(double x, double y) { BoardHexagon board = new BoardHexagon(); Board.Children.Add(board); board.SetTileType(TileType.board); Canvas.SetLeft(board, x); Canvas.SetTop(board, y); return board; }
private BoardHexagon GetBoardTile(double x, double y, TileType tileType) { BoardHexagon element = new BoardHexagon(); element.SetTileType(tileType); Board.Children.Add(element); Canvas.SetLeft(element, x); Canvas.SetTop(element, y); element.ShowLinks(false); return(element); }
private ITileControl GetBoardTile(double x, double y, TileType tileType) { BoardHexagon element = new BoardHexagon(); element.SetTileType(tileType); Board.Children.Add(element); Canvas.SetLeft(element, x); Canvas.SetTop(element, y); return((ITileControl)element); }
private ITileControl GetBoardTile(double x, double y) { BoardHexagon board = new BoardHexagon(); Board.Children.Add(board); board.SetTileType(TileType.board); Canvas.SetLeft(board, x); Canvas.SetTop(board, y); return(board); }
void ChooseTurn(object sender, System.Windows.Input.MouseButtonEventArgs e) { BoardHexagon control = (BoardHexagon)sender; control.CurrentTile.TileType = this.turnOrder[this.currentTurn]; control.SetTileType(this.turnOrder[this.currentTurn]); TurnTilesToCurrentColor(control.CurrentTile); control.MouseLeftButtonDown -= ChooseTurn; InitNextTurn(); e.Handled = true; }
private BoardHexagon GetEditTile(double x, double y) { BoardHexagon editTile = new BoardHexagon(); editTile.MouseLeftButtonDown += AddHexagonTile; Board.Children.Add(editTile); Canvas.SetLeft(editTile, x); Canvas.SetTop(editTile, y); editTile.SetTileType(TileType.none); SetDisplayProperties(editTile); return(editTile); }
private void RemoveColouredTile(object sender, MouseButtonEventArgs e) { BoardHexagon control = (BoardHexagon)sender; control.MouseRightButtonDown -= RemoveColouredTile; control.MouseLeftButtonDown -= AddPropertyToColour; control.MouseLeftButtonDown += AddNewColour; control.MouseRightButtonDown += RemoveHexagonTile; control.SetTileType(TileType.board); control.ShowFortress(false); hexagonList[control].TileType = TileType.board; CreateMappings(); }
private void BoardChoice(object sender, System.Windows.Input.MouseButtonEventArgs e) { BoardHexagon control = (BoardHexagon)sender; int choice = this.board[control]; game.ChooseTurn(choice, Guid.NewGuid()); foreach (int i in this.choiceList) { this.board[i].SetTileType(TileType.board); this.board[i].MouseLeftButtonDown -= BoardChoice; } control.SetTileType(this.currentColor); InitializeTurn(); }
private BoardHexagon GetBoardTile(double x, double y) { BoardHexagon boardTile = new BoardHexagon(); boardTile.MouseLeftButtonDown += AddNewColour; boardTile.MouseRightButtonDown += RemoveHexagonTile; Board.Children.Add(boardTile); boardTile.SetTileType(TileType.board); Canvas.SetLeft(boardTile, x); Canvas.SetTop(boardTile, y); SetDisplayProperties(boardTile); return(boardTile); }
public void LoadSaveData(BoardSerializable boardData) { Dictionary <HexagonTileSerializable, HexagonTile> mapping = new Dictionary <HexagonTileSerializable, HexagonTile>(); this.hexagonList.Clear(); this.Board.Children.Clear(); foreach (HexagonTileSerializable serializedTile in boardData.ActiveTileList) { HexagonTile tile = new HexagonTile() { TileType = serializedTile.TileType, }; if (tile.TileType != TileType.none) { mapping.Add(serializedTile, tile); this.hexagonList.Add(tile); BoardHexagon board = (BoardHexagon)this.GetBoardTile(serializedTile.X, serializedTile.Y); tile.Visual = board; board.SetTileType(tile.TileType); board.ShowLinks(false); } } foreach (HexagonTile tile in hexagonList) { MapUpTile(tile); } foreach (HexagonTile tile in hexagonList) { tile.Visual.SetLinkCount(); } this.SetTurn(); }
private void BoardChoice(object sender, System.Windows.Input.MouseButtonEventArgs e) { BoardHexagon control = (BoardHexagon)sender; int choice = this.board[control]; if (!this.FortressSelected) { this.webservice.ChooseTurn(this.gameId, this.playerId, choice); } else { this.webservice.ChooseFortressedTurn(this.gameId, this.playerId, choice); this.MyFortresses--; } this.FortressSelected = false; this.DisplayFortressSelected(); foreach (int i in this.choiceList) { int p = i; this.board[i].Dispatcher.BeginInvoke( (Action)(() => { this.board[p].SetTileType(TileType.board); this.board[p].MouseLeftButtonDown -= BoardChoice; })); } control.SetTileType(TileType.board); UpdateBoard(); lock (semaphor) { Monitor.Pulse(semaphor); } }
private ITileControl GetBoardTile(double x, double y, TileType tileType) { BoardHexagon element = new BoardHexagon(); element.SetTileType(tileType); Board.Children.Add(element); Canvas.SetLeft(element, x); Canvas.SetTop(element, y); return (ITileControl)element; }
public void LoadSaveData(BoardSerializable boardData) { Dictionary <HexagonTileSerializable, HexagonTile> mapping = new Dictionary <HexagonTileSerializable, HexagonTile>(); this.hexagonList.Clear(); this.Board.Children.Clear(); this.Fortresses.Text = boardData.FortressesPerPlayer.ToString(); foreach (HexagonTileSerializable serializedTile in boardData.ActiveTileList) { HexagonTile tile = new HexagonTile() { Id = serializedTile.Id, TileType = serializedTile.TileType, X = serializedTile.X, Y = serializedTile.Y, TileValue = serializedTile.TileValue, Fortress = serializedTile.Fortress, }; mapping.Add(serializedTile, tile); BoardHexagon board = null; switch (tile.TileType) { case TileType.none: board = (BoardHexagon)this.GetEditTile(serializedTile.X, serializedTile.Y); board.SetTileType(tile.TileType); board.SetTileValue(tile.TileValue); board.ShowFortress(tile.Fortress); this.hexagonList.Add(tile, board); break; case TileType.board: board = (BoardHexagon)this.GetBoardTile(serializedTile.X, serializedTile.Y); board.SetTileType(tile.TileType); this.hexagonList.Add(tile, board); board.SetTileValue(tile.TileValue); board.ShowFortress(tile.Fortress); break; case TileType.blue: case TileType.red: case TileType.yellow: board = (BoardHexagon)this.GetBoardTile(serializedTile.X, serializedTile.Y, tile.TileType); board.SetTileType(tile.TileType); board.SetTileValue(tile.TileValue); board.ShowFortress(tile.Fortress); this.hexagonList.Add(tile, board); break; } } foreach (HexagonTile tile in hexagonList) { MapUpTile(tile); } foreach (HexagonTile tile in hexagonList) { hexagonList[tile].SetLinkCount(tile.LinkCount); } CreateMappings(); }