FairyGUI.UIPackage.GetItemAssetByURL C# (CSharp) Method

GetItemAssetByURL() public static method

Get a asset with a certain name.
public static GetItemAssetByURL ( string url ) : object
url string Resource url.
return object
        public static object GetItemAssetByURL(string url)
        {
            PackageItem item = GetItemByURL(url);
            if (item == null)
                return null;

            return item.owner.GetItemAsset(item);
        }

Usage Example

Example #1
0
        override public void Setup_AfterAdd(XML cxml)
        {
            base.Setup_AfterAdd(cxml);

            if (_downEffect == 2)
            {
                this.SetPivot(0.5f, 0.5f);
            }

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

            if (xml == null)
            {
                this.title = string.Empty;
                this.icon  = null;
                return;
            }

            string str;

            this.title = xml.GetAttribute("title");
            this.icon  = xml.GetAttribute("icon");
            str        = xml.GetAttribute("selectedTitle");
            if (str != null)
            {
                this.selectedTitle = str;
            }
            str = xml.GetAttribute("selectedIcon");
            if (str != null)
            {
                this.selectedIcon = str;
            }

            str = xml.GetAttribute("titleColor");
            if (str != null)
            {
                this.titleColor = ToolSet.ConvertFromHtmlColor(str);
            }
            str = xml.GetAttribute("controller");
            if (str != null)
            {
                _relatedController = parent.GetController(str);
            }
            pageOption.id = xml.GetAttribute("page");
            this.selected = xml.GetAttributeBool("checked", false);

            str = xml.GetAttribute("sound");
            if (str != null)
            {
                sound = UIPackage.GetItemAssetByURL(str) as AudioClip;
            }

            str = xml.GetAttribute("volume");
            if (str != null)
            {
                soundVolumeScale = float.Parse(str) / 100f;
            }
        }
All Usage Examples Of FairyGUI.UIPackage::GetItemAssetByURL