A simplest and readonly XML class
        public override void ConstructFromXML(XML xml)
        {
            base.ConstructFromXML(xml);

            _grip = GetChild("grip");
            if (_grip == null)
            {
                Debug.LogWarning("FairyGUI: " + this.resourceURL + " should define grip");
                return;
            }

            _bar = GetChild("bar");
            if (_bar == null)
            {
                Debug.LogWarning("FairyGUI: " + this.resourceURL + " should define bar");
                return;
            }

            _arrowButton1 = GetChild("arrow1");
            _arrowButton2 = GetChild("arrow2");

            _grip.onMouseDown.Add(__gripMouseDown);
            if (_arrowButton1 != null)
                _arrowButton1.onClick.Add(__arrowButton1Click);
            if (_arrowButton2 != null)
                _arrowButton2.onClick.Add(__arrowButton2Click);
        }
Exemple #2
0
        public override void Setup_AfterAdd(XML xml)
        {
            base.Setup_AfterAdd(xml);

            XML cxml = xml.GetNode("gearColor");
            if (cxml != null)
                gearColor.Setup(cxml);
        }
Exemple #3
0
    public override void ConstructFromXML(FairyGUI.Utils.XML cxml)
    {
        base.ConstructFromXML(cxml);

        _timeText        = this.GetChild("timeText").asTextField;
        _readController  = this.GetController("IsRead");
        _fetchController = this.GetController("c1");
        _trans           = this.GetTransition("t0");
    }
        public override void Setup_BeforeAdd(Utils.XML xml)
        {
            base.Setup_BeforeAdd(xml);

            _promptText             = xml.GetAttribute("prompt");
            _textField.restrict     = xml.GetAttribute("restrict");
            _textField.maxLength    = xml.GetAttributeInt("maxLength", int.MaxValue);
            _textField.keyboardType = xml.GetAttributeInt("keyboardType");
        }
Exemple #5
0
        public override void Setup_BeforeAdd(XML xml)
        {
            base.Setup_BeforeAdd(xml);

            string str;
            str = xml.GetAttribute("color");
            if (str != null)
                this.color = ToolSet.ConvertFromHtmlColor(str);

            str = xml.GetAttribute("flip");
            if (str != null)
                _content.flip = FieldTypes.ParseFlipType(str);
        }
Exemple #6
0
        public override void Setup_BeforeAdd(Utils.XML xml)
        {
            base.Setup_BeforeAdd(xml);

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

            if (str != null)
            {
                inputTextField.promptText = str;
            }
            inputTextField.displayAsPassword = xml.GetAttributeBool("password", false);
            inputTextField.restrict          = xml.GetAttribute("restrict");
            inputTextField.maxLength         = xml.GetAttributeInt("maxLength", int.MaxValue);
            inputTextField.keyboardType      = xml.GetAttributeInt("keyboardType");
        }
Exemple #7
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("values");
            string[] values = null;
            if (str != null)
                values = str.Split(jointChar1);

            if (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);
        }
Exemple #8
0
        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 && values != null)
                {
                    for (int i = 0; i < values.Length; i++)
                        AddStatus(pages[i], values[i]);
                }
                str = xml.GetAttribute("default");
                if (str != null)
                    AddStatus(null, str);
            }
        }
    private void SetLanguage()
    {
        string s = null;

        switch (System.Convert.ToInt32(gComboBox.value))
        {
        case 1:
            s = Resources.Load("Languages/Chinese").ToString();
            break;

        case 2:
            s = Resources.Load("Languages/English").ToString();
            break;

        case 3:
            s = Resources.Load("Languages/Japanese").ToString();
            break;

        default:
            break;
        }
        FairyGUI.Utils.XML xML = new FairyGUI.Utils.XML(s);
        GameManager.Instance.ChangeLanguage(xML);
    }
Exemple #10
0
 public Enumerator(List<XML> source, string selector)
 {
     _source = source;
     _selector = selector;
     _index = -1;
     if (_source != null)
         _total = _source.Count;
     else
         _total = 0;
     _current = null;
 }
        public override void ConstructFromXML(XML xml)
        {
            base.ConstructFromXML(xml);

            LuaUIHelper.ConnectLua(this);
        }
Exemple #12
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);
            }
        }
