public void LoadSaveData(BoardSerializable boardData)
        {
            int id = 0;

            Dictionary<HexagonTileSerializable, HexagonTile> mapping = new Dictionary<HexagonTileSerializable, HexagonTile>();

            this.hexagonList.Clear();

            foreach (HexagonTileSerializable serializedTile in boardData.ActiveTileList)
            {
                HexagonTile tile = new HexagonTile()
                {
                    Id = serializedTile.Id,
                    TileType = serializedTile.TileType,
                    X = serializedTile.X,
                    Y = serializedTile.Y,
                };

                if (tile.TileType != TileType.none)
                {
                    mapping.Add(serializedTile, tile);
                    this.hexagonList.Add(tile);
                }
            }

            foreach (HexagonTile tile in hexagonList)
            {
                MapUpTile(tile);
            }

            this.SetTurn();
        }
Exemplo n.º 2
0
        public BoardSerializable GetSaveData()
        {
            int id = 0;

            BoardSerializable boardData = new BoardSerializable();

            boardData.FortressesPerPlayer = int.Parse(this.Fortresses.Text);

            foreach (HexagonTile tile in hexagonList)
            {
                HexagonTileSerializable serializableTile = new HexagonTileSerializable(tile);

                // temp code to fill TileValue
                //tile.Fortress = false;

                serializableTile.Id = id++;
                boardData.ActiveTileList.Add(serializableTile);
            }

            return(boardData);
        }
 public void LoadSaveData(BoardSerializable boardData)
 {
     game.LoadSaveData(boardData);
 }
Exemplo n.º 4
0
 internal void LoadData(LE.GameEngine.board.BoardSerializable gameData)
 {
     //Player1.LoadSaveData(gameData);
     //Game.StartNewGame();
 }
        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();
        }
        public BoardSerializable GetSaveData()
        {
            int id = 0;

            BoardSerializable boardData = new BoardSerializable();

            boardData.FortressesPerPlayer = int.Parse(this.Fortresses.Text);

            foreach (HexagonTile tile in hexagonList)
            {
                HexagonTileSerializable serializableTile = new HexagonTileSerializable(tile);

                // temp code to fill TileValue
                //tile.Fortress = false;

                serializableTile.Id = id++;
                boardData.ActiveTileList.Add(serializableTile);
            }

            return boardData;
        }
Exemplo n.º 7
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();
        }