Ejemplo n.º 1
0
		public override void Encode(BinaryOutput stream) {
			stream.Write(Directories.Count);
			Directories.ForEach(d => d.Encode(stream));

			stream.Write(Sprites.Count);
			Sprites.ForEach(s => s.Encode(stream));
		}
Ejemplo n.º 2
0
 public void Serialize(BinaryOutput output)
 {
     output.Write(TilesetID);
     output.Write(Row);
     output.Write(Col);
     output.Write(X);
     output.Write(Y);
 }
Ejemplo n.º 3
0
		public void Encode(BinaryOutput stream) {
			stream.Write(Name);
			stream.Write(Tiles.Count);

			foreach (Tile tile in Tiles) {
				stream.Write(tile);
			}
			stream.Write(Texture);
		}
Ejemplo n.º 4
0
		public void Encode(BinaryOutput stream) {
			stream.Write((byte) Pattern);
			stream.Write((byte) Speed);
			stream.Write(Count);
			stream.Write(CurrentIndex);
			stream.Write(Inverted);
			stream.Write(Movements.Count);
			Movements.ForEach(m => m.Encode(stream));
		}
Ejemplo n.º 5
0
		public void Encode(BinaryOutput stream) {
			stream.Write(this.Name);
			stream.Write(this.TimePerFrame);
			stream.Write((byte) this.Flags);

			stream.Write(this.Indices.Count);
			foreach (int value in this.Indices) {
				stream.Write(value);
			}
		}
Ejemplo n.º 6
0
		public void Encode(BinaryOutput stream, World world) {
			stream.Write(world.Name);
			stream.Write(world.Author ?? "");
			
			world.TilesetFactory.Encode(stream);
			world.EntityTemplateFactory.Encode(stream);

			world.TilesetContainer.Encode(stream);
			world.EntityContainer.Encode(stream);
			world.UIContainer.Encode(stream);
			world.SpriteLibrary.Encode(stream);
		}
Ejemplo n.º 7
0
		public void Encode(BinaryOutput stream) {
			stream.Write(Name);
			stream.Write(Tokens.Count);
			NamedVariableIO io = new NamedVariableIO(stream);
			foreach (IEncodable token in Tokens) {
				if (token is NamedVariable) {
					io.Write(token as NamedVariable);
				} else {
					stream.Write(-1);
					stream.Write(token);
				}
			}
		}
Ejemplo n.º 8
0
        public void Serialize(BinaryOutput output)
        {
            output.Write(Rows);
            output.Write(Cols);

            for (var i = 0; i < Rows; i++)
            {
                for (var j = 0; j < Cols; j++)
                {
                    output.Write(Tiles[i, j]);
                }
            }
        }
Ejemplo n.º 9
0
        public void Serialize(BinaryOutput output)
        {
            output.Write(Texture);
            output.Write(Position);

            int size = animations.Count;
            output.Write(size);
            for (var i = 0; i < size; i++)
            {
                KeyValuePair<string, Animation> element = animations.ElementAt(i);
                output.Write(element.Key);
                output.Write(element.Value);
            }
        }
Ejemplo n.º 10
0
        public void Serialize(BinaryOutput output)
        {
            output.Write(Name);

            output.Write(Tilesets.Count);
            for (var i = 0; i < Tilesets.Count; i++)
            {
                KeyValuePair<int, Tileset> element = Tilesets.ElementAt(i);
                output.Write(element.Key);
                output.Write(element.Value);
            }

            output.Write(Layers);
        }
Ejemplo n.º 11
0
		public void BuildGame(Project project, string loc) {
			FileStream stream = File.OpenWrite(loc);
			BinaryOutput output = new BinaryOutput(stream);


			output.Write(project.World.TilesetContainer.Count);
			foreach (Tileset t in project.World.TilesetContainer) {
				output.Write(t);
			}

			output.Write(project.World.EntityContainer.All().Count);
			foreach (EntityTemplate e in project.World.EntityContainer.All()) {
				output.Write(e);
			}


		}
Ejemplo n.º 12
0
		public static void DumpGame(World world, BinaryOutput output) {
			new RegionData().Encode(output, world);

			output.Write(world.Maps.Count);
			foreach (Map map in world.Maps) {
				new MapData().Encode(output, map);
			}
		}
