diff --git a/.idea/.idea.Infra/.idea/indexLayout.xml b/.idea/.idea.Infra/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/.idea/.idea.Infra/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Infra/.idea/projectSettingsUpdater.xml b/.idea/.idea.Infra/.idea/projectSettingsUpdater.xml
new file mode 100644
index 0000000..64af657
--- /dev/null
+++ b/.idea/.idea.Infra/.idea/projectSettingsUpdater.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Infra/.idea/vcs.xml b/.idea/.idea.Infra/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/.idea.Infra/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Infra/.idea/workspace.xml b/.idea/.idea.Infra/.idea/workspace.xml
new file mode 100644
index 0000000..fd9819b
--- /dev/null
+++ b/.idea/.idea.Infra/.idea/workspace.xml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ "associatedIndex": 2
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1768917644200
+
+
+ 1768917644200
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Assets/Code/Example.meta b/Assets/Code/Example.meta
deleted file mode 100644
index adeca3b..0000000
--- a/Assets/Code/Example.meta
+++ /dev/null
@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: 07cf07a937934e0094469237b5865b60
-timeCreated: 1766350980
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/Camera/CameraFactory.cs b/Assets/Code/Infrastructure/Camera/CameraFactory.cs
index d841c1a..f6e1deb 100644
--- a/Assets/Code/Infrastructure/Camera/CameraFactory.cs
+++ b/Assets/Code/Infrastructure/Camera/CameraFactory.cs
@@ -20,8 +20,7 @@ namespace Code.Infrastructure.Camera
private string _cameraConfigsLabel;
private EventBus.EventBus _eventBus;
- private UnityEngine.Camera _camera;
- private IDisposable _disposableImplementation;
+ private UnityEngine.Camera _camera;
public CameraFactory(IConfigLocator configLocator, EventBus.EventBus eventBus)
{
diff --git a/Assets/Code/Infrastructure/UI.meta b/Assets/Code/Infrastructure/UI.meta
new file mode 100644
index 0000000..e943801
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: f00c637597e248c9b6df168e80ab4ea2
+timeCreated: 1768978928
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/UI/UIFactory.cs b/Assets/Code/Infrastructure/UI/UIFactory.cs
new file mode 100644
index 0000000..09bcfc0
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI/UIFactory.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Code.Infrastructure.Configs;
+using Code.Infrastructure.EventBus;
+using Cysharp.Threading.Tasks;
+using UnityEngine.AddressableAssets;
+using UnityEngine.ResourceManagement.AsyncOperations;
+
+namespace Code.Infrastructure.UI
+{
+ public interface IUIFactory
+ {
+ UniTaskVoid LoadPanel(UIPanelType panelType);
+ void ReleasePanel(UIPanel panel);
+ }
+
+ public class UIFactory : IDisposable, IUIFactory
+ {
+ private Dictionary _configs;
+ private string _configsLabel;
+ private EventBus.EventBus _eventBus;
+
+ private AsyncOperationHandle> _configsHandle;
+
+ public UIFactory(IConfigLocator configLocator, EventBus.EventBus eventBus)
+ {
+ _eventBus = eventBus;
+ _configsLabel = configLocator.TryGetManyConfigAssetReferences();
+
+ LoadConfigs().Forget();
+ }
+
+ public async UniTaskVoid LoadPanel(UIPanelType panelType)
+ {
+ var panel = (await Addressables.InstantiateAsync(_configs[panelType]).ToUniTask()).GetComponent();
+
+ _eventBus.RaiseEvent(ui => ui.UIPanelLoaded(panel, panelType));
+ }
+
+ public void ReleasePanel(UIPanel panel)
+ {
+ Addressables.ReleaseInstance(panel.gameObject);
+ }
+
+ private async UniTaskVoid LoadConfigs()
+ {
+ _configsHandle = Addressables.LoadAssetsAsync(_configsLabel);
+
+ await _configsHandle.ToUniTask();
+
+ _configs = _configsHandle.Result.ToDictionary(c => c.UIPanelType);
+
+ _eventBus.RaiseEvent(ui => ui.UIInitialized());
+ }
+ public void Dispose()
+ {
+ Addressables.Release(_configsHandle);
+ }
+ }
+
+ public interface IUIInitializedHandle : IGlobalSubscriber
+ {
+ void UIInitialized();
+ }
+ public interface IUIPanelLoadedHandle : IGlobalSubscriber
+ {
+ void UIPanelLoaded(UIPanel panel, UIPanelType panelType);
+ }
+}
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/UI/UIFactory.cs.meta b/Assets/Code/Infrastructure/UI/UIFactory.cs.meta
new file mode 100644
index 0000000..41887d6
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI/UIFactory.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 8447b81247b24f1b869b0067aeeff0b8
+timeCreated: 1768979324
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/UI/UIPanel.cs b/Assets/Code/Infrastructure/UI/UIPanel.cs
new file mode 100644
index 0000000..3044725
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI/UIPanel.cs
@@ -0,0 +1,13 @@
+using System.ComponentModel;
+using UnityEngine;
+
+namespace Code.Infrastructure.UI
+{
+ public abstract class UIPanel : MonoBehaviour
+ {
+ [field: Category("UIPanel")] public bool InjectMeSenpai { get; protected set; }
+
+ public abstract void Open();
+ public abstract void Close();
+ }
+}
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/UI/UIPanel.cs.meta b/Assets/Code/Infrastructure/UI/UIPanel.cs.meta
new file mode 100644
index 0000000..5b618a0
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI/UIPanel.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 4464e0158e044f5985c45cb73250cf43
+timeCreated: 1768980188
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/UI/UIPanelSettings.cs b/Assets/Code/Infrastructure/UI/UIPanelSettings.cs
new file mode 100644
index 0000000..fd8cc33
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI/UIPanelSettings.cs
@@ -0,0 +1,12 @@
+using Code.Infrastructure.Generators;
+using UnityEngine.AddressableAssets;
+
+namespace Code.Infrastructure.UI
+{
+ [Config("Configs/UI/UIPanelSettings", true)]
+ public class UIPanelSettings
+ {
+ [ToConfig] public AssetReference Prefab;
+ [ToConfig] public UIPanelType UIPanelType;
+ }
+}
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/UI/UIPanelSettings.cs.meta b/Assets/Code/Infrastructure/UI/UIPanelSettings.cs.meta
new file mode 100644
index 0000000..c49f1cd
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI/UIPanelSettings.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 996c214bb8624a64b6c563f0c13320ac
+timeCreated: 1768979468
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/UI/UIPanelType.cs b/Assets/Code/Infrastructure/UI/UIPanelType.cs
new file mode 100644
index 0000000..7de166d
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI/UIPanelType.cs
@@ -0,0 +1,9 @@
+namespace Code.Infrastructure.UI
+{
+ public enum UIPanelType
+ {
+ Logo,
+ Loading,
+ DebugMenu
+ }
+}
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/UI/UIPanelType.cs.meta b/Assets/Code/Infrastructure/UI/UIPanelType.cs.meta
new file mode 100644
index 0000000..494d90a
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI/UIPanelType.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: e33d3007130a4cbbac8a5e962d5c4806
+timeCreated: 1768979170
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/UI/UIService.cs b/Assets/Code/Infrastructure/UI/UIService.cs
new file mode 100644
index 0000000..5256616
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI/UIService.cs
@@ -0,0 +1,66 @@
+using System.Collections.Generic;
+using Reflex.Core;
+using Reflex.Extensions;
+using Reflex.Injectors;
+using UnityEngine.SceneManagement;
+
+namespace Code.Infrastructure.UI
+{
+ public interface IUIService
+ {
+ void OpenPanel(UIPanelType uiPanelType);
+ void ClosePanel(UIPanelType uiPanelType);
+ void TryLoadPanel(UIPanelType uiPanelType);
+ void TryRemovePanel(UIPanelType panelType);
+ }
+
+ public class UIService : IUIPanelLoadedHandle, IUIService
+ {
+ private Dictionary _loadedPanels = new();
+
+ private EventBus.EventBus _eventBus;
+ private IUIFactory _factory;
+
+ public UIService(EventBus.EventBus eventBus, IUIFactory factory)
+ {
+ _eventBus = eventBus;
+ _factory = factory;
+ eventBus.Subscribe(this);
+ }
+
+ public void OpenPanel(UIPanelType uiPanelType)
+ {
+ _loadedPanels[uiPanelType].gameObject.SetActive(true); // TODO Братуха реально реши надо вкл\выкл или это очередная хренооптимизация
+ _loadedPanels[uiPanelType].Open();
+ }
+
+ public void ClosePanel(UIPanelType uiPanelType)
+ {
+ _loadedPanels[uiPanelType].gameObject.SetActive(false);
+ _loadedPanels[uiPanelType].Close();
+ }
+
+ public void TryLoadPanel(UIPanelType uiPanelType) => _factory.LoadPanel(uiPanelType);
+
+ public void UIPanelLoaded(UIPanel panel, UIPanelType panelType)
+ {
+ _loadedPanels.Add(panelType, panel);
+
+ if(panel.InjectMeSenpai)
+ GameObjectInjector.InjectRecursive(panel.gameObject, Container.RootContainer);
+ // GameObjectInjector.InjectRecursive(panel.gameObject, SceneManager.GetActiveScene().GetSceneContainer()); // Скорее всего будут нужны компоненты текущей сцены
+ }
+
+ public void TryRemovePanel(UIPanelType panelType)
+ {
+ //
+ RemovePanel(panelType);
+ }
+
+ private void RemovePanel(UIPanelType panelType)
+ {
+ _factory.ReleasePanel(_loadedPanels[panelType]);
+ _loadedPanels.Remove(panelType);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Code/Infrastructure/UI/UIService.cs.meta b/Assets/Code/Infrastructure/UI/UIService.cs.meta
new file mode 100644
index 0000000..8be06ed
--- /dev/null
+++ b/Assets/Code/Infrastructure/UI/UIService.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 0bcb777d18014c428f24113d73787e38
+timeCreated: 1768980594
\ No newline at end of file
diff --git a/Assets/SourceGeneration.meta b/Assets/SourceGeneration.meta
new file mode 100644
index 0000000..de0ceba
--- /dev/null
+++ b/Assets/SourceGeneration.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3d2c689e65afcd2498be16afac55fa0f
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/SourceGeneration/InfraGens~/.idea/.idea.InfraGens/.idea/projectSettingsUpdater.xml b/Assets/SourceGeneration/InfraGens~/.idea/.idea.InfraGens/.idea/projectSettingsUpdater.xml
new file mode 100644
index 0000000..64af657
--- /dev/null
+++ b/Assets/SourceGeneration/InfraGens~/.idea/.idea.InfraGens/.idea/projectSettingsUpdater.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Assets/SourceGeneration/InfraGens~/.idea/.idea.InfraGens/.idea/workspace.xml b/Assets/SourceGeneration/InfraGens~/.idea/.idea.InfraGens/.idea/workspace.xml
new file mode 100644
index 0000000..b54af24
--- /dev/null
+++ b/Assets/SourceGeneration/InfraGens~/.idea/.idea.InfraGens/.idea/workspace.xml
@@ -0,0 +1,82 @@
+
+
+
+ InfraGens/InfraGens/InfraGens.csproj
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ "associatedIndex": 1
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1768916878151
+
+
+ 1768916878151
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs b/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs
index ff47eb4..79d8132 100644
--- a/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs
+++ b/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs
@@ -19,15 +19,15 @@ public partial class AppStateMachine : AbstractStateMachine AllowedStates.HasFlag(nextState);
diff --git a/Assets/UnityCodeGen.Generated/Code.Infrastructure.Camera.CameraStateMachine.Generated.cs b/Assets/UnityCodeGen.Generated/Code.Infrastructure.Camera.CameraStateMachine.Generated.cs
index 1e9d26f..0ec0463 100644
--- a/Assets/UnityCodeGen.Generated/Code.Infrastructure.Camera.CameraStateMachine.Generated.cs
+++ b/Assets/UnityCodeGen.Generated/Code.Infrastructure.Camera.CameraStateMachine.Generated.cs
@@ -3,8 +3,6 @@
#pragma warning disable CS0105
using Code.Infrastructure.StateMachine;
-using Code.Infrastructure.Camera.CameraStates;
-
using Code.Infrastructure.Camera.CameraStates;
#pragma warning restore CS0105
@@ -19,7 +17,6 @@ public partial class CameraStateMachine : AbstractStateMachine("SystemConfigsReferences");
+ _multipleConfigReferences.Add(typeof(Code.Infrastructure.Camera.CameraSettingsConfig), systemConfigsReferences.CameraSettings);
+
+ _multipleConfigReferences.Add(typeof(Code.Infrastructure.UI.UIPanelSettingsConfig), systemConfigsReferences.UIPanelSettings);
+
+ _singleConfigReferences.Add(typeof(Code.Infrastructure.Camera.GameCameraConfig), systemConfigsReferences.GameCamera);
+
_multipleConfigReferences.Add(typeof(Code.Infrastructure.SceneLoader.SceneInfoConfig), systemConfigsReferences.SceneInfo);
_singleConfigReferences.Add(typeof(Code.Infrastructure.Input.InputServiceConfig), systemConfigsReferences.InputService);
- _multipleConfigReferences.Add(typeof(Code.Infrastructure.Camera.CameraSettingsConfig), systemConfigsReferences.CameraSettings);
-
- _singleConfigReferences.Add(typeof(Code.Infrastructure.Camera.GameCameraConfig), systemConfigsReferences.GameCamera);
-
//_singleConfigReferences.Add(typeof(ScenesAssetReferences), systemConfigsReferences.scenesAssetReferences);
}
}
diff --git a/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs b/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs
index 5347e46..42c7521 100644
--- a/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs
+++ b/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs
@@ -1,9 +1,10 @@
#pragma warning disable CS0105
- using Code.Infrastructure.SceneLoader;
+ using Code.Infrastructure.Camera;
+using Code.Infrastructure.UI;
+using Code.Infrastructure.Camera;
+using Code.Infrastructure.SceneLoader;
using Code.Infrastructure.Input;
-using Code.Infrastructure.Camera;
-using Code.Infrastructure.Camera;
using UnityEngine.AddressableAssets;
#pragma warning restore CS0105
@@ -11,10 +12,11 @@ using Code.Infrastructure.Camera;
namespace Code.Infrastructure.Configs{
public partial class SystemConfigsReferences
{
- public string SceneInfo;
-public AssetReference InputService;
-public string CameraSettings;
+ public string CameraSettings;
+public string UIPanelSettings;
public AssetReference GameCamera;
+public string SceneInfo;
+public AssetReference InputService;
}
}
diff --git a/Assets/UnityCodeGen.Generated/UIPanelSettingsConfig.Generated.cs b/Assets/UnityCodeGen.Generated/UIPanelSettingsConfig.Generated.cs
new file mode 100644
index 0000000..ad47edd
--- /dev/null
+++ b/Assets/UnityCodeGen.Generated/UIPanelSettingsConfig.Generated.cs
@@ -0,0 +1,18 @@
+
+#pragma warning disable CS0105
+using UnityEngine.AddressableAssets;
+using Code.Infrastructure.UI;
+
+using UnityEngine;
+using UnityEngine.AddressableAssets;
+
+namespace Code.Infrastructure.UI{
+#pragma warning restore CS0105
+[CreateAssetMenu(fileName = "UIPanelSettingsConfig", menuName = "Configs/UI/UIPanelSettings")]
+public class UIPanelSettingsConfig : ScriptableObject
+{
+ public UnityEngine.AddressableAssets.AssetReference Prefab;
+public Code.Infrastructure.UI.UIPanelType UIPanelType;
+
+}
+}
diff --git a/Assets/UnityCodeGen.Generated/UIPanelSettingsConfig.Generated.cs.meta b/Assets/UnityCodeGen.Generated/UIPanelSettingsConfig.Generated.cs.meta
new file mode 100644
index 0000000..24c1380
--- /dev/null
+++ b/Assets/UnityCodeGen.Generated/UIPanelSettingsConfig.Generated.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 17bdede85b436f44e992b27d170ccbc2
\ No newline at end of file