Пример #1
0
 public override AssetAsyncLoad LoadAssetAsync(string assetName, UnityAction <Object> loadedCallback, UnityAction <float> progressCallback, AssetLoadPriority priority = AssetLoadPriority.Normal)
 {
     if (m_CurrentLoadTask != null)
     {
         if (m_AssetLoadList[(int)priority].ContainsKey(assetName))
         {
             var loadTask = m_AssetLoadList[(int)priority][assetName];
             loadTask.AssetName = assetName;
             var asyncLoad = new AssetAsyncLoad(assetName);
             loadTask.AddCallback(asyncLoad, loadedCallback, progressCallback);
             return(asyncLoad);
         }
         else
         {
             var loadTask = AssetLoadTask.GetAssetLoadTask();
             loadTask.AssetName = assetName;
             var asyncLoad = new AssetAsyncLoad(assetName);
             loadTask.AddCallback(asyncLoad, loadedCallback, progressCallback);
             m_AssetLoadList[(int)priority].Add(assetName, loadTask);
             return(asyncLoad);
         }
     }
     else
     {
         var loadTask = AssetLoadTask.GetAssetLoadTask();
         loadTask.AssetName = assetName;
         var asyncLoad = new AssetAsyncLoad(assetName);
         loadTask.AddCallback(asyncLoad, loadedCallback, progressCallback);
         m_CurrentLoadTask = loadTask;
         StartLoadAsset();
         return(asyncLoad);
     }
 }
Пример #2
0
        public void RemoveCallback(AssetAsyncLoad asyncLoad)
        {
            if (m_LoadedCallbackList.ContainsKey(asyncLoad))
            {
                m_LoadedCallbackList.Remove(asyncLoad);
            }

            if (m_ProgressCallbackList.ContainsKey(asyncLoad))
            {
                m_ProgressCallbackList.Remove(asyncLoad);
            }
        }
Пример #3
0
        public void AddCallback(AssetAsyncLoad asyncLoad, UnityAction <Object> loaded, UnityAction <float> progress)
        {
            if (loaded != null)
            {
                m_LoadedCallbackList.Add(asyncLoad, loaded);
            }

            if (progress != null)
            {
                m_ProgressCallbackList.Add(asyncLoad, progress);
            }
        }
Пример #4
0
 public override void RemoveLoadRequest(AssetAsyncLoad asyncRequest)
 {
     if (asyncRequest != null)
     {
         for (int i = 0; i < m_AssetLoadList.Count; ++i)
         {
             if (m_AssetLoadList[i].ContainsKey(asyncRequest.Name))
             {
                 m_AssetLoadList[i][asyncRequest.Name].RemoveCallback(asyncRequest);
             }
         }
     }
 }
Пример #5
0
 public override void RemoveLoadRequest(AssetAsyncLoad asyncRequest)
 {
     m_AssetLoader.RemoveLoadRequest(asyncRequest);
 }
Пример #6
0
 /// <summary>
 /// 移除某一个资源的加载任务中的一个回调,只能移除还未加载的任务中的回调
 /// </summary>
 public abstract void RemoveLoadRequest(AssetAsyncLoad asyncRequest);