diff --git a/Editor/Theme.meta b/Editor/Theme.meta deleted file mode 100644 index 782ae99..0000000 --- a/Editor/Theme.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 8e389af561a242dba68aea66075684fd -timeCreated: 1740888613 \ No newline at end of file diff --git a/Runtime/Engine/Assets/UI/Panel Settings.asset b/Runtime/Engine/Assets/UI/Panel Settings.asset index b2d7780..e847d65 100644 --- a/Runtime/Engine/Assets/UI/Panel Settings.asset +++ b/Runtime/Engine/Assets/UI/Panel Settings.asset @@ -12,8 +12,7 @@ MonoBehaviour: m_Script: {fileID: 19101, guid: 0000000000000000e000000000000000, type: 0} m_Name: Panel Settings m_EditorClassIdentifier: - themeUss: {fileID: -4733365628477956816, guid: 5dd55e8f9f3419144b6d6fc3fcc478d0, - type: 3} + themeUss: {fileID: -4733365628477956816, guid: 5dd55e8f9f3419144b6d6fc3fcc478d0, type: 3} m_DisableNoThemeWarning: 0 m_TargetTexture: {fileID: 0} m_RenderMode: 0 diff --git a/Runtime/Engine/Code/EngineConfigAsset.cs.meta b/Runtime/Engine/Code/EngineConfigAsset.cs.meta index e7f2b35..2ff7d41 100644 --- a/Runtime/Engine/Code/EngineConfigAsset.cs.meta +++ b/Runtime/Engine/Code/EngineConfigAsset.cs.meta @@ -1,2 +1,16 @@ fileFormatVersion: 2 -guid: ae5fb4e9fdf89f64b8d2e2d147cb0231 \ No newline at end of file +guid: ae5fb4e9fdf89f64b8d2e2d147cb0231 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: + - ConsoleService: {fileID: 11400000, guid: c5c519d68547d704da8672695e382c08, type: 2} + - InputService: {fileID: 11400000, guid: 64a8b10c553e44f488e183dd04990761, type: 2} + - WorldService: {fileID: 11400000, guid: d6d951b44dc41664fb301e470fac8f80, type: 2} + - GameService: {fileID: 11400000, guid: 75254d95c14787546b733dc1b448fb3d, type: 2} + - StartingGameMode: {instanceID: 0} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Engine/Code/Foundation/DIContext.cs b/Runtime/Engine/Code/Foundation/DIContext.cs index 6ed0522..95d4b4e 100644 --- a/Runtime/Engine/Code/Foundation/DIContext.cs +++ b/Runtime/Engine/Code/Foundation/DIContext.cs @@ -58,9 +58,7 @@ namespace RebootKit.Engine.Foundation { Type type = typeof(T); foreach (FieldInfo field in type.GetFields(k_fieldsBindingFlags)) { - if (!InjectField(field, target)) { - return; - } + InjectField(field, target); } foreach (MethodInfo method in type.GetMethods(k_methodsBindingFlags)) { diff --git a/Runtime/Engine/Code/Foundation/IService.cs b/Runtime/Engine/Code/Foundation/IService.cs index e592a9d..7594ddb 100644 --- a/Runtime/Engine/Code/Foundation/IService.cs +++ b/Runtime/Engine/Code/Foundation/IService.cs @@ -1,15 +1,11 @@ using System; -using System.Threading; -using Cysharp.Threading.Tasks; using UnityEngine; namespace RebootKit.Engine.Foundation { public interface IService : IDisposable { - UniTask OnInit(CancellationToken cancellationToken); } public abstract class ServiceMonoBehaviour : MonoBehaviour, IService { - public abstract UniTask OnInit(CancellationToken cancellationToken); public abstract void Dispose(); } diff --git a/Runtime/Engine/Code/Graphics/MainCameraService.cs b/Runtime/Engine/Code/Graphics/MainCameraService.cs index f0f2e2b..640ccd0 100644 --- a/Runtime/Engine/Code/Graphics/MainCameraService.cs +++ b/Runtime/Engine/Code/Graphics/MainCameraService.cs @@ -1,6 +1,4 @@ -using System.Threading; -using Cysharp.Threading.Tasks; -using RebootKit.Engine.Foundation; +using RebootKit.Engine.Foundation; using UnityEngine; namespace RebootKit.Engine.Graphics { @@ -8,10 +6,6 @@ namespace RebootKit.Engine.Graphics { [field: SerializeField] public Camera Camera { get; private set; } - public override async UniTask OnInit(CancellationToken cancellationToken) { - await UniTask.Yield(cancellationToken); - } - public override void Dispose() { } } diff --git a/Runtime/Engine/Code/RR.cs b/Runtime/Engine/Code/RR.cs index 0db9bb4..7411f82 100644 --- a/Runtime/Engine/Code/RR.cs +++ b/Runtime/Engine/Code/RR.cs @@ -46,8 +46,10 @@ namespace RebootKit.Engine { _diContext = new DIContext(); _diContext.AddInjector(new CVarFieldInjector()); - await CreateCoreServices(cancellationToken); - await RegisterServicesFromMainSceneAsync(cancellationToken); + CreateCoreServices(); + InstallMainScene(); + + await UniTask.Yield(cancellationToken); } public async UniTask Run(CancellationToken cancellationToken) { @@ -55,25 +57,23 @@ namespace RebootKit.Engine { await _gameService.Start(_engineConfigAsset.StartingGameMode, cancellationToken); } - private async UniTask CreateServiceAsync(ServiceAsset asset, CancellationToken cancellationToken = default) where TService : IService { + private TService CreateService(ServiceAsset asset) where TService : IService { TService service = asset.Create(); - _diContext.Bind(service); + _diContext.Bind(service); _diContext.Inject(service); - - await service.OnInit(cancellationToken); return service; } - private async UniTask CreateCoreServices(CancellationToken cancellationToken) { + private void CreateCoreServices() { Logger.Debug("Registering core services"); - _consoleService = await CreateServiceAsync(_engineConfigAsset.ConsoleService, cancellationToken); - _inputService = await CreateServiceAsync(_engineConfigAsset.InputService, cancellationToken); - _worldService = await CreateServiceAsync(_engineConfigAsset.WorldService, cancellationToken); - _gameService = await CreateServiceAsync(_engineConfigAsset.GameService, cancellationToken); + _consoleService = CreateService(_engineConfigAsset.ConsoleService); + _inputService = CreateService(_engineConfigAsset.InputService); + _worldService = CreateService(_engineConfigAsset.WorldService); + _gameService = CreateService(_engineConfigAsset.GameService); } - private async UniTask RegisterServicesFromMainSceneAsync(CancellationToken cancellationToken = default) { + private void InstallMainScene() { GameObject[] gameObjects = SceneManager.GetSceneByBuildIndex(RConsts.MainSceneBuildIndex).GetRootGameObjects(); if (gameObjects.Length == 0) { return; @@ -88,8 +88,6 @@ namespace RebootKit.Engine { di.Install(_diContext); } - - await UniTask.Yield(); } // diff --git a/Runtime/Engine/Code/Services/Console/CVarAsset.cs b/Runtime/Engine/Code/Services/Console/CVarAsset.cs index 18d0acf..723d84c 100644 --- a/Runtime/Engine/Code/Services/Console/CVarAsset.cs +++ b/Runtime/Engine/Code/Services/Console/CVarAsset.cs @@ -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; diff --git a/Runtime/Engine/Code/Services/Console/ConsoleService.cs b/Runtime/Engine/Code/Services/Console/ConsoleService.cs index 544f04e..f0c74e8 100644 --- a/Runtime/Engine/Code/Services/Console/ConsoleService.cs +++ b/Runtime/Engine/Code/Services/Console/ConsoleService.cs @@ -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); diff --git a/Runtime/Engine/Code/Services/Game/GameService.cs b/Runtime/Engine/Code/Services/Game/GameService.cs index 5cea58c..95deee9 100644 --- a/Runtime/Engine/Code/Services/Game/GameService.cs +++ b/Runtime/Engine/Code/Services/Game/GameService.cs @@ -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); diff --git a/Runtime/Engine/Code/Services/Input/InputService.cs b/Runtime/Engine/Code/Services/Input/InputService.cs index eb308b1..fc82d59 100644 --- a/Runtime/Engine/Code/Services/Input/InputService.cs +++ b/Runtime/Engine/Code/Services/Input/InputService.cs @@ -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(); } diff --git a/Runtime/Engine/Code/Services/LoadigScreen.meta b/Runtime/Engine/Code/Services/LoadingScreen.meta similarity index 100% rename from Runtime/Engine/Code/Services/LoadigScreen.meta rename to Runtime/Engine/Code/Services/LoadingScreen.meta diff --git a/Runtime/Engine/Code/Services/LoadigScreen/LoadingScreenService.cs b/Runtime/Engine/Code/Services/LoadingScreen/LoadingScreenService.cs similarity index 100% rename from Runtime/Engine/Code/Services/LoadigScreen/LoadingScreenService.cs rename to Runtime/Engine/Code/Services/LoadingScreen/LoadingScreenService.cs diff --git a/Runtime/Engine/Code/Services/LoadigScreen/LoadingScreenService.cs.meta b/Runtime/Engine/Code/Services/LoadingScreen/LoadingScreenService.cs.meta similarity index 100% rename from Runtime/Engine/Code/Services/LoadigScreen/LoadingScreenService.cs.meta rename to Runtime/Engine/Code/Services/LoadingScreen/LoadingScreenService.cs.meta diff --git a/Runtime/Engine/Code/Services/Simulation/WorldService.cs b/Runtime/Engine/Code/Services/Simulation/WorldService.cs index 92a42ec..fa6c79a 100644 --- a/Runtime/Engine/Code/Services/Simulation/WorldService.cs +++ b/Runtime/Engine/Code/Services/Simulation/WorldService.cs @@ -13,10 +13,6 @@ namespace RebootKit.Engine.Services.Simulation { private WorldConfig _config; private List _actors = new(); - public async UniTask OnInit(CancellationToken cancellationToken) { - await UniTask.Yield(cancellationToken); - } - public void Dispose() { KillAllActors(); } diff --git a/Runtime/Engine/Code/Services/UpdateLoopService.cs b/Runtime/Engine/Code/Services/UpdateLoopService.cs index c94a069..b0f7c59 100644 --- a/Runtime/Engine/Code/Services/UpdateLoopService.cs +++ b/Runtime/Engine/Code/Services/UpdateLoopService.cs @@ -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); } diff --git a/Tests/Runtime/Engine/DIContextTests.cs b/Tests/Runtime/Engine/DIContextTests.cs index 3fddf47..8ef174b 100644 --- a/Tests/Runtime/Engine/DIContextTests.cs +++ b/Tests/Runtime/Engine/DIContextTests.cs @@ -1,6 +1,4 @@ using NUnit.Framework; -using NUnit.Framework.Interfaces; -using NUnit.Framework.Internal; using RebootKit.Engine.Foundation; namespace Tests.Runtime.Engine { diff --git a/package.json b/package.json index c825f64..b92b339 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,6 @@ "com.unity.render-pipelines.universal": "17.0.4", "com.unity.cinemachine": "2.10.3", "com.unity.collections": "2.5.3", - "com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask" + "com.cysharp.unitask": "2.5.10" } } \ No newline at end of file