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

40 lines
847 B
C#

using SRF;
using SRF.UI;
using UnityEngine;
namespace SRDebugger.UI.Other
{
[RequireComponent(typeof(StyleComponent))]
public class DebugPanelBackgroundBehaviour : SRMonoBehaviour
{
private string _defaultKey;
private bool _isTransparent;
private StyleComponent _styleComponent;
public string TransparentStyleKey = string.Empty;
private void Awake()
{
_styleComponent = GetComponent<StyleComponent>();
_defaultKey = _styleComponent.StyleKey;
Update();
}
private void Update()
{
if (!_isTransparent && Settings.Instance.EnableBackgroundTransparency)
{
_styleComponent.StyleKey = TransparentStyleKey;
_isTransparent = true;
}
else if (_isTransparent && !Settings.Instance.EnableBackgroundTransparency)
{
_styleComponent.StyleKey = _defaultKey;
_isTransparent = false;
}
}
}
}