Esempio n. 1
0
    public ABDataScene(string url, string resname, System.Type type, ABLoadScene sceneload)
        : base(url, resname, type, sceneload)
    {
        mProgress = 0;

        mCount = mLoadScene.asset.material.Length + 3;
    }
Esempio n. 2
0
    public override void Destory()
    {
        if (mLoadScene != null)
        {
            mLoadScene = null;
        }

        if (_ABLoadGoMono != null)
        {
            _ABLoadGoMono.Clear();
            GameObject.Destroy(_ABLoadGoMono);
            _ABLoadGoMono = null;
        }

        if (_scene != null)
        {
            _scene.SetActive(false);
            GameObject.Destroy(_scene);
            _scene = null;
        }
        _scene = null;

        if (_nav != null)
        {
            _nav.SetActive(false);
            GameObject.Destroy(_nav);
            _nav = null;
        }
        _nav      = null;
        _asset    = null;
        _lightmap = null;

        base.Destory();
    }
Esempio n. 3
0
    public override void Create()
    {
        mLoadScene = (ABLoadScene)mLoad;

        mProgress = 0;

        //mDontDestroyOnLoad = true;

        _Create();
    }
Esempio n. 4
0
    public static bool GetABScene(string url, string resname, System.Type type, ABDataType abtype = ABDataType.Mpq)
    {
#if UNITY_STANDALONE_WIN
        if (url.ToLower().EndsWith(".mp3"))
        {
            Debuger.LogError("ABLoad.Load GetAudioClip Not Supported Mp3! " + url);

            return(false);
        }
#endif

        ABLoadScene mAB = null;

        Debuger.Log("GetABScene " + url);

        do
        {
            //  获取已有
            mAB = mUti.mFactory.GetABLoadScene(url, version);

            Debuger.Log("mAB " + mAB);

            if (mAB == null)
            {
                break;
            }

            //  返回
            if (OnSceneFinishLoading != null)
            {
                //Debuger.Log("AssetBundleUti.OnFinishLoading " + System.IO.Path.GetFileName(url) + " " + resname + " " + type.ToString());

                OnSceneFinishLoading(url, resname, true);
            }

            return(true);
        } while (true);

        if (mAB == null)
        {
            mAB = mUti.mFactory.AddABLoadScene(url, version, abtype);
        }

        mUti.StartCoroutine(mUti.SceneCallBack(mAB, url, resname, abtype));

        return(true);
    }
Esempio n. 5
0
    public static ABDataScene GetObjectScene(string url)
    {
        ABLoadScene load = mUti.mFactory.GetABLoadScene(url, version);

        if (load == null)
        {
            return(null);
        }

        if (load.Error())
        {
            return(null);
        }

        ABDataScene data = new ABDataScene(url, "", typeof(ABLoadScene), load);

        datas.Add(data);

        return(data);
    }
Esempio n. 6
0
    public IEnumerator SceneCallBack(ABLoadScene mAB, string url, string resname, ABDataType abtype = ABDataType.Mpq)
    {
        Count++;

        string errorcode = string.Empty;

        do
        {
            if (!mAB.Create(url))
            {
                errorcode = "ABLoadScene Create " + url;

                break;
            }

            yield return(StartCoroutine(mAB.Waiting()));

            Debuger.Log("Waiting End ");

            while (true)
            {
                if (mAB.IsWWW())
                {
                    break;
                }

                yield return(null);
            }

            if (mAB.Error())
            {
                errorcode = mAB.GetErrorMsg();

                break;
            }
            else
            {
                //  返回
                if (OnSceneFinishLoading != null)
                {
                    //Debuger.Log("AssetBundleUti.OnFinishLoading " + System.IO.Path.GetFileName(url) + " " + resname + " " + type.ToString());

                    OnSceneFinishLoading(url, resname, true);
                }
            }

            yield return(1);
        }while (false);

        if (OnSceneFinishLoading != null)
        {
            //Debuger.Log("AssetBundleUti.OnFinishLoading " + System.IO.Path.GetFileName(url) + " " + resname + " " + type.ToString());

            curContent = errorcode;

            OnSceneFinishLoading(url, resname, false, errorcode);
        }

        Count--;

        releaseQueue.Enqueue(mAB);

        if (Count <= 0)
        {
            Count = 0;
            releaseAllBundles();
        }
    }