Ejemplo n.º 13
0
		public void Encode(BinaryOutput stream) {
			stream.Write(spriteindex);
			stream.Write(collidable);
			stream.Write(reflecting);
			stream.Write(animated);
			stream.Write(frames);
			stream.Write(timeperframe);
			stream.Write(DefaultBehavior);
		}
Ejemplo n.º 14
0
		public void Copy() {
			if (this.Initialized) {
				if (EditorEngine.Instance.StateMachine.State == EntityEditorState.Instance) {
					//DataObject obj = new DataObject("aeon_entities", null);
					DataFormats.Format f = DataFormats.GetFormat("aeon_entities");
					IDataObject obj = new DataObject();

					MemoryStream stream = new MemoryStream();
					BinaryOutput bin = new BinaryOutput(stream);

					bin.Write(EntitySelectionTool.Instance.SelectedEntities.Count);
					//write Template index and positions, no actual Entities :>
					EntitySelectionTool.Instance.SelectedEntities.ForEach(e => {
						bin.Write(e.TemplateID);
						bin.Write(e.Position.X);
						bin.Write(e.Position.Y);
					});

					obj.SetData(f.Name, false, stream);
					Clipboard.SetDataObject(obj);
				}
			}
		}
Ejemplo n.º 15
0
 public void Serialize(BinaryOutput output)
 {
     output.Write(Name);
     output.Write(TimePerFrame);
     output.Write(Frames);
     output.Write((byte) AnimationFlag);
     output.Write((byte) FlipEffect);
     output.Write(Rotation);
 }
        public byte[] DecompileMethod(MethodDefinition method)
        {
            var binout = new BinaryOutput(this);

            try
            {
                DecompileMethod(method, binout);
            }
            catch (Exception ex)
            {
                binout.Write("Error Decompiling: " + ex.Message);
            }

            return binout.GetOutput();
        }
Ejemplo n.º 17
0
		public void Encode(BinaryOutput stream, Map map) {
			stream.Write(map.Name);
			stream.Write(map.Author);

			stream.Write(map.Width);
			stream.Write(map.Height);

			stream.Write(map.Tilesets);

			for (int i = 0; i < map.Width; i++) {
				for (int j = 0; j < map.Height; j++) {
					for (int k = 0; k < Map.LayerCount; k++) {
						map.Tiles[i][j][k].Encode(stream);
					}
				}
			}

			stream.Write(map.Entities.Count);
			foreach (MapEntity e in map.Entities) {
				stream.Write(e.TemplateID);
				stream.Write(e.Position);
			}
		}
Ejemplo n.º 18
0
		public void Encode(BinaryOutput stream) {
			stream.Write(Name);
			stream.Write(ID);

			stream.Write((byte) EntityType);
			stream.Write((byte) ShadowType);

			stream.Write(isSubEntity);

			stream.Write(ShadowOffset);
			stream.Write(0);

			stream.Write(CollisionMap as IEncodable);
			stream.Write(Texture);

			stream.Write(Animations.Count);
			foreach (Animation animation in Animations) {
				stream.Write(animation);
			}
		}
Ejemplo n.º 19
0
		public virtual void Encode(BinaryOutput stream) {
			stream.Write(this.Name);
			stream.Write(this.Deletable);

			stream.Write(Directories.Count);
			foreach (SpriteLibraryDirectory pair in Directories) {
				stream.Write(pair);
			}

			stream.Write(Sprites.Count);
			foreach (SpriteLibrarySprite pair in Sprites) {
				stream.Write(pair);
			}
		}
Ejemplo n.º 20
0
        public void Encode(BinaryOutput stream)
        {
            stream.Write(Name);
            stream.Write(ID);

            stream.Write((byte)EntityType);
            stream.Write((byte)ShadowType);

            stream.Write(isSubEntity);

            stream.Write(ShadowOffset);
            stream.Write(0);

            stream.Write(CollisionMap as IEncodable);
            stream.Write(Texture);

            stream.Write(Animations.Count);
            foreach (Animation animation in Animations)
            {
                stream.Write(animation);
            }
        }
Ejemplo n.º 21
0
		public void Encode(BinaryOutput stream) {
			stream.Write(Uid);
			stream.Write(Elapsed);
			stream.Write(Duration);
		}
Ejemplo n.º 22
0
 public void Serialize(BinaryOutput output)
 {
     output.Write(Texture);
 }
