This commit is contained in:
2025-05-26 17:04:33 +02:00
parent f0536f4129
commit 6bda371baa
303 changed files with 1361 additions and 1372 deletions

0
Runtime/Engine.meta Normal file → Executable file
View File

0
Runtime/Engine/Code.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Components.meta Normal file → Executable file
View File

101
Runtime/Engine/Code/Components/CopyTransform.cs Normal file → Executable file
View File

@@ -1,39 +1,64 @@
using System;
using UnityEngine;
namespace RebootKit.Engine.Components {
[Flags]
public enum TransformComponents {
None = 0,
Position = 1 << 0,
Rotation = 1 << 1,
Scale = 1 << 2,
All = Position | Rotation | Scale
}
[DefaultExecutionOrder(100)]
public class CopyTransform : MonoBehaviour {
[SerializeField] TransformComponents m_Components = TransformComponents.All;
[SerializeField] Transform m_Source;
Transform m_Transform;
void Awake() {
m_Transform = transform;
}
void LateUpdate() {
if (m_Components.HasFlag(TransformComponents.Position)) {
m_Transform.position = m_Source.position;
}
if (m_Components.HasFlag(TransformComponents.Rotation)) {
m_Transform.rotation = m_Source.rotation;
}
if (m_Components.HasFlag(TransformComponents.Scale)) {
m_Transform.localScale = m_Source.localScale;
}
}
}
using System;
using UnityEngine;
namespace RebootKit.Engine.Components {
[Flags]
public enum TransformComponents {
None = 0,
Position = 1 << 0,
Rotation = 1 << 1,
Scale = 1 << 2,
All = Position | Rotation | Scale
}
[DefaultExecutionOrder(100)]
public class CopyTransform : MonoBehaviour {
enum UpdateLoop {
Update,
LateUpdate,
FixedUpdate
}
[SerializeField] TransformComponents m_Components = TransformComponents.All;
[SerializeField] Transform m_Source;
[SerializeField] UpdateLoop m_UpdateLoop = UpdateLoop.LateUpdate;
Transform m_Transform;
void Awake() {
m_Transform = transform;
}
void FixedUpdate() {
if (m_UpdateLoop == UpdateLoop.FixedUpdate) {
CopyTransformComponents();
}
}
void Update() {
if (m_UpdateLoop == UpdateLoop.Update) {
CopyTransformComponents();
}
}
void LateUpdate() {
if (m_UpdateLoop == UpdateLoop.LateUpdate) {
CopyTransformComponents();
}
}
void CopyTransformComponents() {
if (m_Components.HasFlag(TransformComponents.Position)) {
m_Transform.position = m_Source.position;
}
if (m_Components.HasFlag(TransformComponents.Rotation)) {
m_Transform.rotation = m_Source.rotation;
}
if (m_Components.HasFlag(TransformComponents.Scale)) {
m_Transform.localScale = m_Source.localScale;
}
}
}
}

0
Runtime/Engine/Code/Components/CopyTransform.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/EngineConfigAsset.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/EngineConfigAsset.cs.meta Normal file → Executable file
View File

2
Runtime/Engine/Code/EngineCoreServicesAsset.cs Normal file → Executable file
View File

@@ -1,6 +1,5 @@
using RebootKit.Engine.Foundation;
using RebootKit.Engine.Services.Console;
using RebootKit.Engine.Services.GameMode;
using RebootKit.Engine.Services.Input;
using RebootKit.Engine.Services.Simulation;
using UnityEngine;
@@ -11,6 +10,5 @@ namespace RebootKit.Engine {
public ServiceAsset<ConsoleService> consoleService;
public ServiceAsset<InputService> inputService;
public ServiceAsset<WorldService> worldService;
public ServiceAsset<GameModesService> gameService;
}
}

0
Runtime/Engine/Code/EngineCoreServicesAsset.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/ColorEx.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/ColorEx.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/GameObjectEx.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/GameObjectEx.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/LayerMaskEx.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/LayerMaskEx.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/ListEx.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/ListEx.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/TransformEx.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/TransformEx.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/Vector3Ex.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Extensions/Vector3Ex.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/ConfigVar.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/ConfigVar.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/ConfigVarsContainer.cs Normal file → Executable file
View File

View File

