Example #1
0
    //--------------------------------------------------------------------------------------------
    // 打包场景文件
    static public void BuildGameScene(string file, List <string> fLst, BuildTarget tgt, GameBundleVersionControl version)
    {
        //BuildOptions op = BuildOptions.BuildAdditionalStreamedScenes;
        //string szMsg = BuildPipeline.BuildPlayer(fLst.ToArray(), file, tgt, op);
        file = file.ToLower();
        string pkgName = Path.GetFileName(file);

        pkgName = pkgName.ToLower();
        bool needPackage = false;

        foreach (string n in fLst)
        {
            string sceneFileName = ArchiveUtil.NtfPathAfterAssets(n).ToLower();

            if (version.UpdateFileMD5(sceneFileName, pkgName))
            {
                needPackage = true;
                break;
            }
        }
        if (!needPackage)
        {
            return;
        }

        string szMsg = BuildPipeline.BuildStreamedSceneAssetBundle(fLst.ToArray(), file, tgt);

        if (string.IsNullOrEmpty(szMsg))
        {
            AppendResPackItm(fLst.ToArray(), file, tgt);
            version.IncreasePackageVersion(pkgName);
            szMsg = @"操作成功";
        }
        EditorUtility.DisplayDialog(@"操作已结束", @"消息: " + szMsg, "Ok");
    }
Example #2
0
    static public string BuildGameScene(string file, string szScene, BuildTarget tgt, GameBundleVersionControl version)
    {
        file = file.ToLower();
        string pkgName = Path.GetFileName(file);

        pkgName = pkgName.ToLower();
        string sceneFileName = ArchiveUtil.NtfPathAfterAssets(szScene).ToLower();

        if (!version.UpdateFileMD5(sceneFileName, pkgName))
        {
            return("");
        }
        string[] szAry = new string[] { szScene };
        string   szMsg = BuildPipeline.BuildStreamedSceneAssetBundle(szAry, file, tgt);

        if (string.IsNullOrEmpty(szMsg))
        {
            AppendResPackItm(szAry, file, tgt);
            version.IncreasePackageVersion(pkgName);
        }
        return(szMsg);
    }