Exemple #1
0
        public static void LoadAsync(string abName, Action <List <Sprite> > callback)
        {
            if (string.IsNullOrEmpty(abName))
            {
                Debug.LogError("abName or assetName is null!!!");
                if (callback != null)
                {
                    callback(null);
                }
                return;
            }

            Action <AssetLoadData> tCallBack = null;

            if (callback != null)
            {
                tCallBack = (data) =>
                {
                    if (data != null && data.mAssets != null)
                    {
                        List <Sprite> spriteList = new List <Sprite>();
                        spriteList = data.mAssets.ConvertAll((item) => { return(item as Sprite); });
                        callback(spriteList);
                    }
                    else
                    {
                        callback(null);
                    }
                };
            }

            HSpriteAtlas res = Get <HSpriteAtlas>(abName, "*", AssetType.eSpriteAtlas);

            res.StartLoad(false, true, false, tCallBack);
        }
Exemple #2
0
        public static List <Sprite> Load(string abName)
        {
            if (string.IsNullOrEmpty(abName))
            {
                Debug.LogError("abName or assetName is null!!!");
                return(null);
            }

            HSpriteAtlas res = Get <HSpriteAtlas>(abName, "*", AssetType.eSpriteAtlas);

            res.StartLoad(true, true, false, null);
            List <Sprite> spriteList = new List <Sprite>();

            for (int i = 0; i < res.AssetData.mAssets.Count; i++)
            {
                spriteList.Add(res.AssetData.mAssets[i] as Sprite);
            }

            return(spriteList);
        }
Exemple #3
0
 //协程加载图集
 public AsyncRequest LoadSpriteAtlasCoRequest(string abName)
 {
     return(HSpriteAtlas.LoadCoRequest(abName));
 }
Exemple #4
0
 //同步加载图集
 public List <Sprite> LoadSpriteAtlas(string abName)
 {
     return(HSpriteAtlas.Load(abName));
 }
Exemple #5
0
 //异步加载图集
 public void LoadSpriteAtlasAsync(string abName, Action <List <Sprite> > callback)
 {
     HSpriteAtlas.LoadAsync(abName, callback);
 }