Esempio n. 1
0
        IEnumerator CloadScene(bool bNeedUpdate)
        {
            if (bNeedUpdate)
            {
                ClearAll();
            }
            bool bSucceed = true;

            if (!File.Exists(mFile))
            {
                if (!File.Exists(mZipFile))
                {
                    bSucceed = false;
                    var dl = KHttpDownloader.Load(mUrlZipFile, mZipFile, 0);
                    while (!dl.IsFinished)
                    {
                        yield return(null);

                        if (onDownload != null)
                        {
                            onDownload(dl.Progress);
                        }
                    }
                    bSucceed = dl.IsError == false ? true : false;
                    dl.Dispose();
                }
                if (bSucceed)
                {
                    yield return(this.StartCoroutineAsync(CDecompress(mFile)));
                }
            }

            LoadSceneCenter.Instance.OnComplete(this, bSucceed);
        }
Esempio n. 2
0
        IEnumerator StartLoad()
        {
            var dl = KHttpDownloader.Load(mUrlFile, mFile, 0);

            while (!dl.IsFinished)
            {
                yield return(null);

                if (onDownload != null)
                {
                    onDownload(dl.Progress);
                }
            }
            dl.Dispose();

            if (!dl.IsError)
            {
                GameInfoCenter.Instance.GetGameInfo(GameType.大厅).UpdateVerion();
                Application.OpenURL(mFile);
            }
            else
            {
                //下载出错,请重新下载
                StartCoroutine(StartLoad());
            }
        }