Exemplo n.º 1
0
    public static void OneKeyBuild(string target_path, BuildTarget platform, bool lua_debug, bool assetbundle,
                                   bool clean, bool build_lua, bool export_data, bool csharp_script, bool set_bundlename)
    {
        Debug.Log("BuildTarget-" + platform.ToString() + "\n" +
                  "target_path-" + target_path);

        BuildAssetBundle window = EditorWindow.GetWindow <BuildAssetBundle>();

        window.InitPath();
        window.SwitchPlatform(platform);

        //create dest path.
        CreateFolder(window.dest_path);

        if (assetbundle)
        {
            if (clean)  //clear assetbundle path
            {
                FileUtil.DeleteFileOrDirectory(window.assetbundles_path);
                CreateFolder(window.assetbundles_path);
            }

            //0.export dependency.
            if (csharp_script)
            {
                window.BuildCSharpScript();
            }

            //1.build Assetbundle.
            window.BuildAssetBundles(set_bundlename);
        }

        //2.compile lua code
        if (build_lua)
        {
            FileUtil.DeleteFileOrDirectory(window.export_path);
            CreateFolder(window.export_path);

            window.BuildLua(lua_debug);
        }

        //3.
        if (export_data)
        {
            window.PakAll();
        }

        //4.copy asset to target_path
        //assetbundles
        CopyToTarget(window, target_path);
    }