GetColor() public method

public GetColor ( string attrName, Color defValue ) : Color
attrName string
defValue UnityEngine.Color
return UnityEngine.Color
Example #1
0
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner   = owner;
            _element = element;

            string type = element.GetString("type");

            if (type != null)
            {
                type = type.ToLower();
            }

            _hidden = type == "hidden";
            if (!_hidden)
            {
                int   width           = element.GetInt("width", 0);
                int   height          = element.GetInt("height", 0);
                int   borderSize      = element.GetInt("border", defaultBorderSize);
                Color borderColor     = element.GetColor("border-color", defaultBorderColor);
                Color backgroundColor = element.GetColor("background-color", defaultBackgroundColor);

                if (width == 0)
                {
                    width = element.space;
                    if (width > _owner.width / 2 || width < 100)
                    {
                        width = (int)_owner.width / 2;
                    }
                }
                if (height == 0)
                {
                    height = element.format.size + 10;
                }

                textInput.textFormat        = element.format;
                textInput.displayAsPassword = type == "password";
                textInput.maxLength         = element.GetInt("maxlength", int.MaxValue);
                textInput.border            = borderSize;
                textInput.borderColor       = borderColor;
                textInput.backgroundColor   = backgroundColor;
                textInput.SetSize(width, height);
            }
            textInput.text = element.GetString("value");
        }
Example #2
0
 static public int GetColor(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlElement self = (FairyGUI.Utils.HtmlElement)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         UnityEngine.Color a2;
         checkType(l, 3, out a2);
         var ret = self.GetColor(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #3
0
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner   = owner;
            _element = element;

            string type = element.GetString("type");

            if (type != null)
            {
                type = type.ToLower();
            }

            _hidden = type == "hidden";
            if (!_hidden)
            {
                int width  = element.GetInt("width", 0);
                int height = element.GetInt("height", 0);
                _borderSize = element.GetInt("border", defaultBorderSize);
                Color borderColor = element.GetColor("border-color", defaultBorderColor);

                if (width == 0)
                {
                    width = element.space - _borderSize * 2;
                    if (width > _owner.width / 2 || width < 100)
                    {
                        width = (int)_owner.width / 2;
                    }
                }
                if (height == 0)
                {
                    height = element.format.size + 10 + _borderSize * 2;
                }

                textInput.textFormat        = element.format;
                textInput.displayAsPassword = type == "password";
                textInput.SetSize(width - _borderSize * 2, height - _borderSize * 2);
                textInput.maxLength = element.GetInt("maxlength", int.MaxValue);
                _border.size        = new Vector2(width, height);
                _border.DrawRect(_borderSize, borderColor, new Color(0, 0, 0, 0));
            }
            textInput.text = element.GetString("value");
        }
Example #4
0
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner = owner;
            _element = element;

            string type = element.GetString("type");
            if (type != null)
                type = type.ToLower();

            _hidden = type == "hidden";
            if (!_hidden)
            {
                int width = element.GetInt("width", 0);
                int height = element.GetInt("height", 0);
                _borderSize = element.GetInt("border", defaultBorderSize);
                Color borderColor = element.GetColor("border-color", defaultBorderColor);

                if (width == 0)
                {
                    width = element.space;
                    if (width > _owner.width / 2 || width < 100)
                        width = (int)_owner.width / 2;
                }
                if (height == 0)
                    height = element.format.size + 10 + _borderSize * 2;

                textInput.textFormat = element.format;
                textInput.displayAsPassword = type == "password";
                textInput.SetSize(width - _borderSize * 2, height - _borderSize * 2);
                textInput.maxLength = element.GetInt("maxlength", int.MaxValue);

                _border.SetXY(-_borderSize, -_borderSize);
                _border.SetSize(width, height);
                _border.DrawRect(_borderSize, borderColor, new Color(0, 0, 0, 0));
            }
            textInput.text = element.GetString("value");
        }