Exemple #13
0
        void LoadPackage()
        {
            string[] arr = null;
            string str;

            str = LoadString("sprites.bytes");
            arr = str.Split(sep1);
            int cnt = arr.Length;
            for (int i = 1; i < cnt; i++)
            {
                str = arr[i];
                if (str.Length == 0)
                    continue;

                string[] arr2 = str.Split(sep2);
                AtlasSprite sprite = new AtlasSprite();
                string itemId = arr2[0];
                int binIndex = int.Parse(arr2[1]);
                if (binIndex >= 0)
                    sprite.atlas = "atlas" + binIndex;
                else
                {
                    int pos = itemId.IndexOf("_");
                    if (pos == -1)
                        sprite.atlas = "atlas_" + itemId;
                    else
                        sprite.atlas = "atlas_" + itemId.Substring(0, pos);
                }
                sprite.rect.x = int.Parse(arr2[2]);
                sprite.rect.y = int.Parse(arr2[3]);
                sprite.rect.width = int.Parse(arr2[4]);
                sprite.rect.height = int.Parse(arr2[5]);
                sprite.rotated = arr2[6] == "1";
                _sprites[itemId] = sprite;
            }

            str = GetDesc("package.xml");
            XML xml = new XML(str);

            id = xml.GetAttribute("id");
            name = xml.GetAttribute("name");

            XML rxml = xml.GetNode("resources");
            if (rxml == null)
                throw new Exception("Invalid package xml");

            XMLList resources = rxml.Elements();

            _itemsById = new Dictionary<string, PackageItem>();
            _itemsByName = new Dictionary<string, PackageItem>(); ;
            PackageItem pi;

            foreach (XML cxml in resources)
            {
                pi = new PackageItem();
                pi.type = FieldTypes.ParsePackageItemType(cxml.name);
                pi.id = cxml.GetAttribute("id");
                pi.name = cxml.GetAttribute("name");
                pi.file = cxml.GetAttribute("file");
                str = cxml.GetAttribute("size");
                if (str != null)
                {
                    arr = str.Split(sep0);
                    pi.width = int.Parse(arr[0]);
                    pi.height = int.Parse(arr[1]);
                }
                switch (pi.type)
                {
                    case PackageItemType.Image:
                        {
                            string scale = cxml.GetAttribute("scale");
                            if (scale == "9grid")
                            {
                                arr = cxml.GetAttributeArray("scale9grid");
                                if (arr != null)
                                {
                                    Rect rect = new Rect();
                                    rect.x = int.Parse(arr[0]);
                                    rect.y = int.Parse(arr[1]);
                                    rect.width = int.Parse(arr[2]);
                                    rect.height = int.Parse(arr[3]);
                                    pi.scale9Grid = rect;
                                }
                            }
                            else if (scale == "tile")
                                pi.scaleByTile = true;
                            break;
                        }
                }
                pi.owner = this;
                _items.Add(pi);
                _itemsById[pi.id] = pi;
                if (pi.name != null)
                    _itemsByName[pi.name] = pi;
            }

            cnt = _items.Count;
            for (int i = 0; i < cnt; i++)
            {
                pi = _items[i];
                if (pi.type == PackageItemType.Font)
                {
                    pi.Load();
                    FontManager.RegisterFont(pi.bitmapFont, null);
                }
                else
                    GetItemAsset(pi);
            }

            if (_resBundle != null)
            {
                _resBundle.Unload(false);
                _resBundle = null;
            }
        }
        public override void ConstructFromXML(XML cxml)
        {
            base.ConstructFromXML(cxml);

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

            string str;

            _buttonController = GetController("button");
            _titleObject = GetChild("title") as GTextField;

            str = xml.GetAttribute("dropdown");
            if (str != null && str.Length > 0)
            {
                dropdown = UIPackage.CreateObjectFromURL(str) as GComponent;
                if (dropdown == null)
                {
                    Debug.LogWarning("FairyGUI: " + this.resourceURL + " should be a component.");
                    return;
                }

                _list = dropdown.GetChild("list") as GList;
                if (_list == null)
                {
                    Debug.LogWarning("FairyGUI: " + this.resourceURL + ": should container a list component named list.");
                    return;
                }
                _list.onClickItem.Add(__clickItem);

                _list.AddRelation(dropdown, RelationType.Width);
                _list.RemoveRelation(dropdown, RelationType.Height);

                dropdown.AddRelation(_list, RelationType.Height);
                dropdown.RemoveRelation(_list, RelationType.Width);
            }

            displayObject.onRollOver.Add(__rollover);
            displayObject.onRollOut.Add(__rollout);
            displayObject.onTouchBegin.Add(__touchBegin);
            displayObject.onTouchEnd.Add(__touchEnd);
        }
Exemple #15
0
 public override void ConstructFromXML(FairyGUI.Utils.XML cxml)
 {
     base.ConstructFromXML(cxml);
     _txt  = this.GetChild("text").asTextField;
     _icon = this.GetChild("pic").asLoader;
 }
        public override void ConstructFromXML(XML cxml)
        {
            base.ConstructFromXML(cxml);

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

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

            _titleObject = GetChild("title") as GTextField;
            _barObjectH = GetChild("bar");
            _barObjectV = GetChild("bar_v");
            _aniObject = GetChild("ani") as GMovieClip;

            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;
            }
        }
Exemple #17
0
 public override void ConstructFromXML(FairyGUI.Utils.XML cxml)
 {
     base.ConstructFromXML(cxml);
     _pic_container = this.GetChild("pic").asCom;
     _pic           = _pic_container.GetChild("icon").asLoader;
 }
 public override void ConstructFromXML(FairyGUI.Utils.XML cxml)
 {
     base.ConstructFromXML(cxml);
     _trans = this.GetTransition("t0");
 }
Exemple #19
0
    public override void ConstructFromXML(FairyGUI.Utils.XML xml)
    {
        base.ConstructFromXML(xml);

        bar0 = this.GetChild("n1").asLoader;
    }
