UI Update, volumes
This commit is contained in:
1 parent
e2d0974b3c
commit
0f0c8bab43
100 files changed
+10862
-734
No files matched your search
@@ -1,75 +1,101 @@
|
||||
using System;
|
||||
using Code.Infrastructure.Camera;
|
||||
using Code.Infrastructure.Configs;
|
||||
using Code.Infrastructure.Input;
|
||||
using Code.Infrastructure.Loadings;
|
||||
using Code.Infrastructure.SceneLoader;
|
||||
using Code.Infrastructure.UI;
|
||||
using Code.Infrastructure.Volume;
|
||||
using Reflex.Core;
|
||||
using Reflex.Enums;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
using Resolution = Reflex.Enums.Resolution;
|
||||
|
||||
namespace Code.Infrastructure.App
|
||||
{
|
||||
public class PapaInstaller : MonoBehaviour, IInstaller,
|
||||
public class PapaInstaller : MonoBehaviour, IInstaller,
|
||||
ISceneConfigsLoadedHandle,
|
||||
IInputServiceInitializedHandle,
|
||||
ICameraInitializedHandle,
|
||||
IUIInitializedHandle,
|
||||
IUIPanelLoaded
|
||||
IUIPanelLoaded,
|
||||
IVolumesInitializedHandle,
|
||||
IVolumeLoaded
|
||||
{
|
||||
public void InstallBindings(ContainerBuilder containerBuilder)
|
||||
{
|
||||
containerBuilder.RegisterType(typeof(EventBus.EventBus), Lifetime.Singleton, Resolution.Eager);
|
||||
containerBuilder.RegisterType(typeof(ConfigLocator), new[] { typeof(IConfigLocator) }, Lifetime.Singleton, Resolution.Eager);
|
||||
containerBuilder.RegisterType(typeof(ConfigLocator), new[] { typeof(IConfigLocator) }, Lifetime.Singleton,
|
||||
Resolution.Eager);
|
||||
containerBuilder.RegisterType(typeof(SceneLoader.SceneLoader), Lifetime.Singleton, Resolution.Eager);
|
||||
containerBuilder.RegisterType(typeof(InputService),new[] { typeof(IInputService) }, Lifetime.Singleton, Resolution.Eager);
|
||||
|
||||
containerBuilder.RegisterType(typeof(InputService), new[] { typeof(IInputService) }, Lifetime.Singleton,
|
||||
Resolution.Eager);
|
||||
|
||||
containerBuilder.OnContainerBuilt += Bootstrap;
|
||||
|
||||
containerBuilder.RegisterType(typeof(AppStateMachine), Lifetime.Singleton, Resolution.Lazy);
|
||||
containerBuilder.RegisterType(typeof(AppStateMachineContext), Lifetime.Singleton, Resolution.Lazy);
|
||||
|
||||
containerBuilder.RegisterType(typeof(CameraFactory), Lifetime.Singleton, Resolution.Lazy);
|
||||
containerBuilder.RegisterType(typeof(CameraStateMachine), Lifetime.Singleton, Resolution.Lazy);
|
||||
containerBuilder.RegisterType(typeof(CameraStateMachineContext), Lifetime.Singleton, Resolution.Lazy);
|
||||
|
||||
containerBuilder.RegisterType(typeof(UIFactory), new []{typeof(IUIFactory)}, Lifetime.Singleton, Resolution.Eager);
|
||||
containerBuilder.RegisterType(typeof(UIService), new []{typeof(IUIService)}, Lifetime.Singleton, Resolution.Eager);
|
||||
|
||||
|
||||
containerBuilder.RegisterType(typeof(AppStateMachine), Lifetime.Singleton, Resolution.Lazy);
|
||||
containerBuilder.RegisterType(typeof(AppStateMachineContext), Lifetime.Singleton, Resolution.Lazy);
|
||||
|
||||
containerBuilder.RegisterType(typeof(CameraFactory), Lifetime.Singleton, Resolution.Lazy);
|
||||
containerBuilder.RegisterType(typeof(CameraStateMachine), Lifetime.Singleton, Resolution.Lazy);
|
||||
containerBuilder.RegisterType(typeof(CameraStateMachineContext), Lifetime.Singleton, Resolution.Lazy);
|
||||
|
||||
containerBuilder.RegisterType(typeof(UIFactory), new[] { typeof(IUIFactory) }, Lifetime.Singleton,
|
||||
Resolution.Eager);
|
||||
containerBuilder.RegisterType(typeof(UIService), new[] { typeof(IUIService) }, Lifetime.Singleton,
|
||||
Resolution.Eager);
|
||||
|
||||
containerBuilder.RegisterType(typeof(VolumeService), new[] { typeof(IVolumeService) }, Lifetime.Singleton,
|
||||
Resolution.Lazy);
|
||||
containerBuilder.RegisterType(typeof(VolumeFactory), new[] { typeof(IVolumeFactory) }, Lifetime.Singleton,
|
||||
Resolution.Eager);
|
||||
|
||||
// UIFactory
|
||||
// Logo
|
||||
// Scene configs
|
||||
// Input service
|
||||
// Camera
|
||||
_initialLoading = new Loading(5, () => EssentialLoadEnded(_thatRightContainer));
|
||||
// Volume Factory
|
||||
// Loading volume
|
||||
_initialLoading = new Loading(7, () => EssentialLoadEnded(_thatRightContainer));
|
||||
_ui2CamLoading = new Loading(2,
|
||||
() =>
|
||||
{
|
||||
_thatRightContainer.Resolve<IUIService>().SetCanvasCamera(_thatRightContainer
|
||||
.Resolve<CameraStateMachineContext>().cameraLoadedData.Camera);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private Loading _initialLoading;
|
||||
private Loading _ui2CamLoading;
|
||||
private Container _thatRightContainer;
|
||||
|
||||
private void Bootstrap(Container container)
|
||||
{
|
||||
_thatRightContainer = container;
|
||||
|
||||
|
||||
container.Resolve<EventBus.EventBus>().Subscribe(this);
|
||||
|
||||
container.Resolve<CameraFactory>().CreateCameraStateMachine(container.Resolve<CameraStateMachine>()).Forget();
|
||||
|
||||
|
||||
container.Resolve<CameraFactory>().CreateCameraStateMachine(container.Resolve<CameraStateMachine>())
|
||||
.Forget();
|
||||
}
|
||||
|
||||
private void EssentialLoadEnded(Container container)
|
||||
{
|
||||
container.Resolve<EventBus.EventBus>().Unsubscribe(this);
|
||||
container.Resolve<AppStateMachine>().SwitchState(AppStates.Bootstrap).AllowStateTransition(AppStates.Gameplay);
|
||||
container.Resolve<AppStateMachine>().SwitchState(AppStates.Bootstrap)
|
||||
.AllowStateTransition(AppStates.Gameplay);
|
||||
}
|
||||
|
||||
public void SceneConfigsLoaded()
|
||||
{
|
||||
{
|
||||
_initialLoading.DoProgress();
|
||||
}
|
||||
|
||||
public void InputServiceInitialized()
|
||||
{
|
||||
{
|
||||
_initialLoading.DoProgress();
|
||||
}
|
||||
|
||||
@@ -77,34 +103,59 @@ namespace Code.Infrastructure.App
|
||||
{
|
||||
_thatRightContainer.Resolve<CameraStateMachineContext>().cameraLoadedData = data;
|
||||
_thatRightContainer.Resolve<CameraStateMachine>().SwitchState(CameraMode.None)
|
||||
.AllowStateTransition(CameraMode.FirstPerson);
|
||||
|
||||
.AllowStateTransition(CameraMode.FirstPerson);
|
||||
|
||||
data.Camera.GetUniversalAdditionalCameraData().renderPostProcessing = true;
|
||||
|
||||
_ui2CamLoading.DoProgress();
|
||||
_initialLoading.DoProgress();
|
||||
}
|
||||
|
||||
public void UIInitialized()
|
||||
{
|
||||
_ui2CamLoading.DoProgress();
|
||||
_initialLoading.DoProgress();
|
||||
|
||||
|
||||
_thatRightContainer.Resolve<IUIService>().TryLoadPanel(UIPanelType.Logo);
|
||||
_thatRightContainer.Resolve<IUIService>().TryLoadPanel(UIPanelType.Loading);
|
||||
}
|
||||
|
||||
public void UILoaded(UIPanelType uiPanelType)
|
||||
{
|
||||
if (_initialLoading.Completed) return;
|
||||
|
||||
switch (uiPanelType)
|
||||
{
|
||||
case UIPanelType.Logo:
|
||||
_thatRightContainer.Resolve<IUIService>().OpenPanel(UIPanelType.Logo);
|
||||
|
||||
|
||||
_initialLoading.DoProgress();
|
||||
break;
|
||||
case UIPanelType.Loading:
|
||||
// _thatRightContainer.Resolve<IUIService>().OpenPanel(UIPanelType.Logo);
|
||||
break;
|
||||
default:
|
||||
Application.Quit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void VolumesInitialized()
|
||||
{
|
||||
_initialLoading.DoProgress();
|
||||
|
||||
_thatRightContainer.Resolve<IVolumeService>().TryLoadVolume(VolumeId.MenuRetro);
|
||||
}
|
||||
|
||||
public void VolumeLoaded(VolumeId volumeId)
|
||||
{
|
||||
switch (volumeId)
|
||||
{
|
||||
case VolumeId.MenuRetro:
|
||||
_initialLoading.DoProgress();
|
||||
break;
|
||||
default:
|
||||
Application.Quit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user