PlantList

This commit is contained in:
ThomasCharester committed 2026-03-05 11:27:10 +03:00
1 parent ba49ef5015
commit 7c207ef5b9
44 files changed
+2795 -1147

No files matched your search

+7 -4
View File
@@ -12,14 +12,16 @@ namespace Code.Infrastructure.UI
{
public interface IUIFactory
{
UniTaskVoid LoadPanel(UIPanelType panelType);
UniTaskVoid LoadPanel(UIPanelType panelType, Transform parent = null);
void ReleasePanel(UIPanel panel);
Canvas Canvas { get; }
bool CheckIsMultiple(UIPanelType panelType);
}
public class UIFactory : IDisposable, IUIFactory
{
private Dictionary<UIPanelType, UIPanelSettingsConfig> _configs;
public bool CheckIsMultiple(UIPanelType panelType) => _configs[panelType].Multiple;
private AssetReference _canvasConfigReference;
private string _configsLabel;
private EventBus.EventBus _eventBus;
@@ -41,9 +43,9 @@ namespace Code.Infrastructure.UI
LoadConfigs().Forget();
}
public async UniTaskVoid LoadPanel(UIPanelType panelType)
public async UniTaskVoid LoadPanel(UIPanelType panelType, Transform parent = null)
{
var panel = (await Addressables.InstantiateAsync(_configs[panelType].Prefab, _canvas.transform).ToUniTask())
var panel = (await Addressables.InstantiateAsync(_configs[panelType].Prefab, parent ?? _canvas.transform).ToUniTask())
.GetComponent<UIPanel>();
UnityEngine.Debug.LogWarning($"Panel loaded {panelType}");
@@ -52,7 +54,7 @@ namespace Code.Infrastructure.UI
public void ReleasePanel(UIPanel panel)
{
UnityEngine.Debug.LogWarning($"Panel released {panel.gameObject.name}");
Debug.LogWarning($"Panel released {panel.gameObject.name}");
Addressables.ReleaseInstance(panel.gameObject);
}
@@ -90,5 +92,6 @@ namespace Code.Infrastructure.UI
public interface IUIPanelLoadedHandle : IGlobalSubscriber
{
void UIPanelLoaded(UIPanel panel, UIPanelType panelType);
List<UIPanel> TryGetMultiplePanels(UIPanelType panelType);
}
}