예제 #1
0
        protected override void InternalConstructFromXML(XML cxml)
        {
            XML xml = cxml.GetNode("Slider");

            bool reverse = xml.GetAttributeBool("reverse");

            Slider.Direction dir = Slider.Direction.LeftToRight;
            GObject          bar = this.GetChild("bar");

            if (bar == null)
            {
                bar = this.GetChild("bar_v");
                if (bar != null)
                {
                    dir = reverse
                                                ? Slider.Direction.BottomToTop
                                                : Slider.Direction.TopToBottom;
                }
            }
            else
            {
                if (reverse)
                {
                    dir = Slider.Direction.RightToLeft;
                }
            }
            this._content.titleObject = this.GetChild("title") as GTextField;
            this._content.barObject   = bar;
            this._content.aniObject   = this.GetChild("ani") as GMovieClip;
            this._content.gripObject  = this.GetChild("grip");
            this._content.direction   = dir;

            this._content.maxValue = xml.GetAttributeInt("max");
            this._content.value    = xml.GetAttributeInt("value");

            string str = xml.GetAttribute("titleType");

            this._content.titleType = str != null?FieldTypes.ParseProgressTitleType(str) : ProgressTitleType.Percent;
        }
예제 #2
0
        public void Setup(XML xml)
        {
            this.name     = xml.GetAttribute("name");
            this._options = xml.GetAttributeInt("options");
            this.autoPlay = xml.GetAttributeBool("autoPlay");
            if (this.autoPlay)
            {
                this.autoPlayRepeat = xml.GetAttributeInt("autoPlayRepeat", 1);
                this.autoPlayDelay  = xml.GetAttributeFloat("autoPlayDelay");
            }
            XMLList col = xml.Elements("item");

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

                item.time     = cxml.GetAttributeInt("time") / 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 = cxml.GetAttributeInt("duration") / FRAME_RATE;
                    if (item.time + item.duration > this._maxTime)
                    {
                        this._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)
                    {
                        this.DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.startValue);
                        this.DecodeValue(item.type, v, item.endValue);
                    }
                    else
                    {
                        item.tween = false;
                        this.DecodeValue(item.type, cxml.GetAttribute("startValue", string.Empty), item.value);
                    }
                }
                else
                {
                    if (item.time > this._maxTime)
                    {
                        this._maxTime = item.time;
                    }
                    this.DecodeValue(item.type, cxml.GetAttribute("value", string.Empty), item.value);
                    if (item.type == TransitionActionType.Shake)
                    {
                        item.tween = true;
                    }
                }
            }
        }