public static void PatchCode() { IFixEditor.Patch(); IFixEditor.CompileToAndroid(); //IFixEditor.CompileToIOS(); }
static void BuildHandle(PlatformType type, BuildOptions buildOptions, bool isBuildExe, bool clearFolder, bool isInject) { BuildTarget buildTarget = BuildTarget.StandaloneWindows; string programName = "ET"; string exeName = programName; string platform = ""; switch (type) { case PlatformType.PC: buildTarget = BuildTarget.StandaloneWindows64; exeName += ".exe"; IFixEditor.Patch(); platform = "pc"; break; case PlatformType.Android: KeystoreSetting(); buildTarget = BuildTarget.Android; exeName += ".apk"; IFixEditor.CompileToAndroid(); platform = "android"; break; case PlatformType.IOS: buildTarget = BuildTarget.iOS; IFixEditor.CompileToIOS(); platform = "ios"; break; case PlatformType.MacOS: buildTarget = BuildTarget.StandaloneOSX; IFixEditor.Patch(); platform = "pc"; break; } //打程序集 BuildAssemblieEditor.BuildCodeRelease(); if (isInject) { //Inject IFixEditor.InjectAssemblys(); } HandleProject(); //string fold = string.Format(BuildFolder, type); if (clearFolder && Directory.Exists(relativeDirPrefix)) { Directory.Delete(relativeDirPrefix, true); Directory.CreateDirectory(relativeDirPrefix); } else { Directory.CreateDirectory(relativeDirPrefix); } if (isBuildExe) { AssetDatabase.Refresh(); string[] levels = { "Assets/AssetsPackage/Scenes/InitScene/Init.unity", }; UnityEngine.Debug.Log("开始EXE打包"); BuildPipeline.BuildPlayer(levels, $"{relativeDirPrefix}/{exeName}", buildTarget, buildOptions); UnityEngine.Debug.Log("完成exe打包"); } string jstr = File.ReadAllText("Assets/AssetsPackage/config.bytes"); var obj = LitJson.JsonMapper.ToObject <Dictionary <string, string> >(jstr); string version = obj["ResVer"]; var settings = AASUtility.GetSettings(); string fold = Directory.GetParent(settings.RemoteCatalogBuildPath.GetValue(settings)).FullName; string targetPath = Path.Combine(relativeDirPrefix, $"{version}_{platform}"); if (!Directory.Exists(targetPath)) { Directory.CreateDirectory(targetPath); } FileHelper.CleanDirectory(targetPath); FileHelper.CopyFiles(fold, targetPath); UnityEngine.Debug.Log("完成cdn资源打包"); }