IAwakeSystem.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System;
  2. namespace ET
  3. {
  4. public interface IAwakeSystem
  5. {
  6. Type Type();
  7. }
  8. public interface IAwake
  9. {
  10. void Run(object o);
  11. }
  12. public interface IAwake<A>
  13. {
  14. void Run(object o, A a);
  15. }
  16. public interface IAwake<A, B>
  17. {
  18. void Run(object o, A a, B b);
  19. }
  20. public interface IAwake<A, B, C>
  21. {
  22. void Run(object o, A a, B b, C c);
  23. }
  24. public interface IAwake<A, B, C, D>
  25. {
  26. void Run(object o, A a, B b, C c, D d);
  27. }
  28. [ObjectSystem]
  29. public abstract class AwakeSystem<T> : IAwakeSystem, IAwake
  30. {
  31. public Type Type()
  32. {
  33. return typeof(T);
  34. }
  35. public void Run(object o)
  36. {
  37. this.Awake((T)o);
  38. }
  39. public abstract void Awake(T self);
  40. }
  41. [ObjectSystem]
  42. public abstract class AwakeSystem<T, A> : IAwakeSystem, IAwake<A>
  43. {
  44. public Type Type()
  45. {
  46. return typeof(T);
  47. }
  48. public void Run(object o, A a)
  49. {
  50. this.Awake((T)o, a);
  51. }
  52. public abstract void Awake(T self, A a);
  53. }
  54. [ObjectSystem]
  55. public abstract class AwakeSystem<T, A, B> : IAwakeSystem, IAwake<A, B>
  56. {
  57. public Type Type()
  58. {
  59. return typeof(T);
  60. }
  61. public void Run(object o, A a, B b)
  62. {
  63. this.Awake((T)o, a, b);
  64. }
  65. public abstract void Awake(T self, A a, B b);
  66. }
  67. [ObjectSystem]
  68. public abstract class AwakeSystem<T, A, B, C> : IAwakeSystem, IAwake<A, B, C>
  69. {
  70. public Type Type()
  71. {
  72. return typeof(T);
  73. }
  74. public void Run(object o, A a, B b, C c)
  75. {
  76. this.Awake((T)o, a, b, c);
  77. }
  78. public abstract void Awake(T self, A a, B b, C c);
  79. }
  80. }