コード例 #1
0
    public static void AsyncLoadForGameObject(string pathname, GameObject parnet, Action <bool, AssetBundleResult> callback)
    {
        if (Mode == ABLoaderMode.Self)
        {
            if (!ResBundleMgr.mIns.Cache.ContainsLoading(pathname))
            {
                AsyncLoader loader = BaseBundleLoader.CreateLoader <AsyncLoader>();
                if (loader == null)
                {
                    loader = new AsyncLoader();
                }

                if (callback != null)
                {
                    loader.onComplete += callback;
                }
                loader.Load(pathname, parnet);
            }
            else
            {
                BaseBundleLoader baseLoader = ResBundleMgr.mIns.Cache.GetLoading(pathname);

                if (callback != null)
                {
                    baseLoader.onComplete += callback;
                }
            }
        }
        else if (Mode == ABLoaderMode.ABTang)
        {
#if USE_TANGAB
#endif
        }
    }
コード例 #2
0
    public static void PreLoadForAssets(string pathname)
    {
        if (Mode == ABLoaderMode.Self)
        {
            if (!ResBundleMgr.mIns.Cache.ContainsLoading(pathname))
            {
                PreLoader loader = BaseBundleLoader.CreateLoader <PreLoader>();
                if (loader == null)
                {
                    loader = new PreLoader();
                }

                loader.Load(pathname);
            }
            else
            {
                LogMgr.LogErrorFormat("{0} is loading ", pathname);
            }
        }
        else if (Mode == ABLoaderMode.ABTang)
        {
#if USE_TANGAB
#endif
        }
    }
コード例 #3
0
    public static AssetBundleResult SyncLoadForAssetsWithResult(string pathname, Action <bool, AssetBundleResult> callback)
    {
        if (Mode == ABLoaderMode.Self)
        {
            if (!ResBundleMgr.mIns.Cache.ContainsLoading(pathname))
            {
                SyncLoader loader = BaseBundleLoader.CreateLoader <SyncLoader>();
                if (loader == null)
                {
                    loader = new SyncLoader();
                }

                if (callback != null)
                {
                    loader.onComplete += callback;
                }
                loader.Load(pathname);
                //get result
                AssetBundleResult result = loader.GetABResult();
                loader.Dispose();
                return(result);
            }
            else
            {
                LogMgr.LogErrorFormat("{0} is loading ", pathname);
            }
        }
        else if (Mode == ABLoaderMode.ABTang)
        {
#if USE_TANGAB
#endif
        }

        return(default(AssetBundleResult));
    }
コード例 #4
0
    public static UnityEngine.Object SyncLoadForAssets(string pathname)
    {
        if (Mode == ABLoaderMode.Self)
        {
            if (!ResBundleMgr.mIns.Cache.ContainsLoading(pathname))
            {
                SyncLoader loader = BaseBundleLoader.CreateLoader <SyncLoader>();
                if (loader == null)
                {
                    loader = new SyncLoader();
                }

                loader.Load(pathname);

                UnityEngine.Object result = loader.GetABResult().LoadedObject;
                loader.Dispose();

                return(result);
            }
            else
            {
                LogMgr.LogErrorFormat("{0} is loading ", pathname);
            }
        }
        else if (Mode == ABLoaderMode.ABTang)
        {
#if USE_TANGAB
            BundlePkgInfo info       = ResBundleMgr.mIns.BundleInformation.SeekInfo(pathname);
            string        resultpath = info.EditorPath.Replace("/", ".");
            manager.Load(resultpath);
#endif
        }

        return(null);
    }
コード例 #5
0
    public static void LoadScene(string name)
    {
        SceneSyncLoader loader = BaseBundleLoader.CreateLoader <SceneSyncLoader>();

        if (loader == null)
        {
            loader = new SceneSyncLoader();
        }

        loader.Load(name);
    }
コード例 #6
0
    public static void SyncLoad(string pathname, Action <bool, AssetBundleResult> callback)
    {
        if (Mode == ABLoaderMode.Self)
        {
            if (!ResBundleMgr.mIns.Cache.ContainsLoading(pathname))
            {
                SyncLoader loader = BaseBundleLoader.CreateLoader <SyncLoader>();
                if (loader == null)
                {
                    loader = new SyncLoader();
                }

                if (callback != null)
                {
                    loader.onComplete += callback;
                }
                loader.Load(pathname);

                loader.Dispose();
            }
            else
            {
                LogMgr.LogErrorFormat("{0} is loading ", pathname);
            }
        }
        else if (Mode == ABLoaderMode.ABTang)
        {
#if USE_TANGAB
            BundlePkgInfo info       = ResBundleMgr.mIns.BundleInformation.SeekInfo(pathname);
            string        resultpath = info.EditorPath.Replace("/", ".");
            manager.Load(resultpath, (result) =>
            {
                if (callback != null)
                {
                    callback(true, Info2Result(result));
                }
            });
#endif
        }
    }
コード例 #7
0
    public static GameObject SyncLoadForGameObjects(string pathname, GameObject parent)
    {
        if (Mode == ABLoaderMode.Self)
        {
            if (!ResBundleMgr.mIns.Cache.ContainsLoading(pathname))
            {
                SyncLoader loader = BaseBundleLoader.CreateLoader <SyncLoader>();

                if (loader == null)
                {
                    loader = new SyncLoader();
                }

                loader.Load(pathname, parent);

                AssetBundleResult result = loader.GetABResult();
                loader.Dispose();

                GameObject target = result.InstancedObject;
                if (target == null)
                {
                    target = result.SimpleInstance();
                }

                return(target);
            }
            else
            {
                LogMgr.LogErrorFormat("{0} is loading ", pathname);
            }
        }
        else if (Mode == ABLoaderMode.ABTang)
        {
#if USE_TANGAB
#endif
        }

        return(null);
    }
コード例 #8
0
    public static void LoadSceneAsync(string name, Action <BaseBundleLoader, int, int> OnProgressHandler, Action <bool, AssetBundleResult> oncomplete)
    {
        if (ResBundleMgr.mIns.Cache.ContainsLoading(name))
        {
            BaseBundleLoader loader = ResBundleMgr.mIns.Cache.GetLoading(name);

            if (oncomplete != null)
            {
                loader.onComplete += oncomplete;
            }

            if (OnProgressHandler != null)
            {
                loader.OnProgressHandler += OnProgressHandler;
            }
        }
        else
        {
            SceneAsyncLoader loader = BaseBundleLoader.CreateLoader <SceneAsyncLoader>();
            if (loader == null)
            {
                loader = new SceneAsyncLoader();
            }

            if (oncomplete != null)
            {
                loader.onComplete += oncomplete;
            }

            if (OnProgressHandler != null)
            {
                loader.OnProgressHandler += OnProgressHandler;
            }

            loader.Load(name);
        }
    }