Пример #1
0
        static private IEnumerator IE_LoadAssetAsync <T>(JABLoadOperation request, Action <T> assetCallback = null, Action <bool> levelCallBack = null) where T : UnityEngine.Object
        {
            if (request == null)
            {
                if (assetCallback != null)
                {
                    assetCallback(null);
                }
                if (levelCallBack != null)
                {
                    levelCallBack(false);
                }
                yield break;
            }
            yield return(ABLoaderMgr.StartCoroutine(request));

            if (assetCallback != null)
            {
                assetCallback((request as JABLoadAssetOperation).GetAsset <T>());
            }
            if (levelCallBack != null)
            {
                levelCallBack(true);
            }
        }
Пример #2
0
 /// <summary>
 /// 异步加载,回调形式,不用关心过程
 /// </summary>
 /// <param name="assetBundleName">包含变体</param>
 /// <param name="assetName"></param>
 /// <param name="callback"></param>
 static public void LoadLevelAsync(string assetBundleName, string levelName, bool isAdditive, Action <bool> callback)
 {
     ABLoaderMgr.StartCoroutine(IE_LoadAssetAsync <GameObject>(LoadLevelAsync(assetBundleName, levelName, isAdditive), null, callback));
 }
Пример #3
0
 /// <summary>
 /// 异步加载,回调形式,不用关心过程
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="assetBundleName">包含变体</param>
 /// <param name="assetName"></param>
 /// <param name="callback"></param>
 static public void LoadAssetAsync <T>(string assetBundleName, string assetName, Action <T> callback) where T : UnityEngine.Object
 {
     ABLoaderMgr.StartCoroutine(IE_LoadAssetAsync <T>(LoadAssetAsync <T>(assetBundleName, assetName), callback, null));
 }