Exemple #20
0
    public override void ConstructFromXML(FairyGUI.Utils.XML xml)
    {
        base.ConstructFromXML(xml);
        components[0] = (ComponentView)this.GetChild("c0").asCom;
        components[1] = (ComponentView)this.GetChild("c1").asCom;
        components[2] = (ComponentView)this.GetChild("c2").asCom;
        components[3] = (ComponentView)this.GetChild("c3").asCom;

        for (int i = 0; i < 4; i++)
        {
            components [i].idx        = i;
            components [i].towerPanel = this;
            components [i].visible    = false;
            int idx = i;
            components [i].onTouchEnd.Add(delegate() {
                clickComponent(idx);
            });
        }

        towers = this.GetChild("towers").asList;

        _switch_detail          = this.GetChild("switch").asButton;
        _switch_detail.selected = true;
        _switch_detail.onClick.Add(delegate() {
            isDetailShown = !isDetailShown;
            if (isDetailShown)
            {
                for (int i = 0; i < 4; i++)
                {
                    components[i].showDetail();
                }
            }
            else
            {
                for (int i = 0; i < 4; i++)
                {
                    components[i].hideDetail();
                }
            }
        });
        //tComponents = this.GetChild ("components").asList;

        //movingIcon = this.GetChild ("moving_icon").asLoader;
        //movingIcon.sortingOrder = int.MaxValue;

        towers.onClickItem.Add(clickTower);
        towers.itemRenderer = RenderTowers;
        towers.numItems     = PlayerData.getInstance().ownedTowers.Count;

        //tComponents.foldInvisibleItems = true;
        //tComponents.itemRenderer = RenderComponents;
        //tComponents.numItems = PlayerData.getInstance ().bagComponents.Count;
        //tComponents.EnsureBoundsCorrect();

//		DragDropManager.inst.dragAgent.onDragEnd.Add(delegate(EventContext context2) {
//			if(!isDropOnSlot)
//				tComponents.GetChildAt(nowDragIdx).visible = true;
//			tComponents.numItems = PlayerData.getInstance ().bagComponents.Count;
//			nowDragIdx = -1;
//		});

        _property         = (TowerPropertyAfter)this.GetChild("property").asCom;
        _property.visible = false;

        towerComponentWindow = new TowerComponentChooseWindow(this);
    }
Exemple #21
0
 public override void ConstructFromXML(FairyGUI.Utils.XML xml)
 {
 }
Exemple #22
0
 public override void ConstructFromXML(FairyGUI.Utils.XML xml)
 {
     base.ConstructFromXML(xml);
     _icon = this.GetChild("type").asLoader;
     _num  = this.GetChild("v").asTextField;
 }
Exemple #23
0
 public override void ConstructFromXML(FairyGUI.Utils.XML cxml)
 {
     base.ConstructFromXML(cxml);
     _content = this.GetChild("title").asTextField;
 }
Exemple #24
0
 public void Add(XML xml)
 {
     rawList.Add(xml);
 }
Exemple #25
0
        public override void Setup_BeforeAdd(XML xml)
        {
            base.Setup_BeforeAdd(xml);

            string str;
            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;

            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);

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

            SetupOverflowAndScroll(overflow, scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags);

            string[] 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");
            defaultItem = xml.GetAttribute("defaultItem");

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

            XMLList col = xml.Elements("item");
            foreach (XML ix in col)
            {
                string url = ix.GetAttribute("url");
                if (string.IsNullOrEmpty(url))
                    url = defaultItem;
                if (string.IsNullOrEmpty(url))
                    continue;

                GObject obj = AddItemFromPool(url);
                if (obj is GButton)
                {
                    ((GButton)obj).title = ix.GetAttribute("title");
                    ((GButton)obj).icon = ix.GetAttribute("icon");
                }
                else if (obj is GLabel)
                {
                    ((GLabel)obj).title = ix.GetAttribute("title");
                    ((GLabel)obj).icon = ix.GetAttribute("icon");
                }
            }
        }
