示例#1
0
文件: Entity.cs 项目: hot1989hot/nora
        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;
        }
示例#2
0
 private Entity(uint id, EntityClass clazz)
 {
     this.Id         = id;
     this.Class      = clazz;
     this.Properties = new List <Property>();
 }
示例#3
0
文件: Entity.cs 项目: hot1989hot/nora
 private Entity(uint id, EntityClass clazz) {
     this.Id = id;
     this.Class = clazz;
     this.Properties = new List<Property>();
 }
示例#4
0
        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;
            }
        }