StyleSheet.cs 657 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace SRF.UI
  5. {
  6. [Serializable]
  7. public class StyleSheet : ScriptableObject
  8. {
  9. public Style GetStyle(string key, bool searchParent = true)
  10. {
  11. int num = this._keys.IndexOf(key);
  12. if (num >= 0)
  13. {
  14. return this._styles[num];
  15. }
  16. if (searchParent && this.Parent != null)
  17. {
  18. return this.Parent.GetStyle(key, true);
  19. }
  20. return null;
  21. }
  22. [SerializeField]
  23. private List<string> _keys = new List<string>();
  24. [SerializeField]
  25. private List<Style> _styles = new List<Style>();
  26. [SerializeField]
  27. public StyleSheet Parent;
  28. }
  29. }