You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

50 lines
1.4 KiB

using UnityEngine.UI;
namespace UnityEngine.Rendering.UI
{
/// <summary>
/// DebugUIHandler for Button widget.
/// </summary>
public class DebugUIHandlerButton : DebugUIHandlerWidget
{
/// <summary>Name of the widget.</summary>
public Text nameLabel;
DebugUI.Button m_Field;
internal override void SetWidget(DebugUI.Widget widget)
{
base.SetWidget(widget);
m_Field = CastWidget<DebugUI.Button>();
nameLabel.text = m_Field.displayName;
}
/// <summary>
/// OnSelection implementation.
/// </summary>
/// <param name="fromNext">True if the selection wrapped around.</param>
/// <param name="previous">Previous widget.</param>
/// <returns>State of the widget.</returns>
public override bool OnSelection(bool fromNext, DebugUIHandlerWidget previous)
{
nameLabel.color = colorSelected;
return true;
}
/// <summary>
/// OnDeselection implementation.
/// </summary>
public override void OnDeselection()
{
nameLabel.color = colorDefault;
}
/// <summary>
/// OnAction implementation.
/// </summary>
public override void OnAction()
{
if (m_Field.action != null)
m_Field.action();
}
}
}