protected virtual bool RowCompare(ScoredObject oldObj, ScoredObject newObj) { var info = new PredicateInfo(); var factory = new PredicateFactory(); var predicateInfo = BuildPredicateInfo(oldObj.Score); var predicate = factory.Instantiate(predicateInfo); return(predicate.Execute(newObj.Score)); }
public static string FormatByAttribute(string attName) { var componentName = "ILHot.ILHotComponentMenu"; var componentType = GetType(componentName); var monoProxyType = GetType(attName); var serializeName = "ILHot.ILHotSerializeField"; var serializeType = GetType(serializeName); var objectClassName = "ILHot.ILMonoBehaviour"; var objectClassType = GetType(objectClassName); if (componentType != null && monoProxyType != null && serializeType != null && objectClassType != null) { var displayNameField = componentType.GetField("MenuPath", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); string result = FormatDLLByManual(type => { var componentAttribute = type.GetCustomAttributes(componentType, false).ToList(); var monoAttribute = type.GetCustomAttributes(monoProxyType, false).ToList(); var fields = type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).ToList(); var serializeField = fields.Find(field => field.GetCustomAttributes(serializeType, false).Length != 0); var predicateInfo = new PredicateInfo(); predicateInfo.IsProxy = monoAttribute.Count > 0; predicateInfo.IsBaseType = serializeField != null; predicateInfo.IsSubClass = monoAttribute.Count == 0; predicateInfo.IsObject = objectClassType.IsAssignableFrom(type); predicateInfo.DisplayName = componentAttribute.Count == 0 ? "" : (string)displayNameField.GetValue(componentAttribute[0]); if (predicateInfo.DisplayName == "DemoTestObjComponent") { tmpStr += "\n" + JsonConvert.SerializeObject(predicateInfo); } return(predicateInfo); }, field => { return(field.IsPublic || field.GetCustomAttributes(typeof(SerializableAttribute), false).Length != 0); }); return(result); } return("Faild:Attribute is invalid!"); }
public static string FormatPlayMaker() { var componentName = "ILHot.ILHotComponentMenu"; var componentType = GetType(componentName); var fsmProxyName = "ILHot.ILHotFsmProxyAttribute"; var fsmProxyType = GetType(fsmProxyName); var serializeName = "ILHot.ILHotSerializeField"; var serializeType = GetType(serializeName); var objectClassName = "ILHot.ILProxyBehabiour"; var objectClassType = GetType(objectClassName); if (componentType != null && fsmProxyType != null && serializeType != null) { var displayNameField = componentType.GetField("MenuPath", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); var result = FormatDLLByManual(type => { var componentAttribute = type.GetCustomAttributes(componentType, false).ToList(); var fsmAttribute = type.GetCustomAttributes(fsmProxyType, false).ToList(); var fields = type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).ToList(); var serializeField = fields.Find(field => field.GetCustomAttributes(serializeType, false).Length != 0); var predicateInfo = new PredicateInfo(); predicateInfo.IsProxy = fsmAttribute.Count > 0; predicateInfo.IsBaseType = serializeField != null; predicateInfo.IsSubClass = fsmAttribute.Count == 0; predicateInfo.IsObject = objectClassType.IsAssignableFrom(type); predicateInfo.DisplayName = componentAttribute.Count == 0 ? "" : (string)displayNameField.GetValue(componentAttribute[0]); return(predicateInfo); }, field => { return(field.GetCustomAttributes(serializeType, false).Length > 0); }); return(result); } return("Faild:Dll or attribute is invalid!"); }