private List <EntityComValueJson> GetSelComEditorValues() { FieldInfo[] fields = LCReflect.GetTypeFieldInfos(SelCom); List <EntityComValueJson> comValues = new List <EntityComValueJson>(); for (int i = 0; i < fields.Length; i++) { FieldInfo info = fields[i]; ComValueAttribute comValueAttribute = LCReflect.GetFieldAttr <ComValueAttribute>(info); if (comValueAttribute != null) { if (comValueAttribute.ViewEditor) { comValues.Add(new EntityComValueJson() { Name = info.Name, Type = info.FieldType.ToString(), Value = "", }); } } } return(comValues); }
/// <summary> /// 处理实体组件 /// </summary> private static List <EntityComView> HandleEntityComs(Entity entity) { List <EntityComView> comViews = new List <EntityComView>(); //组件名 HashSet <string> entityComs = entity.GetAllComStr(); foreach (string comName in entityComs) { BaseCom com = entity.GetCom(comName); FieldInfo[] fields = LCReflect.GetTypeFieldInfos(com.GetType()); EntityComView comView = new EntityComView(comName, fields, com); comViews.Add(comView); } return(comViews); }
private void GetEditorNodeKeyValue() { Type nodeType = LCReflect.GetType(Json.TypeFullName); FieldInfo[] fields = LCReflect.GetTypeFieldInfos(nodeType); for (int i = 0; i < fields.Length; i++) { FieldInfo info = fields[i]; NodeValueAttribute nodeValueAttribute = LCReflect.GetFieldAttr <NodeValueAttribute>(info); if (nodeValueAttribute != null) { if (nodeValueAttribute.ViewEditor) { object defauleValue = LCReflect.GeTypeDefaultFieldValue(Json.TypeFullName, info.Name); UpdateNodeKeyValue(info, defauleValue); } } } }