public ISerializable Deserialize(BinaryInput input) { Texture = input.ReadTexture(); Position = input.ReadVector2(); int size = input.ReadInt32(); animations = new Dictionary<string, Animation>(size); for (var i = 0; i < size; i++) { string key = input.ReadString(); var value = input.ReadObject<Animation>(); animations.Add(key, value); } return this; }
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); }
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; }