コード例 #1
0
        public override void ApplyAttributes(AttributeDictionary attributesToApply)
        {
            // this should never happen, but just in case
            if (TextMeshProDropdownTagHandler.CurrentHandler == null)
            {
                return;
            }

            attributesToApply.AddIfKeyNotExists("alignment", "Left");
            attributesToApply.AddIfKeyNotExists("dontMatchParentDimensions", "true");

            var dropdown = TextMeshProDropdownTagHandler.CurrentHandler.CurrentDropdown;

            var TMPHandler = XmlLayoutUtilities.GetXmlTagHandler("TextMeshPro");

            TMPHandler.SetInstance(dropdown.itemText.rectTransform, currentXmlLayoutInstance);
            TMPHandler.ApplyAttributes(attributesToApply);

            if (attributesToApply.ContainsKey("padding"))
            {
                var padding = attributesToApply["padding"].ToRectOffset();
                dropdown.itemText.rectTransform.offsetMin = new Vector2(padding.left, padding.bottom);
                dropdown.itemText.rectTransform.offsetMax = new Vector2(-padding.right, -padding.top);
            }

            var xmlElement = dropdown.itemText.GetComponent <XmlElement>();

            //xmlElement.attributes = xmlElement.attributes.Merge(attributesToApply);
            xmlElement.attributes.Merge(attributesToApply);
        }
コード例 #2
0
        public override void ApplyAttributes(AttributeDictionary attributesToApply)
        {
            // this should never happen, but just in case
            if (TextMeshProDropdownTagHandler.CurrentHandler == null)
            {
                return;
            }

            attributesToApply.AddIfKeyNotExists("alignment", "Left");
            attributesToApply.AddIfKeyNotExists("dontMatchParentDimensions", "true");

            var dropdown = TextMeshProDropdownTagHandler.CurrentHandler.CurrentDropdown;

            var TMPHandler = XmlLayoutUtilities.GetXmlTagHandler("TextMeshPro");

            TMPHandler.SetInstance(dropdown.itemText.rectTransform, currentXmlLayoutInstance);
            TMPHandler.ApplyAttributes(attributesToApply);
        }