您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
47 行
1.1 KiB
47 行
1.1 KiB
using System;
|
|
using UnityEngine.UI;
|
|
|
|
namespace UnityEngine.Rendering.UI
|
|
{
|
|
public class DebugUIHandlerIndirectToggle : DebugUIHandlerWidget
|
|
{
|
|
public Text nameLabel;
|
|
public Toggle valueToggle;
|
|
public Image checkmarkImage;
|
|
|
|
public Func<int, bool> getter;
|
|
public Action<int, bool> setter;
|
|
public int index;
|
|
|
|
public void Init()
|
|
{
|
|
UpdateValueLabel();
|
|
}
|
|
|
|
public override bool OnSelection(bool fromNext, DebugUIHandlerWidget previous)
|
|
{
|
|
nameLabel.color = colorSelected;
|
|
checkmarkImage.color = colorSelected;
|
|
return true;
|
|
}
|
|
|
|
public override void OnDeselection()
|
|
{
|
|
nameLabel.color = colorDefault;
|
|
checkmarkImage.color = colorDefault;
|
|
}
|
|
|
|
public override void OnAction()
|
|
{
|
|
bool value = !getter(index);
|
|
setter(index, value);
|
|
UpdateValueLabel();
|
|
}
|
|
|
|
void UpdateValueLabel()
|
|
{
|
|
if (valueToggle != null)
|
|
valueToggle.isOn = getter(index);
|
|
}
|
|
}
|
|
}
|