diff --git a/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerAssetListViewer.cs b/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerAssetListViewer.cs index bb0ce23c..03f9432a 100644 --- a/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerAssetListViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerAssetListViewer.cs @@ -53,7 +53,11 @@ namespace YooAsset.Editor CreateDependTableViewColumns(); #if UNITY_2020_3_OR_NEWER - SplitView.Adjuster(_root); + var topGroup = _root.Q("TopGroup"); + var bottomGroup = _root.Q("BottomGroup"); + topGroup.style.minHeight = 100; + bottomGroup.style.minHeight = 100f; + PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup); #endif } private void CreateAssetTableViewColumns() diff --git a/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerBundleListViewer.cs b/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerBundleListViewer.cs index 6f72f385..d2e97d26 100644 --- a/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerBundleListViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleDebugger/VisualViewers/DebuggerBundleListViewer.cs @@ -54,7 +54,11 @@ namespace YooAsset.Editor CreateUsingTableViewColumns(); #if UNITY_2020_3_OR_NEWER - SplitView.Adjuster(_root); + var topGroup = _root.Q("TopGroup"); + var bottomGroup = _root.Q("BottomGroup"); + topGroup.style.minHeight = 100; + bottomGroup.style.minHeight = 100f; + PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup); #endif } private void CreateBundleTableViewColumns() diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs index 1770f4b6..5a9a39e4 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs @@ -57,7 +57,11 @@ namespace YooAsset.Editor CreateDependTableViewColumns(); #if UNITY_2020_3_OR_NEWER - SplitView.Adjuster(_root); + var topGroup = _root.Q("TopGroup"); + var bottomGroup = _root.Q("BottomGroup"); + topGroup.style.minHeight = 100; + bottomGroup.style.minHeight = 100f; + PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup); #endif } private void CreateAssetTableViewColumns() diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs index e88ff0b6..07f63ebe 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs @@ -57,7 +57,11 @@ namespace YooAsset.Editor CreateIncludeTableViewColumns(); #if UNITY_2020_3_OR_NEWER - SplitView.Adjuster(_root); + var topGroup = _root.Q("TopGroup"); + var bottomGroup = _root.Q("BottomGroup"); + topGroup.style.minHeight = 100; + bottomGroup.style.minHeight = 100f; + PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup); #endif } private void CreateBundleTableViewColumns() diff --git a/Assets/YooAsset/Editor/UIElements/ElementsDefine.meta b/Assets/YooAsset/Editor/UIElements/ElementsDefine.meta new file mode 100644 index 00000000..355f1c6b --- /dev/null +++ b/Assets/YooAsset/Editor/UIElements/ElementsDefine.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f915322e2be56345a9d145800f7a0e0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/YooAsset/Editor/UIElements/ElementsDefine/DisplayToggle.cs b/Assets/YooAsset/Editor/UIElements/ElementsDefine/DisplayToggle.cs new file mode 100644 index 00000000..be523aca --- /dev/null +++ b/Assets/YooAsset/Editor/UIElements/ElementsDefine/DisplayToggle.cs @@ -0,0 +1,41 @@ +#if UNITY_2019_4_OR_NEWER +using System; +using UnityEditor; +using UnityEngine; +using UnityEditor.UIElements; +using UnityEngine.UIElements; + +namespace YooAsset.Editor +{ + /// + /// 显示开关(眼睛图标) + /// + public class DisplayToggle : Toggle + { + private readonly VisualElement _checkbox; + + public DisplayToggle() + { + _checkbox = this.Q("unity-checkmark"); + RefreshIcon(); + } + + /// + /// 刷新图标 + /// + public void RefreshIcon() + { + if (this.value) + { + var icon = EditorGUIUtility.IconContent("animationvisibilitytoggleoff@2x").image as Texture2D; + _checkbox.style.backgroundImage = icon; + } + else + { + var icon = EditorGUIUtility.IconContent("animationvisibilitytoggleon@2x").image as Texture2D; + _checkbox.style.backgroundImage = icon; + } + } + } +} +#endif \ No newline at end of file diff --git a/Assets/YooAsset/Editor/UIElements/ElementsDefine/DisplayToggle.cs.meta b/Assets/YooAsset/Editor/UIElements/ElementsDefine/DisplayToggle.cs.meta new file mode 100644 index 00000000..b251ffb3 --- /dev/null +++ b/Assets/YooAsset/Editor/UIElements/ElementsDefine/DisplayToggle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 551a9db915a2cf744ac6088e7c634689 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/YooAsset/Editor/UIElements/ElementsDefine/PanelSplitView.cs b/Assets/YooAsset/Editor/UIElements/ElementsDefine/PanelSplitView.cs new file mode 100644 index 00000000..d4cbf918 --- /dev/null +++ b/Assets/YooAsset/Editor/UIElements/ElementsDefine/PanelSplitView.cs @@ -0,0 +1,42 @@ +#if UNITY_2020_3_OR_NEWER +using System; +using UnityEditor; +using UnityEngine; +using UnityEditor.UIElements; +using UnityEngine.UIElements; + +namespace YooAsset.Editor +{ + /// + /// 分屏控件 + /// + public class PanelSplitView : TwoPaneSplitView + { +#if UNITY_6000_0_OR_NEWER + public new class UxmlFactory : UxmlElementAttribute + { + } +#else + public new class UxmlFactory : UxmlFactory + { + } +#endif + + /// + /// 竖版分屏 + /// + public static void SplitVerticalPanel(VisualElement root, VisualElement panelA, VisualElement panelB) + { + root.Remove(panelA); + root.Remove(panelB); + + var spliteView = new PanelSplitView(); + spliteView.fixedPaneInitialDimension = 300; + spliteView.orientation = TwoPaneSplitViewOrientation.Vertical; + spliteView.contentContainer.Add(panelA); + spliteView.contentContainer.Add(panelB); + root.Add(spliteView); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/YooAsset/Editor/UIElements/UIElementsDefine.cs.meta b/Assets/YooAsset/Editor/UIElements/ElementsDefine/PanelSplitView.cs.meta similarity index 100% rename from Assets/YooAsset/Editor/UIElements/UIElementsDefine.cs.meta rename to Assets/YooAsset/Editor/UIElements/ElementsDefine/PanelSplitView.cs.meta diff --git a/Assets/YooAsset/Editor/UIElements/UIElementsDefine.cs b/Assets/YooAsset/Editor/UIElements/UIElementsDefine.cs deleted file mode 100644 index 41b31cee..00000000 --- a/Assets/YooAsset/Editor/UIElements/UIElementsDefine.cs +++ /dev/null @@ -1,76 +0,0 @@ -#if UNITY_2020_3_OR_NEWER -using System; -using UnityEditor; -using UnityEngine; -using UnityEditor.UIElements; -using UnityEngine.UIElements; - -namespace YooAsset.Editor -{ - /// - /// 分屏控件 - /// - public class SplitView : TwoPaneSplitView - { -#if UNITY_6000_0_OR_NEWER - public new class UxmlFactory : UxmlElementAttribute - { - } -#else - public new class UxmlFactory : UxmlFactory - { - } -#endif - - /// - /// 窗口分屏适配 - /// - public static void Adjuster(VisualElement root) - { - var topGroup = root.Q("TopGroup"); - var bottomGroup = root.Q("BottomGroup"); - topGroup.style.minHeight = 100f; - bottomGroup.style.minHeight = 100f; - root.Remove(topGroup); - root.Remove(bottomGroup); - var spliteView = new SplitView(); - spliteView.fixedPaneInitialDimension = 300; - spliteView.orientation = TwoPaneSplitViewOrientation.Vertical; - spliteView.contentContainer.Add(topGroup); - spliteView.contentContainer.Add(bottomGroup); - root.Add(spliteView); - } - } - - /// - /// 显示开关(眼睛图标) - /// - public class DisplayToggle : Toggle - { - private readonly VisualElement _checkbox; - - public DisplayToggle() - { - _checkbox = this.Q("unity-checkmark"); - RefreshIcon(); - } - - /// - /// 刷新图标 - /// - public void RefreshIcon() - { - if (this.value) - { - var icon = EditorGUIUtility.IconContent("animationvisibilitytoggleoff@2x").image as Texture2D; - _checkbox.style.backgroundImage = icon; - } - else - { - var icon = EditorGUIUtility.IconContent("animationvisibilitytoggleon@2x").image as Texture2D; - _checkbox.style.backgroundImage = icon; - } - } - } -} -#endif \ No newline at end of file