ИИ гонщиков, запуск, перезапуск игры и пр
This commit is contained in:
1 parent
f557c58c9d
commit
efcfaae647
48 files changed
+1486
-212
No files matched your search
@@ -6,12 +6,12 @@ namespace Code.Infrastructure.UI.Panels
|
||||
{
|
||||
public override void Open(Action callback = null)
|
||||
{
|
||||
|
||||
callback?.Invoke();
|
||||
}
|
||||
|
||||
public override void Close(Action callback = null)
|
||||
{
|
||||
|
||||
callback?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,22 @@
|
||||
using System;
|
||||
using Code.Debug;
|
||||
using Code.Infrastructure.Audio;
|
||||
using Reflex.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Infrastructure.UI.Panels
|
||||
{
|
||||
public class MenuChoosePanel : UIPanel
|
||||
{
|
||||
[Inject] IAudioService _audioService;
|
||||
[SerializeField] private SceneChooser sceneChooser;
|
||||
public void PlaySelectSound() => _audioService.PlayOneShot(AudioNames.UISounds, 7);
|
||||
public void PlayDeselectSound() => _audioService.PlayOneShot(AudioNames.UISounds, 8);
|
||||
public void PlayClickSound() => _audioService.PlayOneShot(AudioNames.UISounds, 1);
|
||||
public override void Open(Action callback = null)
|
||||
{
|
||||
|
||||
sceneChooser.EnableButtons();
|
||||
callback?.Invoke();
|
||||
}
|
||||
|
||||
public override void Close(Action callback = null)
|
||||
|
||||
@@ -43,13 +43,16 @@ namespace Code.Infrastructure.UI
|
||||
|
||||
public async UniTaskVoid LoadPanel(UIPanelType panelType)
|
||||
{
|
||||
var panel = (await Addressables.InstantiateAsync(_configs[panelType].Prefab, _canvas.transform).ToUniTask()).GetComponent<UIPanel>();
|
||||
var panel = (await Addressables.InstantiateAsync(_configs[panelType].Prefab, _canvas.transform).ToUniTask())
|
||||
.GetComponent<UIPanel>();
|
||||
|
||||
UnityEngine.Debug.LogWarning($"Panel loaded {panelType}");
|
||||
_eventBus.RaiseEvent<IUIPanelLoadedHandle>(ui => ui.UIPanelLoaded(panel, panelType));
|
||||
}
|
||||
|
||||
public void ReleasePanel(UIPanel panel)
|
||||
{
|
||||
UnityEngine.Debug.LogWarning($"Panel released {panel.gameObject.name}");
|
||||
Addressables.ReleaseInstance(panel.gameObject);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Code.Infrastructure.UI
|
||||
Loading,
|
||||
DebugSceneChooser,
|
||||
PlayerScoreCounter,
|
||||
WinScreen,
|
||||
DebugMenu
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ namespace Code.Infrastructure.UI
|
||||
void TryLoadPanel(UIPanelType uiPanelType);
|
||||
void TryRemovePanel(UIPanelType uiPanelType);
|
||||
void SetCanvasCamera(UnityEngine.Camera camera);
|
||||
UIPanel TryGetPanel(UIPanelType panelType);
|
||||
}
|
||||
|
||||
public class UIService : IUIPanelLoadedHandle, IUIService
|
||||
@@ -34,6 +35,7 @@ namespace Code.Infrastructure.UI
|
||||
public void SetCanvasCamera(UnityEngine.Camera camera)
|
||||
{
|
||||
_factory.Canvas.worldCamera = camera;
|
||||
_factory.Canvas.planeDistance = 0.3f;
|
||||
}
|
||||
|
||||
public void OpenPanel(UIPanelType uiPanelType)
|
||||
@@ -75,6 +77,8 @@ namespace Code.Infrastructure.UI
|
||||
_factory.ReleasePanel(_loadedPanels[panelType]);
|
||||
_loadedPanels.Remove(panelType);
|
||||
}
|
||||
|
||||
public UIPanel TryGetPanel(UIPanelType panelType) => _loadedPanels.GetValueOrDefault(panelType);
|
||||
}
|
||||
|
||||
public interface IUIPanelLoaded : IGlobalSubscriber
|
||||
|
||||
Reference in new issue
Block a user