/// <summary> /// 对比版本 /// </summary> static void CheckVersion() { //根据版本号,判断当前应该热更还是更新整包 var myV = Application.version.Split('.'); var nowV = mNowVersion.Split('.'); if (myV[0] != nowV[0]) //大版本有变化,更新完整包 { } else if (myV[1] != nowV[1]) //小版本不同,更新热更包 { //检测本机版本文件和下载版本文件的区别 mVersionPath = string.Concat(IOPath.Instance.NowPlatformPath, IOPath.Instance.NowPlatformName, "_", cVersion); string oldStr = ""; if (IOTool.CheckHaveFile(mVersionPath)) { oldStr = IOTool.LoadFileString(mVersionPath); } List <string> add; List <string> del; List <string> diff; VersionComparisonTool.Comparison(oldStr, mVersion, out add, out del, out diff); //删除所有旧文件 for (int i = 0; i < del.Count; i++) { var dPath = IOPath.Instance.NowPlatformPath + del[i]; if (IOTool.CheckHaveFile(dPath)) //可能被删除过 { IOTool.DeleteFile(dPath); } } //下载文件 var list = add.Concat(diff).ToList(); if (list.Count > 0) { DoUpdateFiles(list); } else { if (mUpdateFinishCb != null) { mUpdateFinishCb(); } } } }