Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/SRDebugger/UI/Tabs/ProfilerTabController.cs
2026-02-21 16:45:37 +08:00

47 lines
740 B
C#

using SRF;
using UnityEngine.UI;
namespace SRDebugger.UI.Tabs
{
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;
}
}
}