Exemple #26
0
        void LoadPackage()
        {
            string[] arr = null;
            string str;

            str = LoadString("sprites.bytes");
            if (str == null)
            {
                Debug.LogError("FairyGUI: cannot load package from " + _assetNamePrefix);
                return;
            }
            arr = str.Split(sep1);
            int cnt = arr.Length;
            for (int i = 1; i < cnt; i++)
            {
                str = arr[i];
                if (str.Length == 0)
                    continue;

                string[] arr2 = str.Split(sep2);
                AtlasSprite sprite = new AtlasSprite();
                string itemId = arr2[0];
                int binIndex = int.Parse(arr2[1]);
                if (binIndex >= 0)
                    sprite.atlas = "atlas" + binIndex;
                else
                {
                    int pos = itemId.IndexOf("_");
                    if (pos == -1)
                        sprite.atlas = "atlas_" + itemId;
                    else
                        sprite.atlas = "atlas_" + itemId.Substring(0, pos);
                }
                sprite.rect.x = int.Parse(arr2[2]);
                sprite.rect.y = int.Parse(arr2[3]);
                sprite.rect.width = int.Parse(arr2[4]);
                sprite.rect.height = int.Parse(arr2[5]);
                sprite.rotated = arr2[6] == "1";
                _sprites[itemId] = sprite;
            }

            byte[] hittestData = LoadBinary("hittest.bytes");
            if (hittestData != null)
            {
                ByteBuffer ba = new ByteBuffer(hittestData);
                while (ba.bytesAvailable)
                {
                    PixelHitTestData pht = new PixelHitTestData();
                    _hitTestDatas[ba.ReadString()] = pht;
                    pht.Load(ba);
                }
            }

            str = _descPack["package.xml"];
            XML xml = new XML(str);

            id = xml.GetAttribute("id");
            name = xml.GetAttribute("name");

            XML rxml = xml.GetNode("resources");
            if (rxml == null)
                throw new Exception("Invalid package xml");

            XMLList resources = rxml.Elements();

            _itemsById = new Dictionary<string, PackageItem>();
            _itemsByName = new Dictionary<string, PackageItem>();
            PackageItem pi;

            foreach (XML cxml in resources)
            {
                pi = new PackageItem();
                pi.owner = this;
                pi.type = FieldTypes.ParsePackageItemType(cxml.name);
                pi.id = cxml.GetAttribute("id");
                pi.name = cxml.GetAttribute("name");
                pi.exported = cxml.GetAttributeBool("exported");
                pi.file = cxml.GetAttribute("file");
                str = cxml.GetAttribute("size");
                if (str != null)
                {
                    arr = str.Split(sep0);
                    pi.width = int.Parse(arr[0]);
                    pi.height = int.Parse(arr[1]);
                }
                switch (pi.type)
                {
                    case PackageItemType.Image:
                        {
                            string scale = cxml.GetAttribute("scale");
                            if (scale == "9grid")
                            {
                                arr = cxml.GetAttributeArray("scale9grid");
                                if (arr != null)
                                {
                                    Rect rect = new Rect();
                                    rect.x = int.Parse(arr[0]);
                                    rect.y = int.Parse(arr[1]);
                                    rect.width = int.Parse(arr[2]);
                                    rect.height = int.Parse(arr[3]);
                                    pi.scale9Grid = rect;
                                }
                            }
                            else if (scale == "tile")
                                pi.scaleByTile = true;
                            break;
                        }

                    case PackageItemType.Font:
                        {
                            pi.bitmapFont = new BitmapFont(pi);
                            FontManager.RegisterFont(pi.bitmapFont, null);
                            break;
                        }
                }
                _items.Add(pi);
                _itemsById[pi.id] = pi;
                if (pi.name != null)
                    _itemsByName[pi.name] = pi;
            }

            bool preloadAll = Application.isPlaying;
            if (preloadAll)
            {
                cnt = _items.Count;
                for (int i = 0; i < cnt; i++)
                    GetItemAsset(_items[i]);

                _descPack = null;
                _sprites = null;
            }
            else
                _items.Sort(ComparePackageItem);

            if (_resBundle != null)
            {
                _resBundle.Unload(false);
                _resBundle = null;
            }
        }
Exemple #27
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;
                }
            }
        }
Exemple #28
0
        private GObject ConstructChild(XML xml)
        {
            string pkgId = xml.GetAttribute("pkg");
            UIPackage thisPkg = _packageItem.owner;
            UIPackage pkg;
            if (pkgId != null && pkgId != thisPkg.id)
            {
                pkg = UIPackage.GetById(pkgId);
                if (pkg == null)
                    return null;
            }
            else
                pkg = thisPkg;

            string src = xml.GetAttribute("src");
            if (src != null)
            {
                PackageItem pi = pkg.GetItem(src);
                if (pi == null)
                    return null;

                GObject g = pkg.CreateObject(pi, null);
                return g;
            }
            else
            {
                GObject g;
                if (xml.name == "text" && xml.GetAttributeBool("input", false))
                    g = new GTextInput();
                else
                    g = UIObjectFactory.NewObject(xml.name);
                return g;
            }
        }
Exemple #29
0
        void Parse(string aSource)
        {
            XML lastOpenNode = null;

            sNodeStack.Clear();

            XMLIterator.Begin(aSource);
            while (XMLIterator.NextTag())
            {
                if (XMLIterator.tagType == XMLTagType.Start || XMLIterator.tagType == XMLTagType.Void)
                {
                    XML childNode;
                    if (lastOpenNode != null)
                    {
                        childNode = new XML();
                    }
                    else
                    {
                        if (this.name != null)
                        {
                            Cleanup();
                            throw new Exception("Invalid xml format - no root node.");
                        }
                        childNode = this;
                    }

                    childNode.name        = XMLIterator.tagName;
                    childNode._attributes = XMLIterator.GetAttributes(childNode._attributes);

                    if (lastOpenNode != null)
                    {
                        if (XMLIterator.tagType != XMLTagType.Void)
                        {
                            sNodeStack.Push(lastOpenNode);
                        }
                        if (lastOpenNode._children == null)
                        {
                            lastOpenNode._children = new XMLList();
                        }
                        lastOpenNode._children.Add(childNode);
                    }
                    if (XMLIterator.tagType != XMLTagType.Void)
                    {
                        lastOpenNode = childNode;
                    }
                }
                else if (XMLIterator.tagType == XMLTagType.End)
                {
                    if (lastOpenNode == null || lastOpenNode.name != XMLIterator.tagName)
                    {
                        Cleanup();
                        throw new Exception("Invalid xml format - <" + XMLIterator.tagName + "> dismatched.");
                    }

                    if (lastOpenNode._children == null || lastOpenNode._children.Count == 0)
                    {
                        lastOpenNode.text = XMLIterator.GetText();
                    }

                    if (sNodeStack.Count > 0)
                    {
                        lastOpenNode = sNodeStack.Pop();
                    }
                    else
                    {
                        lastOpenNode = null;
                    }
                }
            }
        }
        public override void Setup_AfterAdd(XML cxml)
        {
            base.Setup_AfterAdd(cxml);

            XML xml = cxml.GetNode("ProgressBar");
            if (xml != null)
            {
                _value = xml.GetAttributeInt("value");
                _max = xml.GetAttributeInt("max");
            }

            Update(_value);
        }
