private Type[] GetInterfaceTypes(SerializedProperty property) { InterfaceAttribute att = (InterfaceAttribute)attribute; Type[] t = att.Types; if (!String.IsNullOrEmpty(att.TypeFromFieldName)) { var thisType = property.serializedObject.targetObject.GetType(); while (thisType != null) { var referredFieldInfo = thisType.GetField(att.TypeFromFieldName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (referredFieldInfo != null) { t = new Type[1] { referredFieldInfo.FieldType }; break; } thisType = thisType.BaseType; } } return(t ?? singleMonoBehaviourType); }
public static string GetInterfaceName(this PropertyInfo thisProperty) { InterfaceAttribute thisInterface = thisProperty.GetAttribute <InterfaceAttribute>() !; if (thisInterface != null) { return(thisInterface.InterfaceName); } return(""); }
public MetadataNamedInterface( InterfaceAttribute attribute, SourceSymbolContext sourceSymbolContext, DiagnosticBag diagnostics) : base(diagnostics) { _anonymousSourceInterface = new SourceAnonymousInterface( Utils.Parse( attribute.AnonymousInterfaceDeclaration, p => p.anonymous_interface_declaration_metadata().anonymous_interface_declaration(), _diagnostics), sourceSymbolContext.WithTypeParameters(() => TypeParameters), true, _diagnostics); _attribute = attribute; _sourceSymbolContext = sourceSymbolContext; FullyQualifiedName = QualifiedName.Parse(attribute.FullyQualifiedName); _typeParameters = new Lazy <ImmutableArray <ITypeParameter> >(GenerateTypeParameters); }