Esempio n. 1
0
    // buildOptions = BuildOptions.Development | BuildOptions.ConnectWithProfiler | BuildOptions.AllowDebugging;     // debug
    // buildOptions = BuildOptions.None;   // release
    public static bool Build(BuildOptions buildOptions, bool bSvnUpdate, string newVersion, bool bBundleLuaCsv, bool bBundleData, bool bBundleMap, bool bCopyData, bool bBuildApp)
    {
        if (!AppPackage.CheckVersion(newVersion))
        {
            Debug.LogError("Invalid Version!!!!");
            return(false);
        }

        ms_sNewVersion = newVersion;
        bool   IsWinBuild  = ms_target == BuildTarget.StandaloneWindows;
        string sDataOutDir = AppPackage.AddStamp(ms_sDataOutDir);

        if (!IsWinBuild && Directory.Exists(sDataOutDir))
        {
            Debug.LogError("Exists Directory: " + sDataOutDir);
            return(false);
        }

        if (bSvnUpdate && !AppPackage.SvnUpdate())
        {
            Debug.LogError("SvnUpdate Failed !!!!");
            return(false);
        }

        if (bBundleLuaCsv && !AppPackage.BundleLuaCsv())
        {
            return(false);
        }

        if (bBundleData && !AppPackage.BundleData())
        {
            return(false);
        }

        if (bBundleMap && !AppPackage.BundleMap())
        {
            return(false);
        }

        if (!AppPackage.GenVersion(newVersion))
        {
            return(false);
        }

        //真机随包资源处理
        if (bCopyData && !IsWinBuild)
        {
            if (!AppPackage.CopyFiles(sDataOutDir, ms_sResourcesDir, new string[] { "*" + ms_sABType, /*"*.manifest"*/ }, true))
            {
                return(false);
            }
        }

        AssetDatabase.Refresh();
        if (bBuildApp && !AppPackage.BuildAPP(GameConfigMgr.ms_sPublicDir, buildOptions, null, bCopyData))
        {
            return(false);
        }

        //PC资源处理
        if (bCopyData && IsWinBuild)
        {
            string sWinData = GameConfigMgr.ms_sPublicDir + ms_target.ToString() + "/" + GameConfigMgr.ms_sABFolderName + "/";
            if (!AppPackage.CopyFiles(sDataOutDir, sWinData, new string[] { "*" + ms_sABType, /*"*.manifest"*/ }, true, true))
            {
                return(false);
            }
        }

        return(true);
    }