Inheritance: IDisposable
Beispiel #1
0
	// 携程加载
	public IEnumerator CommonLoad()
	{
		mCommonLoader = new WWW (mCommonBundlePath);

		while (!mCommonLoader.isDone) {
			mCommonResLoadProgress = mCommonLoader.progress;

			if (null != mLoadProgress) {
				mLoadProgress (mBundleName, mCommonLoader.progress);
			}
			yield return mCommonLoader.progress;
			mCommonResLoadProgress = mCommonLoader.progress;
		}

		if (mCommonResLoadProgress >= 1.0f) { // 表示已经加载完成
			if (null != mLoadProgress) {
				mLoadProgress (mBundleName, mCommonLoader.progress);
			}

			if (null != mLoadFinish) {
				this.mLoadFinish (mBundleName);
			}
				
			mABLoader = new IABResLoader (mCommonLoader.assetBundle);
		} else {
			Debug.LogError ("load bundle error == " + mBundleName);
		}

		mCommonLoader = null;


	}
Beispiel #2
0
    public IEnumerator CommonLoad()
    {
        commonLoader = new WWW(commonBundlePath);
        while (!commonLoader.isDone)
        {
            commResLoaderProcess = commonLoader.progress;
            if (loaderProgress != null)
            {
                loaderProgress(bundleName, commResLoaderProcess);
            }
            yield return(commonLoader.progress);

            commResLoaderProcess = commonLoader.progress;
        }
        if (commResLoaderProcess >= 1.0)//表示已经加载完成
        {
            abResLoader = new IABResLoader(commonLoader.assetBundle);
            if (loaderProgress != null)
            {
                loaderProgress(bundleName, commResLoaderProcess);
            }
            if (loadFinish != null)
            {
                loadFinish(bundleName);
            }
        }
        else
        {
            Debug.Log("load bundle error ==" + bundleName);
        }
        commonLoader = null;
    }
Beispiel #3
0
 /// <summary>
 /// 释放功能
 /// </summary>
 public void DisPose()
 {
     if (abResLoader != null)
     {
         abResLoader.Dispose();
         abResLoader = null;
     }
 }
Beispiel #4
0
 /// <summary>
 /// 卸载内存镜像
 /// </summary>
 public void Dispose()
 {
     if (mABResLoader != null)
     {
         mABResLoader.Dispose();
         mABResLoader = null;
     }
 }
Beispiel #5
0
 /// <summary>
 /// Releases all resource used by the <see cref="IABLoader"/> object.
 /// </summary>
 /// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="IABLoader"/>. The <see cref="Dispose"/>
 /// method leaves the <see cref="IABLoader"/> in an unusable state. After calling <see cref="Dispose"/>, you must
 /// release all references to the <see cref="IABLoader"/> so the garbage collector can reclaim the memory that the
 /// <see cref="IABLoader"/> was occupying.</remarks>
 public void Dispose()
 {
     if (null != mABLoader)
     {
         mABLoader.Dispose();
         mABLoader = null;
     }
 }
Beispiel #6
0
 public IABLoader(LoaderProgrecess loaderProgrecess, LoadFinish loadFinish)
 {
     commonBundlePath     = "";
     bundleName           = "";
     commResLoaderProcess = 0;
     this.loaderProgress  = loaderProgrecess;
     this.loadFinish      = loadFinish;
     abResLoader          = null;
 }