Exemple #31
0
 public override void ConstructFromXML(FairyGUI.Utils.XML cxml)
 {
     base.ConstructFromXML(cxml);
     //_timeText = this.GetChild("battle_text").asTextField;
 }
Exemple #32
0
        void LoadMovieClip(PackageItem item)
        {
            string str = GetDesc(item.id + ".xml");
            XML xml = new XML(str);
            string[] arr = null;

            arr = xml.GetAttributeArray("pivot");
            if (arr != null)
            {
                item.pivot.x = int.Parse(arr[0]);
                item.pivot.y = int.Parse(arr[1]);
            }
            str = xml.GetAttribute("interval");
            if (str != null)
                item.interval = float.Parse(str) / 1000f;
            item.swing = xml.GetAttributeBool("swing", false);
            str = xml.GetAttribute("repeatDelay");
            if (str != null)
                item.repeatDelay = float.Parse(str) / 1000f;
            int frameCount = xml.GetAttributeInt("frameCount");
            item.frames = new Frame[frameCount];

            XMLList frameNodes = xml.GetNode("frames").Elements();

            int i = 0;
            foreach (XML frameNode in frameNodes)
            {
                Frame frame = new Frame();
                arr = frameNode.GetAttributeArray("rect");
                frame.rect = new Rect(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]), int.Parse(arr[3]));
                str = frameNode.GetAttribute("addDelay");
                if (str != null)
                    frame.addDelay = float.Parse(str) / 1000f;

                AtlasSprite sprite;
                if (_sprites.TryGetValue(item.id + "_" + i, out sprite))
                    frame.texture = CreateSpriteTexture(sprite);
                item.frames[i] = frame;
                i++;
            }
        }
Exemple #33
0
        /// <summary>
        /// Set strings source.
        /// </summary>
        /// <param name="source"></param>
        public static void SetStringsSource(XML source)
        {
            _stringsSource = new Dictionary<string, Dictionary<string, string>>();
            XMLList list = source.Elements("string");
            foreach (XML cxml in list)
            {
                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 = _stringsSource[key2];
                if (col == null)
                {
                    col = new Dictionary<string, string>();
                    _stringsSource[key2] = col;
                }
                col[key3] = text;
            }
        }
        public override void Setup_AfterAdd(XML cxml)
        {
            base.Setup_AfterAdd(cxml);

            XML xml = cxml.GetNode("ComboBox");
            if (xml == null)
                return;

            string str;
            str = xml.GetAttribute("titleColor");
            if (str != null)
                this.titleColor = ToolSet.ConvertFromHtmlColor(str);
            visibleItemCount = xml.GetAttributeInt("visibleItemCount", visibleItemCount);
            _popupDirection = xml.GetAttribute("direction", _popupDirection);

            XMLList col = xml.Elements("item");
            _items = new string[col.Count];
            _values = new string[col.Count];
            int i = 0;
            foreach (XML ix in col)
            {
                _items[i] = ix.GetAttribute("title");
                _values[i] = ix.GetAttribute("value");
                i++;
            }

            str = xml.GetAttribute("title");
            if (str != null && str.Length > 0)
            {
                this.text = str;
                _selectedIndex = Array.IndexOf(_items, str);
            }
            else if (_items.Length > 0)
            {
                _selectedIndex = 0;
                this.text = _items[0];
            }
            else
                _selectedIndex = -1;
        }
Exemple #35
0
        void LoadMovieClip(PackageItem item)
        {
            string str = _descPack[item.id + ".xml"];
            XML xml = new XML(str);
            string[] arr = null;

            str = xml.GetAttribute("interval");
            if (str != null)
                item.interval = float.Parse(str) / 1000f;
            item.swing = xml.GetAttributeBool("swing", false);
            str = xml.GetAttribute("repeatDelay");
            if (str != null)
                item.repeatDelay = float.Parse(str) / 1000f;
            int frameCount = xml.GetAttributeInt("frameCount");
            item.frames = new MovieClip.Frame[frameCount];

            XMLList frameNodes = xml.GetNode("frames").Elements();

            int i = 0;
            foreach (XML frameNode in frameNodes)
            {
                MovieClip.Frame frame = new MovieClip.Frame();
                arr = frameNode.GetAttributeArray("rect");
                frame.rect = new Rect(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]), int.Parse(arr[3]));
                str = frameNode.GetAttribute("addDelay");
                if (str != null)
                    frame.addDelay = float.Parse(str) / 1000f;

                AtlasSprite sprite;
                if (_sprites.TryGetValue(item.id + "_" + i, out sprite))
                {
                    PackageItem atlasItem = _itemsById[sprite.atlas];
                    if (atlasItem != null)
                    {
                        if (item.texture == null)
                            item.texture = (NTexture)GetItemAsset(atlasItem);
                        frame.uvRect = new Rect(sprite.rect.x / item.texture.width * item.texture.uvRect.width,
                            1 - sprite.rect.yMax * item.texture.uvRect.height / item.texture.height,
                            sprite.rect.width * item.texture.uvRect.width / item.texture.width,
                            sprite.rect.height * item.texture.uvRect.height / item.texture.height);
                    }
                }
                item.frames[i] = frame;
                i++;
            }
        }
