public static void BuildStandaloneProject(Version v) { //隐藏Resources目录 BuildTool.ShowResourcesFolder(false); AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); string[] levels = new string[] { BuildTool.startScene }; try { string apkPath = string.Format("{0}/{1}", ResSetting.AssetBundlesOutputPath, ResSetting.GetChannelRes()); string location = string.Format("{0}/{1}.exe", apkPath, v); UnityEditor.PlayerSettings.bundleVersion = FileUtilTool.ReadFile("IOS_Build/appleversion.dat"); UnityEditor.PlayerSettings.applicationIdentifier = "com.yxm.tankwar"; FileUtilTool.CreateFolderForFile(location); var result = BuildPipeline.BuildPlayer(levels, location, BuildTarget.StandaloneWindows64, BuildOptions.None); } catch (System.Exception e) { Debug.LogError("build StandaloneWindows64 error: " + e.ToString()); } finally { //恢复 BuildTool.ShowResourcesFolder(true); } }
public static void BuildApk(Version v, string location) { //隐藏Resources目录 BuildTool.ShowResourcesFolder(false); string content = FileUtilTool.ReadFile(keystoreFilePath); if (!string.IsNullOrEmpty(content)) { string[] lines = content.Replace("\r\n", "\n").Split('\n'); PlayerSettings.Android.keystoreName = lines[0].Trim(); PlayerSettings.Android.keystorePass = lines[1].Trim(); PlayerSettings.Android.keyaliasName = lines[2].Trim(); PlayerSettings.Android.keyaliasPass = lines[3].Trim(); Debug.LogError("PlayerSettings.Android.keystoreName " + PlayerSettings.Android.keystoreName); Debug.LogError("PlayerSettings.Android.keystorePass " + PlayerSettings.Android.keystorePass); Debug.LogError("PlayerSettings.Android.keyaliasName " + PlayerSettings.Android.keyaliasName); Debug.LogError("PlayerSettings.Android.keyaliasPass " + PlayerSettings.Android.keyaliasPass); } FileUtilTool.CreateFolderForFile(location); string[] levels = new string[] { BuildTool.startScene }; try { if (BuildTool.type == BuildTool.BuildType.APK) { if (BuildTool.isDev) { var result = BuildPipeline.BuildPlayer(levels, location, BuildTarget.Android, BuildOptions.ConnectWithProfiler | BuildOptions.Development); } else { var result = BuildPipeline.BuildPlayer(levels, location, BuildTarget.Android, BuildOptions.None); } } else { if (BuildTool.isDev) { var result = BuildPipeline.BuildPlayer(levels, location, BuildTarget.Android, BuildOptions.ConnectWithProfiler | BuildOptions.Development | BuildOptions.AcceptExternalModificationsToPlayer); } else { var result = BuildPipeline.BuildPlayer(levels, location, BuildTarget.Android, BuildOptions.AcceptExternalModificationsToPlayer); } } } catch (System.Exception e) { Debug.LogError("build android error: " + e.ToString()); } finally { //显示Resources目录 BuildTool.ShowResourcesFolder(true); } }
public static void BuildStandaloneRes() { FileUtilTool.CopyFile("IOS_Build/appleversion.dat", Application.streamingAssetsPath + "/appleversion.dat"); Version v = BuildTool.versionRes; Version.SaveVersion2StreamingAsset(v); BuildTool.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows64); ResTool.BuildLocalRes(); }
public static void BuildIOSRes() { //AndroidOneKeyTool.UpdateStreaming(); FileUtilTool.CopyFile("IOS_Build/appleversion.dat", Application.streamingAssetsPath + "/appleversion.dat"); Version v = BuildTool.versionRes; //v.UpgradeLittleVersion(); Version.SaveVersion2StreamingAsset(v); //AndroidOneKeyTool.CallShellCommandForVersionRes(); BuildTool.SwitchActiveBuildTarget(BuildTarget.iOS); ResTool.BuildLocalRes(); }
/// <summary> /// 生成本地资源不包括加密 /// </summary> public static void BuildLocalRes() { try { BuildTool.buildLog.First(); MarkTool.ClearMarkForce(); BuildTool.buildLog.Next(); MarkTool.GenRecord(); BuildTool.buildLog.Next(); MarkTool.MarkAutoFromRecord(); BuildTool.buildLog.Next(); BuildAssetBundleTool.BuildAssetBundles(); BuildTool.buildLog.Next(); MarkTool.ClearAutoFromRecord(); BuildTool.buildLog.Next(); //BuildAssetBundleTool.DeleteMainfestFile(); BuildTool.buildLog.Next(); ResTool.CompressAssetBundle(); BuildTool.buildLog.Next(); ResTool.CopyStreamingToRes(); BuildTool.buildLog.End(); BuildTool.SaveBuildLog(BuildTool.buildLog); } catch (System.Exception e) { BuildTool.buildLog.errorLog = e.ToString(); BuildTool.SaveBuildLog(BuildTool.buildLog); Debug.LogError(e); } }
public static void BuildIOSProject(Version v) { //隐藏Resources目录 BuildTool.ShowResourcesFolder(false); AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); string[] levels = new string[] { BuildTool.startScene }; try { string apkPath = string.Format("{0}/{1}", ResSetting.AssetBundlesOutputPath, ResSetting.GetChannelRes()); string location = string.Format("{0}/{1}", apkPath, v); UnityEditor.PlayerSettings.bundleVersion = FileUtilTool.ReadFile("IOS_Build/appleversion.dat").Replace("\r\n", "\n").Replace("\n", ""); UnityEditor.PlayerSettings.applicationIdentifier = "com.yxm.tankwar"; UnityEditor.PlayerSettings.iOS.buildNumber = BuildTool.versionCode.ToString(); FileUtilTool.CreateFolderForFile(location); if (BuildTool.isDev) { var result = BuildPipeline.BuildPlayer(levels, location, BuildTarget.iOS, BuildOptions.ConnectWithProfiler | BuildOptions.Development); } else { var result = BuildPipeline.BuildPlayer(levels, location, BuildTarget.iOS, BuildOptions.None); } } catch (System.Exception e) { Debug.LogError("build ios error: " + e.ToString()); } finally { //恢复 BuildTool.ShowResourcesFolder(true); } }
public static void BuildAndroidRes() { BuildTool.SwitchActiveBuildTarget(BuildTarget.Android); ResTool.BuildLocalRes(); }