您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
49 行
1.2 KiB
49 行
1.2 KiB
using UnityEngine.UI;
|
|
|
|
namespace UnityEngine.Rendering.UI
|
|
{
|
|
public class DebugUIHandlerValue : DebugUIHandlerWidget
|
|
{
|
|
public Text nameLabel;
|
|
public Text valueLabel;
|
|
DebugUI.Value m_Field;
|
|
|
|
float m_Timer;
|
|
|
|
protected override void OnEnable()
|
|
{
|
|
m_Timer = 0f;
|
|
}
|
|
|
|
internal override void SetWidget(DebugUI.Widget widget)
|
|
{
|
|
base.SetWidget(widget);
|
|
m_Field = CastWidget<DebugUI.Value>();
|
|
nameLabel.text = m_Field.displayName;
|
|
}
|
|
|
|
public override bool OnSelection(bool fromNext, DebugUIHandlerWidget previous)
|
|
{
|
|
nameLabel.color = colorSelected;
|
|
valueLabel.color = colorSelected;
|
|
return true;
|
|
}
|
|
|
|
public override void OnDeselection()
|
|
{
|
|
nameLabel.color = colorDefault;
|
|
valueLabel.color = colorDefault;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (m_Timer >= m_Field.refreshRate)
|
|
{
|
|
valueLabel.text = m_Field.GetValue().ToString();
|
|
m_Timer -= m_Field.refreshRate;
|
|
}
|
|
|
|
m_Timer += Time.deltaTime;
|
|
}
|
|
}
|
|
}
|