Ejemplo n.º 1
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The starting cached value of the drawer. </param>
        /// <param name="methodInfo"> LinkedMemberInfo of the method that the drawer represent. If represents an anonymous method, leave null. </param>
        /// <param name="parent"> The parent drawer of this member. Can be null. </param>
        /// <param name="label"> The label. </param>
        /// <param name="setReadOnly"> True if control should be read only. </param>
        /// <returns> The newly-created instance. </returns>
        public static DelegateDrawer Create([CanBeNull] MulticastDelegate value, [CanBeNull] LinkedMemberInfo methodInfo, IParentDrawer parent, GUIContent label, bool setReadOnly)
        {
            DelegateDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new DelegateDrawer();
            }
            result.Setup(value, DrawerUtility.GetType(methodInfo, value), methodInfo, parent, label, setReadOnly);
            result.LateSetup();
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The starting cached value of the drawer. </param>
        /// <param name="methodInfo"> LinkedMemberInfo of the method that the drawer represent. If represents an anonymous method, leave null. </param>
        /// <param name="parent"> The parent drawer of this member. Can be null. </param>
        /// <param name="label"> The label. </param>
        /// <param name="setReadOnly"> True if control should be read only. </param>
        /// <returns> The newly-created instance. </returns>
        public static DelegateDrawer Create([CanBeNull] MulticastDelegate value, [CanBeNull] LinkedMemberInfo methodInfo, Type delegateType, IParentDrawer parent, GUIContent label, bool setReadOnly)
        {
            DelegateDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new DelegateDrawer();
            }

                        #if DEV_MODE
            if (delegateType != null)
            {
                Debug.Assert(delegateType != typeof(Delegate), delegateType.FullName + " not supported by DelegateDrawer. Should use AnyDelegateDrawer instead.");
                Debug.Assert(delegateType != typeof(MulticastDelegate), delegateType.FullName + " not supported by DelegateDrawer. Should use AnyDelegateDrawer instead.");
            }
                        #endif

            result.Setup(value, delegateType, methodInfo, parent, label, setReadOnly);
            result.LateSetup();
            return(result);
        }
Ejemplo n.º 3
0
 /// <inheritdoc />
 protected override IDrawer BuildDrawerForValue(Type setType, object setValue, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
 {
     return(DelegateDrawer.Create((MulticastDelegate)setValue, setMemberInfo, setType, setParent, setLabel, setReadOnly));
 }