Exemplo n.º 1
0
 /// <summary>
 /// 计算下载的资源
 /// </summary>
 void ComputeDownload()
 {
     m_DownLoadList.Clear();
     m_DownLoadDic.Clear();
     m_DownLoadMD5Dic.Clear();
     if (m_GameVersion != null && m_GameVersion.Pathces != null && m_GameVersion.Pathces.Length > 0)
     {
         m_CurrentPatches = m_GameVersion.Pathces[m_GameVersion.Pathces.Length - 1];
         if (m_CurrentPatches.Files != null && m_CurrentPatches.Files.Count > 0)
         {
             foreach (Patch patch in m_CurrentPatches.Files)
             {
                 if ((Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) && patch.Platform.Contains("StandaloneWindows64"))
                 {
                     AddDownLoadList(patch);
                 }
                 else if ((Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.WindowsEditor) && patch.Platform.Contains("Android"))
                 {
                     AddDownLoadList(patch);
                 }
                 else if ((Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.WindowsEditor) && patch.Platform.Contains("IOS"))
                 {
                     AddDownLoadList(patch);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 获取所有热更包信息
 /// </summary>
 void GetHotAB()
 {
     if (m_GameVersion != null && m_GameVersion.Pathces != null && m_GameVersion.Pathces.Length > 0)
     {
         Pathces lastPatches = m_GameVersion.Pathces[m_GameVersion.Pathces.Length - 1];
         if (lastPatches != null && lastPatches.Files != null)
         {
             foreach (Patch patch in lastPatches.Files)
             {
                 m_HotFixDic.Add(patch.Name, patch);
             }
         }
     }
 }
Exemplo n.º 3
0
        static void CopyAbAndGeneratJson(List <string> changeList, string hotCount)
        {
            if (!Directory.Exists(m_HotPath))
            {
                Directory.CreateDirectory(m_HotPath);
            }
            DeleteAllFile(m_HotPath);
            foreach (string str in changeList)
            {
                if (!str.EndsWith(".manifest"))
                {
                    File.Copy(m_BunleTargetPath + "/" + str, m_HotPath + "/" + str);
                }
            }

            //生成服务器Patch
            DirectoryInfo directory = new DirectoryInfo(m_HotPath);

            FileInfo[] files   = directory.GetFiles("*", SearchOption.AllDirectories);
            Pathces    pathces = new Pathces();

            pathces.Version = 1;
            pathces.Files   = new List <Patch>();
            for (int i = 0; i < files.Length; i++)
            {
                Patch patch = new Patch();
                patch.Md5      = MD5Manager.Instance.BuildFileMd5(files[i].FullName);
                patch.Name     = files[i].Name;
                patch.Size     = files[i].Length / 1024.0f;
                patch.Platform = EditorUserBuildSettings.activeBuildTarget.ToString();
                //服务器资源路径
                patch.Url = "http://annuzhiting2.oss-cn-hangzhou.aliyuncs.com/AssetBundle/" + PlayerSettings.bundleVersion + "/" + hotCount + "/" + files[i].Name;
                pathces.Files.Add(patch);
            }

            BinarySerializeOpt.Xmlserialize(m_HotPath + "/Patch.xml", pathces);
        }