Exemple #36
0
        public override void Setup_BeforeAdd(Utils.XML xml)
        {
            base.Setup_BeforeAdd(xml);

            _promptText = xml.GetAttribute("prompt");
        }
Exemple #37
0
    public override void ConstructFromXML(FairyGUI.Utils.XML xml)
    {
        base.ConstructFromXML(xml);

        _obj = this.GetChild("n1");
    }
Exemple #38
0
        public virtual void Setup_BeforeAdd(XML xml)
        {
            string str;
            string[] arr;

            id = xml.GetAttribute("id");
            name = xml.GetAttribute("name");

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

            arr = xml.GetAttributeArray("size");
            if (arr != null)
            {
                initWidth = int.Parse(arr[0]);
                initHeight = int.Parse(arr[1]);
                SetSize(initWidth, initHeight, true);
            }

            arr = xml.GetAttributeArray("scale");
            if (arr != null)
                SetScale(float.Parse(arr[0]), float.Parse(arr[1]));

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

            str = xml.GetAttribute("rotation");
            if (str != null)
                this.rotation = int.Parse(str);

            arr = xml.GetAttributeArray("pivot");
            if (arr != null)
            {
                float f1 = float.Parse(arr[0]);
                float f2 = float.Parse(arr[1]);
                //处理旧版本的兼容性(旧版本发布的值是坐标值,新版本是比例,一般都小于2)
                if (f1 > 2)
                {
                    if (sourceWidth != 0)
                        f1 = f1 / sourceWidth;
                    else
                        f1 = 0;
                }
                if (f2 > 2)
                {
                    if (sourceHeight != 0)
                        f2 = f2 / sourceHeight;
                    else
                        f2 = 0;
                }
                this.SetPivot(f1, f2, xml.GetAttributeBool("anchor"));
            }
            else
                this.SetPivot(0, 0, false);

            str = xml.GetAttribute("alpha");
            if (str != null)
                this.alpha = float.Parse(str);

            this.touchable = xml.GetAttributeBool("touchable", true);
            this.visible = xml.GetAttributeBool("visible", true);
            this.grayed = xml.GetAttributeBool("grayed", false);

            str = xml.GetAttribute("blend");
            if (str != null)
                this.blendMode = FieldTypes.ParseBlendMode(str);

            str = xml.GetAttribute("filter");
            if (str != null)
            {
                switch (str)
                {
                    case "color":
                        ColorFilter cf = new ColorFilter();
                        this.filter = cf;
                        arr = xml.GetAttributeArray("filterData");
                        cf.AdjustBrightness(float.Parse(arr[0]));
                        cf.AdjustContrast(float.Parse(arr[1]));
                        cf.AdjustSaturation(float.Parse(arr[2]));
                        cf.AdjustHue(float.Parse(arr[3]));
                        break;
                }
            }

            str = xml.GetAttribute("tooltips");
            if (str != null)
                this.tooltips = str;
        }
Exemple #39
0
        public override void Setup_BeforeAdd(XML xml)
        {
            base.Setup_BeforeAdd(xml);

            string str;
            str = xml.GetAttribute("color");
            if (str != null)
                this.color = ToolSet.ConvertFromHtmlColor(str);

            str = xml.GetAttribute("flip");
            if (str != null)
                _content.flip = FieldTypes.ParseFlipType(str);

            str = xml.GetAttribute("fillMethod");
            if (str != null)
                _content.fillMethod = FieldTypes.ParseFillMethod(str);

            if (_content.fillMethod != FillMethod.None)
            {
                _content.fillOrigin = xml.GetAttributeInt("fillOrigin");
                _content.fillClockwise = xml.GetAttributeBool("fillClockwise", true);
                _content.fillAmount = (float)xml.GetAttributeInt("fillAmount", 100) / 100;
            }
        }
Exemple #40
0
            public bool MoveNext()
            {
                while (++_index < _total)
                {
                    _current = _source[_index];
                    if (_selector == null || _current.name == _selector)
                        return true;
                }

                return false;
            }
        public override void Setup_BeforeAdd(XML xml)
        {
            base.Setup_BeforeAdd(xml);

            string str;

            str = xml.GetAttribute("frame");
            if (str != null)
                _content.currentFrame = int.Parse(str);
            _content.playing = xml.GetAttributeBool("playing", true);

            str = xml.GetAttribute("color");
            if (str != null)
                this.color = ToolSet.ConvertFromHtmlColor(str);
        }
Exemple #42
0
 public override void ConstructFromXML(FairyGUI.Utils.XML xml)
 {
     _desp = this.GetChild("n3").asTextField;
 }
