예제 #1
0
        private static void Add2LoadedAssets(string assetPath, LoadedAsset loadedAsset)
        {
            var requestList = GetLoadRequest(assetPath);

            for (int i = 0; i < requestList.Count; i++)
            {
                var     request = requestList[i];
                UObject asset   = loadedAsset.assetbundle.LoadAssetAsync(request.assetName, request.assetType).asset;
                if (null != request.callback)
                {
                    request.callback(asset);
                }
                if (null != request.luaCallback)
                {
                    request.luaCallback.Call(asset);
                }
            }
            m_loadedAssets.Add(assetPath, loadedAsset);
        }
예제 #2
0
 private void InvokeWWWRequest()
 {
     if (m_wwws.Keys.Count <= 0)
     {
         return;
     }
     foreach (KeyValuePair <string, WWW> www in m_wwws)
     {
         WWW download = www.Value;
         if (null != download.error)
         {
             m_errors.Add(www.Key, download.error);
             finishedList.Add(www.Key);
         }
         else
         {
             if (download.isDone)
             {
                 AssetBundle bundle = download.assetBundle;
                 if (null == bundle)
                 {
                     m_errors.Add(www.Key, string.Format("{0} is not a valid asset bundle.", www.Key));
                 }
                 else
                 {
                     LoadedAsset loadedAsset = new LoadedAsset {
                         assetbundle = bundle
                     };
                     Add2LoadedAssets(www.Key, loadedAsset);
                 }
                 finishedList.Add(www.Key);
             }
         }
     }
     for (int i = 0; i < finishedList.Count; i++)
     {
         m_wwws[finishedList[i]].Dispose();
         m_wwws[finishedList[i]] = null;
         m_wwws.Remove(finishedList[i]);
     }
     finishedList.Clear();
 }