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

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

+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 98b04a1dab924594a3bb3f93d863cc02
timeCreated: 1772122466
@@ -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
@@ -3,19 +3,38 @@ using System.Collections.Generic;
namespace Code.Calendar.DataStructures
{
public struct Plant
public struct Plant : IEquatable<Plant>
{
public string Name;
public string IconPath;
public int Id;
public Guid Id;
public bool Equals(Plant other) => Id == other.Id;
public override bool Equals(object obj) => obj is Plant other && Equals(other);
public override int GetHashCode() => Id.GetHashCode();
}
public struct Task
public struct Task : IEquatable<Task>
{
public Guid Id;
public bool Active;
public string Description;
public DateTime Date;
public bool IsPeriodic;
public int PeriodicInterval;
public int PlantId;
public DateTime PeriodicUntil;
public Guid PlantId;
public List<string> PhotoPaths;
public bool Equals(Task other) => Id == other.Id;
public override bool Equals(object obj) => obj is Task other && Equals(other);
public override int GetHashCode() => Id.GetHashCode();
}
}
@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Code.Infrastructure.EventBus;
using Cysharp.Threading.Tasks;
using Newtonsoft.Json;
using UnityEngine;
namespace Code.Calendar.DataStructures
{
public interface IPlantService
{
void AddPlant(Plant plant);
void DeletePlant(Plant plant);
Plant GetPlant(Guid plantId);
List<Plant> GetPlants();
void EditPlant(Guid guid, Plant newPlant);
}
public class PlantService : IDisposable, IPlantService
{
private readonly EventBus _eventBus;
private List<Plant> _plants;
public PlantService(EventBus eventBus)
{
_eventBus = eventBus;
LoadJsonTasks().Forget();
}
private async UniTaskVoid LoadJsonTasks()
{
var path = Path.Combine(Application.persistentDataPath, "Plants.json");
if (File.Exists(path))
{
using StreamReader reader = new(path);
_plants = JsonConvert.DeserializeObject<List<Plant>>(await reader.ReadToEndAsync()) ?? new List<Plant>();
}
else
{
await using (File.Create(path)) { }
}
_eventBus.RaiseEvent<IPlantsServiceInitHandle>(x=> x.PlantsLoaded());
}
private bool _inAction, _reUseRequest;
private async UniTaskVoid SaveJsonTasks()
{
if (_inAction)
{
_reUseRequest = true;
return;
}
_inAction = true;
var json = JsonConvert.SerializeObject(_plants, Formatting.Indented);
await using StreamWriter writer = new(Path.Combine(Application.persistentDataPath, "Plants.json"));
await writer.WriteAsync(json).AsUniTask();
_inAction = false;
if(!_reUseRequest) _eventBus.RaiseEvent<IPlantsServiceInitHandle>(x=> x.PlantsSaved());
else SaveJsonTasks().Forget();
}
public void AddPlant(Plant plant)
{
plant.Id = Guid.NewGuid();
_plants.Add(plant);
SaveJsonTasks().Forget();
}
public void EditPlant(Guid guid, Plant newPlant)
{
_plants[_plants.FindIndex(x => x.Id == guid)] = newPlant;
SaveJsonTasks().Forget();
}
public void DeletePlant(Plant plant)
{
_plants.Remove(plant);
SaveJsonTasks().Forget();
}
public Plant GetPlant(Guid plantId) => _plants.FirstOrDefault(x => x.Id == plantId);
public List<Plant> GetPlants() => _plants;
public void Dispose()
{
SaveJsonTasks().Forget();
}
}
public interface IPlantsServiceInitHandle : IGlobalSubscriber
{
void PlantsLoaded();
void PlantsSaved();
}
public interface IPlantsServiceHandle : IGlobalSubscriber
{
void PlantAdded();
void PlantRemoved();
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: eb3e195da68845ea872e2eff73582745
timeCreated: 1772116279
@@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Code.Infrastructure.EventBus;
using Cysharp.Threading.Tasks;
using Newtonsoft.Json;
using UnityEngine;
namespace Code.Calendar.DataStructures
{
public interface ITaskService
{
void AddTask(Task task);
void DeleteTask(Task task);
List<Task> GetByPlant(Guid plantId);
List<Task> GetTasks();
List<Task> GetByDate(DateTime date);
void EditTask(Guid guid, Task newTask);
}
public class TaskService : IDisposable, ITaskService
{
private readonly EventBus _eventBus;
private List<Task> _tasks;
public TaskService(EventBus eventBus)
{
_eventBus = eventBus;
LoadJsonTasks().Forget();
}
private async UniTaskVoid LoadJsonTasks()
{
var path = Path.Combine(Application.persistentDataPath, "Tasks.json");
if (File.Exists(path))
{
using StreamReader reader = new(path);
_tasks = JsonConvert.DeserializeObject<List<Task>>(await reader.ReadToEndAsync()) ?? new List<Task>();
}
else
{
await using (File.Create(path)) { }
}
_eventBus.RaiseEvent<ITaskServiceHandle>(x => x.TasksLoaded());
}
private bool _inAction, _reUseRequest;
private async UniTaskVoid SaveJsonTasks()
{
if (_inAction)
{
_reUseRequest = true;
return;
}
_inAction = true;
var json = JsonConvert.SerializeObject(_tasks, Formatting.Indented);
await using StreamWriter writer = new(Path.Combine(Application.persistentDataPath, "Tasks.json"));
await writer.WriteAsync(json).AsUniTask();
_inAction = false;
if (!_reUseRequest) _eventBus.RaiseEvent<ITaskServiceHandle>(x => x.TasksSaved());
else SaveJsonTasks().Forget();
}
public void AddTask(Task task)
{
_tasks.Add(task);
task.Id = Guid.NewGuid();
SaveJsonTasks().Forget();
}
public void EditTask(Guid guid, Task newTask)
{
_tasks[_tasks.FindIndex(x => x.Id == guid)] = newTask;
SaveJsonTasks().Forget();
}
public void DeleteTask(Task task)
{
_tasks.Remove(task);
SaveJsonTasks().Forget();
}
public List<Task> GetByPlant(Guid plantId) => _tasks.Where(x => x.PlantId == plantId).ToList();
public List<Task> GetByDate(DateTime date)
{
var byDay = _tasks
.Where(x => x.Date.Day == date.Day)
.ToList();
var periodicOnes = _tasks
.Where(x => x.IsPeriodic && x.Date.Day + new TimeSpan(0, x.PeriodicInterval, 0).Days == date.Day)
.ToList();
byDay.AddRange(periodicOnes);
return byDay;
}
public List<Task> GetTasks() => _tasks;
public void Dispose()
{
SaveJsonTasks().Forget();
}
}
public interface ITaskServiceHandle : IGlobalSubscriber
{
void TasksLoaded();
void TasksSaved();
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e0a70b7566234451ad60128860af9517
timeCreated: 1772113905
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 073ac04536184a2b9b164161a2f41a61
timeCreated: 1772119626
@@ -0,0 +1,22 @@
using System;
using Code.Infrastructure.UI;
using PrimeTween;
using UnityEngine;
using UnityEngine.UI;
namespace Code.Calendar.Panels
{
public class LoadingPanel : UIPanel
{
[SerializeField] private Image loadingScreen;
public override void Open(Action callback = null)
{
Tween.Alpha(loadingScreen, 1f, 1f).OnComplete(target: this, _ => callback?.Invoke());
}
public override void Close(Action callback = null)
{
Tween.Alpha(loadingScreen, 0f, 1f).OnComplete(target: this, _ => callback?.Invoke());
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4466c13a031a42498f42c15baf25ec03
timeCreated: 1772123986
+22
View File
@@ -0,0 +1,22 @@
using System;
using Code.Infrastructure.UI;
using PrimeTween;
using UnityEngine;
using UnityEngine.UI;
namespace Code.Calendar.Panels
{
public class LogoPanel : UIPanel
{
[SerializeField] private Image logo;
public override void Open(Action callback = null)
{
Tween.Alpha(logo, 1f, 1f).OnComplete(target: this, _ => callback?.Invoke());
}
public override void Close(Action callback = null)
{
Tween.Alpha(logo, 0f, 1f).OnComplete(target: this, _ => callback?.Invoke());
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 03f95468478e4025944889f8b4a54798
timeCreated: 1772123906
@@ -0,0 +1,19 @@
using System;
using Code.Infrastructure.UI;
namespace Code.Calendar.Panels
{
public class PictureChooseMenu : UIPanel
{
public override void Open(Action callback = null)
{
}
public override void Close(Action callback = null)
{
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 46e10e555bb5495899af512610cde913
timeCreated: 1772119767
@@ -0,0 +1,43 @@
using System;
using Code.Calendar.Constants;
using Code.Calendar.DataStructures;
using Code.Infrastructure.UI;
using PrimeTween;
using Reflex.Attributes;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Code.Calendar.Panels
{
public class PlantAddPanel : UIPanel
{
[Inject] private IPlantService _plantService;
[SerializeField] private TMP_InputField plantName;
[SerializeField] private Image image;
public void TryGetIcon()
{
}
public void TryAddPlant()
{
Plant newPlant = new()
{
Name = plantName.text,
IconPath = null
};
_plantService.AddPlant(newPlant);
}
public override void Open(Action callback = null)
{
Tween.Alpha(image, 1f, 1f).OnComplete(target: this, _ => callback?.Invoke());
}
public override void Close(Action callback = null)
{
Tween.Alpha(image, 0f, 1f).OnComplete(target: this, _ => callback?.Invoke());
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2b11bfff50fe458c8799204f39f395ce
timeCreated: 1772119636
@@ -7,10 +7,7 @@ namespace Code.Infrastructure.App
{
public enum AppStates
{
Bootstrap,
Gameplay,
MainMenu,
Platformer
Bootstrap
}
public class AppStateMachineContext
+46 -13
View File
@@ -1,3 +1,5 @@
using Code.Calendar.Constants;
using Code.Calendar.DataStructures;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Configs;
using Code.Infrastructure.Input;
@@ -8,7 +10,6 @@ using Reflex.Core;
using Reflex.Enums;
using Reflex.Injectors;
using UnityEngine;
using UnityEngine.Rendering.Universal;
using Resolution = Reflex.Enums.Resolution;
namespace Code.Infrastructure.App
@@ -20,7 +21,10 @@ namespace Code.Infrastructure.App
IUIPanelLoaded,
IAudioSourcePoolInitializedHandle,
IAudioConfigsLoadedHandle,
ILayerMasksInitializedHandle
ILayerMasksInitializedHandle,
ITaskServiceHandle,
IPlantsServiceInitHandle,
IConstantImagesServiceHandle
{
public void InstallBindings(ContainerBuilder containerBuilder)
{
@@ -50,18 +54,29 @@ namespace Code.Infrastructure.App
Resolution.Eager);
containerBuilder.RegisterType(typeof(AudioService), new[] { typeof(IAudioService) }, Lifetime.Singleton,
Resolution.Eager);
containerBuilder.RegisterType(typeof(TaskService), new[] { typeof(ITaskService) }, Lifetime.Singleton,
Resolution.Eager);
containerBuilder.RegisterType(typeof(PlantService), new[] { typeof(IPlantService) }, Lifetime.Singleton,
Resolution.Eager);
containerBuilder.RegisterType(typeof(ConstantImagesService), Lifetime.Singleton,
Resolution.Eager);
}
private void InitLoadings()
{
// UIFactory
// UIFactory =
// Logo
// Scene configs
// Input service
// Audio Factory
// Audio Pool
// Scene configs =
// Input service
// Audio Factory =
// Audio Pool =
// Layer masks
_initialLoading = new Loading(7, () => EssentialLoadEnded(_thatRightContainer));
// Tasks =
// Plants =
// CIS =
_initialLoading = new Loading(10, () => EssentialLoadEnded(_thatRightContainer));
}
@@ -81,9 +96,7 @@ namespace Code.Infrastructure.App
private void EssentialLoadEnded(Container container)
{
container.Resolve<EventBus.EventBus>().Unsubscribe(this);
container.Resolve<AppStateMachine>().SwitchState(AppStates.Bootstrap)
.AllowStateTransition(AppStates.Gameplay)
.AllowStateTransition(AppStates.Platformer);
container.Resolve<AppStateMachine>().SwitchState(AppStates.Bootstrap);
container.Resolve<AppStateMachineContext>().StateMachine = container.Resolve<AppStateMachine>();
}
@@ -96,8 +109,7 @@ namespace Code.Infrastructure.App
{
_initialLoading.DoProgress();
}
public void UIInitialized()
{
_initialLoading.DoProgress();
@@ -138,5 +150,26 @@ namespace Code.Infrastructure.App
{
_initialLoading.DoProgress();
}
public void TasksLoaded()
{
_initialLoading.DoProgress();
}
public void TasksSaved()
{ }
public void PlantsLoaded()
{
_initialLoading.DoProgress();
}
public void PlantsSaved()
{ }
public void ImagesLoaded()
{
_initialLoading.DoProgress();
}
}
}
@@ -21,7 +21,8 @@ namespace Code.Infrastructure.App.States
_eventBus.Subscribe(this);
Context.UIService.TryRemovePanel(UIPanelType.Logo);
Context.UIService.TryRemovePanel(UIPanelType.Loading);
Context.UIService.TryLoadPanel(UIPanelType.PlantAdd);
// Context.AudioFactory.LoadAudioClips(AudioNames.UISounds);
}
@@ -33,9 +34,9 @@ namespace Code.Infrastructure.App.States
public void UILoaded(UIPanelType uiPanelType)
{
// if (uiPanelType != UIPanelType.DebugSceneChooser) return;
//
// Context.UIService.OpenPanel(uiPanelType);
if (uiPanelType != UIPanelType.PlantAdd) return;
Context.UIService.OpenPanel(uiPanelType);
}
public void OnReadyToPlay(AudioNames groupName)
{
@@ -29,7 +29,7 @@ namespace Code.Infrastructure.Audio
{
_eventBus = eventBus;
_label = configLocator.TryGetManyConfigAssetReferences<AudioInfoConfig>();
for (var i = 0; i < typeof(AudioNames).GetEnumValues().Length; i++)
{
_audioInfos.Add((AudioNames)i, new Dictionary<int, AssetReference>());
@@ -38,15 +38,17 @@ namespace Code.Infrastructure.Audio
LoadConfigs().Forget();
}
private async UniTaskVoid LoadConfigs()
{
_configsHandle = Addressables.LoadAssetsAsync<AudioInfoConfig>(_label);
if ((await Addressables.LoadResourceLocationsAsync(_label).Task).Count != 0)
{
_configsHandle = Addressables.LoadAssetsAsync<AudioInfoConfig>(_label);
await _configsHandle.ToUniTask();
await _configsHandle.ToUniTask();
foreach (AudioInfoConfig config in _configsHandle.Result)
_audioInfos[config.GroupName].Add(config.id, config.fileReference);
foreach (var config in _configsHandle.Result)
_audioInfos[config.GroupName].Add(config.id, config.fileReference);
}
_eventBus.RaiseEvent<IAudioConfigsLoadedHandle>(ui => ui.AudioConfigsLoaded());
}
@@ -54,14 +56,15 @@ namespace Code.Infrastructure.Audio
public async UniTaskVoid LoadAudioClips(AudioNames groupName)
{
UnityEngine.Debug.LogWarning($"Audios loaded {groupName}");
foreach (var audioInfo in _audioInfos[groupName])
if (!_clipsHandles[groupName].ContainsKey(audioInfo.Key))
_clipsHandles[groupName].Add(audioInfo.Key, Addressables.LoadAssetAsync<AudioClip>(audioInfo.Value));
_clipsHandles[groupName]
.Add(audioInfo.Key, Addressables.LoadAssetAsync<AudioClip>(audioInfo.Value));
else
_clipsHandles[groupName][audioInfo.Key] = Addressables.LoadAssetAsync<AudioClip>(audioInfo.Value);
foreach (var handle in _clipsHandles[groupName])
foreach (var handle in _clipsHandles[groupName])
await handle.Value.ToUniTask();
_eventBus.RaiseEvent<IAudioClipsEventHandle>(ui =>
@@ -73,11 +76,12 @@ namespace Code.Infrastructure.Audio
public void ReleaseAudios(AudioNames groupName)
{
UnityEngine.Debug.LogWarning($"Audios unloaded {groupName}");
_eventBus.RaiseEvent<IAudioClipsEventHandle>(x=> x.AudioClipsUnLoaded(groupName));
foreach (var handle in _clipsHandles)
_eventBus.RaiseEvent<IAudioClipsEventHandle>(x => x.AudioClipsUnLoaded(groupName));
foreach (var handle in _clipsHandles)
Addressables.Release(handle.Value);
}
public void Dispose()
{
foreach (var handles in _clipsHandles)
@@ -88,7 +92,8 @@ namespace Code.Infrastructure.Audio
}
}
_configsHandle.Release();
if (_configsHandle.IsValid())
_configsHandle.Release();
}
}
@@ -118,7 +118,7 @@ namespace Code.Infrastructure.Audio
{
Addressables.Release(_handles);
Addressables.Release(_prefabConfigHandle);
Addressables.Release(_sourcePrefab);
if(_sourcePrefab) Addressables.Release(_sourcePrefab);
}
}
@@ -32,15 +32,21 @@ namespace Code.Infrastructure.Configs
}
private async UniTaskVoid SetupMasks(IConfigLocator configLocator, EventBus.EventBus eventBus)
{
var handle =
Addressables.LoadAssetsAsync<LayerMasksConfigConfig>(
configLocator.TryGetManyConfigAssetReferences<LayerMasksConfigConfig>(), null, Addressables.MergeMode.Union);
var label = configLocator.TryGetManyConfigAssetReferences<LayerMasksConfigConfig>();
if ((await Addressables.LoadResourceLocationsAsync(label).Task).Count != 0)
{
await handle.ToUniTask();
var handle =
Addressables.LoadAssetsAsync<LayerMasksConfigConfig>(
label, null, Addressables.MergeMode.Union);
SetMasks(handle.Result);
await handle.ToUniTask();
Addressables.Release(handle);
SetMasks(handle.Result);
Addressables.Release(handle);
}
eventBus.RaiseEvent<ILayerMasksInitializedHandle>(x => x.LayerMasksInitialized());
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7b23da77f3794e41b162b2ba2e392936
timeCreated: 1772114910
@@ -0,0 +1,7 @@
namespace Code.Infrastructure.JSON
{
public class JsonService
{
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0c0d29a568964f799b9fda906d71323f
timeCreated: 1772115192
@@ -5,6 +5,7 @@ using Code.Infrastructure.Configs;
using Code.Infrastructure.EventBus;
using Code.Infrastructure.Generators;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
@@ -12,23 +13,24 @@ using UnityEngine.SceneManagement;
namespace Code.Infrastructure.SceneLoader
{
[Config("Configs/SceneConfig",true)]
[Config("Configs/SceneConfig", true)]
public class SceneInfo
{
[ToConfig] public AssetReference SceneAsset;
[ToConfig] public SceneId SceneId;
[ToConfig] public SceneId SceneId;
}
public partial class SceneLoader : IDisposable
{
private Dictionary<SceneId, SceneInfo> _sceneInfos = new();
private Dictionary<SceneId, Action> _scenesActions = new();
private EventBus.EventBus _eventBus;
partial void SetupScenesInfo();
private AsyncOperationHandle<IList<SceneInfoConfig>> _loadHandle;
public SceneLoader(EventBus.EventBus eventBus, IConfigLocator configLocator)
{
_eventBus = eventBus;
@@ -41,16 +43,17 @@ namespace Code.Infrastructure.SceneLoader
if (loadMode == LoadSceneMode.Single)
for (var i = 0; i < _loadedScenes.Count; i++)
UnloadSceneAsync(_loadedScenes.Keys.ToList()[i]).Forget();
_loadedScenes.Add(id,Addressables.LoadSceneAsync(_sceneInfos[id].SceneAsset, loadMode));
_loadedScenes.Add(id, Addressables.LoadSceneAsync(_sceneInfos[id].SceneAsset, loadMode));
await _loadedScenes[id];
_scenesActions[id]();
_scenesActions[id]();
}
private Dictionary<SceneId, AsyncOperationHandle<SceneInstance>> _loadedScenes = new();
public Scene GetScene(SceneId id) => _loadedScenes[id].Result.Scene;
public async UniTaskVoid UnloadSceneAsync(SceneId id)
{
await Addressables.UnloadSceneAsync(_loadedScenes[id]);
@@ -61,35 +64,41 @@ namespace Code.Infrastructure.SceneLoader
private async UniTaskVoid LoadConfigs(string configReferences)
{
_configHandle = Addressables.LoadAssetsAsync<SceneInfoConfig>(configReferences, OnSceneConfigLoaded, Addressables.MergeMode.Union);
await _configHandle.ToUniTask();
SetupScenesInfo();
_eventBus.RaiseEvent<ISceneConfigsLoadedHandle>(h => h.SceneConfigsLoaded());
if ((await Addressables.LoadResourceLocationsAsync(configReferences).Task).Count != 0)
{
_configHandle = Addressables.LoadAssetsAsync<SceneInfoConfig>(configReferences, OnSceneConfigLoaded,
Addressables.MergeMode.Union);
await _configHandle.ToUniTask();
SetupScenesInfo();
}
_eventBus.RaiseEvent<ISceneConfigsLoadedHandle>(h => h.SceneConfigsLoaded());
}
private void OnSceneConfigLoaded(SceneInfoConfig sceneInfoConfig)
{
SceneInfo sceneInfo = new();
sceneInfo.SceneId = sceneInfoConfig.SceneId;
sceneInfo.SceneAsset = sceneInfoConfig.SceneAsset;
_sceneInfos.Add(sceneInfoConfig.SceneId, sceneInfo);
}
public void Dispose()
{
Addressables.Release(_configHandle);
if(_configHandle.IsValid()) _configHandle.Release();
}
}
public interface ISceneConfigsLoadedHandle : IGlobalSubscriber
{
void SceneConfigsLoaded();
}
public interface ILoadedSceneHandle : IGlobalSubscriber
{
void SceneLoaded(SceneId sceneId);
+5 -1
View File
@@ -3,6 +3,10 @@ namespace Code.Infrastructure.UI
public enum UIPanelType
{
Logo,
Loading
Loading,
Calendar,
Tasks,
Plants,
PlantAdd
}
}