Example #1
0
        /// <inheritdoc/>
        protected override void DoBuildMembers()
        {
                        #if DEV_MODE && DEBUG_BUILD_MEMBERS
            Debug.Log(Msg(ToString(), ".DoBuildMembers with hasResult=", hasResult, ", hasParameters=", hasParameters, ", isGeneric=", isGeneric));
                        #endif

            if (!hasResult && !hasParameters && !isGeneric)
            {
                DrawerArrayPool.Resize(ref members, 0);
            }
            else
            {
                int size = 0;
                if (hasResult)
                {
                    size++;
                }
                if (isGeneric)
                {
                    size++;
                }
                if (hasParameters)
                {
                    size++;
                }
                DrawerArrayPool.Resize(ref members, size);

                bool readOnly = ReadOnly;

                int index = 0;
                if (isGeneric)
                {
                    members[0] = GenericsDrawer.Create(memberInfo, this, GUIContentPool.Create("Generics"), readOnly);
                    index++;
                }

                if (hasParameters)
                {
                    members[index] = ParameterDrawer.Create(MethodInfo.GetParameters(), memberInfo, this, GUIContentPool.Create("Parameters"), readOnly);
                    index++;
                }

                if (hasResult)
                {
                    string tooltip = LinkedMemberInfo.TooltipDatabase.GetTooltipFromParent(MethodInfo.ReturnParameter, memberInfo, "Returns");
                    if (tooltip.Length == 0)
                    {
                        tooltip = "Value returned by method.";
                    }

                    var resultMemberInfo = resultMemberHierarchy.Get(null, typeof(MethodDrawer).GetField("result", BindingFlags.Instance | BindingFlags.NonPublic), LinkedMemberParent.ClassInstance, null);
                    members[index] = DrawerProvider.GetForField(result, Type, resultMemberInfo, this, GUIContentPool.Create("Result", tooltip), readOnly);
                }
            }
        }
Example #2
0
        /// <inheritdoc/>
        protected override void DoBuildMembers()
        {
            if (!hasResult && !hasParameters)
            {
                DrawerArrayPool.Resize(ref members, 0);
            }
            else
            {
                if (hasResult)
                {
                    ResultDrawer = DrawerProvider.GetForField(base.Value, Type, memberInfo, this, GUIContentPool.Create("Value"), ReadOnly);
                }

                if (hasParameters)
                {
                    IndexParameterDrawer = ParameterDrawer.Create(PropertyInfo.GetIndexParameters(), memberInfo, this, GUIContentPool.Create("Parameters"), false);
                }
            }
        }