30 lines
923 B
C#
30 lines
923 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.AddressableAssets;
|
|
|
|
namespace Code.Infrastructure.Configs
|
|
{
|
|
public partial class ConfigLocator : IConfigLocator
|
|
{
|
|
private Dictionary<Type, AssetReference> _singleConfigReferences = new();
|
|
private Dictionary<Type, string> _multipleConfigReferences = new();
|
|
|
|
public AssetReference TryGetConfigAssetReference<T>() => _singleConfigReferences.GetValueOrDefault(typeof(T), null);
|
|
public string TryGetManyConfigAssetReferences<T>() => _multipleConfigReferences.GetValueOrDefault(typeof(T), null);
|
|
|
|
partial void LoadConfigs();
|
|
|
|
public ConfigLocator()
|
|
{
|
|
LoadSystemConfigs();
|
|
|
|
LoadConfigs();
|
|
}
|
|
|
|
private void LoadSystemConfigs()
|
|
{
|
|
Resources.Load<SystemConfigsReferences>("SystemConfigsReferences");
|
|
}
|
|
}
|
|
} |