You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/3rd/StompyRobot/SRDebugger/Scripts/UI/Tabs/ProfilerTabController.cs

50 lines
1010 B
C#

//#define SR_CONSOLE_DEBUG
namespace SRDebugger.UI.Tabs
{
using SRF;
using UnityEngine.UI;
public class ProfilerTabController : SRMonoBehaviourEx
{
private bool _isDirty;
[RequiredField] public Toggle PinToggle;
protected override void Start()
{
base.Start();
PinToggle.onValueChanged.AddListener(PinToggleValueChanged);
Refresh();
}
private void PinToggleValueChanged(bool isOn)
{
SRDebug.Instance.IsProfilerDocked = isOn;
}
protected override void OnEnable()
{
base.OnEnable();
_isDirty = true;
}
protected override void Update()
{
base.Update();
if (_isDirty)
{
Refresh();
}
}
private void Refresh()
{
PinToggle.isOn = SRDebug.Instance.IsProfilerDocked;
_isDirty = false;
}
}
}