mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-23 17:20:12 +00:00
update diagnostic system
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
#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
|
||||
@@ -1,36 +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 PanelSplitView : TwoPaneSplitView
|
||||
{
|
||||
public new class UxmlFactory : UxmlFactory<PanelSplitView, UxmlTraits>
|
||||
{
|
||||
}
|
||||
|
||||
/// <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
|
||||
@@ -0,0 +1,52 @@
|
||||
#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 ToggleDisplay : Toggle
|
||||
{
|
||||
public new class UxmlFactory : UxmlFactory<ToggleDisplay, UxmlTraits>
|
||||
{
|
||||
}
|
||||
|
||||
private readonly VisualElement _checkbox;
|
||||
|
||||
public ToggleDisplay()
|
||||
{
|
||||
_checkbox = this.Q<VisualElement>("unity-checkmark");
|
||||
RefreshIcon();
|
||||
}
|
||||
public override void SetValueWithoutNotify(bool newValue)
|
||||
{
|
||||
base.SetValueWithoutNotify(newValue);
|
||||
RefreshIcon();
|
||||
}
|
||||
protected override void ToggleValue()
|
||||
{
|
||||
base.ToggleValue();
|
||||
RefreshIcon();
|
||||
}
|
||||
|
||||
private void RefreshIcon()
|
||||
{
|
||||
if (this.value)
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent(UIElementsIcon.VisibilityToggleOff).image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent(UIElementsIcon.VisibilityToggleOn).image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
#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 ToggleRecord : Toggle
|
||||
{
|
||||
public new class UxmlFactory : UxmlFactory<ToggleRecord, UxmlTraits>
|
||||
{
|
||||
}
|
||||
|
||||
private readonly VisualElement _checkbox;
|
||||
|
||||
public ToggleRecord()
|
||||
{
|
||||
_checkbox = this.Q<VisualElement>("unity-checkmark");
|
||||
RefreshIcon();
|
||||
}
|
||||
public override void SetValueWithoutNotify(bool newValue)
|
||||
{
|
||||
base.SetValueWithoutNotify(newValue);
|
||||
RefreshIcon();
|
||||
}
|
||||
protected override void ToggleValue()
|
||||
{
|
||||
base.ToggleValue();
|
||||
RefreshIcon();
|
||||
}
|
||||
|
||||
private void RefreshIcon()
|
||||
{
|
||||
if (this.value)
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent(UIElementsIcon.RecordOn).image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
var icon = EditorGUIUtility.IconContent(UIElementsIcon.RecordOff).image as Texture2D;
|
||||
_checkbox.style.backgroundImage = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c3f4136cf7142346ae33e8a82cbdb27
|
||||
guid: 4eace285493a0844f8a8b8f4a4ea02d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
Reference in New Issue
Block a user