Esempio n. 1
0
 /// <summary>
 /// 异步加载资源
 /// </summary>
 /// <param name="path"></param>
 /// <param name="resName"></param>
 /// <returns></returns>
 public static void LoadAsync(string path, string resName)
 {
     if (sInstance.m_eLoadType == LOAD_TYPE.NORMAL)
     {
         if (sInstance.m_mapRes.ContainsKey(path))
         {
             if (!sInstance.m_mapAsyncLoader.ContainsKey(resName))
             {
                 AsyncLoader loader = AsyncLoader.StartLoad(((AssetBundle)sInstance.m_mapRes[path].GetAssetObject()), resName);
                 sInstance.m_mapAsyncLoader.Add(resName, loader);
             }
             else
             {
                 Debug.Log("The resources is already in the list. " + resName);
             }
         }
         else
         {
             Debug.LogError("The resources is not exist. " + path);
         }
     }
     else
     {
         if (!sInstance.m_mapAsyncLoader.ContainsKey(resName))
         {
             UnityEngine.Object obj = ResourceMgr.LoadEditor(resName);
             sInstance.m_mapAsyncLoader.Add(resName, obj);
         }
         else
         {
             Debug.Log("The resources is already in the list. " + resName);
         }
     }
 }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        AssetBundle ab   = null;
        string      path = "" + Application.dataPath + "/example/bundle/combine_uncompress.unity3d";

        if (FileLoader.IsExist(path))
        {
            ab          = AssetBundleLoader.CreateFromFile(path);
            this.loader = AsyncLoader.StartLoad(ab, "item", finish_callback);
        }
    }