internal TileLayer(ContentReader reader, TileRegistry registry) : base(reader) { _registry = registry; TileWidth = reader.ReadInt16(); TileHeight = reader.ReadInt16(); Width = reader.ReadInt16(); Height = reader.ReadInt16(); _tiles = new TileGrid(Width, Height); int stackCount = reader.ReadInt32(); for (int i = 0; i < stackCount; i++) { int dx = reader.ReadInt16(); int dy = reader.ReadInt16(); int tcount = reader.ReadInt16(); Tile[] st = new Tile[tcount]; for (int j = 0; j < tcount; j++) { st[j] = _registry[reader.ReadInt16()]; } _tiles[dx, dy] = new TileStack(st); } }
internal TileLayer(ContentReader reader, TileRegistry registry) : base(reader) { _registry = registry; TileWidth = reader.ReadInt16(); TileHeight = reader.ReadInt16(); Width = reader.ReadInt16(); Height = reader.ReadInt16(); _tiles = new TileGrid(Width, Height); int tileCount = reader.ReadInt32(); for (int i = 0; i < tileCount; i++) { int dx = reader.ReadInt16(); int dy = reader.ReadInt16(); int tileId = reader.ReadInt32(); if (_tiles[dx, dy] == null) { _tiles[dx, dy] = new TileStack(_registry[tileId]); } else { _tiles[dx, dy] = new TileStack(_tiles[dx, dy], _registry[tileId]); } } /*int stackCount = reader.ReadInt32(); * for (int i = 0; i < stackCount; i++) { * int dx = reader.ReadInt16(); * int dy = reader.ReadInt16(); * * int tcount = reader.ReadInt16(); * Tile[] st = new Tile[tcount]; * * for (int j = 0; j < tcount; j++) { * st[j] = _registry[reader.ReadInt16()]; * } * * _tiles[dx, dy] = new TileStack(st); * }*/ }