Beispiel #1
0
 public EntityTemplate(string uid, Category cat)
 {
     Uid = uid;
     _cat = cat;
     _attrProps = new List<AttrProperty>();
     foreach (var id in _cat.AttrIDs)
     {
         var desc = AttrDesc.DescList.ContainsKey(id.Name) ? AttrDesc.DescList[id.Name] : new AttrDesc();
         if (desc.InstanceOnly) continue;
         _attrProps.Add(new AttrProperty(id, desc));
         if (id.Name == "GUID") _guidProp = _attrProps.Last();
     }
 }
Beispiel #2
0
 public Entity(string uid, Category cat, bool existing)
 {
     _isExisting = (uid.Length > 0) && existing;
     _uid = uid;
     _cat = cat;
     _attrProps = new List<AttrProperty>();
     foreach (var id in _cat.AttrIDs)
     {
         AttrDesc desc;
         if (!AttrDesc.DescList.TryGetValue(id.Name, out desc))
             desc = new AttrDesc();
         _attrProps.Add(new AttrProperty(id, desc));
         if (id.Name == "GUID") _guidProp = _attrProps.Last();
        }
 }
Beispiel #3
0
 public Category AddCategory(int Idx)
 {
     int InstAttrCount = EngineAPI.Categories.GetInstAttrCount(Idx);
     if (InstAttrCount < 2) return null;
     Category Cat = new Category();
     Cat.Name = EngineAPI.Categories.GetName(Idx);
     for (int j = 0; j < InstAttrCount; j++)
         Cat.AttrIDs.Add(EngineAPI.Categories.GetAttrID(Idx, j));
     EntityCats.Add(Cat.Name, Cat);
     Cat.TplNode = tvCatsTpls.Nodes.Add(Cat.Name, Cat.Name);
     Cat.TplNode.Tag = Cat;
     Cat.InstNode = tvEntities.Nodes.Add(Cat.Name);
     Cat.InstNode.Tag = Cat;
     return Cat;
 }