Esempio n. 1
0
 static int CreateAssetBundleAsync(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         string arg0 = ToLua.CheckString(L, 1);
         RequestLoadBundle.OnCreateAssetBundle arg1 = (RequestLoadBundle.OnCreateAssetBundle)ToLua.CheckDelegate <RequestLoadBundle.OnCreateAssetBundle>(L, 2);
         int o = ResourceUtil.CreateAssetBundleAsync(arg0, arg1);
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 2
0
    /// <summary>
    ///依赖bundle加载状态
    /// </summary>
    /// <param name="loadAssetInfo"></param>
    private static void PushPending(LoadAssetInfo loadAssetInfo)
    {
        EnterLoadDepend(loadAssetInfo);
        string bundleName = loadAssetInfo.bundleName;

        if (!_pendingLoadAssetInfoList.ContainsKey(bundleName))
        {
            // 加载bundle
            int abRequestId = ResourceUtil.CreateAssetBundleAsync(bundleName, OnLoadPeningBundle);
            PendingLoadAssetInfo pendingInfo = new PendingLoadAssetInfo();
            pendingInfo            = GetTempPendingLoadAssetInfo();
            pendingInfo.reqeustId  = abRequestId;
            pendingInfo.bundleName = bundleName;
            _pendingLoadAssetInfoList.Add(bundleName, pendingInfo);
        }
    }
Esempio n. 3
0
    void CreateBundle()
    {
        int requestId = ResourceUtil.CreateAssetBundleAsync(pname, (string tBundleName, AssetBundle tAssetBundle, int tRequestId) =>
        {
            Debug.Log("==========================load bundle success " + tBundleName);
            // 卸载
            if (createState == CreateState.Destory)
            {
                ResourceUtil.DestoryAssetBundle(tBundleName);
            }
        });

        // 取消加载
        if (createState == CreateState.Cancel)
        {
            ResourceUtil.CancelLoadBundleAsync(requestId);
        }
    }