GetEnumerator() public method

public GetEnumerator ( ) : XMLList.Enumerator
return XMLList.Enumerator
示例#1
0
        public virtual void Setup_AfterAdd(XML xml)
        {
            string str;

            str = xml.GetAttribute("group");
            if (str != null)
                group = parent.GetChildById(str) as GGroup;

            XMLList.Enumerator et = xml.GetEnumerator();
            XML cxml;
            int index;
            while (et.MoveNext())
            {
                cxml = et.Current;
                if (GearXMLKeys.TryGetValue(cxml.name, out index))
                    GetGear(index).Setup(cxml);
            }
        }
示例#2
0
        public override void Setup_BeforeAdd(XML xml)
        {
            base.Setup_BeforeAdd(xml);

            string str;
            string[] arr;

            str = xml.GetAttribute("layout");
            if (str != null)
                _layout = FieldTypes.ParseListLayoutType(str);
            else
                _layout = ListLayoutType.SingleColumn;

            str = xml.GetAttribute("selectionMode");
            if (str != null)
                selectionMode = FieldTypes.ParseListSelectionMode(str);
            else
                selectionMode = ListSelectionMode.Single;

            OverflowType overflow;
            str = xml.GetAttribute("overflow");
            if (str != null)
                overflow = FieldTypes.ParseOverflowType(str);
            else
                overflow = OverflowType.Visible;

            str = xml.GetAttribute("margin");
            if (str != null)
                _margin.Parse(str);

            str = xml.GetAttribute("align");
            if (str != null)
                _align = FieldTypes.ParseAlign(str);

            str = xml.GetAttribute("vAlign");
            if (str != null)
                _verticalAlign = FieldTypes.ParseVerticalAlign(str);

            if (overflow == OverflowType.Scroll)
            {
                ScrollType scroll;
                str = xml.GetAttribute("scroll");
                if (str != null)
                    scroll = FieldTypes.ParseScrollType(str);
                else
                    scroll = ScrollType.Vertical;

                ScrollBarDisplayType scrollBarDisplay;
                str = xml.GetAttribute("scrollBar");
                if (str != null)
                    scrollBarDisplay = FieldTypes.ParseScrollBarDisplayType(str);
                else
                    scrollBarDisplay = ScrollBarDisplayType.Default;

                int scrollBarFlags = xml.GetAttributeInt("scrollBarFlags");

                Margin scrollBarMargin = new Margin();
                str = xml.GetAttribute("scrollBarMargin");
                if (str != null)
                    scrollBarMargin.Parse(str);

                string vtScrollBarRes = null;
                string hzScrollBarRes = null;
                arr = xml.GetAttributeArray("scrollBarRes");
                if (arr != null)
                {
                    vtScrollBarRes = arr[0];
                    hzScrollBarRes = arr[1];
                }

                SetupScroll(scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags, vtScrollBarRes, hzScrollBarRes);
            }
            else
            {
                SetupOverflow(overflow);
            }

            arr = xml.GetAttributeArray("clipSoftness");
            if (arr != null)
                this.clipSoftness = new Vector2(int.Parse(arr[0]), int.Parse(arr[1]));

            _lineGap = xml.GetAttributeInt("lineGap");
            _columnGap = xml.GetAttributeInt("colGap");
            _lineItemCount = xml.GetAttributeInt("lineItemCount");
            defaultItem = xml.GetAttribute("defaultItem");

            autoResizeItem = xml.GetAttributeBool("autoItemSize", true);

            XMLList.Enumerator et = xml.GetEnumerator("item");
            while (et.MoveNext())
            {
                XML ix = et.Current;
                string url = ix.GetAttribute("url");
                if (string.IsNullOrEmpty(url))
                {
                    url = defaultItem;
                    if (string.IsNullOrEmpty(url))
                        continue;
                }

                GObject obj = GetFromPool(url);
                if (obj != null)
                {
                    AddChild(obj);
                    str = ix.GetAttribute("title");
                    if (str != null)
                        obj.text = str;
                    str = ix.GetAttribute("icon");
                    if (str != null)
                        obj.icon = str;
                    str = ix.GetAttribute("name");
                    if (str != null)
                        obj.name = str;
                }
            }
        }
示例#3
0
        public void Setup(XML xml)
        {
            XMLList.Enumerator et = xml.GetEnumerator("relation");

            string targetId;
            GObject target;
            while (et.MoveNext())
            {
                XML cxml = et.Current;
                targetId = cxml.GetAttribute("target");
                if (_owner.parent != null)
                {
                    if (targetId != null && targetId != "")
                        target = _owner.parent.GetChildById(targetId);
                    else
                        target = _owner.parent;
                }
                else
                {
                    //call from component construction
                    target = ((GComponent)_owner).GetChildById(targetId);
                }
                if (target != null)
                    AddItems(target, cxml.GetAttribute("sidePair"));
            }
        }
示例#4
0
        /// <summary>
        /// Set strings source.
        /// </summary>
        /// <param name="source"></param>
        public static void SetStringsSource(XML source)
        {
            _stringsSource = new Dictionary<string, Dictionary<string, string>>();
            XMLList.Enumerator et = source.GetEnumerator("string");
            while (et.MoveNext())
            {
                XML cxml = et.Current;
                string key = cxml.GetAttribute("name");
                string text = cxml.text;
                int i = key.IndexOf("-");
                if (i == -1)
                    continue;

                string key2 = key.Substring(0, i);
                string key3 = key.Substring(i + 1);
                Dictionary<string, string> col;
                if (!_stringsSource.TryGetValue(key2, out col))
                {
                    col = new Dictionary<string, string>();
                    _stringsSource[key2] = col;
                }
                col[key3] = text;
            }
        }
示例#5
0
        public void Setup(XML xml)
        {
            this.name = xml.GetAttribute("name");
            _options = xml.GetAttributeInt("options");
            _autoPlay = xml.GetAttributeBool("autoPlay");
            if (_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);
                }
            }
        }