Beispiel #7
0
    public IEnumerator LoadAB()
    {
        //WWW类加载方法
        //mLoader = new WWW(mBundleWWWPath);
        //while (!mLoader.isDone)
        //{
        //    mLoadProcess = mLoader.progress;
        //    if (LoadProgressEvent != null)
        //    {
        //        LoadProgressEvent.Invoke(mBundleName, mLoadProcess);
        //    }
        //    yield return mLoader.progress;
        //    mLoadProcess = mLoader.progress;
        //}
        ////加载完成
        //if (mLoadProcess >= 1.0f)
        //{
        //    mABResLoader = new IABResLoader(mLoader.assetBundle);
        //    if (LoadProgressEvent != null)
        //    {
        //        LoadProgressEvent.Invoke(mBundleName, mLoadProcess);
        //    }
        //    if (LoadFinishEvent != null)
        //    {
        //        LoadFinishEvent(mBundleName);
        //    }

        //}
        //else
        //{
        //    Debug.LogError("加载Bundle错误" + mBundleName);
        //}
        //mLoader = null;
        //使用LoadFromFileAsync
        AssetBundleCreateRequest createRequest = AssetBundle.LoadFromFileAsync(mBundleFilePath);

        yield return(createRequest);

        if (createRequest.assetBundle != null)
        {
            mLoadProcess = 1;
            mABResLoader = new IABResLoader(createRequest.assetBundle);
            if (LoadProgressEvent != null)
            {
                LoadProgressEvent.Invoke(mBundleName, mLoadProcess);
            }
            if (LoadFinishEvent != null)
            {
                LoadFinishEvent(mBundleName);
            }
        }
        else
        {
            Debug.LogError("加载Bundle错误" + mBundleName);
        }
        mLoader = null;
    }
Beispiel #8
0
 public IABLoader(LoaderProgress loaderProgress, LoadFinish loadFinish)
 {
     mBundleName       = "";
     mBundleWWWPath    = "";
     mLoadProcess      = 0;
     LoadProgressEvent = loaderProgress;
     LoadFinishEvent   = loadFinish;
     mABResLoader      = null;
 }
 public IABLoader(LoaderProgress tmpLoaderProgress, LoadFinish tmpLoadFinish)
 {
     bundleName            = "";
     commonBundlePath      = "";
     commResLoaderProgress = 0;
     loadProgress          = tmpLoaderProgress;
     loadFinish            = tmpLoadFinish;
     abResLoader           = null;
 }
Beispiel #10
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="tmpProgress">加载时每帧回调</param>
    /// <param name="tmpFinish">完成时回调</param>
    public IABLoader(LoadProgrecess tmpProgress = null, LoadFinish tmpFinish = null)
    {
        this.bundleName              = "";
        this.commonBundlePath        = "";
        this.commonResLoaderProgress = 0;
        this.abResLoader             = null;

        this.loadProgrecess = tmpProgress;
        this.loadFinish     = tmpFinish;
    }
Beispiel #11
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="bundleName">ab标签</param>
    /// <param name="tmpFinish">完成时回调</param>
    /// <param name="tmpProgress">加载时每帧回调</param>
    public IABLoader(string bundleName, LoadFinish tmpFinish = null, LoadProgrecess tmpProgress = null)
    {
        this.bundleName              = bundleName;
        this.commonBundlePath        = IPathTool.GetWWWAssetBundlePath() + "/" + bundleName;
        this.commonResLoaderProgress = 0;
        this.abResLoader             = null;

        this.loadProgrecess = tmpProgress;
        this.loadFinish     = tmpFinish;
    }
Beispiel #12
0
 public IABLoader(LoadProgress loadProgress, LoadFinish loadFinish)
 {
     bundleName             = "";
     commonBundlePath       = "";
     commonResLoaderProcess = 0;
     loadProgress           = null;
     loadFinish             = null;
     abResLoader            = null;
     this.loadProgress      = loadProgress;
     this.loadFinish        = loadFinish;
 }
Beispiel #13
0
    // 协程加载
    public IEnumerator CommonLoad()
    {
        Debug.Log("commonBundlePath ==" + commonBundlePath);

        // 从persistent path 里 先加载 ?
        // 如果有 就从 里面加载。
        //  AssetBundle.LoadFromFile

        commonLoaer = new WWW(commonBundlePath);

        while (!commonLoaer.isDone)
        {
            commResLoaderProcess = commonLoaer.progress;


            if (loadProgress != null)
            {
                loadProgress(bundleName, commResLoaderProcess);
            }

            yield return(commonLoaer.progress);

            commResLoaderProcess = commonLoaer.progress;
        }


        if (commResLoaderProcess >= 1.0f)     //表示已经加载完成
        {
            Debug.Log("load 11111111111111 finish ==" + bundleName);

            //yujie fixed
            abResloader = new IABResLoader(commonLoaer.assetBundle);

            if (loadProgress != null)
            {
                loadProgress(bundleName, commResLoaderProcess);
            }

            if (loadFinish != null)
            {
                this.loadFinish(bundleName);
            }

            //  abResloader = new IABResLoader(commonLoaer.assetBundle);
        }
        else
        {
            Debug.LogError("load  bundle error ==" + bundleName);
        }

        commonLoaer = null;
    }
