Exemplo n.º 1
0
    public static void Start(LoadingCallback callback, LoadingCallback finish = null)
    {
        GameObject fab = (GameObject)Resources.Load("Prefabs\\Loading");    // 载入母体
        GameObject box = Instantiate(fab, new Vector3(0, 0, -1), Quaternion.identity);

        loading = box.GetComponent <Loading>();
        loading.loadingCallback = callback;
        loading.finishCallback  = finish;
        isUsing = true;
        box.SetActive(true);
    }
Exemplo n.º 2
0
    public static void LoadAssetBundle(string name, LoadingCallback callback)
    {
        if (loadedInfo.ContainsKey(name))
        {
            callback(loadedInfo[name]);
            return;
        }
        string path = GetAssetBundlePath(name);
        int    ver  = GetAssetBundleVer(name);

        Instance.StartCoroutine(DownloadAsseBundle(path, ver, (AssetBundle asset) => {
            callback(asset);
        }));
    }
        static int _m_LoadAssetBundleAndAllDependencies_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    string          name     = LuaAPI.lua_tostring(L, 1);
                    LoadingCallback callback = translator.GetDelegate <LoadingCallback>(L, 2);

                    BoyApp.LoadAssetBundleAndAllDependencies(name, callback);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Exemplo n.º 4
0
    public static void LoadAssetBundleAndAllDependencies(string name, LoadingCallback callback)
    {
        string[] loadingDps = BoyApp.manifest.GetAllDependencies(name);

        List <string> needLoading = new List <string>();

        foreach (var key in loadingDps)
        {
            needLoading.Add(key);
            BoyApp.LoadAssetBundle(key, (System.Object asset) => {
                needLoading.Remove(key);

                if (needLoading.Count == 0)
                {
                    BoyApp.LoadAssetBundle(name, callback);
                }
            });
        }

        if (loadingDps.Length == 0)
        {
            BoyApp.LoadAssetBundle(name, callback);
        }
    }