예제 #1
0
        private void InitializeBoard()
        {
            BoardSerializable boardData = this.webservice.RetrieveBoardData(this.gameId);

            this.MyFortresses = boardData.FortressesPerPlayer;
            this.SetFortressesDisplay();

            foreach (HexagonTileSerializable tile in boardData.ActiveTileList)
            {
                BoardHexagon element = this.GetBoardTile(tile.X, tile.Y, tile.TileType, tile.TileValue);
                element.ShowFortress(tile.Fortress);
                this.board.Add(tile.Id, element);
            }
        }
예제 #2
0
        private void AddPropertyToColour(object sender, MouseButtonEventArgs e)
        {
            if (currentSelection != null && currentSelection.TileType == TileType.none)
            {
                BoardHexagon control = (BoardHexagon)sender;

                if (currentSelection is Fortress)
                {
                    ColorToAdd.Children.Clear();
                    control.ShowFortress(true);
                    hexagonList[control].Fortress = true;
                }
            }
        }
예제 #3
0
        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();
        }
예제 #4
0
        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();
        }