internal override void SetWidget(DebugUI.Widget widget)
        {
            base.SetWidget(widget);
            m_Field        = CastWidget <DebugUI.BitField>();
            m_Container    = GetComponent <DebugUIHandlerContainer>();
            nameLabel.text = m_Field.displayName;

            int toggleIndex = 0;

            foreach (var enumName in m_Field.enumNames)
            {
                if (toggleIndex >= toggles.Count)
                {
                    continue;
                }

                var toggle = toggles[toggleIndex];
                toggle.getter            = GetValue;
                toggle.setter            = SetValue;
                toggle.nextUIHandler     = toggleIndex < (m_Field.enumNames.Length - 1) ? toggles[toggleIndex + 1] : null;
                toggle.previousUIHandler = toggleIndex > 0 ? toggles[toggleIndex - 1] : null;
                toggle.parentUIHandler   = this;
                toggle.index             = toggleIndex;
                toggle.nameLabel.text    = enumName.text;
                toggle.Init();
                toggleIndex++;
            }
            ;

            for (; toggleIndex < toggles.Count; ++toggleIndex)
            {
                toggles[toggleIndex].transform.SetParent(null);
            }
        }
示例#2
0
        internal override void SetWidget(DebugUI.Widget widget)
        {
            base.SetWidget(widget);
            m_Field        = CastWidget <DebugUI.Vector4Field>();
            m_Container    = GetComponent <DebugUIHandlerContainer>();
            nameLabel.text = m_Field.displayName;

            fieldX.getter        = () => m_Field.GetValue().x;
            fieldX.setter        = x => SetValue(x, x: true);
            fieldX.nextUIHandler = fieldY;
            SetupSettings(fieldX);

            fieldY.getter            = () => m_Field.GetValue().y;
            fieldY.setter            = x => SetValue(x, y: true);
            fieldY.previousUIHandler = fieldX;
            fieldY.nextUIHandler     = fieldZ;
            SetupSettings(fieldY);

            fieldZ.getter            = () => m_Field.GetValue().z;
            fieldZ.setter            = x => SetValue(x, z: true);
            fieldZ.previousUIHandler = fieldY;
            fieldZ.nextUIHandler     = fieldW;
            SetupSettings(fieldZ);

            fieldW.getter            = () => m_Field.GetValue().w;
            fieldW.setter            = x => SetValue(x, w: true);
            fieldW.previousUIHandler = fieldZ;
            SetupSettings(fieldW);
        }
        internal override void SetWidget(DebugUI.Widget widget)
        {
            base.SetWidget(widget);
            m_Field        = CastWidget <DebugUI.ColorField>();
            m_Container    = GetComponent <DebugUIHandlerContainer>();
            nameLabel.text = m_Field.displayName;

            fieldR.getter        = () => m_Field.GetValue().r;
            fieldR.setter        = x => SetValue(x, r: true);
            fieldR.nextUIHandler = fieldG;
            SetupSettings(fieldR);

            fieldG.getter            = () => m_Field.GetValue().g;
            fieldG.setter            = x => SetValue(x, g: true);
            fieldG.previousUIHandler = fieldR;
            fieldG.nextUIHandler     = fieldB;
            SetupSettings(fieldG);

            fieldB.getter            = () => m_Field.GetValue().b;
            fieldB.setter            = x => SetValue(x, b: true);
            fieldB.previousUIHandler = fieldG;
            fieldB.nextUIHandler     = m_Field.showAlpha ? fieldA : null;
            SetupSettings(fieldB);

            fieldA.gameObject.SetActive(m_Field.showAlpha);
            fieldA.getter            = () => m_Field.GetValue().a;
            fieldA.setter            = x => SetValue(x, a: true);
            fieldA.previousUIHandler = fieldB;
            SetupSettings(fieldA);

            UpdateColor();
        }
        internal override void SetWidget(DebugUI.Widget widget)
        {
            base.SetWidget(widget);
            m_Field        = CastWidget <DebugUI.Foldout>();
            m_Container    = GetComponent <DebugUIHandlerContainer>();
            nameLabel.text = m_Field.displayName;

            int columnNumber = m_Field.columnLabels?.Length ?? 0;

            for (int index = 0; index < columnNumber; ++index)
            {
                var column = Instantiate(nameLabel.gameObject, GetComponent <DebugUIHandlerContainer>().contentHolder);
                column.AddComponent <LayoutElement>().ignoreLayout = true;
                var rectTransform     = column.transform as RectTransform;
                var originalTransform = nameLabel.transform as RectTransform;
                rectTransform.anchorMax = rectTransform.anchorMin = new Vector2(0, 1);
                rectTransform.sizeDelta = new Vector2(100, 26);
                Vector3 pos = originalTransform.anchoredPosition;
                pos.x += (index + 1) * xDecal + xDecalInit;
                rectTransform.anchoredPosition = pos;
                rectTransform.pivot            = new Vector2(0, 0.5f);
                rectTransform.eulerAngles      = new Vector3(0, 0, 13);
                var text = column.GetComponent <Text>();
                text.fontSize = 15;
                text.text     = m_Field.columnLabels[index];
            }

            UpdateValue();
        }
示例#5
0
        internal override void SetWidget(DebugUI.Widget widget)
        {
            base.SetWidget(widget);
            m_Field        = CastWidget <DebugUI.BitField>();
            m_Container    = GetComponent <DebugUIHandlerContainer>();
            nameLabel.text = m_Field.displayName;

            int toggleIndex = 0;

            foreach (var enumName in m_Field.enumNames)
            {
                if (toggleIndex >= toggles.Count)
                {
                    continue;
                }

                var toggle = toggles[toggleIndex];
                toggle.getter            = GetValue;
                toggle.setter            = SetValue;
                toggle.nextUIHandler     = toggleIndex < (m_Field.enumNames.Length - 1) ? toggles[toggleIndex + 1] : null;
                toggle.previousUIHandler = toggleIndex > 0 ? toggles[toggleIndex - 1] : null;
                toggle.parentUIHandler   = this;
                toggle.index             = toggleIndex;
                toggle.nameLabel.text    = enumName.text;
                toggle.Init();
                toggleIndex++;
            }

            // Destroy the remaining toggles outside of the range of the displayed enum.
            for (; toggleIndex < toggles.Count; ++toggleIndex)
            {
                CoreUtils.Destroy(toggles[toggleIndex].gameObject);
                toggles[toggleIndex] = null;
            }
        }
        internal override void SetWidget(DebugUI.Widget widget)
        {
            base.SetWidget(widget);
            m_Field     = CastWidget <DebugUI.Container>();
            m_Container = GetComponent <DebugUIHandlerContainer>();

            if (string.IsNullOrEmpty(m_Field.displayName))
            {
                header.gameObject.SetActive(false);
            }
            else
            {
                nameLabel.text = m_Field.displayName;
            }
        }