DebugPanelBackgroundBehaviour.cs 966 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using SRF;
  3. using SRF.UI;
  4. using UnityEngine;
  5. namespace SRDebugger.UI.Other
  6. {
  7. [RequireComponent(typeof(StyleComponent))]
  8. public class DebugPanelBackgroundBehaviour : SRMonoBehaviour
  9. {
  10. private void Awake()
  11. {
  12. this._styleComponent = base.GetComponent<StyleComponent>();
  13. this._defaultKey = this._styleComponent.StyleKey;
  14. this.Update();
  15. }
  16. private void Update()
  17. {
  18. if (!this._isTransparent && Settings.Instance.EnableBackgroundTransparency)
  19. {
  20. this._styleComponent.StyleKey = this.TransparentStyleKey;
  21. this._isTransparent = true;
  22. }
  23. else if (this._isTransparent && !Settings.Instance.EnableBackgroundTransparency)
  24. {
  25. this._styleComponent.StyleKey = this._defaultKey;
  26. this._isTransparent = false;
  27. }
  28. }
  29. private string _defaultKey;
  30. private bool _isTransparent;
  31. private StyleComponent _styleComponent;
  32. public string TransparentStyleKey = string.Empty;
  33. }
  34. }