コード例 #1
0
        /// <inheritdoc />
        protected override IDrawer BuildResizeField()
        {
            var resizerMemberInfo = ResizerMemberInfo;
            var resizer           = DelayedIntDrawer.Create(MixedSize ? 0 : elementCount, resizerMemberInfo, this, GUIContentPool.Create("Size"), ReadOnly || resizerMemberInfo == null);

            return(resizer);
        }
コード例 #2
0
        /// <inheritdoc />
        protected override void DoBuildMembers()
        {
            DrawerArrayPool.Resize(ref members, 2);

            // Making key be read-only for now until code has been added to handle on-the-fly changing of keys gracefully.
            // E.g. all keys should use delayed text fields and be marked with NotNull (e.g. using a custom DrawerProvider).
            var keyInfo = memberBuildList[0];

            IDrawer keyMember;
            var     keyValue = keyInfo.GetValue(0);
            var     keyLabel = GUIContentPool.Create("K");
            //var keyIsReadOnly = ReadOnly;
            const bool keyIsReadOnly = true;

            if (keyType == Types.Int)
            {
                keyMember = DelayedIntDrawer.Create((int)keyValue, keyInfo, this, keyLabel, keyIsReadOnly);
            }
            else if (keyType == Types.String)
            {
                keyMember = TextDrawer.Create((string)keyValue, keyInfo, this, keyLabel, keyIsReadOnly, false, true);
            }
            else if (keyType == Types.Float)
            {
                keyMember = DelayedFloatDrawer.Create((float)keyValue, keyInfo, this, keyLabel, keyIsReadOnly);
            }
            else
            {
                keyMember = DrawerProvider.GetForField(keyValue, keyType, keyInfo, this, keyLabel, keyIsReadOnly);
            }

            keyMember.OverrideValidateValue = ValidateKey;

            members[0] = keyMember;
            var valueInfo   = memberBuildList[1];
            var valueMember = DrawerProvider.GetForField(valueInfo.GetValue(0), valueType, valueInfo, this, GUIContentPool.Create("V"), ReadOnly);

            members[1] = valueMember;
        }