当前位置: 首页>>代码示例>>C#>>正文


C# Utils.XML类代码示例

本文整理汇总了C#中FairyGUI.Utils.XML的典型用法代码示例。如果您正苦于以下问题:C# XML类的具体用法?C# XML怎么用?C# XML使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XML类属于FairyGUI.Utils命名空间,在下文中一共展示了XML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConstructFromXML

        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);
        }
开发者ID:niuniuzhu,项目名称:FairyGUI-unity,代码行数:27,代码来源:GScrollBar.cs

示例2: Setup_AfterAdd

        public override void Setup_AfterAdd(XML xml)
        {
            base.Setup_AfterAdd(xml);

            XML cxml = xml.GetNode("gearColor");
            if (cxml != null)
                gearColor.Setup(cxml);
        }
开发者ID:niuniuzhu,项目名称:FairyGUI-unity,代码行数:8,代码来源:GImage.cs

示例3: Setup_BeforeAdd

        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);
        }
开发者ID:niuniuzhu,项目名称:FairyGUI-unity,代码行数:13,代码来源:GImage.cs

示例4: Setup

        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);
            }
        }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:47,代码来源:GearBase.cs

示例5: Setup

        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);
        }
开发者ID:hxyxj,项目名称:FairyGUI-unity,代码行数:47,代码来源:GearBase.cs

示例6: GetItemAsset


//.........这里部分代码省略.........

                        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;
            }
        }
开发者ID:yinlei,项目名称:Fishing,代码行数:101,代码来源:UIPackage.cs

示例7: TranslateComponent

        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++;
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:yinlei,项目名称:Fishing,代码行数:75,代码来源:UIPackage.cs

示例8: Add

 public void Add(XML xml)
 {
     rawList.Add(xml);
 }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:4,代码来源:XMLList.cs

示例9: Enumerator

 public Enumerator(List<XML> source, string selector)
 {
     _source = source;
     _selector = selector;
     _index = -1;
     if (_source != null)
         _total = _source.Count;
     else
         _total = 0;
     _current = null;
 }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:11,代码来源:XMLList.cs

示例10: Setup_AfterAdd

        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);
            }
        }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:18,代码来源:GObject.cs

示例11: Setup_AfterAdd

        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;
        }
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:40,代码来源:GComboBox.cs

示例12: Setup_BeforeAdd

        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();
        }
开发者ID:kensong1194717296,项目名称:FairyGUI-unity,代码行数:47,代码来源:GLoader.cs

示例13: Setup_BeforeAdd

        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);
            }
        }
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:42,代码来源:GGraph.cs

示例14: Setup_BeforeAdd

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

//.........这里部分代码省略.........
开发者ID:fairygui,项目名称:FairyGUI-unity,代码行数:101,代码来源:GList.cs

示例15: Setup_BeforeAdd

        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");
                }
            }
        }
开发者ID:niuniuzhu,项目名称:FairyGUI-unity,代码行数:83,代码来源:GList.cs


注:本文中的FairyGUI.Utils.XML类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。