StartConfig.cs 919 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System.Collections.Generic;
  2. using MongoDB.Bson;
  3. using MongoDB.Bson.Serialization.Attributes;
  4. #if !SERVER
  5. using UnityEngine;
  6. #endif
  7. namespace ETModel
  8. {
  9. #if !SERVER
  10. [HideInHierarchy]
  11. #endif
  12. [NoObjectPool]
  13. public class StartConfig: Entity
  14. {
  15. [BsonIgnore]
  16. public long SceneInstanceId { get; set; }
  17. public List<StartConfig> List = new List<StartConfig>();
  18. public void Add(StartConfig startConfig)
  19. {
  20. startConfig.parent = this;
  21. this.List.Add(startConfig);
  22. }
  23. public StartConfig Get(long id)
  24. {
  25. foreach (StartConfig startConfig in this.List)
  26. {
  27. if (startConfig.Id == id)
  28. {
  29. return startConfig;
  30. }
  31. }
  32. return null;
  33. }
  34. public void Remove(StartConfig startConfig)
  35. {
  36. this.List.Remove(startConfig);
  37. }
  38. public override void EndInit()
  39. {
  40. base.EndInit();
  41. foreach (StartConfig startConfig in this.List)
  42. {
  43. startConfig.parent = this;
  44. }
  45. }
  46. }
  47. }