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/Other/DebugPanelBackgroundBehavio...

38 lines
1.0 KiB
C#

1 month ago
namespace SRDebugger.UI.Other
{
using SRF;
using SRF.UI;
using UnityEngine;
[RequireComponent(typeof (StyleComponent))]
public class DebugPanelBackgroundBehaviour : SRMonoBehaviour
{
private string _defaultKey;
private bool _isTransparent;
private StyleComponent _styleComponent;
public string TransparentStyleKey = "";
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;
}
}
}
}