Ejemplo n.º 1
0
        public MapEntity Read()
        {
            MapEntity   result = null;
            BinaryInput stream = _stream as BinaryInput;
            EntityType  type   = (EntityType)stream.ReadByte();

            if (type == EntityType.Building)
            {
                result = new BuildingEntity(factory, ScrollAffected);
            }

            IEncodable encodable = result as IEncodable;

            if (encodable != null)
            {
                encodable.Decode(stream);
            }

            return(result);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public static void Decode(IEncodable encodable, Encoding encodedElement)
 {
     encodable.Decode(encodedElement);
 }
Ejemplo n.º 4
0
    public static void Decode(IEncodable encodable, string encodedString)
    {
//		Debug.Log ("Decoding string \""+encodedString+"\"");
        encodable.Decode(new Encoding(encodedString));
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Decode an encodable object.
 /// </summary>
 /// <param name="encodable"></param>
 public void Decode(IEncodable encodable)
 {
     encodable.Decode(encoder);
 }
Ejemplo n.º 6
-1
	public static void Decode(IEncodable encodable, Encoding encodedElement)
	{
		encodable.Decode(encodedElement);
	}
Ejemplo n.º 7
-1
	public static void Decode(IEncodable encodable, string encodedString)
	{
//		Debug.Log ("Decoding string \""+encodedString+"\"");
		encodable.Decode(new Encoding(encodedString));
	}