mirror of https://github.com/tuyoogame/YooAsset
update UIElements
parent
12bd282ace
commit
012f9b9f03
|
@ -53,7 +53,11 @@ namespace YooAsset.Editor
|
||||||
CreateDependTableViewColumns();
|
CreateDependTableViewColumns();
|
||||||
|
|
||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
SplitView.Adjuster(_root);
|
var topGroup = _root.Q<VisualElement>("TopGroup");
|
||||||
|
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
|
||||||
|
topGroup.style.minHeight = 100;
|
||||||
|
bottomGroup.style.minHeight = 100f;
|
||||||
|
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
private void CreateAssetTableViewColumns()
|
private void CreateAssetTableViewColumns()
|
||||||
|
|
|
@ -54,7 +54,11 @@ namespace YooAsset.Editor
|
||||||
CreateUsingTableViewColumns();
|
CreateUsingTableViewColumns();
|
||||||
|
|
||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
SplitView.Adjuster(_root);
|
var topGroup = _root.Q<VisualElement>("TopGroup");
|
||||||
|
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
|
||||||
|
topGroup.style.minHeight = 100;
|
||||||
|
bottomGroup.style.minHeight = 100f;
|
||||||
|
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
private void CreateBundleTableViewColumns()
|
private void CreateBundleTableViewColumns()
|
||||||
|
|
|
@ -57,7 +57,11 @@ namespace YooAsset.Editor
|
||||||
CreateDependTableViewColumns();
|
CreateDependTableViewColumns();
|
||||||
|
|
||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
SplitView.Adjuster(_root);
|
var topGroup = _root.Q<VisualElement>("TopGroup");
|
||||||
|
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
|
||||||
|
topGroup.style.minHeight = 100;
|
||||||
|
bottomGroup.style.minHeight = 100f;
|
||||||
|
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
private void CreateAssetTableViewColumns()
|
private void CreateAssetTableViewColumns()
|
||||||
|
|
|
@ -57,7 +57,11 @@ namespace YooAsset.Editor
|
||||||
CreateIncludeTableViewColumns();
|
CreateIncludeTableViewColumns();
|
||||||
|
|
||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
SplitView.Adjuster(_root);
|
var topGroup = _root.Q<VisualElement>("TopGroup");
|
||||||
|
var bottomGroup = _root.Q<VisualElement>("BottomGroup");
|
||||||
|
topGroup.style.minHeight = 100;
|
||||||
|
bottomGroup.style.minHeight = 100f;
|
||||||
|
PanelSplitView.SplitVerticalPanel(_root, topGroup, bottomGroup);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
private void CreateBundleTableViewColumns()
|
private void CreateBundleTableViewColumns()
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5f915322e2be56345a9d145800f7a0e0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 显示开关(眼睛图标)
|
||||||
|
/// </summary>
|
||||||
|
public class DisplayToggle : Toggle
|
||||||
|
{
|
||||||
|
private readonly VisualElement _checkbox;
|
||||||
|
|
||||||
|
public DisplayToggle()
|
||||||
|
{
|
||||||
|
_checkbox = this.Q<VisualElement>("unity-checkmark");
|
||||||
|
RefreshIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新图标
|
||||||
|
/// </summary>
|
||||||
|
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
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 551a9db915a2cf744ac6088e7c634689
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 分屏控件
|
||||||
|
/// </summary>
|
||||||
|
public class PanelSplitView : TwoPaneSplitView
|
||||||
|
{
|
||||||
|
#if UNITY_6000_0_OR_NEWER
|
||||||
|
public new class UxmlFactory : UxmlElementAttribute
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
public new class UxmlFactory : UxmlFactory<PanelSplitView, TwoPaneSplitView.UxmlTraits>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 竖版分屏
|
||||||
|
/// </summary>
|
||||||
|
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
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 分屏控件
|
|
||||||
/// </summary>
|
|
||||||
public class SplitView : TwoPaneSplitView
|
|
||||||
{
|
|
||||||
#if UNITY_6000_0_OR_NEWER
|
|
||||||
public new class UxmlFactory : UxmlElementAttribute
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
public new class UxmlFactory : UxmlFactory<SplitView, TwoPaneSplitView.UxmlTraits>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 窗口分屏适配
|
|
||||||
/// </summary>
|
|
||||||
public static void Adjuster(VisualElement root)
|
|
||||||
{
|
|
||||||
var topGroup = root.Q<VisualElement>("TopGroup");
|
|
||||||
var bottomGroup = root.Q<VisualElement>("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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 显示开关(眼睛图标)
|
|
||||||
/// </summary>
|
|
||||||
public class DisplayToggle : Toggle
|
|
||||||
{
|
|
||||||
private readonly VisualElement _checkbox;
|
|
||||||
|
|
||||||
public DisplayToggle()
|
|
||||||
{
|
|
||||||
_checkbox = this.Q<VisualElement>("unity-checkmark");
|
|
||||||
RefreshIcon();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 刷新图标
|
|
||||||
/// </summary>
|
|
||||||
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
|
|
Loading…
Reference in New Issue