/// <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="keyType"> The type of the keys in the dictionary. </param>
        /// <param name="valueType"> The type of the values in the dictionary. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </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 control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static DictionaryEntryDrawer Create(DictionaryEntry value, Type keyType, Type valueType, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly, Func <int, object[], bool> validateKey)
        {
            DictionaryEntryDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new DictionaryEntryDrawer();
            }
            result.Setup(value, DrawerUtility.GetType(memberInfo, value), keyType, valueType, memberInfo, parent, label, readOnly, validateKey);
            result.LateSetup();
            return(result);
        }
示例#2
0
 /// <inheritdoc/>
 protected override IDrawer CreateMemberDrawer(object value, Type memberType, LinkedMemberInfo memberFieldInfo, GUIContent memberLabel)
 {
     return(DictionaryEntryDrawer.Create((DictionaryEntry)value, keyType, valueType, memberFieldInfo, this, memberLabel, ReadOnly || IsReadOnlyCollection, ValidateExistingKey));
 }