Config.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace TheraBytes.BetterUi
  7. {
  8. public static class Config
  9. {
  10. static bool applyAssignmentsToCurrentSettings = true;
  11. /// <summary>
  12. /// If true (default), setters of properties which exist in the unity-base-class
  13. /// will also change the current settings of the active screen configuration.
  14. ///
  15. /// Example: myBetterImage.color = Color.green; // <- will also change the color in the current settings
  16. ///
  17. /// Note that this will only happen if you access the property through a variable
  18. /// which is declared as the better version.
  19. /// </summary>
  20. public static bool ApplyAssignmentsToCurrentSettings
  21. {
  22. get { return applyAssignmentsToCurrentSettings; }
  23. set { applyAssignmentsToCurrentSettings = value; }
  24. }
  25. /// <summary>
  26. /// Internal helper method for setters of hidden or overridden properties.
  27. /// </summary>
  28. public static void Set<T>(T value, Action<T> setBase, Action<T> setSettings)
  29. {
  30. if (applyAssignmentsToCurrentSettings)
  31. setSettings(value);
  32. setBase(value);
  33. }
  34. }
  35. }