LSEntity.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. namespace ET
  3. {
  4. public interface IRegisterLSEntitySystem
  5. {
  6. void RegisterSystem(LSEntity entity);
  7. }
  8. [EnableMethod]
  9. public class LSEntity: Entity
  10. {
  11. public new K AddComponent<K>(bool isFromPool = false) where K : LSEntity, IAwake, new()
  12. {
  13. return this.AddComponentWithId<K>(this.GetId(), isFromPool);
  14. }
  15. public new K AddComponent<K, P1>(P1 p1, bool isFromPool = false) where K : LSEntity, IAwake<P1>, new()
  16. {
  17. return this.AddComponentWithId<K, P1>(this.GetId(), p1, isFromPool);
  18. }
  19. public new K AddComponent<K, P1, P2>(P1 p1, P2 p2, bool isFromPool = false) where K : LSEntity, IAwake<P1, P2>, new()
  20. {
  21. return this.AddComponentWithId<K, P1, P2>(this.GetId(), p1, p2, isFromPool);
  22. }
  23. public new K AddComponent<K, P1, P2, P3>(P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : LSEntity, IAwake<P1, P2, P3>, new()
  24. {
  25. return this.AddComponentWithId<K, P1, P2, P3>(this.GetId(), p1, p2, p3, isFromPool);
  26. }
  27. [EnableAccessEntiyChild]
  28. public new T AddChild<T>(bool isFromPool = false) where T : LSEntity, IAwake
  29. {
  30. return this.AddChildWithId<T>(this.GetId(), isFromPool);
  31. }
  32. [EnableAccessEntiyChild]
  33. public new T AddChild<T, A>(A a, bool isFromPool = false) where T : LSEntity, IAwake<A>
  34. {
  35. return this.AddChildWithId<T, A>(this.GetId(), a, isFromPool);
  36. }
  37. [EnableAccessEntiyChild]
  38. public new T AddChild<T, A, B>(A a, B b, bool isFromPool = false) where T : LSEntity, IAwake<A, B>
  39. {
  40. return this.AddChildWithId<T, A, B>(this.GetId(), a, b, isFromPool);
  41. }
  42. [EnableAccessEntiyChild]
  43. public new T AddChild<T, A, B, C>(A a, B b, C c, bool isFromPool = false) where T : LSEntity, IAwake<A, B, C>
  44. {
  45. return this.AddChildWithId<T, A, B, C>(this.GetId(), a, b, c, isFromPool);
  46. }
  47. protected override void RegisterSystem()
  48. {
  49. IRegisterLSEntitySystem iRegisterLsEntitySystem = (IRegisterLSEntitySystem)this.IScene;
  50. TypeSystems.OneTypeSystems oneTypeSystems = LSEntitySystemSingleton.Instance.GetOneTypeSystems(this.GetType());
  51. if (oneTypeSystems == null)
  52. {
  53. return;
  54. }
  55. if (oneTypeSystems.QueueFlag[LSQueneUpdateIndex.LSUpdate])
  56. {
  57. iRegisterLsEntitySystem.RegisterSystem(this);
  58. }
  59. }
  60. }
  61. }