Развитие системы растений

This commit is contained in:
ThomasCharester committed 2026-03-02 18:25:46 +03:00
1 parent 1b578067f3
commit ba49ef5015
218 files changed
+70415 -1519

No files matched your search

@@ -0,0 +1,46 @@
using System.Collections.Generic;
using System.Linq;
using Code.Infrastructure.Configs;
using Code.Infrastructure.EventBus;
using Cysharp.Threading.Tasks;
using UnityEngine.AddressableAssets;
namespace Code.Calendar.Constants
{
// Написать кодрайтер, который будет находить конфиги и добавлять их сюда пока написано само
public class ConstantImagesService
{
private readonly EventBus _eventBus;
public List<ConstantImageConfig> Configs { get; private set; }
public ConstantImagesService(EventBus eventBus, IConfigLocator configLocator)
{
_eventBus = eventBus;
var label = configLocator.TryGetManyConfigAssetReferences<ConstantImageConfig>();
LoadImage(label).Forget();
}
private async UniTaskVoid LoadImage(string imagesLabel)
{
if ((await Addressables.LoadResourceLocationsAsync(imagesLabel).Task).Count != 0)
{
var images =
Addressables.LoadAssetsAsync<ConstantImageConfig>(imagesLabel, null, Addressables.MergeMode.Union);
await images.ToUniTask();
Configs = images.Result.ToList();
}
_eventBus.RaiseEvent<IConstantImagesServiceHandle>(x=> x.ImagesLoaded());
}
}
public interface IConstantImagesServiceHandle : IGlobalSubscriber
{
void ImagesLoaded();
}
}