feat: add bootstrap architecture and common utilities for Unity project
- Add GameLifetimeScope for dependency injection with Zenject - Implement boot flow service with entry point and interfaces - Create boot state machine (Splash, Menu, Load states) - Add UI views for boot screens - Add common services base class and interface - Implement generic state machine controller - Add base UI view components and ViewModel interface - Update SampleScene.unity - Add BootSettings asset Добавлена архитектура bootstrap и общие утилиты для Unity проекта: - Добавлен GameLifetimeScope для внедрения зависимостей (Zenject) - Реализован сервис потока загрузки с точкой входа и интерфейсами - Создана машина состояний загрузки (Splash, Menu, Load состояния) - Добавлены UI представления для экранов загрузки - Добавлены базовые классы сервисов и интерфейс IService - Реализован контроллер машины состояний - Добавлены базовые компоненты UI вида и интерфейс ViewModel - Обновлена сцена SampleScene.unity - Добавлен ассет BootSettings
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace QuizPleaseTest.Common.StateMachine
|
||||
{
|
||||
public interface IState
|
||||
{
|
||||
UniTask EnterAsync(CancellationToken ct);
|
||||
UniTask ExitAsync(CancellationToken ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5555555555555555555555555555555
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace QuizPleaseTest.Common.StateMachine
|
||||
{
|
||||
public interface IStatesController<TEnum>
|
||||
{
|
||||
UniTask EnterStateAsync(TEnum code, CancellationToken ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6666666666666666666666666666666
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace QuizPleaseTest.Common.StateMachine
|
||||
{
|
||||
public class StatesController<TEnum> : IStatesController<TEnum>
|
||||
{
|
||||
private readonly IReadOnlyDictionary<TEnum, IState> _states;
|
||||
private IState _currentState;
|
||||
|
||||
public StatesController(IReadOnlyDictionary<TEnum, IState> states)
|
||||
{
|
||||
_states = states;
|
||||
}
|
||||
|
||||
public async UniTask EnterStateAsync(TEnum code, CancellationToken ct)
|
||||
{
|
||||
if (!_states.TryGetValue(code, out IState newState))
|
||||
{
|
||||
throw new InvalidOperationException($"State is not registered: {code}");
|
||||
}
|
||||
|
||||
if (_currentState != null)
|
||||
{
|
||||
await _currentState.ExitAsync(ct);
|
||||
}
|
||||
|
||||
_currentState = newState;
|
||||
await _currentState.EnterAsync(ct);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7777777777777777777777777777777
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user