using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.AddressableAssets; namespace Code.Infrastructure.Configs { public interface IConfigLocator { AssetReference TryGetConfigAssetReference(); string TryGetManyConfigAssetReferences(); } public partial class ConfigLocator : IConfigLocator { private readonly Dictionary _singleConfigReferences = new(); private readonly Dictionary _multipleConfigReferences = new(); private ConfigReferences _configReferences; public AssetReference TryGetConfigAssetReference() => _singleConfigReferences.GetValueOrDefault(typeof(T), null); public string TryGetManyConfigAssetReferences() => _multipleConfigReferences.GetValueOrDefault(typeof(T), null); partial void LoadConfigs(); public ConfigLocator() { LoadConfigReferences(); LoadConfigs(); } private void LoadConfigReferences() { _configReferences = Resources.Load("ConfigReferences"); } } }