Beispiel #14
0
    public IEnumerator CommonLoad()
    {
        commonLoaderWWW = new WWW(commonBundlePath);

        while (!commonLoaderWWW.isDone)
        {
            commonResLoaderProcess = commonLoaderWWW.progress;

            if (loadProgress != null)
            {
                loadProgress(bundleName, commonResLoaderProcess);
            }

            yield return(null);
            // 感觉这两句没必要(我直接改成 yield return null)
            //yield return commonLoader.progress;
            //commonResLoaderProcess = commonLoader.progress;
        }


        if (commonResLoaderProcess >= 1.0f) // 加载完成

        {
            abResLoader = new IABResLoader(commonLoaderWWW.assetBundle);

            if (loadProgress != null)
            {
                loadProgress(bundleName, commonResLoaderProcess);
            }

            if (loadFinish != null)
            {
                loadFinish(bundleName);
            }
        }
        else
        {
            Debug.LogError("Load Bundle Error = " + bundleName);
        }

        commonLoaderWWW = null;
    }
Beispiel #15
0
    /// <summary>
    /// 协程加载资源
    /// </summary>
    /// <returns></returns>
    public IEnumerator CommonLoad()
    {
        if (string.IsNullOrEmpty(commonBundlePath))
        {
            Debug.LogError("commonBundlePath is null");
            yield return(null);
        }
        commonLoader = new WWW(commonBundlePath);
        while (!commonLoader.isDone)
        {
            commonResLoaderProgress = commonLoader.progress;
            yield return(commonLoader.progress);

            if (loadProgrecess != null)
            {
                loadProgrecess(bundleName, commonResLoaderProgress);
            }
            commonResLoaderProgress = commonLoader.progress;
        }
        //加载完成
        if (commonResLoaderProgress >= 1.0)
        {
            //拿到加载的bundle创建IABResLoader对象
            abResLoader = new IABResLoader(commonLoader.assetBundle);
            if (loadProgrecess != null)
            {
                loadProgrecess(bundleName, commonResLoaderProgress);
            }
            if (loadFinish != null)
            {
                loadFinish(bundleName);
            }
        }
        else
        {
            Debug.LogError("load bundle error == " + bundleName);
        }
        //释放WWW资源
        commonLoader = null;
    }
Beispiel #16
0
    // 携程加载
    public IEnumerator CommonLoad()
    {
        mCommonLoader = new WWW(mCommonBundlePath);

        while (!mCommonLoader.isDone)
        {
            mCommonResLoadProgress = mCommonLoader.progress;

            if (null != mLoadProgress)
            {
                mLoadProgress(mBundleName, mCommonLoader.progress);
            }
            yield return(mCommonLoader.progress);

            mCommonResLoadProgress = mCommonLoader.progress;
        }

        if (mCommonResLoadProgress >= 1.0f)           // 表示已经加载完成
        {
            if (null != mLoadProgress)
            {
                mLoadProgress(mBundleName, mCommonLoader.progress);
            }

            if (null != mLoadFinish)
            {
                this.mLoadFinish(mBundleName);
            }

            mABLoader = new IABResLoader(mCommonLoader.assetBundle);
        }
        else
        {
            Debug.LogError("load bundle error == " + mBundleName);
        }

        mCommonLoader = null;
    }
Beispiel #17
0
	/// <summary>
	/// Releases all resource used by the <see cref="IABLoader"/> object.
	/// </summary>
	/// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="IABLoader"/>. The <see cref="Dispose"/>
	/// method leaves the <see cref="IABLoader"/> in an unusable state. After calling <see cref="Dispose"/>, you must
	/// release all references to the <see cref="IABLoader"/> so the garbage collector can reclaim the memory that the
	/// <see cref="IABLoader"/> was occupying.</remarks>
	public void Dispose()
	{
		if (null != mABLoader) {
			mABLoader.Dispose ();
			mABLoader = null;
		}
	}