Exemple #43
0
        public virtual void ConstructFromXML(XML xml)
        {
            string str;
            string[] arr;

            underConstruct = true;

            arr = xml.GetAttributeArray("size");
            sourceWidth = int.Parse(arr[0]);
            sourceHeight = int.Parse(arr[1]);
            initWidth = sourceWidth;
            initHeight = sourceHeight;

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

            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);

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

            SetSize(sourceWidth, sourceHeight);

            SetupOverflowAndScroll(overflow, scrollBarMargin, scroll, scrollBarDisplay, scrollBarFlags);

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

            _buildingDisplayList = true;

            XMLList col = xml.Elements("controller");
            Controller controller;
            foreach (XML cxml in col)
            {
                controller = new Controller();
                _controllers.Add(controller);
                controller.parent = this;
                controller.Setup(cxml);
            }

            XML listNode = xml.GetNode("displayList");
            if (listNode != null)
            {
                col = listNode.Elements();
                GObject u;
                foreach (XML cxml in col)
                {
                    u = ConstructChild(cxml);
                    if (u == null)
                        continue;

                    u.underConstruct = true;
                    u.constructingData = cxml;
                    u.Setup_BeforeAdd(cxml);
                    AddChild(u);
                }
            }
            this.relations.Setup(xml);

            int cnt = _children.Count;
            for (int i = 0; i < cnt; i++)
            {
                GObject u = _children[i];
                u.relations.Setup(u.constructingData);
            }

            for (int i = 0; i < cnt; i++)
            {
                GObject u = _children[i];
                u.Setup_AfterAdd(u.constructingData);
                u.underConstruct = false;
                u.constructingData = null;
            }

            XMLList transCol = xml.Elements("transition");
            foreach (XML cxml in transCol)
            {
                Transition trans = new Transition(this);
                trans.Setup(cxml);
                _transitions.Add(trans);
            }

            ApplyAllControllers();

            _buildingDisplayList = false;
            underConstruct = false;

            //build real display list
            foreach (GObject child in _children)
            {
                if (child.displayObject != null && child.finalVisible)
                    container.AddChild(child.displayObject);
            }
        }