Ejemplo n.º 23
0
 public void Encode(BinaryOutput stream)
 {
     stream.Write(Name);
     stream.Write(Code);
 }
Ejemplo n.º 24
0
		public void Encode(BinaryOutput stream) {
			stream.Write((byte) Facing);
			stream.Write((byte) Speed);
		}
Ejemplo n.º 25
0
 public void Serialize(BinaryOutput output)
 {
     output.Write(Source);
 }
Ejemplo n.º 26
0
		public void Encode(BinaryOutput stream) {
			stream.Write(Name);
			stream.Write(Unchangeable);
			stream.Write(Deletable);
			stream.Write(Texture);
		}
Ejemplo n.º 27
0
        public void Encode(BinaryOutput stream)
        {
            stream.Write(World.Name);
            stream.Write(World.Author ?? "");

            World.TilesetContainer.Encode(stream);
            World.EntityContainer.Encode(stream);
            World.EntityTemplateFactory.Encode(stream);
            World.TilesetFactory.Encode(stream);
            World.UIContainer.Encode(stream);
            World.SpriteLibrary.Encode(stream);

            //DFS
            Stack <TreeNode> stack   = new Stack <TreeNode>();
            List <TreeNode>  visited = new List <TreeNode>();

            List <TreeNode> _reversed = lMaps.Nodes[0].Nodes.Cast <TreeNode>().ToList();

            _reversed.Reverse();
            foreach (TreeNode child in _reversed)
            {
                stack.Push(child);
            }

            //OPCODES:
            //0x01 : FOLDER
            //0x02 : FALL-IN
            //0x03 : FALL-BACK
            //0x04 : MAP

            int writeCount = 0;

            Stack <TreeNode> _stack = new Stack <TreeNode>();

            _reversed.Clear();
            _reversed = lMaps.Nodes[0].Nodes.Cast <TreeNode>().ToList();
            _reversed.Reverse();
            foreach (TreeNode child in _reversed)
            {
                _stack.Push(child);
            }

            while (_stack.Count > 0)
            {
                TreeNode node = _stack.Pop();
                writeCount++;
                List <TreeNode> reversed = node.Nodes.Cast <TreeNode>().ToList();
                reversed.Reverse();
                if (reversed.Count > 0)
                {
                    writeCount += 2;
                }
                foreach (TreeNode child in reversed)
                {
                    _stack.Push(child);
                }
            }

            stream.Write(writeCount);

            while (stack.Count > 0)
            {
                TreeNode node = stack.Pop();
                Map      m    = node.Tag as Map;
                visited.Add(node);
                if (m == null)
                {
                    stream.Write(0x01);
                    stream.Write(node.Text);
                    List <TreeNode> reversedChilds = node.Nodes.Cast <TreeNode>().ToList();
                    reversedChilds.Reverse();
                    if (reversedChilds.Count > 0)
                    {
                        stream.Write(0x02);
                    }
                    foreach (TreeNode child in reversedChilds)
                    {
                        stack.Push(child);
                    }
                }
                else
                {
                    stream.Write(0x04);

                    stream.Write(m.Name);
                    stream.Write(m.Author);
                    stream.Write(m.Width);
                    stream.Write(m.Height);

                    /* ENCODE ALL MOCKUP TILESETS */
                    stream.Write(m.Tilesets.Count);
                    foreach (MockupTileset tref in m.Tilesets)
                    {
                        stream.Write(tref.Tileset.Name);
                    }

                    /* ENCODE ALL MOCKUP BEHAVIORS */
                    for (int i = 0; i < m.Width * m.Height; i++)
                    {
                        int x = i % m.Width;
                        int y = i / m.Width;

                        m.Behaviors[x, y].Encode(stream);
                    }

                    /* ENCODE ALL ACTIONS */
                    ActionManager actionmanager = EditorEngine.Instance.GetActionManager(m);
                    ActionIO      writer        = new ActionIO(stream);

                    stream.Write(actionmanager.Actions.Count);
                    foreach (IAction act in actionmanager.Actions)
                    {
                        writer.Write(act);
                    }
                }

                if (node.Parent != null && lMaps.Nodes[0].Nodes[lMaps.Nodes[0].Nodes.Cast <TreeNode>().Count() - 1] != node)
                {
                    bool allDone = true;
                    foreach (TreeNode child in node.Parent.Nodes)
                    {
                        bool done = false;
                        foreach (TreeNode visitedNode in visited.Where(visitedNode => child.Equals(visitedNode)))
                        {
                            done = true;
                        }
                        if (!done)
                        {
                            allDone = false;
                            break;
                        }
                    }
                    if (allDone)
                    {
                        stream.Write(0x03);
                    }
                }
            }
        }
