コード例 #1
0
        /// <summary>
        /// Adds new unsigned signed integer (up to ulong range) value element.
        /// </summary>
        /// <returns>The created element.</returns>
        public UnsignedIntegerValueElement UnsignedIntegerValue()
        {
            var element = new UnsignedIntegerValueElement();

            OnAddElement(element);
            return(element);
        }
コード例 #2
0
        /// <inheritdoc />
        public override void Initialize(LayoutElementsContainer layout)
        {
            _element = null;

            GetLimits(out var min, out var max);

            // Try get limit attribute for value min/max range setting and slider speed
            var attributes = Values.GetAttributes();

            if (attributes != null)
            {
                var limit = attributes.FirstOrDefault(x => x is LimitAttribute);
                if (limit != null)
                {
                    // Use int value editor with limit
                    var element = layout.UnsignedIntegerValue();
                    element.ULongValue.SetLimits((LimitAttribute)limit);
                    element.ULongValue.SetLimits(Mathf.Max(element.ULongValue.MinValue, min), Mathf.Min(element.ULongValue.MaxValue, max));
                    element.ULongValue.ValueChanged += OnValueChanged;
                    element.ULongValue.SlidingEnd   += ClearToken;
                    _element = element;
                    return;
                }
            }
            if (_element == null)
            {
                // Use int value editor
                var element = layout.UnsignedIntegerValue();
                element.ULongValue.SetLimits(Mathf.Max(element.ULongValue.MinValue, min), Mathf.Min(element.ULongValue.MaxValue, max));
                element.ULongValue.ValueChanged += OnValueChanged;
                element.ULongValue.SlidingEnd   += ClearToken;
                _element = element;
            }
        }