Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GenericEntityDescriptor.cs 4.9KB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using System.Runtime.InteropServices;
  2. namespace Svelto.ECS
  3. {
  4. public class GenericEntityDescriptor<T>:IEntityDescriptor where T : EntityView<T>, new()
  5. {
  6. static GenericEntityDescriptor()
  7. {
  8. entityViewBuilders = new IEntityViewBuilder[] { new EntityViewBuilder<T>() };
  9. }
  10. public IEntityViewBuilder[] entityViewsToBuild
  11. {
  12. get { return entityViewBuilders; }
  13. }
  14. public static readonly IEntityViewBuilder[] entityViewBuilders;
  15. }
  16. public class GenericEntityDescriptor<T, U> : IEntityDescriptor where T : EntityView<T>, new()
  17. where U : EntityView<U>, new()
  18. {
  19. static GenericEntityDescriptor()
  20. {
  21. entityViewBuilders = new IEntityViewBuilder[] {new EntityViewBuilder<T>(), new EntityViewBuilder<U>()};
  22. }
  23. public IEntityViewBuilder[] entityViewsToBuild
  24. {
  25. get { return entityViewBuilders; }
  26. }
  27. public static readonly IEntityViewBuilder[] entityViewBuilders;
  28. }
  29. public class GenericEntityDescriptor<T, U, V> : IEntityDescriptor where T : EntityView<T>, new()
  30. where U : EntityView<U>, new()
  31. where V : EntityView<V>, new()
  32. {
  33. static GenericEntityDescriptor()
  34. {
  35. entityViewBuilders = new IEntityViewBuilder[] {new EntityViewBuilder<T>(), new EntityViewBuilder<U>(), new EntityViewBuilder<V>()};
  36. }
  37. public IEntityViewBuilder[] entityViewsToBuild
  38. {
  39. get { return entityViewBuilders; }
  40. }
  41. public static readonly IEntityViewBuilder[] entityViewBuilders;
  42. }
  43. public class GenericEntityDescriptor<T, U, V, W> : IEntityDescriptor where T : EntityView<T>, new()
  44. where U : EntityView<U>, new()
  45. where V : EntityView<V>, new()
  46. where W : EntityView<W>, new()
  47. {
  48. static GenericEntityDescriptor()
  49. {
  50. entityViewBuilders = new IEntityViewBuilder[] {new EntityViewBuilder<T>(), new EntityViewBuilder<U>(), new EntityViewBuilder<V>(), new EntityViewBuilder<W>()};
  51. }
  52. public IEntityViewBuilder[] entityViewsToBuild
  53. {
  54. get { return entityViewBuilders; }
  55. }
  56. public static readonly IEntityViewBuilder[] entityViewBuilders;
  57. }
  58. public class GenericEntityDescriptor<T, U, V, W, X> : IEntityDescriptor where T : EntityView<T>, new()
  59. where U : EntityView<U>, new()
  60. where V : EntityView<V>, new()
  61. where W : EntityView<W>, new()
  62. where X : EntityView<X>, new()
  63. {
  64. static GenericEntityDescriptor()
  65. {
  66. entityViewBuilders = new IEntityViewBuilder[] {new EntityViewBuilder<T>(), new EntityViewBuilder<U>(), new EntityViewBuilder<V>(), new EntityViewBuilder<W>(), new EntityViewBuilder<X>()};
  67. }
  68. public IEntityViewBuilder[] entityViewsToBuild
  69. {
  70. get { return entityViewBuilders; }
  71. }
  72. public static readonly IEntityViewBuilder[] entityViewBuilders;
  73. }
  74. public class GenericEntityDescriptor<T, U, V, W, X, Y> : IEntityDescriptor where T : EntityView<T>, new()
  75. where U : EntityView<U>, new()
  76. where V : EntityView<V>, new()
  77. where W : EntityView<W>, new()
  78. where X : EntityView<X>, new()
  79. where Y : EntityView<Y>, new()
  80. {
  81. static GenericEntityDescriptor()
  82. {
  83. entityViewBuilders = new IEntityViewBuilder[] {new EntityViewBuilder<T>(), new EntityViewBuilder<U>(), new EntityViewBuilder<V>(), new EntityViewBuilder<W>(), new EntityViewBuilder<X>(), new EntityViewBuilder<Y>()};
  84. }
  85. public IEntityViewBuilder[] entityViewsToBuild
  86. {
  87. get { return entityViewBuilders; }
  88. }
  89. public static readonly IEntityViewBuilder[] entityViewBuilders;
  90. }
  91. }