ParseEaseType() public static method

public static ParseEaseType ( string value ) : Ease
value string
return Ease
示例#1
0
        public void Setup(XML xml)
        {
            this.name = xml.GetAttribute("name");
            _options  = xml.GetAttributeInt("options");
            XMLList col = xml.Elements("item");

            foreach (XML cxml in col)
            {
                TransitionItem item = new TransitionItem();
                _items.Add(item);

                item.time     = (float)cxml.GetAttributeInt("time") / (float)FRAME_RATE;
                item.targetId = cxml.GetAttribute("target", string.Empty);
                item.type     = FieldTypes.ParseTransitionActionType(cxml.GetAttribute("type"));
                item.tween    = cxml.GetAttributeBool("tween");
                item.label    = cxml.GetAttribute("label");
                if (item.tween)
                {
                    item.duration = (float)cxml.GetAttributeInt("duration") / FRAME_RATE;

                    string ease = cxml.GetAttribute("ease");
                    if (ease != null)
                    {
                        item.easeType = FieldTypes.ParseEaseType(ease);
                    }

                    item.repeat = cxml.GetAttributeInt("repeat");
                    item.yoyo   = cxml.GetAttributeBool("yoyo");
                    item.label2 = cxml.GetAttribute("label2");

                    string v = cxml.GetAttribute("endValue");
                    if (v != null)
                    {
                        DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.startValue);
                        DecodeValue(item.type, v, item.endValue);
                    }
                    else
                    {
                        item.tween = false;
                        DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.value);
                    }
                }
                else
                {
                    DecodeValue(item.type, cxml.GetAttribute("value", string.Empty), item.value);
                }
            }
        }
示例#2
0
        public void Setup(XML xml)
        {
            this.name     = xml.GetAttribute("name");
            _options      = xml.GetAttributeInt("options");
            this.autoPlay = xml.GetAttributeBool("autoPlay");
            if (this.autoPlay)
            {
                this.autoPlayRepeat = xml.GetAttributeInt("autoPlayRepeat", 1);
                this.autoPlayDelay  = xml.GetAttributeFloat("autoPlayDelay");
            }

            XMLList.Enumerator et = xml.GetEnumerator("item");
            while (et.MoveNext())
            {
                XML            cxml = et.Current;
                TransitionItem item = new TransitionItem();
                _items.Add(item);

                item.time     = (float)cxml.GetAttributeInt("time") / (float)FRAME_RATE;
                item.targetId = cxml.GetAttribute("target", string.Empty);
                item.type     = FieldTypes.ParseTransitionActionType(cxml.GetAttribute("type"));
                item.tween    = cxml.GetAttributeBool("tween");
                item.label    = cxml.GetAttribute("label");
                if (item.tween)
                {
                    item.duration = (float)cxml.GetAttributeInt("duration") / FRAME_RATE;
                    if (item.time + item.duration > _maxTime)
                    {
                        _maxTime = item.time + item.duration;
                    }

                    string ease = cxml.GetAttribute("ease");
                    if (ease != null)
                    {
                        item.easeType = FieldTypes.ParseEaseType(ease);
                    }

                    item.repeat = cxml.GetAttributeInt("repeat");
                    item.yoyo   = cxml.GetAttributeBool("yoyo");
                    item.label2 = cxml.GetAttribute("label2");

                    string v = cxml.GetAttribute("endValue");
                    if (v != null)
                    {
                        DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.startValue);
                        DecodeValue(item.type, v, item.endValue);
                    }
                    else
                    {
                        item.tween = false;
                        DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.value);
                    }
                }
                else
                {
                    if (item.time > _maxTime)
                    {
                        _maxTime = item.time;
                    }
                    DecodeValue(item.type, cxml.GetAttribute("value", string.Empty), item.value);
                }
            }
        }
示例#3
0
        public void Setup(XML xml)
        {
            string str;

            _controller = _owner.parent.GetController(xml.GetAttribute("controller"));
            if (_controller == null)
            {
                return;
            }

            Init();

            string[] pages = xml.GetAttributeArray("pages");
            if (pages != null)
            {
                foreach (string s in pages)
                {
                    pageSet.AddById(s);
                }
            }

            str = xml.GetAttribute("tween");
            if (str != null)
            {
                tween = true;
            }

            str = xml.GetAttribute("ease");
            if (str != null)
            {
                easeType = FieldTypes.ParseEaseType(str);
            }

            str = xml.GetAttribute("duration");
            if (str != null)
            {
                tweenTime = float.Parse(str);
            }

            str = xml.GetAttribute("delay");
            if (str != null)
            {
                delay = float.Parse(str);
            }

            str = xml.GetAttribute("values");
            string[] values = null;
            if (str != null)
            {
                values = str.Split(jointChar1);
            }

            if (pages != null && values != null)
            {
                for (int i = 0; i < values.Length; i++)
                {
                    str = values[i];
                    if (str != "-")
                    {
                        AddStatus(pages[i], str);
                    }
                }
            }
            str = xml.GetAttribute("default");
            if (str != null)
            {
                AddStatus(null, str);
            }
        }
        public void Setup(XML xml)
        {
            string str;

            _controller = _owner.parent.GetController(xml.GetAttribute("controller"));
            if (_controller == null)
            {
                return;
            }

            Init();

            str = xml.GetAttribute("tween");
            if (str != null)
            {
                tween = true;
            }

            str = xml.GetAttribute("ease");
            if (str != null)
            {
                easeType = FieldTypes.ParseEaseType(str);
            }

            str = xml.GetAttribute("duration");
            if (str != null)
            {
                tweenTime = float.Parse(str);
            }

            str = xml.GetAttribute("delay");
            if (str != null)
            {
                delay = float.Parse(str);
            }

            if (this is GearDisplay)
            {
                string[] pages = xml.GetAttributeArray("pages");
                if (pages != null)
                {
                    ((GearDisplay)this).pages = pages;
                }
            }
            else
            {
                string[] pages  = xml.GetAttributeArray("pages");
                string[] values = xml.GetAttributeArray("values", '|');

                if (pages != null)
                {
                    int cnt1 = pages.Length;
                    int cnt2 = values != null ? values.Length : 0;
                    for (int i = 0; i < cnt1; i++)
                    {
                        if (i < cnt2)
                        {
                            str = values[i];
                        }
                        else
                        {
                            str = string.Empty;
                        }
                        AddStatus(pages[i], str);
                    }
                }
                str = xml.GetAttribute("default");
                if (str != null)
                {
                    AddStatus(null, str);
                }
            }
        }