DebugPanelBackgroundBehaviour.cs 967 B

1234567891011121314151617181920212223242526272829303132
  1. namespace SRDebugger.UI.Other
  2. {
  3. using SRF;
  4. using SRF.UI;
  5. using UnityEngine;
  6. [RequireComponent(typeof (StyleComponent))]
  7. public class DebugPanelBackgroundBehaviour : SRMonoBehaviour
  8. {
  9. private StyleComponent _styleComponent;
  10. public string TransparentStyleKey = "";
  11. [SerializeField]
  12. private StyleSheet _styleSheet;
  13. private void Awake()
  14. {
  15. _styleComponent = GetComponent<StyleComponent>();
  16. if (Settings.Instance.EnableBackgroundTransparency)
  17. {
  18. // Update transparent style to have the transparency set in the settings menu.
  19. Style style = _styleSheet.GetStyle(TransparentStyleKey);
  20. Color c = style.NormalColor;
  21. c.a = Settings.Instance.BackgroundTransparency;
  22. style.NormalColor = c;
  23. _styleComponent.StyleKey = TransparentStyleKey;
  24. }
  25. }
  26. }
  27. }