示例#1
0
    /*
     * [MenuItem("Haruhi/Build/CommandLineBuildFastIOS", false, 1)]
     * public static void CommandLineBuildFast()
     * {
     *  SetBuildSetting();
     *  FastBuild(buidPathIOS, BuildTarget.iOS, BuildTargetGroup.iOS);
     * }
     *
     * [MenuItem("Haruhi/Build/CommandLineBuildFastIOSDebug", false, 2)]
     * public static void CommandLineBuildFastIOSDebug()
     * {
     *  SetBuildSetting(true);
     *  FastBuild(buidPathIOS, BuildTarget.iOS, BuildTargetGroup.iOS);
     * }
     *
     * [MenuItem("Haruhi/Build/CommandLineBuildFastIOSDebugSkipBundle", false, 3)]
     * public static void CommandLineBuildFastIOSDebugSkipBundle()
     * {
     *  g_bSkipBundle = true;
     *  SetBuildSetting(true);
     *  FastBuild(buidPathIOS, BuildTarget.iOS, BuildTargetGroup.iOS);
     * }
     *
     *
     * [MenuItem("Haruhi/Build/CommandLineBuildFastAndroid", false, 21)]
     * public static void CommandLineBuildFastAndroid()
     * {
     *  SetAndroidBuildSettings();
     *  AssetDatabase.Refresh();
     *  FastBuild(buidPathAndroid, BuildTarget.Android, BuildTargetGroup.Android);
     * }
     *
     * [MenuItem("Haruhi/Build/CommandLineBuildFastAndroidDebug", false, 22)]
     * public static void CommandLineBuildFastAndroidDebug()
     * {
     *  SetAndroidBuildSettings(true);
     *  AssetDatabase.Refresh();
     *  FastBuild(buidPathAndroid, BuildTarget.Android, BuildTargetGroup.Android);
     * }
     *
     * [MenuItem("Haruhi/Build/CommandLineBuildFastAndroidDebugSkipBundle", false, 23)]
     * public static void CommandLineBuildFastAndroidDebugSkipBundle()
     * {
     *  g_bSkipBundle = true;
     *  SetAndroidBuildSettings(true);
     *  AssetDatabase.Refresh();
     *  FastBuild(buidPathAndroid, BuildTarget.Android, BuildTargetGroup.Android);
     * }
     *
     * [MenuItem("Haruhi/Build/BuildAssets IOS", false, 51)]
     * public static void BuildAssetsIOS()
     * {
     *  g_bSkipBuildPlayer = true;
     *  SetBuildSetting(true);
     *      AssetDatabase.Refresh();
     *  FastBuild(buidPathIOS, BuildTarget.iOS, BuildTargetGroup.iOS);
     * }
     *
     * [MenuItem("Haruhi/Build/BuildAssets Android", false, 52)]
     * public static void BuildAssetsAndroid()
     * {
     *  g_bSkipBuildPlayer = true;
     *  SetAndroidBuildSettings(true);
     *  AssetDatabase.Refresh();
     *  FastBuild(buidPathAndroid, BuildTarget.Android, BuildTargetGroup.Android);
     * }
     *
     * [MenuItem("Haruhi/Build/BuildAssets Windows", false, 53)]
     * public static void BuildAssetsWindows()
     * {
     *  g_bSkipBuildPlayer = true;
     *  SetBuildSetting(true);
     *  AssetDatabase.Refresh();
     *  FastBuild(buidPathWindows, BuildTarget.StandaloneWindows, BuildTargetGroup.Standalone);
     * }
     *
     *  [MenuItem("Haruhi/Build/BuildText IOS", false, 71)]
     *  public static void BuildTextIOS()
     *  {
     *          g_bSkipBuildPlayer = true;
     *          g_bSkipBundle = true;
     *          SetBuildSetting(true);
     *          AssetDatabase.Refresh();
     *          FastBuild(buidPathIOS, BuildTarget.iOS, BuildTargetGroup.iOS);
     *  }
     *
     *  [MenuItem("Haruhi/Build/BuildText Android", false, 72)]
     *  public static void BuildTextAndroid()
     *  {
     *          g_bSkipBuildPlayer = true;
     *          g_bSkipBundle = true;
     *          SetAndroidBuildSettings(true);
     *          AssetDatabase.Refresh();
     *          FastBuild(buidPathAndroid, BuildTarget.Android, BuildTargetGroup.Android);
     *  }
     *
     *  [MenuItem("Haruhi/Build/BuildText Windows", false, 73)]
     *  public static void BuildTextWindows()
     *  {
     *          g_bSkipBuildPlayer = true;
     *          g_bSkipBundle = true;
     *          SetBuildSetting(true);
     *          AssetDatabase.Refresh();
     *          FastBuild(buidPathWindows, BuildTarget.sta, BuildTargetGroup.Standalone);
     *  }
     *
     */

    private static void FastBuild(string buildPath, BuildTarget target, BuildTargetGroup targetGroup)
    {
        Debug.Log("Version of the unity is: " + Application.unityVersion);
        XSwitchPlatform(targetGroup, target);
        SetBuildParamFromCommandLineArgs();

        if (Directory.Exists(buildPath))
        {
            Directory.Delete(buildPath, true);
        }

        if (!Directory.Exists(buildOutPath))
        {
            Directory.CreateDirectory(buildOutPath);
        }

        var resourceList = ResourceBuildTool.GetBuildResources(PathUtility.FullPathToProjectPath(PathUtility.ResourcesPath));

        BuildGame(buildPath, target, buildOption, resourceList);
    }
示例#2
0
    private static void ResetAllAssetBundleName()
    {
        string[] abNameArr = AssetDatabase.GetAllAssetBundleNames();
        for (int i = 0; i < abNameArr.Length; i++)
        {
            EditorUtility.DisplayProgressBar("Remove All AssetBundleName", abNameArr[i], (float)i / abNameArr.Length);
            AssetDatabase.RemoveAssetBundleName(abNameArr[i], true);
        }
        AssetDatabase.SaveAssets();
        EditorUtility.ClearProgressBar();

        //set abname
        var resourceList = ResourceBuildTool.GetBuildResources(PathUtility.FullPathToProjectPath(PathUtility.ResourcesPath));

        CollectionUtility.Insert(resourceSet, resourceList);

        if (!ResourcesBuilder.SetAssetsBundleName(resourceSet))
        {
            Debug.LogError("Error SetAssetsBundleName失敗");
        }
        EditorUtility.ClearProgressBar();
    }