예제 #1
0
    //-------------------------------------------------------------------------
    public void asyncLoadBundle(string bundle_path, _eAsyncAssetLoadType loader_type, Action <string, AssetBundle> loaded_action)
    {
        AssetBundle asset_bundle = null;

        if (MapAssetBundle.TryGetValue(bundle_path, out asset_bundle))
        {
            loaded_action(bundle_path, asset_bundle);
            return;
        }
        else
        {
            Action <string, AssetBundle> action = null;
            if (!MapLoadAssetBundleCallBack.TryGetValue(bundle_path, out action))
            {
                action = loaded_action;
            }
            else
            {
                action += loaded_action;
            }
        }

        if (loader_type == _eAsyncAssetLoadType.LocalBundle)
        {
            AsyncAssetLoaderMgr.LocalBundleAsyncLoader.getAssetBundle(bundle_path, _loadAssetBundleCallBack);
        }
        else if (loader_type == _eAsyncAssetLoadType.WWWBundle)
        {
            AsyncAssetLoaderMgr.WWWBundleAsyncLoader.getAssetBundle(bundle_path, _loadAssetBundleCallBack);
        }

        //return null;
    }
예제 #2
0
 //-------------------------------------------------------------------------
 public void destroy()
 {
     releaseAssetBundle();
     MapLoadAssetBundleCallBack.Clear();
     MapLoaderTicket.Clear();
     ListLoaderAssetBundlesDone.Clear();
     IsCancel = true;
 }
예제 #3
0
    //-------------------------------------------------------------------------
    void _loadAssetBundleCallBack(string bundle_path, AssetBundle asset_bundle)
    {
        MapAssetBundle[bundle_path] = asset_bundle;
        Action <string, AssetBundle> action = null;

        if (MapLoadAssetBundleCallBack.TryGetValue(bundle_path, out action))
        {
            action(bundle_path, asset_bundle);
            MapLoadAssetBundleCallBack.Remove(bundle_path);
        }

        foreach (var i in MapLoaderTicket)
        {
            Dictionary <string, AssetBundle> map_needloadab = i.Key.MapNeedLoadAssetBundle;
            Dictionary <string, AssetBundle> map_loadedab   = i.Key.MapLoadedAssetBundle;
            if (map_needloadab.ContainsKey(bundle_path))
            {
                map_needloadab.Remove(bundle_path);
                map_loadedab[bundle_path] = asset_bundle;
                if (map_needloadab.Count <= 0)
                {
                    List <AssetBundle> list_bundle = new List <AssetBundle>();
                    foreach (var ab in map_loadedab)
                    {
                        list_bundle.Add(ab.Value);
                    }
                    i.Value(list_bundle);
                    ListLoaderAssetBundlesDone.Add(i.Key);
                }
            }
        }

        foreach (var i in ListLoaderAssetBundlesDone)
        {
            MapLoaderTicket.Remove(i);
        }

        ListLoaderAssetBundlesDone.Clear();
    }