51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using Code.Infrastructure.Audio;
|
|
using Code.Infrastructure.Generators;
|
|
using Code.Infrastructure.UI;
|
|
|
|
namespace Code.Infrastructure.App.States
|
|
{
|
|
[State(typeof(AppStates),typeof(AppStateMachineContext))]
|
|
[StateRaisingEvent]
|
|
public partial class BootstrapState : IUIPanelLoaded, IReadyToPlayHandle
|
|
{
|
|
private EventBus.EventBus _eventBus;
|
|
public BootstrapState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context,eventBus)
|
|
{
|
|
_eventBus = eventBus;
|
|
}
|
|
|
|
public override AppStates myState => AppStates.Bootstrap;
|
|
protected override void OnEnterState()
|
|
{
|
|
_eventBus.Subscribe(this);
|
|
|
|
Context.UIService.TryRemovePanel(UIPanelType.Logo);
|
|
Context.UIService.TryRemovePanel(UIPanelType.Loading);
|
|
Context.UIService.TryLoadCreatePanel(UIPanelType.PlantList);
|
|
// Context.AudioFactory.LoadAudioClips(AudioNames.UISounds);
|
|
}
|
|
|
|
protected override void OnExitState()
|
|
{
|
|
// Context.AudioFactory.ReleaseAudios(AudioNames.UISounds);
|
|
_eventBus.Unsubscribe(this);
|
|
}
|
|
|
|
public void UISinglePanelLoaded(UIPanelType uiPanelType)
|
|
{
|
|
if (uiPanelType != UIPanelType.PlantList) return;
|
|
|
|
Context.UIService.OpenPanel(uiPanelType);
|
|
}
|
|
|
|
public void UIMultiplePanelLoaded(UIPanelType uiPanelType, UIPanel panel)
|
|
{
|
|
|
|
}
|
|
|
|
public void OnReadyToPlay(AudioNames groupName)
|
|
{
|
|
// Context.AudioService.PlayRepeatedly(AudioNames.UISounds,0);
|
|
}
|
|
}
|
|
} |