WuhuIslandTesting/Library/PackageCache/com.unity.addressables@1.21.12/Editor/BuildReportVisualizer/ToggleTextExpansionButton.cs
2025-01-07 02:06:59 +01:00

31 lines
916 B
C#

#if UNITY_2022_2_OR_NEWER
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
namespace UnityEditor.AddressableAssets.BuildReportVisualizer
{
public class ToggleTextExpansionButton
{
internal Button ToggleButton { get; set; }
internal ToggleTextExpansionButton(VisualElement container, Length collapsedHeight)
{
ToggleButton = new Button();
ToggleButton.userData = false;
ToggleButton.text = "EYE";
ToggleButton.clicked += () =>
{
if((bool)ToggleButton.userData)
container.style.maxHeight = new Length(100f, LengthUnit.Percent);
else
container.style.maxHeight = collapsedHeight;
ToggleButton.userData = !((bool)ToggleButton.userData);
};
}
}
}
#endif