LocationConfigSingleton.cs 766 B

1234567891011121314151617181920212223242526
  1. using System.Collections.Generic;
  2. namespace ET.Server
  3. {
  4. [ConfigProcess]
  5. public class LocationConfigSingleton: Singleton<LocationConfigSingleton>, ISingletonAwake
  6. {
  7. private readonly List<StartSceneConfig> locations = new();
  8. public void Awake()
  9. {
  10. foreach (StartSceneConfig startSceneConfig in StartSceneConfigCategory.Instance.GetAll().Values)
  11. {
  12. if (startSceneConfig.Type == SceneType.Location)
  13. {
  14. this.locations.Add(startSceneConfig);
  15. }
  16. }
  17. }
  18. public StartSceneConfig GetLocation(long key)
  19. {
  20. return this.locations[(int)((ulong)key % (ulong)this.locations.Count)];
  21. }
  22. }
  23. }