AIConfig.cs 859 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections.Generic;
  2. using System.ComponentModel;
  3. using MongoDB.Bson;
  4. using MongoDB.Bson.Serialization.Attributes;
  5. using ProtoBuf;
  6. namespace ET
  7. {
  8. public partial class AIConfigCategory
  9. {
  10. public Dictionary<int, SortedDictionary<int, AIConfig>> AIConfigs = new Dictionary<int, SortedDictionary<int, AIConfig>>();
  11. public SortedDictionary<int, AIConfig> GetAI(int aiConfigId)
  12. {
  13. return this.AIConfigs[aiConfigId];
  14. }
  15. public override void EndInit()
  16. {
  17. base.EndInit();
  18. foreach (var kv in this.GetAll())
  19. {
  20. SortedDictionary<int, AIConfig> aiNodeConfig;
  21. if (!this.AIConfigs.TryGetValue(kv.Value.AIConfigId, out aiNodeConfig))
  22. {
  23. aiNodeConfig = new SortedDictionary<int, AIConfig>();
  24. this.AIConfigs.Add(kv.Value.AIConfigId, aiNodeConfig);
  25. }
  26. aiNodeConfig.Add(kv.Key, kv.Value);
  27. }
  28. }
  29. }
  30. }