16
Runtime/Engine/Code/Foundation/ConstantsAsset.cs Normal file → Executable file
View File

@@ -1,9 +1,9 @@
using UnityEngine;
namespace RebootKit.Engine.Foundation {
public class ConstantsAsset<T> : RAsset {
[SerializeField] T m_Value;
public T Value => m_Value;
}
using UnityEngine;
namespace RebootKit.Engine.Foundation {
public class ConstantsAsset<T> : RAsset {
[SerializeField] T m_Value;
public T Value => m_Value;
}
}

0
Runtime/Engine/Code/Foundation/ConstantsAsset.cs.meta Normal file → Executable file
View File

12
Runtime/Engine/Code/Foundation/ConstsColorAsset.cs Normal file → Executable file
View File

@@ -1,7 +1,7 @@
using UnityEngine;
namespace RebootKit.Engine.Foundation {
[CreateAssetMenu(menuName = RConsts.k_CreateAssetMenu + "Constants/Consts Color")]
public class ConstsColorAsset : ConstantsAsset<Color> {
}
using UnityEngine;
namespace RebootKit.Engine.Foundation {
[CreateAssetMenu(menuName = RConsts.k_CreateAssetMenu + "Constants/Consts Color")]
public class ConstsColorAsset : ConstantsAsset<Color> {
}
}

View File

12
Runtime/Engine/Code/Foundation/ConstsFloatAsset.cs Normal file → Executable file
View File

@@ -1,7 +1,7 @@
using UnityEngine;
namespace RebootKit.Engine.Foundation {
[CreateAssetMenu(menuName = RConsts.k_CreateAssetMenu + "Constants/Consts Float")]
public class ConstsFloatAsset : ConstantsAsset<float> {
}
using UnityEngine;
namespace RebootKit.Engine.Foundation {
[CreateAssetMenu(menuName = RConsts.k_CreateAssetMenu + "Constants/Consts Float")]
public class ConstsFloatAsset : ConstantsAsset<float> {
}
}

View File

12
Runtime/Engine/Code/Foundation/ConstsIntAsset.cs Normal file → Executable file
View File

@@ -1,7 +1,7 @@
using UnityEngine;
namespace RebootKit.Engine.Foundation {
[CreateAssetMenu(menuName = RConsts.k_CreateAssetMenu + "Constants/Consts Int")]
public class ConstsIntAsset : ConfigAsset<int> {
}
using UnityEngine;
namespace RebootKit.Engine.Foundation {
[CreateAssetMenu(menuName = RConsts.k_CreateAssetMenu + "Constants/Consts Int")]
public class ConstsIntAsset : ConfigAsset<int> {
}
}

0
Runtime/Engine/Code/Foundation/ConstsIntAsset.cs.meta Normal file → Executable file
View File

72
Runtime/Engine/Code/Foundation/ConstsProperty.cs Normal file → Executable file
View File

@@ -1,37 +1,37 @@
using System;
using UnityEngine;
namespace RebootKit.Engine.Foundation {
[Serializable]
public struct ConstsProperty<T> {
[SerializeField] T m_InlineValue;
[SerializeField] ConstantsAsset<T> m_Asset;
[SerializeField] bool m_UseInlineValue;
public ConstsProperty(T value) {
m_InlineValue = value;
m_Asset = null;
m_UseInlineValue = true;
}
public ConstsProperty(ConstantsAsset<T> asset) {
m_InlineValue = default;
m_Asset = asset;
m_UseInlineValue = false;
}
public T Value {
get {
if (m_UseInlineValue) {
return m_InlineValue;
}
if (m_Asset != null) {
return m_Asset.Value;
}
return default;
}
}
}
using System;
using UnityEngine;
namespace RebootKit.Engine.Foundation {
[Serializable]
public struct ConstsProperty<T> {
[SerializeField] T m_InlineValue;
[SerializeField] ConstantsAsset<T> m_Asset;
[SerializeField] bool m_UseInlineValue;
public ConstsProperty(T value) {
m_InlineValue = value;
m_Asset = null;
m_UseInlineValue = true;
}
public ConstsProperty(ConstantsAsset<T> asset) {
m_InlineValue = default;
m_Asset = asset;
m_UseInlineValue = false;
}
public T Value {
get {
if (m_UseInlineValue) {
return m_InlineValue;
}
if (m_Asset != null) {
return m_Asset.Value;
}
return default;
}
}
}
}

0
Runtime/Engine/Code/Foundation/ConstsProperty.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/ControllerAsset.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/ControllerAsset.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/DIContext.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/DIContext.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/DisposableListener.cs Normal file → Executable file
View File

View File

0
Runtime/Engine/Code/Foundation/Either.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/Either.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/FloatRange.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/FloatRange.cs.meta Normal file → Executable file
View File

12
Runtime/Engine/Code/Foundation/IController.cs Normal file → Executable file
View File

@@ -96,21 +96,21 @@ namespace RebootKit.Engine.Foundation {
}
public static class ControllersManagerUtils {
public static void Add(this ControllersManager<IController> manager, ControllerAsset asset, DIContext context) {
IController controller = asset.Create(context);
public static void Add(this ControllersManager<IController> manager, ControllerAsset asset) {
IController controller = asset.Create();
manager.Add(controller);
}
public static void Add(this ControllersManager<IController> manager, List<ControllerAsset> controllerAsset, DIContext context) {
public static void Add(this ControllersManager<IController> manager, List<ControllerAsset> controllerAsset) {
foreach (ControllerAsset asset in controllerAsset) {
IController controller = asset.Create(context);
IController controller = asset.Create();
manager.Add(controller);
}
}
public static void Add(this ControllersManager<IController> manager, ControllerAsset[] controllerAsset, DIContext context) {
public static void Add(this ControllersManager<IController> manager, ControllerAsset[] controllerAsset) {
foreach (ControllerAsset asset in controllerAsset) {
IController controller = asset.Create(context);
IController controller = asset.Create();
manager.Add(controller);
}
}

0
Runtime/Engine/Code/Foundation/IController.cs.meta Normal file → Executable file
View File

8
Runtime/Engine/Code/Foundation/IFactory.cs Normal file → Executable file
View File

@@ -1,11 +1,15 @@
using UnityEngine;
namespace RebootKit.Engine.Foundation {
public interface IFactory<out TProd> {
TProd Create();
}
public interface IFactoryDI<out TProd> {
TProd Create(DIContext context);
}
public abstract class FactoryAsset<TProd> : ScriptableObject, IFactoryDI<TProd> where TProd : class {
public abstract TProd Create(DIContext context);
public abstract class FactoryAsset<TProd> : ScriptableObject, IFactory<TProd> where TProd : class {
public abstract TProd Create();
}
}

0
Runtime/Engine/Code/Foundation/IFactory.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/IPredicate.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/IPredicate.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/IService.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/IService.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/Logger.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/Logger.cs.meta Normal file → Executable file
View File

22
Runtime/Engine/Code/Foundation/SceneContext.cs Normal file → Executable file
View File

@@ -1,5 +1,4 @@
using RebootKit.Engine.Main;
using UnityEngine;
using UnityEngine;
using UnityEngine.Assertions;
namespace RebootKit.Engine.Foundation {
@@ -12,24 +11,23 @@ namespace RebootKit.Engine.Foundation {
}
[DefaultExecutionOrder(-1000)]
public class SceneContext : MonoBehaviour, IDependencyInstaller {
public class SceneContext : MonoBehaviour {
static readonly Logger s_logger = new(nameof(SceneContext));
[SerializeField] SceneDependencyInstaller[] m_Installers;
DIContext m_DIContext;
void Awake() {
DIContext context = RR.DIContext;
foreach (GameObject root in gameObject.scene.GetRootGameObjects()) {
// s_logger.Info("Injecting root game object: " + root.name);
context.InjectGameObject(root);
}
}
m_DIContext = new DIContext();
public void Install(DIContext context) {
s_logger.Info("Installing scene dependency installers");
foreach (SceneDependencyInstaller installer in m_Installers) {
installer.Install(context);
installer.Install(m_DIContext);
}
foreach (GameObject root in gameObject.scene.GetRootGameObjects()) {
m_DIContext.InjectGameObject(root);
}
}
}

0
Runtime/Engine/Code/Foundation/SceneContext.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/SerializableGuid.cs Normal file → Executable file
View File

View File

0
Runtime/Engine/Code/Foundation/StateMachine.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Foundation/StateMachine.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Graphics.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Graphics/CRT.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Graphics/CRT/M_CRT_Default.mat Normal file → Executable file
View File

View File

0
Runtime/Engine/Code/Graphics/CRT/SG_CRT.shadergraph Normal file → Executable file
View File

View File

0
Runtime/Engine/Code/Graphics/MainCameraService.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Graphics/MainCameraService.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Graphics/Pixelize.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Graphics/Pixelize/Pixelize.shader Normal file → Executable file
View File

View File

View File

View File

0
Runtime/Engine/Code/Graphics/Pixelize/PixelizePass.cs Normal file → Executable file
View File

View File

0
Runtime/Engine/Code/Main.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Main/EntryPoint.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/Main/EntryPoint.cs.meta Normal file → Executable file
View File

19
Runtime/Engine/Code/Main/RR.cs Normal file → Executable file
View File

@@ -13,6 +13,10 @@ using UnityEngine.AddressableAssets;
using Assert = UnityEngine.Assertions.Assert;
using Logger = RebootKit.Engine.Foundation.Logger;
// RR
// Game
// GameMode
namespace RebootKit.Engine.Main {
public interface IGame : IDisposable {
UniTask InitAsync(CancellationToken cancellationToken);
@@ -33,7 +37,6 @@ namespace RebootKit.Engine.Main {
static DisposableBag s_disposableBag;
static DisposableBag s_servicesBag;
static DIContext s_diContext;
static ConsoleService s_consoleService;
static GameModesService s_gameModesService;
@@ -44,7 +47,6 @@ namespace RebootKit.Engine.Main {
public static InputService Input => s_inputService;
public static WorldService World => s_worldService;
public static GameModesService GameModes => s_gameModesService;
public static DIContext DIContext => s_diContext;
static IGame s_game;
@@ -57,13 +59,12 @@ namespace RebootKit.Engine.Main {
s_logger.Info("Initializing");
s_servicesBag = new DisposableBag();
s_disposableBag = new DisposableBag();
s_diContext = new DIContext();
s_logger.Debug("Registering core services");
s_consoleService = CreateService(s_engineConfigAsset.coreServices.consoleService);
s_inputService = CreateService(s_engineConfigAsset.coreServices.inputService);
s_worldService = CreateService(s_engineConfigAsset.coreServices.worldService);
s_gameModesService = CreateService(s_engineConfigAsset.coreServices.gameService);
s_gameModesService = CreateService<GameModesService>();
await InitializeAssetsAsync(cancellationToken);
@@ -134,15 +135,17 @@ namespace RebootKit.Engine.Main {
// Service API
public static TService CreateService<TService>(ServiceAsset<TService> asset) where TService : class, IService {
TService service = asset.Create(s_diContext);
s_diContext.Bind(service);
if (asset is null) {
throw new ArgumentNullException($"Null asset of type {typeof(TService)}");
}
TService service = asset.Create();
s_servicesBag.Add(service);
return service;
}
public static TService CreateService<TService>() where TService : class, IService {
TService service = s_diContext.Create<TService>();
s_diContext.Bind(service);
TService service = Activator.CreateInstance<TService>();
s_servicesBag.Add(service);
return service;
}

0
Runtime/Engine/Code/Main/RR.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/MainSceneInstaller.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/MainSceneInstaller.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Misc.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/RAsset.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/RAsset.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/RConsts.cs Normal file → Executable file
View File

0
Runtime/Engine/Code/RConsts.cs.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Services.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Services/Console.meta Normal file → Executable file
View File

0
Runtime/Engine/Code/Services/Console/ConsoleService.cs Normal file → Executable file
View File

View File

View File

@@ -7,9 +7,8 @@ namespace RebootKit.Engine.Services.Console {
public class ConsoleServiceAsset : ServiceAsset<ConsoleService> {
static readonly Logger s_logger = new(nameof(ConsoleServiceAsset));
public override ConsoleService Create(DIContext context) {
public override ConsoleService Create() {
ConsoleService service = new();
context.Inject(service);
return service;
}
}

View File

0
Runtime/Engine/Code/Services/ConsoleUI.meta Normal file → Executable file
View File

View File

View File

0
Runtime/Engine/Code/Services/ConsoleUI/ConsoleVC.cs Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More