Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 打包目标平台
        /// </summary>
        BuildTarget GetBuildTargetType(emBuildType build_type)
        {
            if (build_type == emBuildType.StandaloneWindows)
            {
                return(BuildTarget.StandaloneWindows);
            }
            else if (build_type == emBuildType.Android)
            {
                return(BuildTarget.Android);
            }
            else if (build_type == emBuildType.IOS)
            {
                return(BuildTarget.iOS);
            }

            return(BuildTarget.StandaloneWindows);
        }
        /// <summary>
        ///
        /// </summary>
        void DrawGeneral()
        {
            GUILayout.BeginVertical(GUI.skin.FindStyle("flow background"), GUILayout.MaxHeight(80f));
            GUILayout.BeginHorizontal();
            build_option_ = (BuildAssetBundleOptions)EditorGUILayout.EnumPopup("打包选项", build_option_, GUILayout.MinWidth(200f));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            build_type_ = (emBuildType)EditorGUILayout.EnumPopup("打包方式", build_type_, 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 = GUILayout.Button("开始打包");

            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)
            {
                BuildingAssetBundle();
            }
        }