Files
2026-02-26 11:21:27 +03:00

35 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using Code.Infrastructure.SceneLoader;
using Cysharp.Threading.Tasks;
using Reflex.Core;
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()
{
SystemConfigsReferences systemConfigsReferences = Resources.Load<SystemConfigsReferences>("SystemConfigsReferences");
_singleConfigReferences.Add(typeof(ScenesAssetReferences), systemConfigsReferences.scenesAssetReferences);
}
}
}