/// <inheritdoc /> protected override void DoBuildMembers() { #if DEV_MODE && DEBUG_BUILD_MEMBERS Debug.Log(ToString() + ".DoBuildMembers called with invocationList " + StringUtils.ToString(invocationList)); #endif int count = invocationList.Length; if (count == 0) { DrawerArrayPool.Resize(ref members, 1); members[0] = NullToggleDrawer.Create(AddNewItemToInvocationList, InspectorPreferences.Styles.AddButton, this, ReadOnly); } else { DrawerArrayPool.Resize(ref members, count); var type = Type; for (int n = count - 1; n >= 0; n--) { var invocationMember = invocationList[n]; members[n] = DelegateItemDrawer.Create(invocationMember, type, this, GUIContentPool.Create("Delegate #" + StringUtils.ToString(n + 1)), ReadOnly); members[n].OnKeyboardInputBeingGiven += OnMemberKeyboardInputBeingGiven; } } }
/// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary> /// <param name="value"> The initial cached value of the drawer. </param> /// <param name="type"> Type of the delegate. Can not be null. </param> /// <param name="parent"> The parent drawers of this member. Can be null. </param> /// <param name="label"> The label. </param> /// <param name="setReadOnly"> True if drawer should be read only. </param> /// <returns> The newly-created instance. </returns> public static DelegateItemDrawer Create(Delegate value, [NotNull] Type type, [CanBeNull] IParentDrawer parent, [CanBeNull] GUIContent label, bool setReadOnly) { DelegateItemDrawer result; if (!DrawerPool.TryGet(out result)) { result = new DelegateItemDrawer(); } result.Setup(value, type, null, parent, label, setReadOnly); result.LateSetup(); return(result); }