private static string GetParameterTypeFullName(ParameterInfo parameterInfo)
        {
            bool isArray     = parameterInfo.ParameterType.IsArray;
            Type elementType = isArray ? parameterInfo.ParameterType.GetElementType() : parameterInfo.ParameterType;
            OriginalNameAttribute originalTypeName = elementType.GetCustomAttribute <OriginalNameAttribute>();

            if (originalTypeName == null)
            {
                return(parameterInfo.ParameterType.FullName);
            }

            string name = originalTypeName.OriginalName;

            if (isArray)
            {
                name += "[]";
            }

            return(name);
        }
Beispiel #2
0
        static UnityClassesDataProvider()
        {
            foreach (Type unityType in _unityTypes)
            {
                OriginalNameAttribute originalNameAttribute = unityType.GetCustomAttribute <OriginalNameAttribute>();
                string originalTypeName = originalNameAttribute.OriginalName;

                MethodInfo[] methods = GetInterfaceMethodsDeep(unityType);
                Dictionary <string, UnityMessageMethodInfoData> methodsMap = new Dictionary <string, UnityMessageMethodInfoData>(methods.Length);
                foreach (MethodInfo methodInfo in methods)
                {
                    DocumentationNameAttribute   documentationNameAttribute   = methodInfo.GetCustomAttribute <DocumentationNameAttribute>();
                    DescriptionAttribute         descriptionAttribute         = methodInfo.GetCustomAttribute <DescriptionAttribute>();
                    MinimalUnityVersionAttribute minimalUnityVersionAttribute = methodInfo.GetCustomAttribute <MinimalUnityVersionAttribute>();
                    IsStaticAttribute            isStaticAttribute            = methodInfo.GetCustomAttribute <IsStaticAttribute>();

                    string  description    = descriptionAttribute?.Description;
                    Version minimalVersion = minimalUnityVersionAttribute?.MinimalVersion;
                    bool    isStatic       = isStaticAttribute != null;

                    if (methodsMap.ContainsKey(methodInfo.Name))
                    {
                        continue;
                    }

                    methodsMap.Add(
                        methodInfo.Name,
                        new UnityMessageMethodInfoData(
                            methodInfo,
                            isStatic,
                            originalTypeName,
                            description,
                            documentationNameAttribute.FileName,
                            minimalVersion
                            )
                        );
                }

                _unityClassesMessageMethods.Add(originalTypeName, methodsMap);
            }
        }