FaderEventDriven.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. public class FaderEventDriven : BaseFader
  3. {
  4. protected override void ApplyFadeValue(float value)
  5. {
  6. if (this.onApplyFadeValue != null)
  7. {
  8. this.onApplyFadeValue(value);
  9. }
  10. }
  11. protected override float GetFadeValue()
  12. {
  13. return (this.onGetFadeValue == null) ? 0f : this.onGetFadeValue();
  14. }
  15. protected override bool CheckSkipState()
  16. {
  17. return this.onCheckSkipState != null && this.onCheckSkipState();
  18. }
  19. protected override void OnBeforeFadeIn()
  20. {
  21. if (this.onBeforeFadeIn != null)
  22. {
  23. this.onBeforeFadeIn();
  24. }
  25. }
  26. protected override void OnAfterFadeIn()
  27. {
  28. if (this.onAfterFadeIn != null)
  29. {
  30. this.onAfterFadeIn();
  31. }
  32. }
  33. protected override void OnBeforeFadeOut()
  34. {
  35. if (this.onBeforeFadeOut != null)
  36. {
  37. this.onBeforeFadeOut();
  38. }
  39. }
  40. protected override void OnAfterFadeOut()
  41. {
  42. if (this.onAfterFadeOut != null)
  43. {
  44. this.onAfterFadeOut();
  45. }
  46. }
  47. protected override void OnAbortFadeIn()
  48. {
  49. if (this.onAbortFadeIn != null)
  50. {
  51. this.onAbortFadeIn();
  52. }
  53. }
  54. protected override void OnAbortFadeOut()
  55. {
  56. if (this.onAbortFadeOut != null)
  57. {
  58. this.onAbortFadeOut();
  59. }
  60. }
  61. public Action<float> onApplyFadeValue;
  62. public Func<float> onGetFadeValue;
  63. public Func<bool> onCheckSkipState;
  64. public Action onBeforeFadeIn;
  65. public Action onAfterFadeIn;
  66. public Action onBeforeFadeOut;
  67. public Action onAfterFadeOut;
  68. public Action onAbortFadeIn;
  69. public Action onAbortFadeOut;
  70. }