AllConfigManager.cs 648 B

1234567891011121314151617181920212223242526
  1. using System.Collections.Generic;
  2. namespace Component
  3. {
  4. public class AllConfigManager
  5. {
  6. public readonly Dictionary<string, object> allConfig = new Dictionary<string, object>();
  7. public T Get<T>(int type) where T : IType
  8. {
  9. var configManager = (ConfigManager<T>)allConfig[typeof (T).Name];
  10. return configManager[type];
  11. }
  12. public Dictionary<int, T> GetAll<T>(int type) where T : IType
  13. {
  14. var configManager = (ConfigManager<T>)allConfig[typeof (T).Name];
  15. return configManager.GetAll();
  16. }
  17. public ConfigManager<T> GetConfigManager<T>() where T : IType
  18. {
  19. return (ConfigManager<T>)allConfig[typeof(T).Name];
  20. }
  21. }
  22. }