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(); 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 void Paste() { if (this.Initialized) { MemoryStream stream = null; IDataObject obj = Clipboard.GetDataObject(); const string format = "aeon_entities"; if (obj.GetDataPresent(format)) { stream = obj.GetData(format) as MemoryStream; } EntitySelectionTool.Instance.SelectedEntities.Clear(); BinaryInput bin = new BinaryInput(stream); int c = bin.ReadInt32(); for (int i = 0; i < c; i++) { int temp_index = bin.ReadInt32(); int x = (int)bin.ReadSingle() >> 4; int y = (int)bin.ReadSingle() >> 4; AddEntityAction act = new AddEntityAction(EditorEngine.Instance.World.EntityContainer.All()[temp_index], new Vector2(x, y)); EditorEngine.Instance.GetActionManager().Execute(act); MapEntity result = act.worldEntity; EntitySelectionTool.Instance.SelectedEntities.Add(result); } } }
public IEncodable Decode(BinaryInput stream) { this.Rows = stream.ReadInt32(); this.Columns = stream.ReadInt32(); this.Texture = stream.ReadTexture(); return(this); }
public ISerializable Deserialize(BinaryInput input) { TilesetID = input.ReadInt32(); Row = input.ReadInt32(); Col = input.ReadInt32(); X = input.ReadInt32(); Y = input.ReadInt32(); 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 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 IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.TimePerFrame = stream.ReadSingle(); this.Flags = (AnimationFlags) stream.ReadByte(); int count = stream.ReadInt32(); for (int i = 0; i < count; i++) { this.Indices.Add(stream.ReadInt32()); } return this; }
public IEncodable Decode(BinaryInput stream) { this.Name = stream.ReadString(); this.TimePerFrame = stream.ReadSingle(); this.Flags = (AnimationFlags)stream.ReadByte(); int count = stream.ReadInt32(); for (int i = 0; i < count; i++) { this.Indices.Add(stream.ReadInt32()); } return(this); }
public override IEncodable Decode(BinaryInput stream) { base.Decode(stream); value = stream.ReadInt32(); return(this); }
public static NamedCompound DecodeCompound(BinaryInput stream, List <Tuple <string, Type> > GenericChute) { NamedCompound result = new NamedCompound(); result.Name = stream.ReadString(); int c = stream.ReadInt32(); NamedVariableIO io = new NamedVariableIO(stream); for (int i = 0; i < c; i++) { NamedVariable varag = io.Read(); if (varag != null) { result.Tokens.Add(varag); } else { string n = stream.ReadString(); Type type = null; foreach (Tuple <string, Type> t in GenericChute.Where(t => n == t.Item1)) { type = t.Item2; } if (type != null) { } } } return(result); }
public ISerializable Deserialize(BinaryInput input) { ID = input.ReadInt32(); Name = input.ReadString(); TileableTexture = input.ReadObject<TileableTexture>(); 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 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) { 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) { 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.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 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.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 override IEncodable Decode(BinaryInput stream) { base.Decode(stream); this.Facing = (Facing)stream.ReadByte(); EffectIO io = new EffectIO(stream); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Effects.Add(io.Read()); } 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 static GameData ReadGame(GraphicsDevice graphicsDevice, BinaryInput input) { GameData result = new GameData(); input.GraphicsDevice = graphicsDevice; result.RegionData = new RegionData(); result.RegionData.Decode(input); int c = input.ReadInt32(); for (int i = 0; i < c; i++) { MapData data = new MapData(); data.Decode(input); result.MapDatas.Add(data); } return result; }
public override IEncodable Decode(BinaryInput stream) { base.Decode(stream); TemplateID = stream.ReadInt32(); Collidable = stream.ReadBoolean(); Shadow = stream.ReadBoolean(); Rotation = stream.ReadSingle(); Scale = stream.ReadSingle(); Opacity = stream.ReadSingle(); TopMost = stream.ReadBoolean(); Color = new Color(stream.ReadVector4()); return(this); }
public static GameData ReadGame(GraphicsDevice graphicsDevice, BinaryInput input) { GameData result = new GameData(); input.GraphicsDevice = graphicsDevice; result.RegionData = new RegionData(); result.RegionData.Decode(input); int c = input.ReadInt32(); for (int i = 0; i < c; i++) { MapData data = new MapData(); data.Decode(input); result.MapDatas.Add(data); } return(result); }
public static NamedCompound DecodeCompound(BinaryInput stream, List<Tuple<string, Type>> GenericChute) { NamedCompound result = new NamedCompound(); result.Name = stream.ReadString(); int c = stream.ReadInt32(); NamedVariableIO io = new NamedVariableIO(stream); for (int i = 0; i < c; i++) { NamedVariable varag= io.Read(); if (varag != null) result.Tokens.Add(varag); else { string n = stream.ReadString(); Type type = null; foreach (Tuple<string, Type> t in GenericChute.Where(t => n == t.Item1)) { type = t.Item2; } if (type != null) { } } } return result; }
public IAction Read() { IAction result = null; BinaryInput stream = _stream as BinaryInput; int i = stream.ReadInt32(); if (i == 1) { result = new SetTileAction(); } if (i == 2) { result = new MultiAction(); } if (i == 3) { result = new FillAction(); } if (i == 4) { result = new RectangleAction(); } if (i == 5) { result = new AddEntityAction(); } if (i == 6) { result = new RemoveEntityAction(); } IEncodable encodable = result as IEncodable; if (encodable != null) { encodable.Decode(stream); } return(result); }
public IEncodable Decode(BinaryInput stream) { this.currentId = stream.ReadInt32(); return this; }
public IEncodable Decode(BinaryInput stream) { this.Rows = stream.ReadInt32(); this.Columns = stream.ReadInt32(); this.Texture = stream.ReadTexture(); 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) { this.currentId = stream.ReadInt32(); 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 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 override IEncodable Decode(BinaryInput stream) { base.Decode(stream); this.Facing = (Facing) stream.ReadByte(); EffectIO io = new EffectIO(stream); int c = stream.ReadInt32(); for (int i = 0; i < c; i++) { Effects.Add(io.Read()); } return this; }
public override IEncodable Decode(BinaryInput stream) { base.Decode(stream); TemplateID = stream.ReadInt32(); Collidable = stream.ReadBoolean(); Shadow = stream.ReadBoolean(); Rotation = stream.ReadSingle(); Scale = stream.ReadSingle(); Opacity = stream.ReadSingle(); TopMost = stream.ReadBoolean(); Color = new Color(stream.ReadVector4()); 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 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 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); }