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