public static Entity CreateWith(uint id, EntityClass clazz, FlatTable table) { var entity = new Entity(id, clazz); foreach (var info in table.Properties) { entity.Properties.Add(Property.For(info)); } return entity; }
private Entity(uint id, EntityClass clazz) { this.Id = id; this.Class = clazz; this.Properties = new List <Property>(); }
private Entity(uint id, EntityClass clazz) { this.Id = id; this.Class = clazz; this.Properties = new List<Property>(); }
private void Create(uint id, EntityClass clazz, uint baseline) { client.Created.Add(id); if (!client.Slots.ContainsKey(id)) { client.Slots[id] = new nora.lara.state.Client.Slot(null); } var slot = client.Slots[id]; slot.Live = true; if (slot.Baselines[baseline] != null && slot.Baselines[baseline].Class.Equals(clazz)) { slot.Entity = slot.Baselines[baseline].Copy(); } else { slot.Entity = Entity.CreateWith(id, clazz, client.FlatTables[(int) clazz.Id]); StringTable table = client.Strings[client.StringsIndex["instancebaseline"]]; using (var stream = Bitstream.CreateWith(table.Get(clazz.Id.ToString()).Value)) { ReadAndUnpackFields(slot.Entity, stream); } } foreach (var prop in slot.Entity.Properties) { var info = prop.Info; var handle = new Client.PropertyHandle() { Entity = id, Table = info.Origin.NetTableName, Name = info.VarName }; client.Properties[handle] = prop; } }