예제 #1
0
    static void pack_all(BuildTarget buildTarget)
    {
        XPack pack = new XPack();

        pack.setInfo(buildTarget);
        try
        {
            System.IO.Directory.Delete(pack.targetDir, true);
        }
        catch (System.Exception e)
        {
            XDebug.LogError(e.Message);
        }

        XDebug.Log("开始打包");

        foreach (var item in instance._packItems)
        {
            if (item.type == XPackItem.XPackType.File)
            {
                string path = item.path;
                pack.pack(path);
            }
            else if (item.type == XPackItem.XPackType.DirFiles)
            {
                pack.packdirfiles(item.path, item.searchPattern, item.searchOption);
            }
            else if (item.type == XPackItem.XPackType.Dir)
            {
                pack.packdir(item.path, item.searchPattern, item.searchOption);
            }
        }

        pack.packluadir("lua/", luaJit);

        AssetBundleManifest manifest = pack.packAll();
        XPackInfo           info     = new XPackInfo();

        info.parseManifest(manifest, pack.targetDir);
        info._version      = version;
        info._firstVersion = version;
        info.saveFile(pack.targetDir + "Assets/version.json");

        XVer ver = new XVer {
            ver = version, ab = pack.getWebDir(webPublishUrl), remoteLogUrl = remoteLogURL, isRemoteLog = isRemoteLog
        };

        ver.saveFile(pack.targetDir + "Assets/ver.json");



        XDebug.Log("打包结束");
    }
예제 #2
0
    static void menuPackLua()
    {
        XDebug.Log("打包lua结束");
        XPack pack = new XPack();

        pack.setInfo();
        XPackInfo info = new XPackInfo();

        if (!info.loadFile(pack.targetDir + "Assets/version.json"))
        {
            XDebug.LogError("打包lua失败,应当先打包");
            return;
        }
        XDebug.Log("打包lua");
        pack.packluadir("lua/", luaJit);
        info.saveFile(pack.targetDir + "Assets/version.json");
        XDebug.Log("打包lua结束");
    }