Example #1
0
        private void Setup(Type setGenericTypeDefinition, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
        {
                        #if DEV_MODE
            if (setReadOnly)
            {
                Debug.LogWarning(StringUtils.ToColorizedString(ToString(), ".Setup - readonly=", true, ". Really don't allow editing generic type argument? This is usually desired even for read-only properties."));
            }
                        #endif

            genericTypeDefinition = setGenericTypeDefinition;

            var genericTypeArguments = genericTypeDefinition.GetGenericArguments();
            drawInSingleRow = genericTypeArguments.Length == 1;

            if (setLabel == null)
            {
                setLabel = GUIContentPool.Create("Arguments", "Type arguments for the generic type definition.");
            }

            int count    = genericTypeArguments.Length;
            var setValue = ArrayPool <Type> .Create(count);

            for (int n = count - 1; n >= 0; n--)
            {
                setValue[n] = GenericArgumentValues.GetValue(setGenericTypeDefinition, n);
            }

            // always set readonly to false to fix issue where
            // parameters of read-only indexer Properties could not be modified
            base.Setup(setValue, typeof(Type[]), setMemberInfo, setParent, setLabel, setReadOnly);
        }
 public override void SetValue(ref object fieldOwner, object value)
 {
     GenericArgumentValues.CacheValue(genericTypeArgument, argumentIndex, (Type)value);
 }
 public override void GetValue(object fieldOwner, out object result)
 {
     result = GenericArgumentValues.GetValue(genericTypeArgument, argumentIndex);
 }