Ejemplo n.º 1
0
    public static void Build()
    {
        //打ab包
        BundleEditor.Build();
        //生成可执行程序
        string abPath = Application.dataPath + "/../AssetBundle/" + EditorUserBuildSettings.activeBuildTarget.ToString() + "/";

        Copy(abPath, Application.streamingAssetsPath);
        string savePath = "";

        if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
        {
            savePath = m_AndroidPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget + string.Format("_{0:yyyy_MM_dd_HH_mm}", DateTime.Now) + ".apk";
        }
        else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
        {
            savePath = m_IOSPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget + string.Format("_{0:yyyy_MM_dd_HH_mm}", DateTime.Now);
        }
        else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows || EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64)
        {
            savePath = m_WindowsPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget + string.Format("_{0:yyyy_MM_dd_HH_mm}/{1}.exe", DateTime.Now, m_AppName);
        }

        BuildPipeline.BuildPlayer(FindEnableEditorrScenes(), savePath, EditorUserBuildSettings.activeBuildTarget, BuildOptions.None);
        DeleteDir(Application.streamingAssetsPath);
    }
Ejemplo n.º 2
0
    public static void Build()
    {
        //打最新的ab包
        BundleEditor.Build();
        //打包
        string abPath     = Application.dataPath + "/../AssetBundle/" + EditorUserBuildSettings.activeBuildTarget.ToString() + "/";
        string targetPath = AssetBundleManger.Instance.ABLoadpath;

        Copy(abPath, targetPath);//复制ab包到streamasset/AssetBundle
        string savePath = "";

        switch (EditorUserBuildSettings.activeBuildTarget)
        {
        case BuildTarget.Android:
            savePath = m_AndroidPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget +
                       string.Format("_{0:yyyy_MM_dd_HH_mm}", DateTime.Now) + ".apk";
            break;

        case BuildTarget.iOS:
            break;

        case BuildTarget.StandaloneWindows:
        case BuildTarget.StandaloneWindows64:
            savePath = m_WindowsPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget +
                       string.Format("_{0:yyyy_MM_dd_HH_mm}/{1}.exe", DateTime.Now, m_AppName);
            break;

        default:
            Debug.Log("当前选择平台不支持自动打包" + EditorUserBuildSettings.activeBuildTarget);
            break;
        }
        BuildPipeline.BuildPlayer(FindEnableEditorScenes(), savePath, EditorUserBuildSettings.activeBuildTarget, BuildOptions.None);
        Delete(targetPath);
    }
