/// <summary>
        ///
        /// </summary>
        void DrawScenes()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("场景", "OL Title");
            GUILayout.Label("是否打包", "OL Title", GUILayout.Width(80f));
            GUILayout.Label("压缩", "OL Title", GUILayout.Width(80f));
            GUILayout.Label("打包到安装包", "OL Title", GUILayout.Width(80f));
            GUILayout.EndHorizontal();

            GUILayout.BeginVertical(GUI.skin.FindStyle("flow background"));
            GUILayout.BeginHorizontal(GUI.skin.FindStyle("flow background"));
            scene_scroll_ = GUILayout.BeginScrollView(scene_scroll_);
            for (int i = 0; i < asset_bundle_build_.Data.Scenes.Scenes.Count; ++i)
            {
                var scene = asset_bundle_build_.Data.Scenes.Scenes[i];
                GUI.color = Color.white;
                GUILayout.Space(-1f);
                bool highlight = selection_scene_ == scene.ScenePath;
                GUI.backgroundColor = highlight ? Color.white : new Color(0.8f, 0.8f, 0.8f);
                GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
                GUI.backgroundColor = Color.white;
                if (GUILayout.Button(scene.ScenePath, "OL TextField", GUILayout.Height(20f)))
                {
                    selection_scene_ = scene.ScenePath;
                }

                scene.IsBuild    = GUILayout.Toggle(scene.IsBuild, "", GUILayout.Width(80f));
                scene.IsCompress = GUILayoutHelper.Toggle(scene.IsCompress || asset_bundle_build_.Data.IsAllCompress, "", asset_bundle_build_.Data.IsAllCompress, GUILayout.Width(80f));
                scene.IsNative   = GUILayoutHelper.Toggle(scene.IsNative || asset_bundle_build_.Data.IsAllNative, "", asset_bundle_build_.Data.IsAllNative, GUILayout.Width(60f));
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
        /// <summary>
        /// 选中的树形节点信息
        /// </summary>
        bool DrawSelectAssetNodeInfo(out emAssetBundleNameRule rule
                                     , out bool is_compress, out bool is_native, out bool is_permanent, out bool is_startup_load)
        {
            rule            = emAssetBundleNameRule.None;
            is_compress     = false;
            is_native       = false;
            is_permanent    = false;
            is_startup_load = false;

            if (gui_multi_select_ == null || gui_multi_select_.SelectNodes.Count == 0)
            {
                return(false);
            }

            var asset_node = gui_multi_select_.SelectNodes[0] as AssetNode;

            rule            = (emAssetBundleNameRule)asset_node.Element.Rule;
            is_compress     = asset_node.Element.IsCompress;
            is_native       = asset_node.Element.IsNative;
            is_permanent    = asset_node.Element.IsPermanent;
            is_startup_load = asset_node.Element.IsStartupLoad;

            GUILayout.BeginVertical();

            //打包规则
            GUILayout.BeginHorizontal();
            GUILayout.Label("打包规则", GUILayout.Width(50f), GUILayout.MaxHeight(16f));
            emAssetBundleNameRule select_rule = (emAssetBundleNameRule)EditorGUILayout.EnumPopup("", rule, GUILayout.MaxWidth(150f), GUILayout.MaxHeight(16f));

            GUILayout.EndHorizontal();

            var  config             = AssetBundleBuildWindow.Instance.asset_bundle_build_.Data;
            bool is_compress_op     = is_compress;
            bool is_native_op       = is_native;
            bool is_permanent_op    = is_permanent;
            bool is_startup_load_op = is_startup_load;

            if (select_rule == emAssetBundleNameRule.SingleFile ||
                select_rule == emAssetBundleNameRule.Folder)
            {
                is_compress_op     = GUILayoutHelper.Toggle(is_compress_op, "压缩", config.IsAllCompress);
                is_native_op       = GUILayoutHelper.Toggle(is_native_op, "打包到安装包", config.IsAllNative);
                is_permanent_op    = GUILayout.Toggle(is_permanent_op, "常驻内存");
                is_startup_load_op = GUILayout.Toggle(is_startup_load_op, "启动时加载");
            }

            if (asset_node != null && asset_node.GranularityDetails != null)
            {
                GUILayout.Space(20f);
                GUILayout.Label("粒度详细引用信息", "OL Title");
                GUILayout.TextArea(asset_node.GranularityDetails);
            }

            GUILayout.EndVertical();

            if (select_rule != rule ||
                is_compress != is_compress_op ||
                is_native != is_native_op ||
                is_permanent != is_permanent_op ||
                is_startup_load != is_startup_load_op)
            {
                rule            = select_rule;
                is_compress     = is_compress_op;
                is_native       = is_native_op;
                is_permanent    = is_permanent_op;
                is_startup_load = is_startup_load_op;
                return(true);
            }

            return(false);
        }
Пример #3
0
            /// <summary>
            /// 渲染
            /// </summary>
            public override GUILayoutMultiSelectGroup.OperateResult Draw(float width)
            {
                if (AssetBundle == null)
                {
                    return(null);
                }

                var config = AssetBundleBrowseWindow.Instance.Manifest.Data;

                GUI.backgroundColor = IsSelect ? Color.white : new Color(0.8f, 0.8f, 0.8f);
                GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
                GUI.color = IsSelect ? Color.yellow : Color.white;
                GUILayout.Label(Index.ToString(), GUILayout.Width(24f));
                bool  toggle   = GUILayout.Button(AssetBundle.AssetBundleName, "OL TextField", GUILayout.Height(20f));
                float size     = (float)AssetBundle.Size / 1024f;
                bool  toggle_1 = GUILayout.Button(size.ToString("F2") + "KB", "OL TextField", GUILayout.Width(108f));

                GUILayout.Space(32f);
                bool is_compress = GUILayoutHelper.Toggle(config.IsAllCompress || AssetBundle.IsCompress, "", config.IsAllCompress, GUILayout.Width(24f));

                GUILayout.Space(40f);
                bool is_native = GUILayoutHelper.Toggle(config.IsAllNative || AssetBundle.IsNative, "", config.IsAllNative, GUILayout.Width(24f));

                GUILayout.Space(40f);
                bool is_permanent = GUILayoutHelper.Toggle(AssetBundle.IsPermanent, "", false, GUILayout.Width(24f));

                GUILayout.Space(40f);
                bool is_startup_load = GUILayoutHelper.Toggle(AssetBundle.IsStartupLoad, "", false, GUILayout.Width(24f));

                GUILayout.EndHorizontal();
                GUI.color           = Color.white;
                GUI.backgroundColor = Color.white;

                SelectResultStatus.Operate op = SelectResultStatus.Operate.None;
                if (is_compress != AssetBundle.IsCompress)
                {
                    op = SelectResultStatus.Operate.Compress;
                }
                if (is_native != AssetBundle.IsNative)
                {
                    op = SelectResultStatus.Operate.Native;
                }
                if (is_permanent != AssetBundle.IsPermanent)
                {
                    op = SelectResultStatus.Operate.Permanent;
                }
                if (is_startup_load != AssetBundle.IsStartupLoad)
                {
                    op = SelectResultStatus.Operate.StartupLoad;
                }

                if (toggle || toggle_1 || op != SelectResultStatus.Operate.None)
                {
                    return(new GUILayoutMultiSelectGroup.OperateResult()
                    {
                        SelectNode = this,
                        Status = new SelectResultStatus()
                        {
                            Op = op,
                            IsCompress = is_compress,
                            IsNative = is_native,
                            IsPermanent = is_permanent,
                            IsStartupLoad = is_startup_load,
                        },
                    });
                }

                return(null);
            }