public static void BuildAssetBundlesForAllChannels(BuildTarget buildTarget) { bool buildForPerChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget); var targetName = PackageUtils.GetPlatformName(buildTarget); Debug.Assert(buildForPerChannel == true); // XLuaMenu.CopyLuaFilesToAssetsPackage(); PackageUtils.CheckAndRunAllCheckers(buildForPerChannel, false); int index = 0; double switchChannel = 0; double buildAssetbundles = 0; var start = DateTime.Now; foreach (var current in (ChannelType[])Enum.GetValues(typeof(ChannelType))) { var channelName = current.ToString(); start = DateTime.Now; CheckAssetBundles.SwitchChannel(channelName); switchChannel = (DateTime.Now - start).TotalSeconds; start = DateTime.Now; InnerBuildAssetBundles(buildTarget, channelName, index == 0); buildAssetbundles = (DateTime.Now - start).TotalSeconds; index++; Debug.Log(string.Format("{0}.Build assetbundles for platform : {1} and channel : {2} done! use time : switchChannel = {3}s , build assetbundls = {4} s", index, targetName, channelName, switchChannel, buildAssetbundles)); } Debug.Log(string.Format("Build assetbundles for platform : {0} for all {1} channels done!", targetName, index)); }
public static void BuildAssetBundlesForAllChannels(BuildTarget buildTarget) { var targetName = PackageUtils.GetPlatformName(buildTarget); var start = DateTime.Now; CheckAssetBundles.Run(); Debug.Log("Finished CheckAssetBundles.Run! use " + (DateTime.Now - start).TotalSeconds + "s"); int index = 0; double switchChannel = 0; double buildAssetbundles = 0; foreach (var current in (ChannelType[])Enum.GetValues(typeof(ChannelType))) { start = DateTime.Now; var channelName = current.ToString(); CheckAssetBundles.SwitchChannel(channelName); switchChannel = (DateTime.Now - start).TotalSeconds; start = DateTime.Now; InnerBuildAssetBundles(buildTarget, channelName, index == 0); buildAssetbundles = (DateTime.Now - start).TotalSeconds; index++; Debug.Log(string.Format("{0}.Build assetbundles for platform : {1} and channel : {2} done! use time : switchChannel = {3}s , build assetbundls = {4} s", index, targetName, channelName, switchChannel, buildAssetbundles)); } Debug.Log(string.Format("Build assetbundles for platform : {0} for all {1} channels done!", targetName, index)); }
public static void BuildAssetBundles(BuildTarget buildTarget, string channelName) { bool buildForPerChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget); XLuaMenu.CopyLuaFilesToAssetsPackage(); PackageUtils.CheckAndRunAllCheckers(buildForPerChannel, false); DateTime start = DateTime.Now; if (buildForPerChannel) { start = DateTime.Now; CheckAssetBundles.SwitchChannel(channelName); Debug.Log("Finished CheckAssetBundles.SwitchChannel! use " + (DateTime.Now - start).TotalSeconds + "s"); } start = DateTime.Now; InnerBuildAssetBundles(buildTarget, channelName, true); Debug.Log("Finished InnerBuildAssetBundles! use " + (DateTime.Now - start).TotalSeconds + "s"); //转换wwise xml为txt //ConvertXml2Json(Application.dataPath + "/StreamingAssets/SoundbanksInfo.xml", Application.dataPath + "/Wwise/Resources/SoundbanksInfo.txt"); //拷贝所有的音效资源到下载目录 转换xml为json 计算所有资源的md5值并生成尺寸文件 PackageUtils.BuildAudioData(buildTarget, channelName); var targetName = PackageUtils.GetPlatformName(buildTarget); Debug.Log(string.Format("Build assetbundles for platform : {0} and channel : {1} done!", targetName, channelName)); }
public static void BuildAssetBundlesForAllChannels() { var start = DateTime.Now; BuildPlayer.BuildAssetBundlesForAllChannels(buildTarget); var buildTargetName = PackageUtils.GetPlatformName(buildTarget); EditorUtility.DisplayDialog("Success", string.Format("Build AssetBundles for : \n\nplatform : {0} \nchannel : all \n\ndone! use {1}s", buildTargetName, (DateTime.Now - start).TotalSeconds), "Confirm"); }
public static void BuildAssetBundlesForCurrentChannel() { IncreaseResSubVersion(); var start = DateTime.Now; BuildPlayer.BuildAssetBundles(buildTarget, channelType.ToString()); var buildTargetName = PackageUtils.GetPlatformName(buildTarget); EditorUtility.DisplayDialog("Success", string.Format("Build AssetBundles for : \n\nplatform : {0} \nchannel : {1} \n\ndone! use {2}s", buildTargetName, channelType, (DateTime.Now - start).TotalSeconds), "Confirm"); }
public static void SaveAllCurrentVersionFile(bool silence = false) { var buildTargetName = PackageUtils.GetPlatformName(buildTarget); SaveAllVersionFile(buildTarget, channelType); SaveResVersionConfig(resVersion); PlayerSettings.bundleVersion = bundleVersion; if (!silence) { EditorUtility.DisplayDialog("Success", string.Format("Save all version file : \n\nplatform : {0} \nchannel : {1} \n\n", buildTargetName, channelType.ToString()), "Confirm"); } }
public static void BuildIOSPlayerForCurrentChannel() { if (CheckSymbolsToCancelBuild()) { return; } var start = DateTime.Now; BuildPlayer.BuildXCode(channelType.ToString(), channelType == ChannelType.Test); var buildTargetName = PackageUtils.GetPlatformName(buildTarget); EditorUtility.DisplayDialog("Success", string.Format("Build player for : \n\nplatform : {0} \nchannel : {1} \n\ndone! use {2}s", buildTargetName, channelType, (DateTime.Now - start).TotalSeconds), "Confirm"); }
public static void LoadCurrentVersionFile() { string readVersion = ReadVersionFile(buildTarget, channelType); if (string.IsNullOrEmpty(readVersion)) { var buildTargetName = PackageUtils.GetPlatformName(buildTarget); EditorUtility.DisplayDialog("Error", string.Format("No version file for : \n\nplatform : {0} \nchannel : {1} \n\n", buildTargetName, channelType.ToString()), "Confirm"); } else { resVersion = readVersion; EditorUtility.DisplayDialog("Success", "Load cur version file done!", "Confirm"); } }
//[MenuItem("Tools/Copy Test", false, 0)] static void CopyVideo1() { BuildTarget buildTarget = BuildTarget.Android; //首先从资源路径复制所有音效资源到更新路径 string pltname = PackageUtils.GetPlatformName(buildTarget); //取得音效的原始路径 string sourcePath = PackageUtils.GetAudioSourceDataPath(pltname); //资源输出路径 string AssetsPath = PackageUtils.GetAssetBundleOutputPath(buildTarget, "Test"); //需要复制到的资源路径 string destPath = Path.Combine(AssetsPath, AssetBundleConfig.AssetBundlesAudioFolderName_GEN); //加入平台 destPath = Path.Combine(destPath, pltname); // 有毒,竟然在有的windows系统这个函数删除不了目录,不知道是不是Unity的Bug // GameUtility.SafeDeleteDir(destination); destPath = GameUtility.FormatToUnityPath(destPath); sourcePath = GameUtility.FormatToUnityPath(sourcePath); //如果文件夹下面有meta文件的时候无法删除文件夹,因为meta文件是隐藏文件,需要权限 GameUtility.SafeDeleteDir(destPath); //检测目标路路径是否存在 //GameUtility.CheckDirAndCreateWhenNeeded(destPath); Debug.Log("Audio dst Path:" + destPath); Debug.Log("Audio src Path:" + sourcePath); try { FileUtil.CopyFileOrDirectory(sourcePath, destPath); var allfiles = GameUtility.GetSpecifyFilesInFolder(sourcePath); if (allfiles != null && allfiles.Length > 0) { for (int i = 0; i < allfiles.Length; i++) { if (allfiles[i].IndexOf(".meta") >= 0) { GameUtility.SafeDeleteFile(allfiles[i]); } } } } catch (System.Exception ex) { Debug.LogError("Something wrong: " + ex); return; } }
public static void BuildIOSPlayerForAllChannels() { if (CheckSymbolsToCancelBuild()) { return; } var start = DateTime.Now; foreach (var current in (ChannelType[])Enum.GetValues(typeof(ChannelType))) { BuildPlayer.BuildXCode(current.ToString(), channelType == ChannelType.Test); } var buildTargetName = PackageUtils.GetPlatformName(buildTarget); EditorUtility.DisplayDialog("Success", string.Format("Build player for : \n\nplatform : {0} \nchannel : all \n\ndone! use {2}s", buildTargetName, (DateTime.Now - start).TotalSeconds), "Confirm"); }
public static void BuildAssetBundles(BuildTarget buildTarget, string channelName) { var start = DateTime.Now; CheckAssetBundles.Run(); Debug.Log("Finished CheckAssetBundles.Run! use " + (DateTime.Now - start).TotalSeconds + "s"); start = DateTime.Now; CheckAssetBundles.SwitchChannel(channelName.ToString()); Debug.Log("Finished CheckAssetBundles.SwitchChannel! use " + (DateTime.Now - start).TotalSeconds + "s"); start = DateTime.Now; InnerBuildAssetBundles(buildTarget, channelName, true); Debug.Log("Finished InnerBuildAssetBundles! use " + (DateTime.Now - start).TotalSeconds + "s"); var targetName = PackageUtils.GetPlatformName(buildTarget); Debug.Log(string.Format("Build assetbundles for platform : {0} and channel : {1} done!", targetName, channelName)); }
public static void LoadCurrentResVersionFromFile(bool silence = false) { var buildTargetName = PackageUtils.GetPlatformName(buildTarget); string readVersion = ReadResVersionFile(buildTarget, channelType); if (string.IsNullOrEmpty(readVersion)) { if (!silence) { EditorUtility.DisplayDialog("Error", string.Format("No res version file for : \n\nplatform : {0} \nchannel : {1} \n\n", buildTargetName, channelType.ToString()), "Confirm"); } } else { resVersion = readVersion; if (!silence) { EditorUtility.DisplayDialog("Success", string.Format("Load cur res version file : \n\nplatform : {0} \nchannel : {1} \n\n", buildTargetName, channelType.ToString()), "Confirm"); } } }
public static void BuildAssetBundles(BuildTarget buildTarget, string channelName) { bool buildForPerChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget); // XLuaMenu.CopyLuaFilesToAssetsPackage(); PackageUtils.CheckAndRunAllCheckers(buildForPerChannel, false); DateTime start = DateTime.Now; if (buildForPerChannel) { start = DateTime.Now; CheckAssetBundles.SwitchChannel(channelName); Debug.Log("Finished CheckAssetBundles.SwitchChannel! use " + (DateTime.Now - start).TotalSeconds + "s"); } start = DateTime.Now; InnerBuildAssetBundles(buildTarget, channelName, true); Debug.Log("Finished InnerBuildAssetBundles! use " + (DateTime.Now - start).TotalSeconds + "s"); var targetName = PackageUtils.GetPlatformName(buildTarget); Debug.Log(string.Format("Build assetbundles for platform : {0} and channel : {1} done!", targetName, channelName)); }
public static string GetPlatformChannelPath(BuildTarget target, string channelName) { return(Path.Combine(PackageUtils.GetPlatformName(target), channelName)); }