Exemplo n.º 1
0
 public static void ExportPublic()
 {
     ExportAssetBundle.BuildAssetBundles();
     AssetDatabase.Refresh();
     ExportAssetBundle.ExportLua();
     AssetDatabase.Refresh();
     ExportAssetBundle.GenerateResPublic(CurrentBundleVersion.versionCode.ToString());
 }
Exemplo n.º 2
0
    public static void ExportAllAssetBundle()
    {
        string        strOutputPath = Path.GetFullPath(Path.Combine(Application.streamingAssetsPath, PathUtil.Platform));
        DirectoryInfo dir           = new DirectoryInfo(strOutputPath);

        if (dir.Exists)
        {
            dir.Delete(true);
        }
        ExportAssetBundle.BuildAssetBundles();
        ExportAssetBundle.ExportLua();
    }
Exemplo n.º 3
0
    private static void GenericBuild(string[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options)
    {
        AssetDatabase.Refresh();

        bool needEncrypt = false;

        if (needEncrypt)
        {
            string        strOutputPath = Path.GetFullPath(Path.Combine(Application.streamingAssetsPath, PathUtil.Platform));
            DirectoryInfo dir           = new DirectoryInfo(strOutputPath);
            if (dir.Exists)
            {
                dir.Delete(true);
            }
            AssetDatabase.Refresh();

            GenerateObfuscatedCode.GenerateCodes();
            AssetDatabase.Refresh();
        }

        ExportAssetBundle.BuildAssetBundles();
        ExportAssetBundle.ExportLua();

        if (needEncrypt)
        {
            ExportAssetBundle.EncryptAssetBundle();
        }

        ExportAssetBundle.GenerateVersion();

        BuildReport  res     = BuildPipeline.BuildPlayer(scenes, target_dir, build_target, build_options);
        BuildSummary summary = res.summary;

        if (summary.result == BuildResult.Failed)
        {
            throw new Exception("BuildPlayer failure: " + res.ToString());
        }
    }
Exemplo n.º 4
0
 public static void ExportLua()
 {
     ExportAssetBundle.ExportLua();
 }
Exemplo n.º 5
0
 public static void ExportLuaPublic()
 {
     ExportAssetBundle.ExportLua();
     AssetDatabase.Refresh();
     ExportAssetBundle.GenerateDataPublic();
 }
Exemplo n.º 6
0
    public static void ExportiPhonePublic(string subBucket = null)
    {
        string[] args = System.Environment.GetCommandLineArgs();
        if (args == null || args.Length == 0)
        {
            return;
        }
        Debug.Log("ExportiPhonePublic: " + string.Join(", ", args));

        List <string> fileList    = new List <string>();
        List <string> versionList = new List <string>();
        Regex         regExp      = new Regex(@"^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$");

        foreach (string fileName in args)
        {
            if (fileName.EndsWith(".u3d"))
            {
                fileList.Add(fileName);
            }
            else
            {
                if (regExp.IsMatch(fileName))
                {
                    string bundleVersionCode = BundleVersionChecker.BundleVersion2Code(fileName);
                    if (!versionList.Contains(bundleVersionCode))
                    {
                        versionList.Add(bundleVersionCode);
                    }
                }
            }
        }

        EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.iOS, BuildTarget.iOS);
        string bundleVersion = args[args.Length - 3];

        PlayerSettings.bundleVersion   = bundleVersion;
        PlayerSettings.iOS.buildNumber = args[args.Length - 2];
        BundleVersionChecker.UpdateBundleVersion();
        AssetDatabase.Refresh();

        ExportAssetBundle.BuildAssetBundles();
        AssetDatabase.Refresh();
        ExportAssetBundle.ExportLua();
        AssetDatabase.Refresh();

        string folder = args[args.Length - 1];

        foreach (string bundleVersionCode in versionList)
        {
            string outFolderName = PathUtil.Platform + bundleVersionCode;
            if (!string.IsNullOrEmpty(subBucket))
            {
                outFolderName = subBucket + "/" + outFolderName;
            }
            string strOut = Path.GetFullPath(Path.Combine(folder, outFolderName));

            if (Directory.Exists(strOut) == false)
            {
                Directory.CreateDirectory(strOut);
            }
            Debug.Log("资源导出目录:" + strOut);
            ExportAssetBundle.GenerateResPublic(bundleVersionCode, strOut, fileList.ToArray());
        }
    }
Exemplo n.º 7
0
    public static void ExportAndroidLuaPublic(string subBucket = null)
    {
        string[] args = System.Environment.GetCommandLineArgs();
        if (args == null || args.Length == 0)
        {
            return;
        }
        Debug.Log(string.Join(",", args));

        List <string> fileList    = new List <string>();
        List <string> versionList = new List <string>();
        Regex         regExp      = new Regex(@"^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$");

        foreach (string fileName in args)
        {
            if (fileName.EndsWith(".u3d"))
            {
                fileList.Add(fileName);
            }
            else
            {
                if (regExp.IsMatch(fileName))
                {
                    string bundleVersionCode = BundleVersionChecker.BundleVersion2Code(fileName);
                    if (!versionList.Contains(bundleVersionCode))
                    {
                        versionList.Add(bundleVersionCode);
                    }
                }
            }
        }

        EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Android, BuildTarget.Android);
        //PlayerSettings.bundleIdentifier = "xin.unwrap.xiami";
        string bundleVersion = args[args.Length - 2];

        PlayerSettings.bundleVersion = bundleVersion;
        //PlayerSettings.SetPropertyInt("ScriptingBackend", (int)ScriptingImplementation.IL2CPP, BuildTarget.Android);
        BundleVersionChecker.UpdateBundleVersion();
        AssetDatabase.Refresh();

        ExportAssetBundle.BuildAssetBundles();
        AssetDatabase.Refresh();
        ExportAssetBundle.ExportLua();
        AssetDatabase.Refresh();

        string folder = args[args.Length - 1];

        foreach (string bundleVersionCode in versionList)
        {
            string outFolderName = PathUtil.Platform + bundleVersionCode;
            if (!string.IsNullOrEmpty(subBucket))
            {
                outFolderName = subBucket + "/" + outFolderName;
            }
            string strOut = Path.GetFullPath(Path.Combine(folder, outFolderName));
            if (Directory.Exists(strOut) == false)
            {
                Directory.CreateDirectory(strOut);
            }
            Debug.Log("导出目录:" + strOut);
            ExportAssetBundle.GenerateDataPublic(strOut, fileList.ToArray());
        }
    }