Сделан сервис UI и заготовки панелек
This commit is contained in:
1 parent
6f2b063700
commit
ae76edb0d0
161 files changed
+70228
-6
No files matched your search
@@ -3,6 +3,8 @@ using Code.Gameplay.Camera;
|
||||
using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.StateMachine;
|
||||
using Code.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.App.AppStates
|
||||
{
|
||||
@@ -18,11 +20,15 @@ namespace Code.App.AppStates
|
||||
Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded);
|
||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||
|
||||
Context.UIService.LoadingScreen.Show();
|
||||
Context.UIService.SwitchPanelTo(UIPanel.Gameplay);
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
|
||||
}
|
||||
|
||||
private void SceneLoaded()
|
||||
{
|
||||
Context.UIService.LoadingScreen.Hide();
|
||||
|
||||
base.EnterState();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ using Code.Gameplay.Camera;
|
||||
using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.StateMachine;
|
||||
using Code.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.App.AppStates
|
||||
{
|
||||
@@ -16,18 +18,35 @@ namespace Code.App.AppStates
|
||||
Context.SceneLoaderService.LoadScene((int)SceneIds.MainMenu, SceneLoaded);
|
||||
Context.InputService.EnableMap(ActionMappings.MainMenu);
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.Static);
|
||||
Context.UIService.LoadingScreen.Show();
|
||||
Context.UIService.SwitchPanelTo(UIPanel.MainMenu);
|
||||
((MainMenuPanel)Context.UIService.CurrentPanel).startButton.onClick.AddListener(StartGame);
|
||||
((MainMenuPanel)Context.UIService.CurrentPanel).exitButton.onClick.AddListener(ExitGame);
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.Static);
|
||||
}
|
||||
|
||||
private void SceneLoaded()
|
||||
{
|
||||
{
|
||||
Context.UIService.LoadingScreen.Hide();
|
||||
|
||||
base.EnterState();
|
||||
}
|
||||
public override void Tick()
|
||||
{ }
|
||||
|
||||
private void StartGame()
|
||||
{
|
||||
Context.StateMachine.SwitchState(AppState.Gameplay)
|
||||
.AllowStateTransition(AppState.MainMenu)
|
||||
.AllowStateTransition(AppState.GameOver);
|
||||
}
|
||||
|
||||
private void ExitGame()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
public override void ExitState()
|
||||
{
|
||||
Context.InputService.DisableMap(ActionMappings.MainMenu);
|
||||
|
||||
@@ -4,6 +4,7 @@ using Code.Gameplay.Camera;
|
||||
using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.StaticData;
|
||||
using Code.UI;
|
||||
using Reflex.Core;
|
||||
using Reflex.Injectors;
|
||||
using UnityEngine;
|
||||
@@ -23,7 +24,7 @@ namespace Code.App
|
||||
containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService));
|
||||
|
||||
InitializeCamera(containerBuilder, staticDataService);
|
||||
|
||||
containerBuilder.AddSingleton(typeof(UIService), typeof(IUIService));
|
||||
containerBuilder.AddSingleton(typeof(SceneLoaderService), typeof(ISceneLoaderService));
|
||||
|
||||
containerBuilder.OnContainerBuilt += Bootstrap;
|
||||
@@ -61,6 +62,8 @@ namespace Code.App
|
||||
containerBuilder.AddSingleton(staticDataService.InputConfig.inputActionAsset, typeof(InputActionAsset));
|
||||
containerBuilder.AddSingleton(staticDataService.CameraConfig, typeof(CameraConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.CharacterConfig, typeof(CharacterConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.UIConfig.canvasPrefab, typeof(Canvas));
|
||||
containerBuilder.AddSingleton(staticDataService.UIConfig.uiElementsPrefabs, typeof(UIElement[]));
|
||||
}
|
||||
|
||||
private void Bootstrap(Container container)
|
||||
@@ -77,7 +80,8 @@ namespace Code.App
|
||||
|
||||
// TODO: поменяно для теста
|
||||
appStateMachine
|
||||
.SwitchState(AppState.MovementDev);
|
||||
.SwitchState(AppState.MainMenu)
|
||||
.AllowStateTransition(AppState.Gameplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Code.Gameplay.Camera;
|
||||
using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.UI;
|
||||
using Reflex.Attributes;
|
||||
|
||||
namespace Code.App.StateMachine
|
||||
@@ -11,5 +12,6 @@ namespace Code.App.StateMachine
|
||||
[Inject] public IInputService InputService;
|
||||
[Inject] public AppStateMachine StateMachine;
|
||||
[Inject] public CameraStateMachine CameraStateMachine;
|
||||
[Inject] public IUIService UIService;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user