public void Write(string name, BodyJSON bodyjson) { WriteStartElement(name); if (bodyjson != null) { Write("Images", bodyjson.Images); Write("Animated", bodyjson.Animated); Write("Turned", bodyjson.Turned); Write("Speed", bodyjson.Speed); Write("Duration", bodyjson.Duration); } WriteEndElement(); }
public virtual void Load(SerializationReader SR) { SR.ReadStartElement(); int version = SR.ReadVersion(); switch (version) { case 0: { string ai = SR.ReadString(); if (ai != "") { AI = Info.Instance(ai) as AI; } if (AI != null) { AI.Entity = this; } ID = SR.ReadString(); X = SR.ReadInt(); Y = SR.ReadInt(); Z = SR.ReadInt(); Name = SR.ReadString(); Width = SR.ReadFloat(); Height = SR.ReadFloat(); CanMove = SR.ReadBool(); CanTarget = SR.ReadBool(); Cross = SR.ReadBool(); Direction = SR.ReadInt(); Flag.Value = SR.ReadInt(); Containers = SR.ReadContainers(); //Move = SR.ReadMove();//Supprimer!!!!! Body = SR.ReadBodyJSON(); break; } } SR.ReadEndElement(); }
public EntityJSON(Entity entity) { ID = entity.ID; X = entity.X; Y = entity.Y; Z = entity.Z; Adjustment = entity.Adjustment; Name = entity.Name; Width = entity.Width; Height = entity.Height; Direction = entity.Direction; Flag = entity.Flag.Value; CanMove = entity.CanMove; CanTarget = entity.CanTarget; Cross = entity.Cross; Move = entity.Move; MoveDraw = entity.MoveDraw; Body = entity.Body; }
public void Editor_New_Entity(string[] str, bool permanents) { //bool permanent = StringToBool(str[1]); int x = StringToInt(str[2]); int y = StringToInt(str[3]); int z = StringToInt(str[4]); int adjx = StringToInt(str[5]); int adjy = StringToInt(str[6]); string fulltype = str[7]; string ai = str[8]; string id = str[9]; string name = str[10]; float width = StringToFloat(str[11]); float height = StringToFloat(str[12]); //int bodyspeed = StringToInt(str[12]); bool canmove = StringToBool(str[13]); bool cantarget = StringToBool(str[14]); bool cross = StringToBool(str[15]); //bool animated = StringToBool(str[16]); //bool turned = StringToBool(str[17]); int direction = StringToInt(str[16]); //ImageJSON[] bodys = Info.JSONDeserialize<ImageJSON[]>(str[19]); //BodyJSON body2 = Info.JSONDeserialize<BodyJSON>(str[20]); BodyJSON body_Stand = Info.JSONDeserialize <BodyJSON>(str[17]); BodyJSON body_Move = Info.JSONDeserialize <BodyJSON>(str[18]); BodyJSON body_Jump = Info.JSONDeserialize <BodyJSON>(str[19]); if (PageInfo.Map == null || !PageInfo.Map.Contains(x, y, z)) { return; } if (id == "") { return; } Entity entity = PageInfo.Map.FindEntity(id); if (entity == null) { if (fulltype == "") { fulltype = "Core.Entity"; } entity = Info.Instance(fulltype) as Entity; if (entity == null) { return; } if (permanents) { PageInfo.Map.Permanents.Add(entity); } else { PageInfo.Map.Entitys.Add(entity); } } if (entity != null) { if (ai != "") { entity.AI = Info.Instance(ai) as AI; if (entity.AI != null) { entity.AI.Entity = entity; } } entity.Adjustment.X = adjx; entity.Adjustment.Y = adjy; entity.ID = id; entity.Name = name; entity.Width = width; entity.Height = height; //entity.Body.Speed = bodyspeed; entity.CanMove = canmove; entity.CanTarget = cantarget; entity.Cross = cross; //entity.Body.Animated = animated; //entity.Body.Turned = turned; entity.Direction = direction; //entity.Body = bodys; entity.Body = body_Stand; entity.X = x; entity.Y = y; entity.Z = z; entity.Map = PageInfo.Map; //if (GameInfo.Map.Entitys.Contains(id)) // GameInfo.Map.Entitys.Remove(entity); //if (GameInfo.Map.Permanents.Contains(id)) // GameInfo.Map.Permanents.Remove(entity); Mobile mobile = entity as Mobile; if (mobile != null) { mobile.Body_Stand = body_Stand; mobile.Body_Move = body_Move; mobile.Body_Jump = body_Jump; } } //GameInfo.Map.EntityJSON = GameInfo.Map.Entitys.JSON(); //SendEntitys(); //if (permanent) PageInfo.Map.CreateMessagePermanents(); SendMap(); }