/// <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); } } }
/// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary> /// <param name="parameterInfos"> ParameterInfos that the created drawers represents. </param> /// <param name="methodOrPropertyInfo"> LinkedMemberInfo that represents the property or method that the parameters belong to. </param> /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param> /// <param name="label"> The prefix label. </param> /// <param name="readOnly"> True if drawer should be read only. </param> /// <returns> The drawer instance, ready to be used. </returns> public static ParameterDrawer Create(ParameterInfo[] parameterInfos, LinkedMemberInfo methodOrPropertyInfo, IParentDrawer parent, GUIContent label, bool readOnly) { ParameterDrawer result; if (!DrawerPool.TryGet(out result)) { result = new ParameterDrawer(); } result.Setup(parameterInfos, methodOrPropertyInfo, parent, label, readOnly); result.LateSetup(); return(result); }
/// <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); } } }