Beispiel #1
0
        /// <summary>
        /// 异步加载资源
        /// </summary>
        /// <param name="assetName">资源名</param>
        /// <param name="priority">优先级</param>
        public async CTask <object> LoadAsset(string assetName, int priority = 0)
        {
            bool   isSuccess = false;
            object callBack  = null;

            Component.LoadAsset(assetName, priority, new LoadAssetCallbacks(
                                    (backAssetName, asset, duration, userData) =>
            {
                callBack  = asset;
                isSuccess = true;
            },
                                    (backAssetName, status, errorMessage, userData) =>
            {
                Log.Error($"资源 :{assetName}  加载失败,errorMessage:{errorMessage}");
                isSuccess = false;
            }));
            await CTask.WaitUntil(() => isSuccess);

            return(callBack);
        }
Beispiel #2
0
 /// <summary>
 /// 等待实体加载完成
 /// </summary>
 public virtual async CTask Await()
 {
     await CTask.WaitUntil(() => isShow && isInstance);
 }
 /// <summary>
 /// 等待立绘加载完成
 /// </summary>
 public virtual async CTask Await()
 {
     await CTask.WaitUntil(() => { return(_isLoaded); });
 }
Beispiel #4
0
 private async CTask waitLoadComplate()
 {
     await CTask.WaitUntil(() => { return(loadCount == loadedCount); });
 }
Beispiel #5
0
 /// <summary>
 /// 等待界面加载完成
 /// </summary>
 public virtual async CTask Await()
 {
     await CTask.WaitUntil(() => isInstance && isOpen);
 }
Beispiel #6
0
 /// <summary>
 /// 等待界面加载完成
 /// </summary>
 public virtual async CTask Await()
 {
     await CTask.WaitUntil(() => { return(gameObject != null || m_isDispose); });
 }