Exemplo n.º 1
0
 public static void ExportLuaPublic()
 {
     ExportAssetBundle.ExportLua();
     AssetDatabase.Refresh();
     ExportAssetBundle.GenerateDataPublic();
 }
Exemplo n.º 2
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());
        }
    }