IAwakeSystem.cs 1.7 KB

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