FairyGUI.FieldTypes.ParseProgressTitleType C# (CSharp) Method

ParseProgressTitleType() public static method

public static ParseProgressTitleType ( string value ) : ProgressTitleType
value string
return ProgressTitleType
        public static ProgressTitleType ParseProgressTitleType(string value)
        {
            switch (value)
            {
                case "percent":
                    return ProgressTitleType.Percent;
                case "valueAndmax":
                    return ProgressTitleType.ValueAndMax;
                case "value":
                    return ProgressTitleType.Value;
                case "max":
                    return ProgressTitleType.Max;
                default:
                    return ProgressTitleType.Percent;
            }
        }

Usage Example

示例#1
0
        override public void ConstructFromXML(XML cxml)
        {
            base.ConstructFromXML(cxml);

            XML xml = cxml.GetNode("Slider");

            string str;

            str = xml.GetAttribute("titleType");
            if (str != null)
            {
                _titleType = FieldTypes.ParseProgressTitleType(str);
            }
            else
            {
                _titleType = ProgressTitleType.Percent;
            }
            _reverse = xml.GetAttributeBool("reverse");

            _titleObject = GetChild("title") as GTextField;
            _barObjectH  = GetChild("bar");
            _barObjectV  = GetChild("bar_v");
            _gripObject  = GetChild("grip");

            if (_barObjectH != null)
            {
                _barMaxWidth      = _barObjectH.width;
                _barMaxWidthDelta = this.width - _barMaxWidth;
                _barStartX        = _barObjectH.x;
            }
            if (_barObjectV != null)
            {
                _barMaxHeight      = _barObjectV.height;
                _barMaxHeightDelta = this.height - _barMaxHeight;
                _barStartY         = _barObjectV.y;
            }

            if (_gripObject != null)
            {
                _gripObject.onTouchBegin.Add(__gripTouchBegin);
                _gripObject.onTouchMove.Add(__gripTouchMove);
                _gripObject.onTouchEnd.Add(__gripTouchEnd);
            }

            onTouchBegin.Add(__barTouchBegin);
        }
All Usage Examples Of FairyGUI.FieldTypes::ParseProgressTitleType