private static void CacheCustomGraphEditors() { IEnumerable <Type> customEditors = FReflectionUtility.GetSubTypesOf <NodeEditorType>(); foreach (Type editor in customEditors) { if (editor.IsAbstract) { continue; } object[] attributes = editor.GetCustomAttributes(typeof(AttributeType), false); if (attributes == null || attributes.Length == 0) { continue; } foreach (object attribute in attributes) { if (attribute is AttributeType graphEditorAttribute) { _editorTypes.Add(graphEditorAttribute.InspectedType, editor); break; } } } }
private void CacheTypeNames() { if (fieldInfo.IsDefined(FSubclassFilterAttribute.CLASS_TYPE)) { Attribute attribute = fieldInfo.GetCustomAttribute(FSubclassFilterAttribute.CLASS_TYPE); PropertyInfo typePropertyInfo = attribute.GetType().GetProperty(nameof(FSubclassFilterAttribute.Type)); Type typeFilter = (Type)typePropertyInfo.GetValue(attribute); IEnumerable <Type> subtypes = FReflectionUtility.GetSubTypesOf(typeFilter); _typeFullNames = subtypes.Select(x => x.FullName).ToArray(); _displaynames = subtypes.Select(x => FReflectionUtility.HasDefinedAttribute(x, FNameAttribute.CLASS_TYPE) ? FReflectionUtility.GetAttributeProperty <string>(x, FNameAttribute.CLASS_TYPE, nameof(FNameAttribute.Name)) : x.FullName).ToArray(); } }
private void OnEnable() { _scriptableObjectTypes = FReflectionUtility.GetSubTypesOf <SScriptableObject>().Where(x => FReflectionUtility.HasDefinedAttribute(x, FScriptableObjectWizardAttribute.CLASS_TYPE)).ToArray(); _scriptableObjectNames = _scriptableObjectTypes.Select(x => FReflectionUtility.GetAttributeProperty <string>(x, FScriptableObjectWizardAttribute.CLASS_TYPE, nameof(FScriptableObjectWizardAttribute.Name))).ToArray(); }