public static string GetFriendlyName(Type t)
        {
            if (t == null)
            {
                return("");
            }
            if (t.get_IsArray())
            {
                return(TypeHelpers.GetFriendlyName(t.GetElementType()) + "[]");
            }
            string result;

            if (!TypeHelpers.friendlyNames.TryGetValue(t, ref result))
            {
                return(t.get_Name());
            }
            return(result);
        }
        public static string GetMethodSignature(MethodInfo method)
        {
            string text = TypeHelpers.GetFriendlyName(method.get_ReturnType()) + " " + method.get_Name() + " (";
            bool   flag = true;

            ParameterInfo[] parameters = method.GetParameters();
            ParameterInfo[] array      = parameters;
            for (int i = 0; i < array.Length; i++)
            {
                ParameterInfo parameterInfo = array[i];
                if (!flag)
                {
                    text += ", ";
                }
                text += TypeHelpers.GetFriendlyName(parameterInfo.get_ParameterType());
                flag  = false;
            }
            return(text + ")");
        }
        public static string GetMethodSignature(string methodName, SkillVar[] parameters, SkillVar result)
        {
            if (parameters == null || result == null)
            {
                return("");
            }
            Type   t    = result.get_RealType() ?? typeof(void);
            string text = TypeHelpers.GetFriendlyName(t) + " " + methodName + " (";
            bool   flag = true;

            for (int i = 0; i < parameters.Length; i++)
            {
                SkillVar fsmVar = parameters[i];
                if (!flag)
                {
                    text += ", ";
                }
                text += TypeHelpers.GetFriendlyName(fsmVar.get_RealType());
                flag  = false;
            }
            return(text + ")");
        }
Exemple #4
0
        public static string GetTypeTooltip(Type type)
        {
            if (type == null)
            {
                return("");
            }
            string text;

            if (Labels.typeTooltips.TryGetValue(type, ref text))
            {
                return(text);
            }
            text = "Type: ";
            if (type == typeof(SkillOwnerDefault))
            {
                text += "GameObject";
            }
            else
            {
                if (type == typeof(SkillEvent))
                {
                    text += "FsmEvent";
                }
                else
                {
                    if (type == typeof(SkillVar))
                    {
                        text += "FsmVar";
                    }
                    else
                    {
                        if (type == typeof(SkillArray))
                        {
                            text += "Array";
                        }
                        else
                        {
                            if (type.IsSubclassOf(typeof(NamedVariable)))
                            {
                                PropertyInfo property = type.GetProperty("Value");
                                if (property != null)
                                {
                                    text += Labels.StripUnityEngineNamespace(TypeHelpers.GetFriendlyName(property.get_PropertyType()));
                                }
                                else
                                {
                                    text += "Unknown";
                                }
                            }
                            else
                            {
                                if (type.get_IsArray())
                                {
                                    text = Labels.GetTypeTooltip(type.GetElementType()) + " Array";
                                }
                                else
                                {
                                    text += TypeHelpers.GetFriendlyName(type);
                                }
                            }
                        }
                    }
                }
            }
            Labels.typeTooltips.Add(type, Labels.NicifyTypeTooltip(text));
            return(text);
        }