GUIColorGradientField.cs 682 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using bs;
  3. namespace bs.Editor
  4. {
  5. partial class GUIColorGradientField
  6. {
  7. /// <summary>
  8. /// Triggered when the gradient in the field changes.
  9. /// </summary>
  10. public event Action<ColorGradient> OnChanged;
  11. /// <summary>
  12. /// Callback triggered when the user clicks on the GUI element.
  13. /// </summary>
  14. partial void OnClicked()
  15. {
  16. GradientPicker.Show(Value, (success, colorGradient) =>
  17. {
  18. if (!success)
  19. return;
  20. Value = colorGradient;
  21. OnChanged?.Invoke(colorGradient);
  22. });
  23. }
  24. }
  25. }