예제 #1
0
    //--------------------------------------------------------------------------------------------
    // 首先下载游戏版本
    IEnumerator NtfDownLoadVer()
    {
        if (!mbLocal)
        {
            string szfNm = ResPath.GetVersionTxt();
            string szUrl = ResPath.GetUrl(szfNm);
            string szLcl = ResPath.GetLocal(szfNm);
            mMsg = "Download ver file = " + szUrl;
            Debug.Log("StartDownload VerFile:" + szUrl);
            WWW wDwn = new WWW(szUrl);
            while (!wDwn.isDone)
            {
                yield return(wDwn);
            }

            if (wDwn.isDone && (null == wDwn.error))
            {
                byte[] localVersionBuffer = ResPath.GetFileData(szLcl);
                if (localVersionBuffer != null)
                {
                    ResUtil.GetVersion(localVersionBuffer, ref mGmVer, ref mReVer);
                }

                string sGmV = "", sReV = "";
                if (ResUtil.GetVersion(wDwn.bytes, ref sGmV, ref sReV))
                {
                    mGmVer = sGmV;
                    if (mReVer != sReV)
                    {
                        mReVer  = sReV;
                        mbLocal = false;
                        ResPath.SaveToLocal(szLcl, wDwn.bytes);
                    }
                }
            }
            else if (null != wDwn.error)
            {
                mMsg = "DownVer ERROR, Msg = " + wDwn.error;
                Debug.LogWarning("DownVer ERROR, Url = " + szUrl + ", Msg = " + wDwn.error);
                IsCheckPackage = true;
                mbLocal        = true;
            }
        }
        m_versionPackage.LoadPackagesVersion(ResPath.GetLocal(ResPath.GetPackageVersionTxt()));
        if (!mbLocal)
        {//版本已经更新,需要重新下载包列表
            string pckVersionFileName  = ResPath.GetPackageVersionTxt();
            string pckVersionFileUrl   = ResPath.GetUrl(pckVersionFileName);
            string pckVersionFileLocal = ResPath.GetLocal(ResPath.GetRemotePackageVersionTxt());
            Debug.Log("StartDownload File Package Version List:" + pckVersionFileUrl);
            WWW wDownloadPckVersionFilr = new WWW(pckVersionFileUrl);
            while (!wDownloadPckVersionFilr.isDone)
            {
                yield return(wDownloadPckVersionFilr);
            }
            if (wDownloadPckVersionFilr.isDone && (null == wDownloadPckVersionFilr.error))
            {
            }
            else
            {
                IsCheckPackage = true;
            }
            if (wDownloadPckVersionFilr.isDone && (null == wDownloadPckVersionFilr.error))
            {
                ResPath.SaveToLocal(pckVersionFileLocal, wDownloadPckVersionFilr.bytes);
            }
            else if (null != wDownloadPckVersionFilr.error)
            {
                mMsg = "DownPkgVer ERROR, Msg = " + wDownloadPckVersionFilr.error;
                Debug.LogWarning("DownPkgVer ERROR, Url = " + pckVersionFileUrl + ", Msg = " + wDownloadPckVersionFilr.error);
            }
            m_remotePackage.LoadPackagesVersion(pckVersionFileLocal);
        }
        NtfDownLoadResList(mbLocal);
    }
예제 #2
0
 public void LoadProject(string folder)
 {
     m_version.LoadPackagesVersion(folder + "/" + ResPath.GetPackageVersionTxt());
     LoadAllSavedFileMD5(folder + "/PackedFileMD5.txt");
 }