Ver Fonte

热更资源一键对比和压缩

ybx_Gdn há 1 ano atrás
pai
commit
f8080525bf

+ 19 - 5
Assets/Editor/AssetBundle/CheckHotUpdateRes.cs

@@ -6,6 +6,8 @@ using Game.Config;
 using System;
 using System.Reflection;
 using System.IO;
+using System.IO.Compression;
+
 public class CheckHotUpdateRes : EditorWindow
 {
 
@@ -289,18 +291,30 @@ public class CheckHotUpdateRes : EditorWindow
         csvWriter.Write();
        
         CopyFile();
-
+        string FiletempPath = $"{curResInfo.OutputPath}/../ZipTempPath";
+        if(Directory.Exists(FiletempPath))
+            Directory.Delete(FiletempPath,true);
+        Directory.CreateDirectory(FiletempPath);
+        CopyFile(FiletempPath);
+        string zipName = $"{curResInfo.CN_Name}---{curResInfo.ResVersion}---{DateTime.Now.Month}.{DateTime.Now.Day}--1.zip";
+        ZipFile.CreateFromDirectory(FiletempPath,$"{curResInfo.OutputPath}/{zipName}");
+        Directory.Delete(FiletempPath,true);
         needResList.Clear();
         Debug.Log($"资源检查完成 输出路径 : 【{curResInfo.OutputPath}】");
     }
 
 
-    private void CopyFile()
+    private void CopyFile(string outP = "")
     {
         if (needResList == null)
         {
             return;
         }
+
+        if (string.IsNullOrEmpty(outP))
+        {
+            outP = curResInfo.OutputPath;
+        }
         int size = needResList.Count;
 
         string datapath = $"{curResInfo.NewPath}/";
@@ -313,15 +327,15 @@ public class CheckHotUpdateRes : EditorWindow
             }
             byte[] fdatas = File.ReadAllBytes(datapath + needResList[i].FullName);
 
-            FileHelper.WirteToFile( $"{curResInfo.OutputPath}/{needResList[i].FullName}" ,fdatas);
+            FileHelper.WirteToFile( $"{outP}/{needResList[i].FullName}" ,fdatas);
 
         }
         
-        FileHelper.WirteStringToFile($"{curResInfo.OutputPath}/{curResInfo.VersionFileName}",curResInfo.ResVersion);
+        FileHelper.WirteStringToFile($"{outP}/{curResInfo.VersionFileName}",curResInfo.ResVersion);
 
         byte[] mdatas = File.ReadAllBytes(datapath + curResInfo.mainfestFileName);
 
-        FileHelper.WirteToFile($"{curResInfo.OutputPath}/{curResInfo.mainfestFileName}", mdatas);
+        FileHelper.WirteToFile($"{outP}/{curResInfo.mainfestFileName}", mdatas);
 
     }
 

+ 2 - 0
Assets/Editor/AssetBundle/CheckResWindowInfo.cs

@@ -88,6 +88,8 @@ public class ResInfo : ScriptableObject
 {
     public string Name = "Test";
 
+    public string CN_Name = "测试服";
+
     public string OldPath = "C:/Users/Administrator/Desktop/My/项目/0";
 
     public string NewPath = "./StreamingAssets/AssetsAndroid";

+ 1 - 0
Assets/Editor/AssetBundle/Hy_Android.asset

@@ -13,6 +13,7 @@ MonoBehaviour:
   m_Name: Hy_Android
   m_EditorClassIdentifier: Assembly-CSharp-Editor::ResInfo
   Name: Hy_Android
+  CN_Name: "\u6D77\u5916\u5B89\u5353"
   OldPath: "C:/Users/Administrator/Desktop/My/\u9879\u76EE/3"
   NewPath: E:/Project/Unity/bt_client_2022_S/Assets/StreamingAssets/AssetsAndroid
   OutputPath: "C:/Users/Administrator/Desktop/My/\u9879\u76EE/3"

+ 1 - 0
Assets/Editor/AssetBundle/Hy_Ios.asset

@@ -13,6 +13,7 @@ MonoBehaviour:
   m_Name: Hy_Ios
   m_EditorClassIdentifier: Assembly-CSharp-Editor::ResInfo
   Name: Hy_Ios
+  CN_Name: "\u6D77\u5916\u5353IOS"
   OldPath: "C:/Users/Administrator/Desktop/My/\u9879\u76EE/4"
   NewPath: ./StreamingAssets/unityRes
   OutputPath: "C:/Users/Administrator/Desktop/My/\u9879\u76EE/4"