IAwakeSystem.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. using System;
  2. namespace ET
  3. {
  4. public interface IAwake
  5. {
  6. }
  7. public interface IAwake<A>
  8. {
  9. }
  10. public interface IAwake<A, B>
  11. {
  12. }
  13. public interface IAwake<A, B, C>
  14. {
  15. }
  16. public interface IAwake<A, B, C, D>
  17. {
  18. }
  19. public interface IAwakeSystem: ISystemType
  20. {
  21. void Run(Entity o);
  22. }
  23. public interface IAwakeSystem<A>: ISystemType
  24. {
  25. void Run(Entity o, A a);
  26. }
  27. public interface IAwakeSystem<A, B>: ISystemType
  28. {
  29. void Run(Entity o, A a, B b);
  30. }
  31. public interface IAwakeSystem<A, B, C>: ISystemType
  32. {
  33. void Run(Entity o, A a, B b, C c);
  34. }
  35. public interface IAwakeSystem<A, B, C, D>: ISystemType
  36. {
  37. void Run(Entity o, A a, B b, C c, D d);
  38. }
  39. [ObjectSystem]
  40. public abstract class AwakeSystem<T> : IAwakeSystem where T: Entity, IAwake
  41. {
  42. Type ISystemType.Type()
  43. {
  44. return typeof(T);
  45. }
  46. Type ISystemType.SystemType()
  47. {
  48. return typeof(IAwakeSystem);
  49. }
  50. InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
  51. {
  52. return InstanceQueueIndex.None;
  53. }
  54. void IAwakeSystem.Run(Entity o)
  55. {
  56. this.Awake((T)o);
  57. }
  58. protected abstract void Awake(T self);
  59. }
  60. [ObjectSystem]
  61. public abstract class AwakeSystem<T, A> : IAwakeSystem<A> where T: Entity, IAwake<A>
  62. {
  63. Type ISystemType.Type()
  64. {
  65. return typeof(T);
  66. }
  67. Type ISystemType.SystemType()
  68. {
  69. return typeof(IAwakeSystem<A>);
  70. }
  71. InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
  72. {
  73. return InstanceQueueIndex.None;
  74. }
  75. void IAwakeSystem<A>.Run(Entity o, A a)
  76. {
  77. this.Awake((T)o, a);
  78. }
  79. protected abstract void Awake(T self, A a);
  80. }
  81. [ObjectSystem]
  82. public abstract class AwakeSystem<T, A, B> : IAwakeSystem<A, B> where T: Entity, IAwake<A, B>
  83. {
  84. Type ISystemType.Type()
  85. {
  86. return typeof(T);
  87. }
  88. Type ISystemType.SystemType()
  89. {
  90. return typeof(IAwakeSystem<A, B>);
  91. }
  92. InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
  93. {
  94. return InstanceQueueIndex.None;
  95. }
  96. void IAwakeSystem<A, B>.Run(Entity o, A a, B b)
  97. {
  98. this.Awake((T)o, a, b);
  99. }
  100. protected abstract void Awake(T self, A a, B b);
  101. }
  102. [ObjectSystem]
  103. public abstract class AwakeSystem<T, A, B, C> : IAwakeSystem<A, B, C> where T: Entity, IAwake<A, B, C>
  104. {
  105. Type ISystemType.Type()
  106. {
  107. return typeof(T);
  108. }
  109. Type ISystemType.SystemType()
  110. {
  111. return typeof(IAwakeSystem<A, B, C>);
  112. }
  113. InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
  114. {
  115. return InstanceQueueIndex.None;
  116. }
  117. void IAwakeSystem<A, B, C>.Run(Entity o, A a, B b, C c)
  118. {
  119. this.Awake((T)o, a, b, c);
  120. }
  121. protected abstract void Awake(T self, A a, B b, C c);
  122. }
  123. [ObjectSystem]
  124. public abstract class AwakeSystem<T, A, B, C, D> : IAwakeSystem<A, B, C, D> where T: Entity, IAwake<A, B, C, D>
  125. {
  126. Type ISystemType.Type()
  127. {
  128. return typeof(T);
  129. }
  130. Type ISystemType.SystemType()
  131. {
  132. return typeof(IAwakeSystem<A, B, C, D>);
  133. }
  134. InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
  135. {
  136. return InstanceQueueIndex.None;
  137. }
  138. void IAwakeSystem<A, B, C, D>.Run(Entity o, A a, B b, C c, D d)
  139. {
  140. this.Awake((T)o, a, b, c, d);
  141. }
  142. protected abstract void Awake(T self, A a, B b, C c, D d);
  143. }
  144. }