Second commit
This commit is contained in:
commit
36840f3ad4
999 files changed
+61364
No files matched your search
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace Code.Infrastructure.Configs
|
||||
{
|
||||
public interface IConfigLocator
|
||||
{
|
||||
AssetReference TryGetConfigAssetReference<T>();
|
||||
string TryGetManyConfigAssetReferences<T>();
|
||||
}
|
||||
public partial class ConfigLocator : IConfigLocator
|
||||
{
|
||||
private readonly Dictionary<Type, AssetReference> _singleConfigReferences = new();
|
||||
private readonly Dictionary<Type, string> _multipleConfigReferences = new();
|
||||
|
||||
private ConfigReferences _configReferences;
|
||||
|
||||
public AssetReference TryGetConfigAssetReference<T>() => _singleConfigReferences.GetValueOrDefault(typeof(T), null);
|
||||
public string TryGetManyConfigAssetReferences<T>() => _multipleConfigReferences.GetValueOrDefault(typeof(T), null);
|
||||
|
||||
partial void LoadConfigs();
|
||||
|
||||
public ConfigLocator()
|
||||
{
|
||||
LoadConfigReferences();
|
||||
|
||||
LoadConfigs();
|
||||
}
|
||||
|
||||
private void LoadConfigReferences()
|
||||
{
|
||||
_configReferences = Resources.Load<ConfigReferences>("ConfigReferences");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user