update UIElements

pull/497/head
何冠峰 2025-03-03 20:57:50 +08:00
parent 6b36cdb5ee
commit b74a44dc36
3 changed files with 7 additions and 13 deletions

View File

@ -52,7 +52,7 @@ namespace YooAsset.Editor
{
_rootList.Add(rootNode);
}
/// <summary>
/// 设置根节点数据
/// </summary>
@ -102,11 +102,6 @@ namespace YooAsset.Editor
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Row;
// 缩进元素
var label = new Label();
label.name = "space";
container.Add(label);
// 折叠按钮
var toggle = new ToggleFoldout();
toggle.text = string.Empty;
@ -134,14 +129,11 @@ namespace YooAsset.Editor
{
var treeNode = _flattenList[index];
// 设置元素缩进
var space = item.Q<Label>("space");
space.text = new string(' ', treeNode.GetDepth() * 4);
// 设置折叠状态
var toggle = item.Q<ToggleFoldout>("foldout");
toggle.SetValueWithoutNotify(treeNode.IsExpanded);
toggle.userData = treeNode;
toggle.style.marginLeft = treeNode.GetDepth() * 15;
// 隐藏折叠按钮
if (treeNode.Children.Count == 0)

View File

@ -10,8 +10,13 @@ namespace YooAsset.Editor
public const string RecordOn = "d_Record On@2x";
public const string RecordOff = "d_Record Off@2x";
#if UNITY_2019
public const string FoldoutOn = "IN foldout on";
public const string FoldoutOff = "IN foldout";
#else
public const string FoldoutOn = "d_IN_foldout_on@2x";
public const string FoldoutOff = "d_IN_foldout@2x";
#endif
public const string VisibilityToggleOff = "animationvisibilitytoggleoff@2x";
public const string VisibilityToggleOn = "animationvisibilitytoggleon@2x";

View File

@ -23,12 +23,10 @@ namespace YooAsset
public void Initialize()
{
Debug.LogWarning("X=Initialize");
_messageCallbacks.Clear();
}
public void Register(Guid messageID, UnityAction<MessageEventArgs> callback)
{
Debug.LogWarning("X=Register");
if (messageID == Guid.Empty)
throw new ArgumentException("messageID is empty !");
@ -37,7 +35,6 @@ namespace YooAsset
}
public void Unregister(Guid messageID)
{
Debug.LogWarning("X=Unregister");
if (_messageCallbacks.ContainsKey(messageID))
_messageCallbacks.Remove(messageID);
}