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); }
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 static void Decode(IEncodable encodable, Encoding encodedElement) { encodable.Decode(encodedElement); }
public static void Decode(IEncodable encodable, string encodedString) { // Debug.Log ("Decoding string \""+encodedString+"\""); encodable.Decode(new Encoding(encodedString)); }
/// <summary> /// Decode an encodable object. /// </summary> /// <param name="encodable"></param> public void Decode(IEncodable encodable) { encodable.Decode(encoder); }