Ejemplo n.º 28
0
 public virtual void Encode(BinaryOutput stream)
 {
     stream.Write(name);
 }
Ejemplo n.º 29
0
		public override void Encode(BinaryOutput stream) {
			base.Encode(stream);

			stream.Write(TemplateID);
			stream.Write(Collidable);

			stream.Write(Shadow);

			stream.Write(Rotation);
			stream.Write(Scale);
			stream.Write(Opacity);

			stream.Write(TopMost);
			stream.Write(Color.ToVector4());
		}
Ejemplo n.º 30
0
 public void Serialize(BinaryOutput output)
 {
     output.Write(ConquerDirectory);
     output.Write(Effects);
 }
Ejemplo n.º 31
0
		public void Encode(BinaryOutput stream) {
			stream.Write(BehaviorId);
		}
Ejemplo n.º 32
0
 public void Encode(BinaryOutput stream)
 {
     stream.Write(BehaviorId);
 }
Ejemplo n.º 33
0
		public void Encode(BinaryOutput stream) {
			stream.Write(this.currentId);
		}
Ejemplo n.º 34
0
 public void Encode(BinaryOutput stream)
 {
     stream.Write(this.currentId);
 }
Ejemplo n.º 35
0
 public void Encode(BinaryOutput stream)
 {
     stream.Write(Uid);
     stream.Write(Elapsed);
     stream.Write(Duration);
 }
Ejemplo n.º 36
0
		public override void Encode(BinaryOutput stream) {
			base.Encode(stream);

			stream.Write((byte) this.Facing);
			stream.Write(Effects.Count);
			EffectIO io = new EffectIO(stream);
			Effects.ForEach(io.Write);
		}
Ejemplo n.º 37
0
 public void Serialize(BinaryOutput output)
 {
     output.Write(ConquerDirectory);
     output.Write(Effects);
 }
Ejemplo n.º 38
0
 public void Execute(WriteBinaryStateMode mode)
 {
     BinaryOutput?.Write(State, mode);
 }
Ejemplo n.º 39
0
 public void Encode(BinaryOutput stream)
 {
     stream.Write((byte)Facing);
     stream.Write((byte)Speed);
 }
Ejemplo n.º 40
0
 public void Encode(BinaryOutput stream)
 {
     stream.Write(this.Rows);
     stream.Write(this.Columns);
     stream.Write(this.Texture);
 }
Ejemplo n.º 41
0
        public void Write(NamedVariable t)
        {
            BinaryOutput stream = _stream as BinaryOutput;

            int type = 0;

            if (t is NamedBoolean)
            {
                type = 1;
            }
            else if (t is NamedByte)
            {
                type = 2;
            }
            else if (t is NamedChar)
            {
                type = 3;
            }
            else if (t is NamedDecimal)
            {
                type = 4;
            }
            else if (t is NamedDouble)
            {
                type = 5;
            }
            else if (t is NamedInt16)
            {
                type = 6;
            }
            else if (t is NamedInt32)
            {
                type = 7;
            }
            else if (t is NamedInt64)
            {
                type = 8;
            }
            else if (t is NamedSByte)
            {
                type = 9;
            }
            else if (t is NamedSingle)
            {
                type = 10;
            }
            else if (t is NamedString)
            {
                type = 11;
            }
            else if (t is NamedUInt16)
            {
                type = 12;
            }
            else if (t is NamedUInt32)
            {
                type = 13;
            }
            else if (t is NamedUInt64)
            {
                type = 14;
            }

            stream.Write(type);
            stream.Write(t);
        }
Ejemplo n.º 42
0
 public override void Encode(BinaryOutput stream)
 {
     base.Encode(stream);
     stream.Write(value);
 }
Ejemplo n.º 43
0
		public void Encode(BinaryOutput stream) {
			stream.Write(Name);
			stream.Write(Code);
		}