Ejemplo n.º 1
0
    public static void SaveVersionFile(BuildTarget target, ChannelType channel)
    {
        string rootPath = PackageUtils.GetBuildPlatformOutputPath(target, channel.ToString());

        GameUtility.SafeWriteAllText(Path.Combine(rootPath, BuildUtils.ResVersionFileName), resVersion);
        GameUtility.SafeWriteAllText(Path.Combine(rootPath, BuildUtils.NoticeVersionFileName), resVersion);
        GameUtility.SafeWriteAllText(Path.Combine(rootPath, BuildUtils.AppVersionFileName), PlayerSettings.bundleVersion);
    }
Ejemplo n.º 2
0
    private static void InnerBuildAssetBundles(BuildTarget buildTarget, string channelName, bool writeConfig)
    {
        BuildAssetBundleOptions buildOption = BuildAssetBundleOptions.IgnoreTypeTreeChanges | BuildAssetBundleOptions.DeterministicAssetBundle;
        var outputPath = PackageUtils.GetBuildPlatformOutputPath(buildTarget, channelName);
        AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(outputPath, buildOption, buildTarget);

        if (manifest != null && writeConfig)
        {
            AssetsPathMappingEditor.BuildPathMapping(manifest);
            VariantMappingEditor.BuildVariantMapping(manifest);
            BuildPipeline.BuildAssetBundles(outputPath, buildOption, buildTarget);
        }
        WritePackageNameFile(buildTarget, channelName);
        WriteAssetBundleSize(buildTarget, channelName);
        AssetDatabase.Refresh();
    }
Ejemplo n.º 3
0
    public static void WriteAssetBundleSize(BuildTarget buildTarget, string channelName)
    {
        var           outputPath      = PackageUtils.GetBuildPlatformOutputPath(buildTarget, channelName);
        var           allAssetbundles = GameUtility.GetSpecifyFilesInFolder(outputPath, new string[] { ".assetbundle" });
        StringBuilder sb = new StringBuilder();

        if (allAssetbundles != null && allAssetbundles.Length > 0)
        {
            foreach (var assetbundle in allAssetbundles)
            {
                FileInfo fileInfo = new FileInfo(assetbundle);
                int      size     = (int)(fileInfo.Length / 1024) + 1;
                var      path     = assetbundle.Substring(outputPath.Length + 1);
                sb.AppendFormat("{0}{1}{2}\n", GameUtility.FormatToUnityPath(path), AssetBundleConfig.CommonMapPattren, size);
            }
        }
        string content = sb.ToString().Trim();

        GameUtility.SafeWriteAllText(Path.Combine(outputPath, BuildUtils.AssetBundlesSizeFileName), content);
    }
Ejemplo n.º 4
0
    public static string ReadVersionFile(BuildTarget target, ChannelType channel)
    {
        string rootPath = PackageUtils.GetBuildPlatformOutputPath(target, channel.ToString());

        return(GameUtility.SafeReadAllText(Path.Combine(rootPath, BuildUtils.ResVersionFileName)));
    }
Ejemplo n.º 5
0
    public static void WritePackageNameFile(BuildTarget buildTarget, string channelName)
    {
        var outputPath = PackageUtils.GetBuildPlatformOutputPath(buildTarget, channelName);

        GameUtility.SafeWriteAllText(Path.Combine(outputPath, BuildUtils.PackageNameFileName), channelName);
    }