FairyGUI.FieldTypes.ParseAutoSizeType C# (CSharp) Method

ParseAutoSizeType() public static method

public static ParseAutoSizeType ( string value ) : AutoSizeType
value string
return AutoSizeType
        public static AutoSizeType ParseAutoSizeType(string value)
        {
            switch (value)
            {
                case "none":
                    return AutoSizeType.None;
                case "both":
                    return AutoSizeType.Both;
                case "height":
                    return AutoSizeType.Height;
                case "shrink":
                    return AutoSizeType.Shrink;
                default:
                    return AutoSizeType.None;
            }
        }

Usage Example

Example #1
0
        override public void Setup_BeforeAdd(XML xml)
        {
            base.Setup_BeforeAdd(xml);

            TextFormat tf = _textField.textFormat;

            string str;

            str = xml.GetAttribute("font");
            if (str != null)
            {
                tf.font = str;
            }

            str = xml.GetAttribute("fontSize");
            if (str != null)
            {
                tf.size = int.Parse(str);
            }

            str = xml.GetAttribute("color");
            if (str != null)
            {
                tf.color = ToolSet.ConvertFromHtmlColor(str);
            }

            str = xml.GetAttribute("align");
            if (str != null)
            {
                this.align = FieldTypes.ParseAlign(str);
            }

            str = xml.GetAttribute("vAlign");
            if (str != null)
            {
                this.verticalAlign = FieldTypes.ParseVerticalAlign(str);
            }

            str = xml.GetAttribute("leading");
            if (str != null)
            {
                tf.lineSpacing = int.Parse(str);
            }

            str = xml.GetAttribute("letterSpacing");
            if (str != null)
            {
                tf.letterSpacing = int.Parse(str);
            }

            _ubbEnabled = xml.GetAttributeBool("ubb", false);

            str = xml.GetAttribute("autoSize");
            if (str != null)
            {
                this.autoSize = FieldTypes.ParseAutoSizeType(str);
            }

            tf.underline    = xml.GetAttributeBool("underline", false);
            tf.italic       = xml.GetAttributeBool("italic", false);
            tf.bold         = xml.GetAttributeBool("bold", false);
            this.singleLine = xml.GetAttributeBool("singleLine", false);
            str             = xml.GetAttribute("strokeColor");
            if (str != null)
            {
                this.strokeColor = ToolSet.ConvertFromHtmlColor(str);
                this.stroke      = xml.GetAttributeInt("strokeSize", 1);
            }

            str = xml.GetAttribute("shadowColor");
            if (str != null)
            {
                this.strokeColor  = ToolSet.ConvertFromHtmlColor(str);
                this.shadowOffset = xml.GetAttributeVector("shadowOffset");
            }

            _textField.textFormat = tf;
        }
All Usage Examples Of FairyGUI.FieldTypes::ParseAutoSizeType