Ejemplo n.º 3
0
    public static void BuildAndroid()
    {
        Debug.Log("BuildAssetProcess.BuildAndroid start:" + DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"));
        string sVersion = string.Empty;

        //parse command line parameters from shell
        string[] arguments = Environment.GetCommandLineArgs();
        Debug.Log("BuildAssetProcess.BuildAndroid arguments number is:" + arguments.Length.ToString());
        for (int index = 0; index < arguments.Length; ++index)
        {
            string sArgu = arguments[index];
            Debug.Log(string.Format("BuildAssetProcess.BuildAndroid argument[{0}]:{1}", index.ToString(), sArgu));
            int iTest = index + 1;
            if (arguments.Length <= iTest)
            {
                break;
            }
            if (sArgu.Equals("-version_num"))
            {
                sVersion = arguments[iTest];
                continue;
            }
        }

        //check command line parameters
        if (string.IsNullOrEmpty(sVersion))
        {
            throw new Exception(string.Format("BuildAssetProcess.BuildAndroid arguments error! Version:{0}", sVersion));
        }

        DoAndroidLowTextrue();
        BundleEditor.ExportBundleData(true, BuildTarget.Android);
        //CreateAssetZip(sVersion);
        Debug.Log("BuildAssetProcess.BuildAndroid end:" + DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"));
    }
Ejemplo n.º 4
0
    public static void Build()
    {
        //打AssetBundle
        BundleEditor.BuildAB();
        //写入版本数据
        SaveVersion(PlayerSettings.bundleVersion, PlayerSettings.applicationIdentifier);
        //打包后的AssetBundle的路径
        string sourcePath = BundleEditor.m_BuildABPath + "/";
        string targetPath = Application.streamingAssetsPath + "/";

        //将初始资源转到到StreamAsset路径下
        Copy(sourcePath, targetPath);
        string savePath = "";

        if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
        {
            savePath = m_AndroidPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget.ToString() + string.Format("_{0:yyyy_MM_dd_HH_mm}", DateTime.Now) + ".apk";
        }
        else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
        {
            savePath = m_iOSPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget.ToString() + string.Format("_{0:yyyy_MM_dd_HH_mm}", DateTime.Now);
        }
        else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64 || EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows)
        {
            savePath = m_WindowsPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget + string.Format("_{0:yyyy_MM_dd_HH_mm}/{1}.exe", DateTime.Now, m_AppName);
        }
        BuildPipeline.BuildPlayer(FindEnableLevel(), savePath, EditorUserBuildSettings.activeBuildTarget, BuildOptions.None);
        //打包之后删除
        DeleteStreamAssets();
        AssetDatabase.Refresh();
    }
Ejemplo n.º 5
0
 private void OnGUI()
 {
     GUILayout.BeginHorizontal();
     md5Path = EditorGUILayout.TextField("ABMD5文件路径", md5Path, GUILayout.Width(350), GUILayout.Height(20));
     if (GUILayout.Button("选择版本ABMD5文件", GUILayout.Width(150), GUILayout.Height(20)))
     {
         m_OpenFileName              = new OpenFileName();
         m_OpenFileName.structSize   = Marshal.SizeOf(m_OpenFileName);
         m_OpenFileName.filter       = "ABMD5文件(*.bytes)\0*.bytes";
         m_OpenFileName.file         = new string(new char[256]);
         m_OpenFileName.maxFile      = m_OpenFileName.file.Length;
         m_OpenFileName.fileTitle    = new string(new char[64]);
         m_OpenFileName.maxFileTitle = m_OpenFileName.fileTitle.Length;
         m_OpenFileName.initialDir   = (Application.dataPath + "/../Version").Replace("/", "\\");//默认路径
         m_OpenFileName.title        = "选择MD5窗口";
         m_OpenFileName.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008;
         if (LocalDialog.GetSaveFileName(m_OpenFileName))
         {
             Debug.Log(m_OpenFileName.file);
             md5Path = m_OpenFileName.file;
         }
     }
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal();
     hotCount = EditorGUILayout.TextField("ABMD5文件路径", hotCount, GUILayout.Width(350), GUILayout.Height(20));
     GUILayout.EndHorizontal();
     if (GUILayout.Button("开始打热更包", GUILayout.Width(100), GUILayout.Height(20)))
     {
         if (!string.IsNullOrEmpty(md5Path) && md5Path.EndsWith("bytes"))
         {
             BundleEditor.BuildAB(true, md5Path, hotCount);
         }
     }
 }
    public override IEnumerator Execute(UTContext context)
    {
        Debug.Log("Start Export AssetBundles");
        BundleEditor.ExportBundleData(true, BuildTarget.Android);
        Debug.Log("End Export AssetBundles");

        // string targetDirectory = context["AssetBundlesPath"] as string;
        // CopyAssetBundle(targetDirectory);
        string resourceVersion = context["resourceVersion"] as string;
        string targetPath      = BundleManager.UpdateOutputPath + "/../" + UpdateHelper.VersionFileName;

        Utils.WriteStringToFile(targetPath, resourceVersion);
        Debug.Log("Write resourceVersion[" + resourceVersion + "] to file[" + targetPath + "]");

        string MONTH  = System.DateTime.Now.Month > 9 ? "" + System.DateTime.Now.Month : "0" + System.DateTime.Now.Month;
        string DAY    = System.DateTime.Now.Day > 9 ? "" + System.DateTime.Now.Day : "0" + System.DateTime.Now.Day;
        string CurDay = System.DateTime.Now.Year + "_" + MONTH + "_" + DAY;
//        string productName = PlayerSettings.productName;
        string hour    = System.DateTime.Now.Hour > 9 ? "" + System.DateTime.Now.Hour : "0" + System.DateTime.Now.Hour;
        string minute  = System.DateTime.Now.Minute > 9 ? "" + System.DateTime.Now.Minute : "0" + System.DateTime.Now.Minute;
        string version = string.Format("{0}_{1}_{2}_{3}", PlatformHelper.GetGameVersion(), PlatformHelper.GetProgramVersion(), GCGame.Table.TableManager.GetPublicConfigByID(GameDefines.PublicResVersionKey, 0).IntValue, UserConfigData.ClientResVersion);

        string zipFileName = "Android_" + version + "_" + CurDay + "_" + hour + "" + minute + ".zip";

        // release文件夹
        string zipFolder = BundleManager.UpdateOutputPath + "/../../";

        CreateFolder(zipFolder);
        zipFolder += CurDay;
        CreateFolder(zipFolder);

        CreateSample(zipFolder + "/" + zipFileName, BundleManager.UpdateOutputPath + "/../");
        yield return("");
    }
Ejemplo n.º 7
0
    // 更新资源(将资源放在包体外)
    public static void BuildiOSUpdate()
    {
        BundleEditor.ExportBundleData(true, BuildTarget.iOS);
        BuildOptions opt = BuildOptions.None;

        CommandBuild.BuildPlayer(BuildTarget.iOS, opt, false);
    }
Ejemplo n.º 8
0
    public static void BuildAndroid()
    {
        BundleEditor.ExportBundleData(false, BuildTarget.Android);
        BuildOptions opt = BuildOptions.UncompressedAssetBundle;

        CommandBuild.BuildPlayer(BuildTarget.Android, opt);
    }
Ejemplo n.º 9
0
    public static void BuildWindows()
    {
        BundleEditor.ExportBundleData(false, BuildTarget.StandaloneWindows);
        BuildOptions opt = BuildOptions.UncompressedAssetBundle | BuildOptions.SymlinkLibraries;

        CommandBuild.BuildPlayer(BuildTarget.StandaloneWindows, opt);
    }
Ejemplo n.º 10
0
    public static void Build()
    {
        //打ab包
        BundleEditor.NormalBuild();
        //写入Version信息
        SaveVersion(PlayerSettings.bundleVersion, PlayerSettings.applicationIdentifier);
        //生成可执行程序
        string abPath = Application.dataPath + "/../AssetBundle/" + EditorUserBuildSettings.activeBuildTarget.ToString() + "/";

        Copy(abPath, Application.streamingAssetsPath);
        string savePath = "";

        if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
        {
            PlayerSettings.Android.keystorePass = "******";
            PlayerSettings.Android.keyaliasPass = "******";
            PlayerSettings.Android.keyaliasName = "android.keystore";
            PlayerSettings.Android.keystoreName = Application.dataPath.Replace("/Assets", "") + "/realfram.keystore";
            savePath = m_AndroidPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget + string.Format("_{0:yyyy_MM_dd_HH_mm}", DateTime.Now) + ".apk";
        }
        else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
        {
            savePath = m_IOSPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget + string.Format("_{0:yyyy_MM_dd_HH_mm}", DateTime.Now);
        }
        else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows || EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64)
        {
            savePath = m_WindowsPath + m_AppName + "_" + EditorUserBuildSettings.activeBuildTarget + string.Format("_{0:yyyy_MM_dd_HH_mm}/{1}.exe", DateTime.Now, m_AppName);
        }

        BuildPipeline.BuildPlayer(FindEnableEditorrScenes(), savePath, EditorUserBuildSettings.activeBuildTarget, BuildOptions.None);
        DeleteDir(Application.streamingAssetsPath);
    }
