IAwakeSystem.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System;
  2. namespace ETModel
  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 abstract class AwakeSystem<T> : IAwakeSystem, IAwake
  25. {
  26. public Type Type()
  27. {
  28. return typeof(T);
  29. }
  30. public void Run(object o)
  31. {
  32. this.Awake((T)o);
  33. }
  34. public abstract void Awake(T self);
  35. }
  36. public abstract class AwakeSystem<T, A> : IAwakeSystem, IAwake<A>
  37. {
  38. public Type Type()
  39. {
  40. return typeof(T);
  41. }
  42. public void Run(object o, A a)
  43. {
  44. this.Awake((T)o, a);
  45. }
  46. public abstract void Awake(T self, A a);
  47. }
  48. public abstract class AwakeSystem<T, A, B> : IAwakeSystem, IAwake<A, B>
  49. {
  50. public Type Type()
  51. {
  52. return typeof(T);
  53. }
  54. public void Run(object o, A a, B b)
  55. {
  56. this.Awake((T)o, a, b);
  57. }
  58. public abstract void Awake(T self, A a, B b);
  59. }
  60. public abstract class AwakeSystem<T, A, B, C> : IAwakeSystem, IAwake<A, B, C>
  61. {
  62. public Type Type()
  63. {
  64. return typeof(T);
  65. }
  66. public void Run(object o, A a, B b, C c)
  67. {
  68. this.Awake((T)o, a, b, c);
  69. }
  70. public abstract void Awake(T self, A a, B b, C c);
  71. }
  72. }