public IEncodable Decode(BinaryInput stream) { Name = stream.ReadString(); ID = stream.ReadInt32(); EntityType = (EntityType)stream.ReadByte(); ShadowType = (ShadowType)stream.ReadByte(); ShadowType = ShadowType.Perspective; isSubEntity = stream.ReadBoolean(); ShadowOffset = stream.ReadInt32(); stream.ReadInt32(); CollisionMap = stream.ReadObject <CollisionMap>(); Texture = stream.ReadObject <TileableTexture>(); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Animations.Add(stream.ReadObject <Animation>()); } return(this); }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); int tilesCount = stream.ReadInt32(); for (int i = 0; i < tilesCount; i++) { Tiles.Add(stream.ReadObject<Tile>()); } this.Texture = stream.ReadObject<TileableTexture>(); return this; }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); int tilesCount = stream.ReadInt32(); for (int i = 0; i < tilesCount; i++) { Tiles.Add(stream.ReadObject <Tile>()); } this.Texture = stream.ReadObject <TileableTexture>(); return(this); }
public ISerializable Deserialize(BinaryInput input) { ID = input.ReadInt32(); Name = input.ReadString(); TileableTexture = input.ReadObject<TileableTexture>(); return this; }
public override IEncodable Decode(BinaryInput stream) { int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibraryDirectory obj = stream.ReadObject<SpriteLibraryDirectory>(); obj.Parent = this; this.Directories.Add(obj); } c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibrarySprite obj = stream.ReadObject<SpriteLibrarySprite>(); obj.Parent = this; this.Sprites.Add(obj); } return this; }
public IEncodable Decode(BinaryInput stream) { int tilesetCount = stream.ReadInt32(); for (int i = 0; i < tilesetCount; i++) { this.Add(stream.ReadObject <Tileset>()); } return(this); }
public IEncodable Decode(BinaryInput stream) { int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Add(stream.ReadObject <UITemplate>()); } return(this); }
public IEncodable Decode(BinaryInput stream) { this.spriteindex = stream.ReadInt32(); this.collidable = stream.ReadBoolean(); this.reflecting = stream.ReadBoolean(); this.animated = stream.ReadBoolean(); this.frames = stream.ReadInt32(); this.timeperframe = stream.ReadSingle(); this.DefaultBehavior = stream.ReadObject<MockupTileBehavior>(); return this; }
public IEffect Read() { BinaryInput stream = this._stream as BinaryInput; int type = stream.ReadByte(); if (type == 0) { return(stream.ReadObject <LockEffect>()); } return(null); }
public IEncodable Decode(BinaryInput stream) { this.spriteindex = stream.ReadInt32(); this.collidable = stream.ReadBoolean(); this.reflecting = stream.ReadBoolean(); this.animated = stream.ReadBoolean(); this.frames = stream.ReadInt32(); this.timeperframe = stream.ReadSingle(); this.DefaultBehavior = stream.ReadObject <MockupTileBehavior>(); return(this); }
public override IEncodable Decode(BinaryInput stream) { int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibraryDirectory obj = stream.ReadObject <SpriteLibraryDirectory>(); obj.Parent = this; this.Directories.Add(obj); } c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibrarySprite obj = stream.ReadObject <SpriteLibrarySprite>(); obj.Parent = this; this.Sprites.Add(obj); } return(this); }
public IEncodable Decode(BinaryInput stream) { Name = stream.ReadString(); ID = stream.ReadInt32(); EntityType = (EntityType) stream.ReadByte(); ShadowType = (ShadowType) stream.ReadByte(); ShadowType = ShadowType.Perspective; isSubEntity = stream.ReadBoolean(); ShadowOffset = stream.ReadInt32(); stream.ReadInt32(); CollisionMap = stream.ReadObject<CollisionMap>(); Texture = stream.ReadObject<TileableTexture>(); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Animations.Add(stream.ReadObject<Animation>()); } return this; }
public IEncodable Decode(BinaryInput stream) { this.Pattern = (MovementPattern)stream.ReadByte(); this.Speed = (MovementSpeed)stream.ReadByte(); this.Count = stream.ReadInt16(); this.CurrentIndex = stream.ReadInt16(); this.Inverted = stream.ReadBoolean(); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Movements.Add(stream.ReadObject <Movement>()); } return(this); }
public virtual IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Deletable = stream.ReadBoolean(); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibraryDirectory child = stream.ReadObject <SpriteLibraryDirectory>(); child.Parent = this; Directories.Add(child); } c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibrarySprite child = stream.ReadObject <SpriteLibrarySprite>(); child.Parent = this; Sprites.Add(child); } return(this); }
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 ISerializable Deserialize(BinaryInput input) { Rows = input.ReadInt32(); Cols = input.ReadInt32(); Tiles = new Tile[Rows, Cols]; for (var i = 0; i < Rows; i++) { for (var j = 0; j < Cols; j++) { Tiles[i, j] = input.ReadObject<Tile>(); } } return this; }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Author = stream.ReadString(); this.TilesetFactory = stream.ReadObject<TilesetFactory>(); this.EntityTemplateFactory = stream.ReadObject<EntityTemplateFactory>(); this.TilesetContainer = stream.ReadObject<TilesetContainer>(); this.EntityContainer = stream.ReadObject<EntityContainer>(); this.UIContainer = stream.ReadObject<UIContainer>(); this.SpriteLibrary = stream.ReadObject<SpriteLibrary.SpriteLibrary>(); 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.TilesetFactory = stream.ReadObject <TilesetFactory>(); this.EntityTemplateFactory = stream.ReadObject <EntityTemplateFactory>(); this.TilesetContainer = stream.ReadObject <TilesetContainer>(); this.EntityContainer = stream.ReadObject <EntityContainer>(); this.UIContainer = stream.ReadObject <UIContainer>(); this.SpriteLibrary = stream.ReadObject <SpriteLibrary.SpriteLibrary>(); return(this); }
public IEncodable Decode(BinaryInput stream) { stream.GraphicsDevice = EditorEngine.Instance.GraphicsDevice; RegionName = stream.ReadString(); RegionAuthor = stream.ReadString(); World world = EditorEngine.Instance.CreateRegion(RegionName); world.TilesetContainer.Decode(stream); world.EntityContainer.Decode(stream); world.EntityTemplateFactory.Decode(stream); world.TilesetFactory.Decode(stream); world.UIContainer.Decode(stream); world.SpriteLibrary.Decode(stream); this.RootNode = new TreeNode(RegionName); TreeNode lastNode = null; TreeNode currentNode = RootNode; int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { int code = stream.ReadInt32(); switch (code) { case 0x01: string text = stream.ReadString(); TreeNode node = new TreeNode(text); currentNode.Nodes.Add(node); lastNode = node; break; case 0x02: currentNode = lastNode; break; case 0x03: currentNode = currentNode.Parent; break; case 0x04: /*RECREATE FROM DETAILS*/ Map m = new Map(EditorEngine.Instance.World.EntityFactory); m.Name = stream.ReadString(); m.Author = stream.ReadString(); m.Width = stream.ReadInt32(); m.Height = stream.ReadInt32(); m.Tiles = new MockupTile[m.Width][][]; for (int x = 0; x < m.Width; x++) { m.Tiles[x] = new MockupTile[m.Height][]; for (int y = 0; y < m.Height; y++) { m.Tiles[x][y] = new MockupTile[Map.LayerCount]; } } /* READ ALL MOCKUP TILESETS */ int c1 = stream.ReadInt32(); for (int j = 0; j < c1; j++) { string name = stream.ReadString(); m.Tilesets.Add(new MockupTileset(world, EditorEngine.Instance.GetTilesetIndexByName(name))); } m.Fill(-1, 0); Map oldCurrentMap = EditorEngine.Instance.CurrentMap; EditorEngine.Instance.CurrentMap = m; List <byte> visited = new List <byte>(); /* READ MOCKUP TILE BEHAVIORS */ m.Behaviors = new MockupTileBehavior[m.Width, m.Height]; for (int j = 0; j < m.Width * m.Height; j++) { int x = j % m.Width; int y = j / m.Height; m.Behaviors[x, y] = stream.ReadObject <MockupTileBehavior>(); } /* READ ACTIONS/REBUILD MAP */ ActionManager actionmanager = EditorEngine.Instance.GetActionManager(); ActionIO reader = new ActionIO(stream); int c2 = stream.ReadInt32(); for (int j = 0; j < c2; j++) { IAction act = reader.Read(); actionmanager.Execute(act); } /*DATA TREE NODE*/ TreeNode node2 = new TreeNode(m.Name); node2.Tag = m; node2.ImageKey = "document.png"; node2.SelectedImageKey = "document.png"; if (currentNode != null) { currentNode.Nodes.Add(node2); } else { Console.WriteLine("WARNING: CurrentNode is null (Project.Decode)"); } EditorEngine.Instance.CurrentMap = oldCurrentMap; break; } } return(this); }
public ISerializable Deserialize(BinaryInput input) { Name = input.ReadString(); int tilesetCount = input.ReadInt32(); Tilesets = new Dictionary<int, Tileset>(tilesetCount); for (var i = 0; i < tilesetCount; i++) { int key = input.ReadInt32(); var value = input.ReadObject<Tileset>(); Tilesets.Add(key, value); } Layers = input.ReadList<Layer>(); for (var i = 0; i < Layers.Count; i++) { Layers[i].Map = this; } return this; }
public IEncodable Decode(BinaryInput stream) { stream.GraphicsDevice = EditorEngine.Instance.GraphicsDevice; RegionName = stream.ReadString(); RegionAuthor = stream.ReadString(); World world = EditorEngine.Instance.CreateRegion(RegionName); world.TilesetContainer.Decode(stream); world.EntityContainer.Decode(stream); world.EntityTemplateFactory.Decode(stream); world.TilesetFactory.Decode(stream); world.UIContainer.Decode(stream); world.SpriteLibrary.Decode(stream); this.RootNode = new TreeNode(RegionName); TreeNode lastNode = null; TreeNode currentNode = RootNode; int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { int code = stream.ReadInt32(); switch (code) { case 0x01: string text = stream.ReadString(); TreeNode node = new TreeNode(text); currentNode.Nodes.Add(node); lastNode = node; break; case 0x02: currentNode = lastNode; break; case 0x03: currentNode = currentNode.Parent; break; case 0x04: /*RECREATE FROM DETAILS*/ Map m = new Map(EditorEngine.Instance.World.EntityFactory); m.Name = stream.ReadString(); m.Author = stream.ReadString(); m.Width = stream.ReadInt32(); m.Height = stream.ReadInt32(); m.Tiles = new MockupTile[m.Width][][]; for (int x = 0; x < m.Width; x++) { m.Tiles[x] = new MockupTile[m.Height][]; for (int y = 0; y < m.Height; y++) { m.Tiles[x][y] = new MockupTile[Map.LayerCount]; } } /* READ ALL MOCKUP TILESETS */ int c1 = stream.ReadInt32(); for (int j = 0; j < c1; j++) { string name = stream.ReadString(); m.Tilesets.Add(new MockupTileset(world, EditorEngine.Instance.GetTilesetIndexByName(name))); } m.Fill(-1, 0); Map oldCurrentMap = EditorEngine.Instance.CurrentMap; EditorEngine.Instance.CurrentMap = m; List<byte> visited = new List<byte>(); /* READ MOCKUP TILE BEHAVIORS */ m.Behaviors = new MockupTileBehavior[m.Width,m.Height]; for (int j = 0; j < m.Width * m.Height; j++) { int x = j % m.Width; int y = j / m.Height; m.Behaviors[x, y] = stream.ReadObject<MockupTileBehavior>(); } /* READ ACTIONS/REBUILD MAP */ ActionManager actionmanager = EditorEngine.Instance.GetActionManager(); ActionIO reader = new ActionIO(stream); int c2 = stream.ReadInt32(); for (int j = 0; j < c2; j++) { IAction act = reader.Read(); actionmanager.Execute(act); } /*DATA TREE NODE*/ TreeNode node2 = new TreeNode(m.Name); node2.Tag = m; node2.ImageKey = "document.png"; node2.SelectedImageKey = "document.png"; if (currentNode != null) currentNode.Nodes.Add(node2); else Console.WriteLine("WARNING: CurrentNode is null (Project.Decode)"); EditorEngine.Instance.CurrentMap = oldCurrentMap; break; } } return this; }
public NamedVariable Read() { BinaryInput stream = _stream as BinaryInput; int type = stream.ReadInt32(); if (type == 1) { return(stream.ReadObject <NamedBoolean>()); } else if (type == 2) { return(stream.ReadObject <NamedByte>()); } else if (type == 3) { return(stream.ReadObject <NamedChar>()); } else if (type == 4) { return(stream.ReadObject <NamedDecimal>()); } else if (type == 5) { return(stream.ReadObject <NamedDouble>()); } else if (type == 6) { return(stream.ReadObject <NamedInt16>()); } else if (type == 7) { return(stream.ReadObject <NamedInt32>()); } else if (type == 8) { return(stream.ReadObject <NamedInt64>()); } else if (type == 9) { return(stream.ReadObject <NamedSByte>()); } else if (type == 10) { return(stream.ReadObject <NamedSingle>()); } else if (type == 11) { return(stream.ReadObject <NamedString>()); } else if (type == 12) { return(stream.ReadObject <NamedUInt16>()); } else if (type == 13) { return(stream.ReadObject <NamedUInt32>()); } else if (type == 14) { return(stream.ReadObject <NamedUInt64>()); } return(null); }
public virtual IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.Deletable = stream.ReadBoolean(); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibraryDirectory child = stream.ReadObject<SpriteLibraryDirectory>(); child.Parent = this; Directories.Add(child); } c = stream.ReadInt32(); for (int i = 0; i < c; i++) { SpriteLibrarySprite child = stream.ReadObject<SpriteLibrarySprite>(); child.Parent = this; Sprites.Add(child); } 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 override IEncodable Decode(BinaryInput stream) { base.Decode(stream); value = stream.ReadObject <T>(); return(this); }
public IEncodable Decode(BinaryInput stream) { this.Pattern = (MovementPattern) stream.ReadByte(); this.Speed = (MovementSpeed) stream.ReadByte(); this.Count = stream.ReadInt16(); this.CurrentIndex = stream.ReadInt16(); this.Inverted = stream.ReadBoolean(); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Movements.Add(stream.ReadObject<Movement>()); } return this; }