Exemple #44
0
        void TranslateComponent(XML xml, Dictionary<string, string> strings)
        {
            XML listNode = xml.GetNode("displayList");
            if (listNode == null)
                return;

            XMLList col = listNode.Elements();

            string ename, elementId, value;
            foreach (XML cxml in col)
            {
                ename = cxml.name;
                elementId = cxml.GetAttribute("id");
                if (cxml.HasAttribute("tooltips"))
                {
                    if (strings.TryGetValue(elementId + "-tips", out value))
                        cxml.SetAttribute("tooltips", value);
                }

                if (ename == "text" || ename == "richtext")
                {
                    if (strings.TryGetValue(elementId, out value))
                        cxml.SetAttribute("text", value);
                }
                else if (ename == "list")
                {
                    XMLList items = cxml.Elements("item");
                    int j = 0;
                    foreach (XML exml in items)
                    {
                        if (strings.TryGetValue(elementId + "-" + j, out value))
                            exml.SetAttribute("title", value);
                        j++;
                    }
                }
                else if (ename == "component")
                {
                    XML dxml = cxml.GetNode("Button");
                    if (dxml != null)
                    {
                        if (strings.TryGetValue(elementId, out value))
                            dxml.SetAttribute("title", value);
                        if (strings.TryGetValue(elementId + "-0", out value))
                            dxml.SetAttribute("selectedTitle", value);
                    }
                    else
                    {
                        dxml = cxml.GetNode("Label");
                        if (dxml != null)
                        {
                            if (strings.TryGetValue(elementId, out value))
                                dxml.SetAttribute("title", value);
                        }
                        else
                        {
                            dxml = cxml.GetNode("ComboBox");
                            if (dxml != null)
                            {
                                if (strings.TryGetValue(elementId, out value))
                                    dxml.SetAttribute("title", value);

                                XMLList items = dxml.Elements("item");
                                int j = 0;
                                foreach (XML exml in items)
                                {
                                    if (strings.TryGetValue(elementId + "-" + j, out value))
                                        exml.SetAttribute("title", value);
                                    j++;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #45
0
 public override void ConstructFromXML(FairyGUI.Utils.XML xml)
 {
     base.ConstructFromXML(xml);
     bg = this.GetChild("n0").asImage;
 }
Exemple #46
0
        internal object GetItemAsset(PackageItem item)
        {
            switch (item.type)
            {
                case PackageItemType.Image:
                    if (!item.decoded)
                    {
                        item.decoded = true;
                        AtlasSprite sprite;
                        if (_sprites.TryGetValue(item.id, out sprite))
                            item.texture = CreateSpriteTexture(sprite);
                        else
                            item.texture = NTexture.Empty;
                    }
                    return item.texture;

                case PackageItemType.Atlas:
                    if (!item.decoded)
                    {
                        item.decoded = true;
                        string fileName = string.IsNullOrEmpty(item.file) ? (item.id + ".png") : item.file;
                        string filePath = _assetNamePrefix + Path.GetFileNameWithoutExtension(fileName);
                        string ext = Path.GetExtension(fileName);

                        Texture2D tex;
                        if (_resBundle != null)
                        {
            #if UNITY_5
                            tex = _resBundle.LoadAsset<Texture2D>(filePath);
            #else
                            tex = (Texture2D)_resBundle.Load(filePath, typeof(Texture2D));
            #endif
                        }
                        else
                            tex = (Texture2D)_loadFunc(filePath, ext, typeof(Texture2D));
                        if (tex == null)
                        {
                            Debug.LogWarning("FairyGUI: texture '" + fileName + "' not found in " + this.name);
                            item.texture = NTexture.Empty;
                        }
                        else
                        {
                            if (tex.mipmapCount > 1)
                                Debug.LogWarning("FairyGUI: texture '" + fileName + "' in " + this.name + " is mipmaps enabled.");
                            item.texture = new NTexture(tex, (float)tex.width / item.width, (float)tex.height / item.height);

                            filePath = filePath + "!a";
                            if (_resBundle != null)
                            {
            #if UNITY_5
                                tex = _resBundle.LoadAsset<Texture2D>(filePath);
            #else
                                tex = (Texture2D)_resBundle.Load(filePath, typeof(Texture2D));
            #endif
                            }
                            else
                                tex = (Texture2D)_loadFunc(filePath, ext, typeof(Texture2D));
                            if (tex != null)
                                item.texture.alphaTexture = tex;
                        }
                    }
                    return item.texture;

                case PackageItemType.Sound:
                    if (!item.decoded)
                    {
                        item.decoded = true;
                        string fileName = _assetNamePrefix + Path.GetFileNameWithoutExtension(item.file);
                        string ext = Path.GetExtension(item.file);
                        if (_resBundle != null)
                        {
            #if UNITY_5
                            item.audioClip = _resBundle.LoadAsset<AudioClip>(fileName);
            #else
                            item.audioClip = (AudioClip)_resBundle.Load(fileName, typeof(AudioClip));
            #endif
                        }
                        else
                            item.audioClip = (AudioClip)_loadFunc(fileName, ext, typeof(AudioClip));
                    }
                    return item.audioClip;

                case PackageItemType.Font:
                    if (!item.decoded)
                    {
                        item.decoded = true;
                        LoadFont(item);
                    }
                    return item.bitmapFont;

                case PackageItemType.MovieClip:
                    if (!item.decoded)
                    {
                        item.decoded = true;
                        LoadMovieClip(item);
                    }
                    return item.frames;

                case PackageItemType.Component:
                    if (!item.decoded)
                    {
                        item.decoded = true;
                        string str = _descPack[item.id + ".xml"];
                        XML xml = new XML(str);
                        if (_stringsSource != null)
                        {
                            Dictionary<string, string> strings;
                            if (_stringsSource.TryGetValue(this.id + item.id, out strings))
                                TranslateComponent(xml, strings);
                        }
                        item.componentData = xml;
                    }
                    return item.componentData;

                default:
                    if (!item.decoded)
                    {
                        item.decoded = true;
                        item.binary = LoadBinary(item.file);
                    }
                    return item.binary;
            }
        }
Exemple #47
0
        public override void Setup_BeforeAdd(XML xml)
        {
            string str;
            string type = xml.GetAttribute("type");
            if (type != null && type != "empty")
            {
                _shape = new Shape();
                _shape.gOwner = this;
                displayObject = _shape;
            }

            base.Setup_BeforeAdd(xml);

            if (_shape != null)
            {
                int lineSize;
                str = xml.GetAttribute("lineSize");
                if (str != null)
                    lineSize = int.Parse(str);
                else
                    lineSize = 1;

                Color lineColor;
                str = xml.GetAttribute("lineColor");
                if (str != null)
                    lineColor = ToolSet.ConvertFromHtmlColor(str);
                else
                    lineColor = Color.black;

                Color fillColor;
                str = xml.GetAttribute("fillColor");
                if (str != null)
                    fillColor = ToolSet.ConvertFromHtmlColor(str);
                else
                    fillColor = Color.white;

                if (type == "rect")
                    DrawRect(this.width, this.height, lineSize, lineColor, fillColor);
                else
                    DrawEllipse(this.width, this.height, fillColor);
            }
        }
        public override void Setup_BeforeAdd(XML xml)
        {
            base.Setup_BeforeAdd(xml);

            string str;
            str = xml.GetAttribute("url");
            if (str != null)
                _url = str;

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

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

            str = xml.GetAttribute("fill");
            if (str != null)
                _fill = FieldTypes.ParseFillType(str);

            _autoSize = xml.GetAttributeBool("autoSize", false);

            str = xml.GetAttribute("errorSign");
            if (str != null)
                showErrorSign = str == "true";

            _playing = xml.GetAttributeBool("playing", true);

            str = xml.GetAttribute("color");
            if (str != null)
                this.color = ToolSet.ConvertFromHtmlColor(str);

            str = xml.GetAttribute("fillMethod");
            if (str != null)
                _content.fillMethod = FieldTypes.ParseFillMethod(str);

            if (_content.fillMethod != FillMethod.None)
            {
                _content.fillOrigin = xml.GetAttributeInt("fillOrigin");
                _content.fillClockwise = xml.GetAttributeBool("fillClockwise", true);
                _content.fillAmount = (float)xml.GetAttributeInt("fillAmount", 100) / 100;
            }

            if (_url != null)
                LoadContent();
        }
Exemple #49
0
 public void AppendChild(XML child)
 {
     this.elements.Add(child);
 }