Ejemplo n.º 11
0
    public static void BuildiOSUpdateTW()
    {
        if (!Internationalize.CopyInternationRes(Games.GlobeDefine.GlobeVar.TYPE_INTERNATION))
        {
            return;
        }
        BundleEditor.ExportBundleData(true, BuildTarget.iOS);
        BuildOptions opt = BuildOptions.None;

        CommandBuild.BuildPlayer(BuildTarget.iOS, opt, false);
    }
Ejemplo n.º 12
0
    public static void BuildIOS()
    {
        //打ab包
        BundleEditor.Build();
        BuildSetting buildSetting = GetIOSBuildSetting();
        string       suffix       = SetIOSSetting(buildSetting);

        //生成可执行程序
        string abPath = Application.dataPath + "/../AssetBundle/" + EditorUserBuildSettings.activeBuildTarget.ToString() + "/";

        //清空生成的文件夹
        DeleteDir(m_IOSPath);
        Copy(abPath, Application.streamingAssetsPath);
        string name     = m_AppName + "_IOS" + suffix + string.Format("_{0:yyyy_MM_dd_HH_mm}", DateTime.Now);
        string savePath = m_IOSPath + name;

        BuildPipeline.BuildPlayer(FindEnableEditorrScenes(), savePath, EditorUserBuildSettings.activeBuildTarget, BuildOptions.None);
        DeleteDir(Application.streamingAssetsPath);
        WriteBuildName(name);
    }
Ejemplo n.º 13
0
    public static void BuildAndroid()
    {
        //打ab包
        BundleEditor.Build();
        PlayerSettings.Android.keystorePass = "******";
        PlayerSettings.Android.keyaliasPass = "******";
        PlayerSettings.Android.keyaliasName = "android.keystore";
        PlayerSettings.Android.keystoreName = Application.dataPath.Replace("/Assets", "") + "/realfram.keystore";
        BuildSetting buildSetting = GetAndoridBuildSetting();
        string       suffix       = SetAndroidSetting(buildSetting);
        //生成可执行程序
        string abPath = Application.dataPath + "/../AssetBundle/" + EditorUserBuildSettings.activeBuildTarget.ToString() + "/";

        //清空生成的文件夹
        DeleteDir(m_AndroidPath);
        Copy(abPath, Application.streamingAssetsPath);
        string savePath = m_AndroidPath + m_AppName + "_Andorid" + suffix + string.Format("_{0:yyyy_MM_dd_HH_mm}.apk", DateTime.Now);

        BuildPipeline.BuildPlayer(FindEnableEditorrScenes(), savePath, EditorUserBuildSettings.activeBuildTarget, BuildOptions.None);
        DeleteDir(Application.streamingAssetsPath);
    }
Ejemplo n.º 14
0
 public static void BuildiOSInternalRes()
 {
     BundleEditor.ExportBundleData(false, GetBuildResTarget);
 }
Ejemplo n.º 15
0
 public static void BuildiOSUpdateRes()
 {
     BundleEditor.ExportBundleData(true, BuildTarget.iOS);
 }