Ejemplo n.º 1
0
		public IEncodable Decode(BinaryInput stream) {
			this.Name = stream.ReadString();
			this.Author = stream.ReadString();

			this.Width = stream.ReadInt32();
			this.Height = stream.ReadInt32();

			this.Tiles = new MockupTile[Width][][];
			for (int i = 0; i < Width; i++) {
				Tiles[i] = new MockupTile[Height][];
				for (int j = 0; j < Height; j++) {
					Tiles[i][j] = new MockupTile[Map.LayerCount];
				}
			}

			int w = Width;
			int h = Height;

			this.Tilesets = stream.ReadList<MockupTileset>();

			for (int i = 0; i < w; i++) {
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < Map.LayerCount; k++) {
						Tiles[i][j][k] = stream.ReadObject<MockupTile>();
					}
				}
			}

			int c = stream.ReadInt32();
			for (int i = 0; i < c; i++) {
				Tuple<Int32, Vector2> t = new Tuple<Int32, Vector2>(stream.ReadInt32(), stream.ReadVector2());
				Entities.Add(t);
			}
			return this;
		}
Ejemplo n.º 2
0
		public IEncodable Decode(General.Encoding.BinaryInput stream) {
			Name = stream.ReadString();
			Author = stream.ReadString();
			Width = stream.ReadInt32();
			Height = stream.ReadInt32();
			int c1 = stream.ReadInt32();
			for (int i = 0; i < c1; i++) {
				Tilesets.Add(stream.ReadObject<MockupTileset>());
			}

			/*Initialize Tiles jagged multidimensional array*/
			this.Tiles = new MockupTile[Width][][];
			for (int i = 0; i < Width; i++) {
				Tiles[i] = new MockupTile[Height][];
				for (int j = 0; j < Height; j++) {
					Tiles[i][j] = new MockupTile[Map.LayerCount];
				}
			}

			for (int x = 0; x < Width; x++) {
				for (int y = 0; y < Height; y++) {
					for (int z = 0; z < LayerCount; z++) {
						Tiles[x][y][z] = stream.ReadObject<MockupTile>();
					}
				}
			}
			int c2 = stream.ReadInt32();
			for (int i = 0; i < c2; i++) {
				EntityTemplate e = stream.ReadObject<EntityTemplate>();
				Entities.Add(e.CreateEntity(World.EntityFactory));
			}
			return this;
		}
Ejemplo n.º 3
0
		public void Fill(int spriteindex, int spritesheetindex, int z) {
			for (int y = 0; y < Height; y++) {
				for (int x = 0; x < Width; x++) {
					Tiles[x][y][z] = new MockupTile(this, spriteindex, spritesheetindex);
				}
			}
		}
Ejemplo n.º 4
0
		public bool isSameType(MockupTile t) {
			if (t == null) return false;
			return isSameType(new Tuple<string, int>(t.Tileset.Name, t.tileIndex));
		}