You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
674 B

  1. using System;
  2. namespace UnityEditor.PackageManager.UI
  3. {
  4. [Serializable]
  5. internal class OperationSignal<T> where T: IBaseOperation
  6. {
  7. public event Action<T> OnOperation = delegate { };
  8. public T Operation { get; set; }
  9. public void SetOperation(T operation)
  10. {
  11. Operation = operation;
  12. OnOperation(operation);
  13. }
  14. public void WhenOperation(Action<T> callback)
  15. {
  16. if (Operation != null)
  17. callback(Operation);
  18. OnOperation += callback;
  19. }
  20. internal void ResetEvents()
  21. {
  22. OnOperation = delegate { };
  23. }
  24. }
  25. }