DI updates
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Services.Console {
|
||||
[CreateAssetMenu(fileName = RConsts.AssetMenu + "cvar")]
|
||||
[CreateAssetMenu(menuName = RConsts.AssetMenu + "cvar", fileName = "cvar")]
|
||||
public class CVarAsset : ScriptableObject {
|
||||
[SerializeField]
|
||||
private CVar _cvar;
|
||||
|
||||
public CVar Create(string name = null) {
|
||||
CVar cvar = new CVar(_cvar);
|
||||
public CVar Create(string cvarName = null) {
|
||||
CVar cvar = new(_cvar);
|
||||
|
||||
if (name != null) {
|
||||
cvar.Name = name;
|
||||
if (cvarName != null) {
|
||||
cvar.Name = cvarName;
|
||||
}
|
||||
|
||||
return cvar;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace RebootKit.Engine.Services.Console {
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public async UniTask OnInit(CancellationToken cancellationToken) {
|
||||
public async UniTask OnWakeUp(CancellationToken cancellationToken) {
|
||||
_logger.Info("Waking up");
|
||||
|
||||
_ui = UnityEngine.Object.Instantiate(_config.ConsoleUIPrefab);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using RebootKit.Engine.Foundation;
|
||||
using RebootKit.Engine.Services.Console;
|
||||
using UnityEngine.Assertions;
|
||||
|
||||
namespace RebootKit.Engine.Services.Game {
|
||||
public class GameService : IService {
|
||||
@@ -11,7 +12,7 @@ namespace RebootKit.Engine.Services.Game {
|
||||
private GameMode _gameMode;
|
||||
private bool _running;
|
||||
|
||||
public async UniTask OnInit(CancellationToken cancellationToken) {
|
||||
public async UniTask OnWakeUp(CancellationToken cancellationToken) {
|
||||
await UniTask.Yield(cancellationToken);
|
||||
}
|
||||
|
||||
@@ -21,6 +22,8 @@ namespace RebootKit.Engine.Services.Game {
|
||||
}
|
||||
|
||||
public async UniTask Start(GameModeAsset asset, CancellationToken cancellationToken) {
|
||||
Assert.IsNotNull(asset);
|
||||
|
||||
_gameMode = asset.Create();
|
||||
await _gameMode.Start(cancellationToken);
|
||||
|
||||
|
||||
@@ -21,10 +21,6 @@ namespace RebootKit.Engine.Services.Input {
|
||||
public void Dispose() {
|
||||
}
|
||||
|
||||
public async UniTask OnInit(CancellationToken cancellationToken) {
|
||||
await UniTask.Yield(cancellationToken);
|
||||
}
|
||||
|
||||
public void EnableControls() {
|
||||
_config.InputAsset.Enable();
|
||||
}
|
||||
|
||||
@@ -13,10 +13,6 @@ namespace RebootKit.Engine.Services.Simulation {
|
||||
private WorldConfig _config;
|
||||
private List<Actor> _actors = new();
|
||||
|
||||
public async UniTask OnInit(CancellationToken cancellationToken) {
|
||||
await UniTask.Yield(cancellationToken);
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
KillAllActors();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using RebootKit.Engine.Foundation;
|
||||
|
||||
namespace RebootKit.Engine.Services {
|
||||
public class UpdateLoopService : IService {
|
||||
public async UniTask OnInit(CancellationToken cancellationToken) {
|
||||
public async UniTask OnWakeUp(CancellationToken cancellationToken) {
|
||||
await UniTask.Yield(cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user