public override void IncreasePackageVersion(string packageName) { PackageVersion.Version v = new PackageVersion.Version(); v.Init(); v.m_version = 0; if (m_version.HavePackage(packageName)) { v = m_version.LookupPackageVersion(packageName); } v.m_version++; m_version.AddPackage(packageName, v); // m_isDirty = true; }
IEnumerator BuildPackListAndDownLoad_Impl() { int downloadQueueCount = 1; for (int i = m_needDownloadPackage.Count; i < downloadQueueCount; i++) { m_needDownloadPackage.Add(new List <NeedDownloadData>()); } string szLast = ""; mMsg = "Build Pack List ..."; mPackDic = new Dictionary <string, ResPackge>(); if (mResDic != null) { foreach (ResPackItm itm in mResDic.Values) { if (szLast == itm.mPack) { continue; } szLast = itm.mPack; // string szNm = Path.GetFileName(itm.mPack); if (mPackDic.ContainsKey(itm.mPack)) { continue; } ResPackge pck = new ResPackge(); pck.mType = itm.mType; pck.mFile = itm.mPack; mPackDic.Add(itm.mPack, pck); } } MergePakcageList(); mMsg = "Down Pack Files ..."; int downloadIndex = 0; foreach (KeyValuePair <string, ResPackge> res in mPackDic) { ResPackge pck = res.Value; mMsg = "DownOrLoad ... " + pck.mFile; //mEntry.StartCoroutine(pck.NtfDownOrLoad(mbLocal)); bool forceDownload = false; bool keepAlive = false; if (!m_versionPackage.HavePackage(pck.mFile)) { forceDownload = true; } else { PackageVersion.Version localVersion = m_versionPackage.LookupPackageVersion(pck.mFile); if (localVersion.m_isAliveInRuntime) { keepAlive = true; } if (m_remotePackage.HavePackage(pck.mFile)) { PackageVersion.Version remoteVersion = m_remotePackage.LookupPackageVersion(pck.mFile); if (remoteVersion.m_version != localVersion.m_version) { forceDownload = true; } } } if (m_remotePackage.HavePackage(pck.mFile)) { PackageVersion.Version remoteVersion = m_remotePackage.LookupPackageVersion(pck.mFile); if (remoteVersion.m_isAliveInRuntime) { keepAlive = true; } } if (keepAlive) { AddKeepAlivePackage(pck.mFile, false); } keepAlive = IsKeepAlivePackage(res.Key); //if (forceDownload || keepAlive) { NeedDownloadData data = new NeedDownloadData(); data.m_forceDownload = forceDownload; data.m_isKeepAlive = keepAlive; data.m_pck = pck; List <NeedDownloadData> downQueue = m_needDownloadPackage[downloadIndex % m_needDownloadPackage.Count]; downQueue.Add(data); downloadIndex++; } //else //{ // IEnumerator e = pck.TryDownload(!keepAlive, forceDownload); // while (true) // { // e.MoveNext(); // if (pck.m_state != ResPackge.State.Downloading) // { // break; // } // yield return e.Current; // } //} } IsCheckPackage = true; mMsg = ""; m_calcDownloadBytesTime = Time.realtimeSinceStartup; for (int i = 0; i < m_needDownloadPackage.Count; i++) { List <NeedDownloadData> downQueue = m_needDownloadPackage[i]; if (downQueue.Count > 0) { mEntry.StartCoroutine(ProcDownloadQueue(i)); mEntry.StartCoroutine(OverTimeCheck()); } } #if (MY_DEBUG) // 显示出来 AddReToViewCtrl(); #endif yield return(1); }