FairyGUI.UIPackage.LoadAtlas C# (CSharp) Method

LoadAtlas() private method

private LoadAtlas ( PackageItem item ) : void
item PackageItem
return void
        void LoadAtlas(PackageItem item)
        {
            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);
                item.texture.storedODisk = _resBundle == null;

                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 = new NTexture(tex);
                    item.texture.alphaTexture.storedODisk = _resBundle == null;
                }
            }
        }