Пример #1
0
        public void GetResourceByPathAsync(string path, Action <AsyncResource> callBack = null, System.Object param = null, bool loadAll = false)
        {
            var ar = new AsyncResource(path, null, param);

            ar.loadedAsset = Resources.Load(path);
            callBack.Invoke(ar);
        }
Пример #2
0
        public void GetResourceByPathAsync(List <string> path, Action <Dictionary <string, AsyncResource> > callBack = null, System.Object param = null)
        {
            if (path.Count == 0 ||
                (path.Count == 1 && path[0] == "param"))
            {
                if (callBack != null)
                {
                    Dictionary <string, AsyncResource> nullMap = new Dictionary <string, AsyncResource>();
                    nullMap.Add("param", new AsyncResource("param", null, param));
                    callBack(nullMap);
                }
                return;
            }
            Dictionary <string, AsyncResource> item = new Dictionary <string, AsyncResource>();

            foreach (string resPath in path)
            {
                if (item.ContainsKey(resPath))
                {
                    continue;
                }

                var ar = new AsyncResource(resPath, null, param);
                ar.loadedAsset = Resources.Load(resPath);
                item.Add(resPath, ar);
            }
            callBack(item);
        }
Пример #3
0
 private void OnPreloadedResource(AsyncResource ar)
 {
     ++m_curPreloaded;
     if (m_onResourcePreloaded != null && ar != null && ar.loadedAsset != null)
     {
         m_onResourcePreloaded.Invoke(ar);
     }
 }
Пример #4
0
        AsyncResource CreateAsyncResource(string resPath, object param, bool loadAll = false)
        {
            string assetName = null;

            resPath = resPath.ToLower();
            AsyncResource ar = new AsyncResource(resPath, null, param);

            ar.AsyncOp = (string.IsNullOrEmpty(resPath) ? null : Resources.LoadAsync(resPath));
            return(ar);
        }
Пример #5
0
 public SingleAsyncRes(Action <AsyncResource> callBack, AsyncResource res)
 {
     m_callBack = callBack;
     m_res      = res;
 }
Пример #6
0
 private static void LoadAssetBundleAsync(string resPath, string assetName, AsyncResource ar, bool loadAll = false)
 {
     ar.isAssetBundleDone = false;
     ar.isLoadAssetBundle = true;
 }