Exemple #1
0
        /// <summary>
        /// 打包AssetBundle
        /// </summary>
        void BuildingAssetBundle(emBuildType build_type)
        {
            try
            {
                bool running = true;
                SaveData();
                running = AssetBundleNameTool.RunningAssetBundleNameTool(asset_bundle_build_);
                if (running)
                {
                    running = SceneConfigTool.GenerateAllSceneConfig(asset_bundle_build_.Data.Scenes);
                }
                if (running)
                {
                    BuildAssetBundle.BuildAllAssetBundlesToTarget(GetBuildTargetType(build_type), build_option_);
                }
                if (running)
                {
                    LoadAssetBundleGranularityInfo();
                }
            }
            catch (System.Exception ex)
            {
                Debug.LogError(ex.Message);
            }

            SceneConfigTool.RestoreAllScene(asset_bundle_build_.Data.Scenes);
            EditorUtility.ClearProgressBar();
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        void DrawGeneral()
        {
            GUILayout.BeginVertical(GUI.skin.FindStyle("flow background"), GUILayout.MaxHeight(80f));
            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("输出位置", EditorCommon.BUILD_PATH);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            build_option_ = (BuildAssetBundleOptions)EditorGUILayout.EnumPopup("打包选项", build_option_, GUILayout.MinWidth(200f));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(20f);
            bool is_save_data = GUILayout.Button("仅保存规则文件(" + AssetBundleBuild.FILE_FULL_NAME + ")");

            GUILayout.Space(20f);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(20f);
            bool is_running_ab_name_tool = GUILayout.Button("仅生成资源AssetBundleName");

            GUILayout.Space(20f);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(20f);
            bool is_build_win = GUILayout.Button("Windows平台版本 - 打包");

            GUILayout.Space(20f);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(20f);
            bool is_build_android = GUILayout.Button(" Android平台版本 - 打包");

            GUILayout.Space(20f);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(20f);
            bool is_build_ios = GUILayout.Button("      IOS平台版本 - 打包");

            GUILayout.Space(20f);
            GUILayout.EndHorizontal();


            GUILayout.EndVertical();

            if (is_save_data)
            {
                SaveData();
            }
            if (is_running_ab_name_tool)
            {
                AssetBundleNameTool.RunningAssetBundleNameTool(asset_bundle_build_);
            }
            if (is_build_win)
            {
                BuildingAssetBundle(emBuildType.StandaloneWindows);
            }
            else if (is_build_android)
            {
                BuildingAssetBundle(emBuildType.Android);
            }
            else if (is_build_ios)
            {
                BuildingAssetBundle(emBuildType.IOS);
            }
        }