Развитие системы растений
This commit is contained in:
1 parent
1b578067f3
commit
ba49ef5015
218 files changed
+70415
-1519
No files matched your search
@@ -0,0 +1,18 @@
|
||||
using Code.Infrastructure.Generators;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace Code.Calendar.Constants
|
||||
{
|
||||
[Config("Configs/ImageConfig", true)]
|
||||
public class ConstantImage
|
||||
{
|
||||
[ToConfig] public AssetReference image;
|
||||
[ToConfig] public ConstantImageType imageType;
|
||||
}
|
||||
|
||||
public enum ConstantImageType
|
||||
{
|
||||
NoPhoto
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 188200b6891f44d993888cc4c68a3bea
|
||||
timeCreated: 1772122627
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e08f396c88804dac9946217cd9474bfa
|
||||
timeCreated: 1772122482
|
||||
Reference in new issue
Block a user