diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 7db594c..4d6a710 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -10,19 +10,26 @@ jobs: strategy: matrix: os: [ ubuntu-latest, windows-latest ] + runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@v3 + with: + submodules: recursive + token: ${{ secrets.PAT_TOKEN }} + - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x + + - name: Restore tools + run: dotnet tool restore + - name: Restore dependencies run: dotnet restore - - name: Generate ECS files by Jenny - run: make gen - - name: Build run: dotnet build --no-restore env: @@ -32,4 +39,4 @@ jobs: run: dotnet test --no-build --verbosity normal - name: Run - run: dotnet run --project ./src/Apps/GameDesktop/GameDesktop.csproj -c Release -p:DefineConstants=IS_CI \ No newline at end of file + run: dotnet run --project ./src/Apps/GameDesktop/GameDesktop.csproj --framework net8.0 -c Release -p:DefineConstants=IS_CI \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9937d13 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "src/Libs/External/MonoGame.ImGuiNet"] + path = src/Libs/External/MonoGame.ImGuiNet + url = git@github.com:Mezo-hx/MonoGame.ImGuiNet.git + ignore = dirty diff --git a/.idea/.idea.MonoGame/.idea/.name b/.idea/.idea.MonoGame/.idea/.name deleted file mode 100644 index 8d9aa34..0000000 --- a/.idea/.idea.MonoGame/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -MonoGame \ No newline at end of file diff --git a/MonoGame.sln b/MonoGame.sln index d6d5a9d..1804589 100644 --- a/MonoGame.sln +++ b/MonoGame.sln @@ -21,8 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Components", "src\Libs\Comp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Systems", "src\Libs\Systems\Systems.csproj", "{CE9F6FF0-F117-4AFA-8758-EDA88BF4A642}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Entitas.Extended", "src\Libs\External\Entitas.Extended\Entitas.Extended.csproj", "{6EEBFA40-2814-43D0-A9DC-4A98F4837A1B}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "src\Libs\External", "{FE9CE932-6F98-4455-A80F-2A0CDB6DB46E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Features", "src\Libs\Features\Features.csproj", "{F4C957C8-3B10-4614-99F4-E2F2398F38ED}" @@ -33,6 +31,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Systems.Debugging", "src\Li EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Features.Debugging", "src\Libs\Features.Debugging\Features.Debugging.csproj", "{8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scellecs.Morpeh.Extended", "src\Libs\External\Scellecs.Morpeh.Extended\Scellecs.Morpeh.Extended.csproj", "{5D45D0B2-6B53-4487-B9C2-3F685B2EC1E4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests.Entities", "src\UnitTests\UnitTests.Entities\UnitTests.Entities.csproj", "{57F0A75A-5AD6-4187-9DC6-3CBA44333061}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monogame.ImGuiNet", "src\Libs\External\MonoGame.ImGuiNet\Monogame.ImGuiNet.csproj", "{56FF7C50-4B5F-4480-A5BE-BA95925152A1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -62,10 +66,6 @@ Global {CE9F6FF0-F117-4AFA-8758-EDA88BF4A642}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE9F6FF0-F117-4AFA-8758-EDA88BF4A642}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE9F6FF0-F117-4AFA-8758-EDA88BF4A642}.Release|Any CPU.Build.0 = Release|Any CPU - {6EEBFA40-2814-43D0-A9DC-4A98F4837A1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6EEBFA40-2814-43D0-A9DC-4A98F4837A1B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6EEBFA40-2814-43D0-A9DC-4A98F4837A1B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6EEBFA40-2814-43D0-A9DC-4A98F4837A1B}.Release|Any CPU.Build.0 = Release|Any CPU {F4C957C8-3B10-4614-99F4-E2F2398F38ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F4C957C8-3B10-4614-99F4-E2F2398F38ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {F4C957C8-3B10-4614-99F4-E2F2398F38ED}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -82,6 +82,18 @@ Global {8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28}.Debug|Any CPU.Build.0 = Debug|Any CPU {8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28}.Release|Any CPU.ActiveCfg = Release|Any CPU {8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28}.Release|Any CPU.Build.0 = Release|Any CPU + {5D45D0B2-6B53-4487-B9C2-3F685B2EC1E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5D45D0B2-6B53-4487-B9C2-3F685B2EC1E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D45D0B2-6B53-4487-B9C2-3F685B2EC1E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5D45D0B2-6B53-4487-B9C2-3F685B2EC1E4}.Release|Any CPU.Build.0 = Release|Any CPU + {57F0A75A-5AD6-4187-9DC6-3CBA44333061}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {57F0A75A-5AD6-4187-9DC6-3CBA44333061}.Debug|Any CPU.Build.0 = Debug|Any CPU + {57F0A75A-5AD6-4187-9DC6-3CBA44333061}.Release|Any CPU.ActiveCfg = Release|Any CPU + {57F0A75A-5AD6-4187-9DC6-3CBA44333061}.Release|Any CPU.Build.0 = Release|Any CPU + {56FF7C50-4B5F-4480-A5BE-BA95925152A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {56FF7C50-4B5F-4480-A5BE-BA95925152A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {56FF7C50-4B5F-4480-A5BE-BA95925152A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {56FF7C50-4B5F-4480-A5BE-BA95925152A1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {5E3B6238-A92E-4703-8527-1C2410D7906A} = {F5258F7E-B0BA-466D-8CF8-4DAB84722BE3} @@ -93,10 +105,12 @@ Global {3116D134-6362-41E8-8C18-EA0196F0C53F} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} {CE9F6FF0-F117-4AFA-8758-EDA88BF4A642} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} {FE9CE932-6F98-4455-A80F-2A0CDB6DB46E} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} - {6EEBFA40-2814-43D0-A9DC-4A98F4837A1B} = {FE9CE932-6F98-4455-A80F-2A0CDB6DB46E} {F4C957C8-3B10-4614-99F4-E2F2398F38ED} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} {8232C7AA-E217-465B-95A3-C42D1000FA3B} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} {7AD01EBF-370B-4F35-9AEC-172A889D643F} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} {8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} + {5D45D0B2-6B53-4487-B9C2-3F685B2EC1E4} = {FE9CE932-6F98-4455-A80F-2A0CDB6DB46E} + {57F0A75A-5AD6-4187-9DC6-3CBA44333061} = {FC0D63F3-9B01-46BD-9435-A7E26C905825} + {56FF7C50-4B5F-4480-A5BE-BA95925152A1} = {FE9CE932-6F98-4455-A80F-2A0CDB6DB46E} EndGlobalSection EndGlobal diff --git a/README.md b/README.md index f7a54f7..b992e5f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -## Getting Started +[![.NET](https://github.com/cherrynik/monogame/actions/workflows/dotnet.yml/badge.svg)](https://github.com/cherrynik/monogame/actions/workflows/dotnet.yml) + +## Getting Started - [Wiki](./docs/TableOfContent.md) - [MonoGame repository](https://github.com/MonoGame/MonoGame) diff --git a/global.json b/global.json new file mode 100644 index 0000000..dad2db5 --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "8.0.0", + "rollForward": "latestMajor", + "allowPrerelease": true + } +} \ No newline at end of file diff --git a/src/Apps/GameDesktop/.config/dotnet-tools.json b/src/Apps/GameDesktop/.config/dotnet-tools.json deleted file mode 100644 index efabe22..0000000 --- a/src/Apps/GameDesktop/.config/dotnet-tools.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "dotnet-mgcb": { - "version": "3.8.1.303", - "commands": [ - "mgcb" - ] - }, - "dotnet-mgcb-editor": { - "version": "3.8.1.303", - "commands": [ - "mgcb-editor" - ] - }, - "dotnet-mgcb-editor-linux": { - "version": "3.8.1.303", - "commands": [ - "mgcb-editor-linux" - ] - }, - "dotnet-mgcb-editor-windows": { - "version": "3.8.1.303", - "commands": [ - "mgcb-editor-windows" - ] - }, - "dotnet-mgcb-editor-mac": { - "version": "3.8.1.303", - "commands": [ - "mgcb-editor-mac" - ] - } - } -} \ No newline at end of file diff --git a/src/Apps/GameDesktop/CompositionRoots/Components/ComponentsCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Components/ComponentsCompositionRoot.cs index 445a2e4..c1fccc0 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Components/ComponentsCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Components/ComponentsCompositionRoot.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; -using Components; using Components.Data; +using Components.Render.Animation; +using Components.Render.Static; +using Components.Tags; using GameDesktop.Resources.Internal; using LightInject; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using MonoGame.Aseprite.Sprites; using Services.Math; @@ -18,11 +20,50 @@ internal class ComponentsCompositionRoot : ICompositionRoot public void Compose(IServiceRegistry serviceRegistry) { - RegisterSpriteComponent(serviceRegistry); - RegisterMovementAnimationComponent(serviceRegistry); - RegisterCameraComponent(serviceRegistry); + RegisterTagComponents(serviceRegistry); + RegisterDataComponents(serviceRegistry); + RegisterStaticRenderComponents(serviceRegistry); + RegisterAnimatedRenderComponents(serviceRegistry); + + // Removed camera as it's a system, existing globally and singly + } + + private static void RegisterDataComponents(IServiceRegistry serviceRegistry) + { RegisterTransformComponent(serviceRegistry); RegisterRectangleCollisionComponent(serviceRegistry); + RegisterInventoryComponent(serviceRegistry); + } + + private static void RegisterTagComponents(IServiceRegistry serviceRegistry) + { + RegisterCameraComponent(serviceRegistry); + RegisterPlayerMovementComponent(serviceRegistry); + } + + + private static void RegisterStaticRenderComponents(IServiceRegistry serviceRegistry) + { + RegisterSpriteComponent(serviceRegistry); + } + + private static void RegisterAnimatedRenderComponents(IServiceRegistry serviceRegistry) + { + RegisterMovementAnimationsComponent(serviceRegistry); + RegisterCharacterAnimatorComponent(serviceRegistry); + } + + private static void RegisterCameraComponent(IServiceRegistry serviceRegistry) + { + serviceRegistry.RegisterSingleton(_ => new Viewport(0, 0, 800, 480), "CameraComponent"); + serviceRegistry.RegisterSingleton(factory => + new CameraComponent(factory.GetInstance("CameraComponent"))); + } + + private static void RegisterPlayerMovementComponent(IServiceRegistry serviceRegistry) + { + serviceRegistry.RegisterSingleton(_ => new InputMovableComponent()); + serviceRegistry.RegisterSingleton(_ => new MovableComponent()); } private static void RegisterSpriteComponent(IServiceRegistry serviceRegistry) @@ -33,42 +74,57 @@ private static void RegisterSpriteComponent(IServiceRegistry serviceRegistry) var getAnimations = factory.GetInstance>>("Character"); Dictionary idle = getAnimations(PlayerSpriteSheetPath, "Idle"); - var defaultSprite = idle[Direction.Down]; + AnimatedSprite defaultSprite = idle[Direction.Down]; return new SpriteComponent(defaultSprite); }); } - private static void RegisterMovementAnimationComponent(IServiceRegistry serviceRegistry) + private static void RegisterMovementAnimationsComponent(IServiceRegistry serviceRegistry) { serviceRegistry.RegisterTransient(factory => { var getAnimations = factory.GetInstance>>("Character"); - return new MovementAnimationComponent(getAnimations(PlayerSpriteSheetPath, "Idle"), + return new MovementAnimationsComponent(getAnimations(PlayerSpriteSheetPath, "Idle"), getAnimations(PlayerSpriteSheetPath, "Walking")); - }); + }, "PlayerEntity"); } - private static void RegisterCameraComponent(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterSingleton(_ => new CameraComponent { Size = new Rectangle(0, 0, 640, 480) }); + + // private static void RegisterCameraComponent(IServiceRegistry serviceRegistry) => + // serviceRegistry.RegisterSingleton(_ => new CameraComponent { Size = new Rectangle(0, 0, 640, 480) }); private static void RegisterTransformComponent(IServiceRegistry serviceRegistry) { serviceRegistry.RegisterSingleton(_ => - { - return new TransformComponent { Position = new(316, 116) }; - }, "Player"); + new TransformComponent { Position = new(316, 116) }, "PlayerEntity"); serviceRegistry.RegisterSingleton(_ => - { - return new TransformComponent { Position = new(300, 100) }; - }, "StaticEntity"); + new TransformComponent { Position = new(300, 100) }, "DummyEntity"); } private static void RegisterRectangleCollisionComponent(IServiceRegistry serviceRegistry) { - serviceRegistry.RegisterTransient(_ => new RectangleCollisionComponent { Size = new Rectangle(0, 0, 8, 8) }); + serviceRegistry.RegisterTransient(_ => + new RectangleCollisionComponent { Size = new(0, 0, 8, 8) }); + } + + private static void RegisterInventoryComponent(IServiceRegistry serviceRegistry) + { + serviceRegistry.RegisterTransient(_ => + new InventoryComponent([])); + } + + private static void RegisterCharacterAnimatorComponent(IServiceRegistry serviceRegistry) + { + serviceRegistry.RegisterSingleton(factory => + { + var movementAnimations = factory.GetInstance("PlayerEntity"); + const Direction facing = Direction.Right; + + return new CharacterAnimatorComponent(facing, movementAnimations.IdleAnimations[facing]); + }, "PlayerEntity"); } } diff --git a/src/Apps/GameDesktop/CompositionRoots/DebugFeatures/DebugRootFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/DebugFeatures/DebugRootFeatureCompositionRoot.cs index a74508c..2b52f92 100644 --- a/src/Apps/GameDesktop/CompositionRoots/DebugFeatures/DebugRootFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/DebugFeatures/DebugRootFeatureCompositionRoot.cs @@ -1,36 +1,25 @@ -using System; -using Entitas; -using Features.Debugging; -using GameDesktop.Resources.Internal; +// using Features.Debugging; using LightInject; -using Serilog; -using Systems.Debugging; +using MonoGame.ImGuiNet; namespace GameDesktop.CompositionRoots.DebugFeatures; internal class DebugRootFeatureCompositionRoot : ICompositionRoot { - private static readonly IMatcher[] Matchers = { GameMatcher.RectangleCollision, GameMatcher.Transform }; - public void Compose(IServiceRegistry serviceRegistry) { RegisterSystems(serviceRegistry); - RegisterFeature(serviceRegistry); + // RegisterFeature(serviceRegistry); } private static void RegisterSystems(IServiceRegistry serviceRegistry) { - serviceRegistry.RegisterSingleton(factory => - { - var getGroup = - factory.GetInstance[], IGroup>>(Matcher.AllOf); - IGroup group = getGroup(Matchers); - - return new DrawRectangleCollisionComponentsSystem(factory.GetInstance(), group, - factory.GetInstance()); - }); + // serviceRegistry.RegisterSingleton(factory => + // { + // return new DrawRectangleCollisionComponentsSystem(factory.GetInstance()); + // }); } - private static void RegisterFeature(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterSingleton(); + // private static void RegisterFeature(IServiceRegistry serviceRegistry) => + // serviceRegistry.RegisterSingleton(); } diff --git a/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs index cdf1c6e..e709e8c 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs @@ -1,5 +1,9 @@ using Components.Data; +using Components.Render.Animation; +using Components.Tags; using Entities; +using Entities.Factories; +using Entities.Factories.Characters; using LightInject; namespace GameDesktop.CompositionRoots.Entities; @@ -12,8 +16,13 @@ public void Compose(IServiceRegistry serviceRegistry) } private static void RegisterEntity(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterTransient(factory => new PlayerEntity(factory.GetInstance(), - factory.GetInstance(), - factory.GetInstance("Player"), factory.GetInstance(), - factory.GetInstance())); + serviceRegistry.RegisterTransient(factory => new PlayerEntityFactory( + factory.GetInstance(), + factory.GetInstance(), + factory.GetInstance("PlayerEntity"), + factory.GetInstance(), + factory.GetInstance(), + factory.GetInstance(), + factory.GetInstance("PlayerEntity"), + factory.GetInstance())); } diff --git a/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs index e9d0d99..426b2a5 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs @@ -1,5 +1,8 @@ using Components.Data; +using Components.Render.Static; using Entities; +using Entities.Factories; +using Entities.Factories.Characters; using LightInject; namespace GameDesktop.CompositionRoots.Entities; @@ -13,8 +16,8 @@ public void Compose(IServiceRegistry serviceRegistry) private static void RegisterEntity(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterTransient(factory => new StaticEntity(factory.GetInstance(), - factory.GetInstance("StaticEntity"), + serviceRegistry.RegisterTransient(factory => new DummyEntityFactory( + factory.GetInstance("DummyEntity"), factory.GetInstance(), factory.GetInstance())); } diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/CameraFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/CameraFeatureCompositionRoot.cs index 28c2588..81a3e73 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/CameraFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/CameraFeatureCompositionRoot.cs @@ -1,36 +1,36 @@ -using System; -using Entitas; -using Entitas.Extended; -using Features; -using GameDesktop.Resources.Internal; -using LightInject; -using Systems; - -namespace GameDesktop.CompositionRoots.Features; - -internal class CameraFeatureCompositionRoot : ICompositionRoot -{ - private static readonly IMatcher[] Matchers = { GameMatcher.Transform, GameMatcher.Drawable }; - - public void Compose(IServiceRegistry serviceRegistry) - { - RegisterSystem(serviceRegistry); - RegisterFeature(serviceRegistry); - } - - private static void RegisterSystem(IServiceRegistry serviceRegistry) - { - serviceRegistry.RegisterSingleton(factory => - { - var getGroup = - factory.GetInstance[], IGroup>>(Matcher.AllOf); - IGroup group = getGroup(Matchers); - - // return new CameraFollowingSystem(factory.GetInstance(), group); - return new DefaultDrawSystem(group); - }); - } - - private static void RegisterFeature(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterSingleton(); -} +// using System; +// using Entitas; +// using Entitas.Extended; +// using Features; +// using GameDesktop.Resources.Internal; +// using LightInject; +// using Systems; +// +// namespace GameDesktop.CompositionRoots.Features; +// +// internal class CameraFeatureCompositionRoot : ICompositionRoot +// { +// private static readonly IMatcher[] Matchers = { GameMatcher.Transform, GameMatcher.Drawable }; +// +// public void Compose(IServiceRegistry serviceRegistry) +// { +// RegisterSystem(serviceRegistry); +// RegisterFeature(serviceRegistry); +// } +// +// private static void RegisterSystem(IServiceRegistry serviceRegistry) +// { +// serviceRegistry.RegisterSingleton(factory => +// { +// var getGroup = +// factory.GetInstance[], IGroup>>(Matcher.AllOf); +// IGroup group = getGroup(Matchers); +// +// // return new CameraFollowingSystem(factory.GetInstance(), group); +// return new DefaultDrawSystem(group); +// }); +// } +// +// private static void RegisterFeature(IServiceRegistry serviceRegistry) => +// serviceRegistry.RegisterSingleton(); +// } diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/InputFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/InputFeatureCompositionRoot.cs index d1e6812..de11420 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/InputFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/InputFeatureCompositionRoot.cs @@ -1,46 +1,46 @@ -using System; -using Entitas; -using Features; -using GameDesktop.Resources.Internal; -using LightInject; -using Serilog; -using Services.Input; -using Systems; - -namespace GameDesktop.CompositionRoots.Features; - -internal class InputFeatureCompositionRoot : ICompositionRoot -{ - private static readonly IMatcher[] Matchers = - { - GameMatcher.Transform, GameMatcher.Movable, GameMatcher.Player - }; - - public void Compose(IServiceRegistry serviceRegistry) - { - RegisterImpl(serviceRegistry); - RegisterSystem(serviceRegistry); - RegisterFeature(serviceRegistry); - } - - private static void RegisterImpl(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterSingleton(); - - private static void RegisterSystem(IServiceRegistry serviceRegistry) - { - serviceRegistry.RegisterSingleton(factory => - { - var inputScanner = factory.GetInstance(); - - var getGroup = factory.GetInstance[], IGroup>>(Matcher.AllOf); - IGroup group = getGroup(Matchers); - - var logger = factory.GetInstance(); - - return new InputSystem(inputScanner, group, logger); - }); - } - - private static void RegisterFeature(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterSingleton(); -} +// using System; +// using Entitas; +// using Features; +// using GameDesktop.Resources.Internal; +// using LightInject; +// using Serilog; +// using Services.Input; +// using Systems; +// +// namespace GameDesktop.CompositionRoots.Features; +// +// internal class InputFeatureCompositionRoot : ICompositionRoot +// { +// private static readonly IMatcher[] Matchers = +// { +// GameMatcher.Transform, GameMatcher.Movable, GameMatcher.Player +// }; +// +// public void Compose(IServiceRegistry serviceRegistry) +// { +// RegisterImpl(serviceRegistry); +// RegisterSystem(serviceRegistry); +// RegisterFeature(serviceRegistry); +// } +// +// private static void RegisterImpl(IServiceRegistry serviceRegistry) => +// serviceRegistry.RegisterSingleton(); +// +// private static void RegisterSystem(IServiceRegistry serviceRegistry) +// { +// serviceRegistry.RegisterSingleton(factory => +// { +// var inputScanner = factory.GetInstance(); +// +// var getGroup = factory.GetInstance[], IGroup>>(Matcher.AllOf); +// IGroup group = getGroup(Matchers); +// +// var logger = factory.GetInstance(); +// +// return new Systems.InputSystem(inputScanner, group, logger); +// }); +// } +// +// private static void RegisterFeature(IServiceRegistry serviceRegistry) => +// serviceRegistry.RegisterSingleton(); +// } diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/MovementFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/MovementFeatureCompositionRoot.cs index 7efe4bf..b82a20b 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/MovementFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/MovementFeatureCompositionRoot.cs @@ -1,74 +1,74 @@ -using System; -using Entitas; -using Features; -using GameDesktop.Resources.Internal; -using LightInject; -using Serilog; -using Services; -using Services.Movement; -using Systems; - -namespace GameDesktop.CompositionRoots.Features; - -internal class MovementFeatureCompositionRoot : ICompositionRoot -{ - private static readonly IMatcher[] CollisionMatchers = - { - GameMatcher.RectangleCollision, GameMatcher.Transform - }; - - private static readonly IMatcher[] MovableMatchers = { GameMatcher.Transform, GameMatcher.Movable }; - - private static readonly IMatcher[] AnimatedMovableMatchers = - { - GameMatcher.Movable, GameMatcher.MovementAnimation - }; - - public void Compose(IServiceRegistry serviceRegistry) - { - RegisterImpl(serviceRegistry); - RegisterSystems(serviceRegistry); - RegisterFeature(serviceRegistry); - } - - private static void RegisterImpl(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterSingleton(); - - private static void RegisterSystems(IServiceRegistry serviceRegistry) - { - serviceRegistry.RegisterSingleton(factory => - { - var getGroup = factory.GetInstance[], IGroup>>(Matcher.AllOf); - IGroup group = getGroup(CollisionMatchers); - - var logger = factory.GetInstance(); - - return new CollisionSystem(group, logger); - }); - - serviceRegistry.RegisterSingleton(factory => - { - var movement = factory.GetInstance(); - - var getGroup = factory.GetInstance[], IGroup>>(Matcher.AllOf); - IGroup group = getGroup(MovableMatchers); - - var logger = factory.GetInstance(); - - return new MovementSystem(movement, group, logger); - }); - - serviceRegistry.RegisterSingleton(factory => - { - var getGroup = factory.GetInstance[], IGroup>>(Matcher.AllOf); - IGroup group = getGroup(AnimatedMovableMatchers); - - var logger = factory.GetInstance(); - - return new AnimatedMovementSystem(group, logger); - }); - } - - private static void RegisterFeature(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterSingleton(); -} +// using System; +// using Entitas; +// using Features; +// using GameDesktop.Resources.Internal; +// using LightInject; +// using Serilog; +// using Services; +// using Services.Movement; +// using Systems; +// +// namespace GameDesktop.CompositionRoots.Features; +// +// internal class MovementFeatureCompositionRoot : ICompositionRoot +// { +// private static readonly IMatcher[] CollisionMatchers = +// { +// GameMatcher.RectangleCollision, GameMatcher.Transform +// }; +// +// private static readonly IMatcher[] MovableMatchers = { GameMatcher.Transform, GameMatcher.Movable }; +// +// private static readonly IMatcher[] AnimatedMovableMatchers = +// { +// GameMatcher.Movable, GameMatcher.MovementAnimation +// }; +// +// public void Compose(IServiceRegistry serviceRegistry) +// { +// RegisterImpl(serviceRegistry); +// RegisterSystems(serviceRegistry); +// RegisterFeature(serviceRegistry); +// } +// +// private static void RegisterImpl(IServiceRegistry serviceRegistry) => +// serviceRegistry.RegisterSingleton(); +// +// private static void RegisterSystems(IServiceRegistry serviceRegistry) +// { +// serviceRegistry.RegisterSingleton(factory => +// { +// var getGroup = factory.GetInstance[], IGroup>>(Matcher.AllOf); +// IGroup group = getGroup(CollisionMatchers); +// +// var logger = factory.GetInstance(); +// +// return new CollisionSystem(group, logger); +// }); +// +// serviceRegistry.RegisterSingleton(factory => +// { +// var movement = factory.GetInstance(); +// +// var getGroup = factory.GetInstance[], IGroup>>(Matcher.AllOf); +// IGroup group = getGroup(MovableMatchers); +// +// var logger = factory.GetInstance(); +// +// return new MovementSystem(movement, group, logger); +// }); +// +// serviceRegistry.RegisterSingleton(factory => +// { +// var getGroup = factory.GetInstance[], IGroup>>(Matcher.AllOf); +// IGroup group = getGroup(AnimatedMovableMatchers); +// +// var logger = factory.GetInstance(); +// +// return new AnimatedMovementSystem(group, logger); +// }); +// } +// +// private static void RegisterFeature(IServiceRegistry serviceRegistry) => +// serviceRegistry.RegisterSingleton(); +// } diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs index 3edf6d1..32f60a7 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs @@ -1,8 +1,24 @@ -using Features; +using Components.Data; +using Entities.Factories.Characters; +using Entities.Factories.Meta; +using Features; +using LightInject; using GameDesktop.CompositionRoots.Components; -using GameDesktop.CompositionRoots.DebugFeatures; using GameDesktop.CompositionRoots.Entities; -using LightInject; +using Implementations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Myra; +using Myra.Graphics2D.UI; +using Scellecs.Morpeh; +using Services.Movement; +using Systems; +using Systems.Debugging; +using Systems.Debugging.Render; +using Systems.Render; +#if DEBUG +using GameDesktop.CompositionRoots.DebugFeatures; +#endif namespace GameDesktop.CompositionRoots.Features; @@ -45,12 +61,68 @@ private static void RegisterEntities(IServiceRegistry serviceRegistry) private static void RegisterFeatures(IServiceRegistry serviceRegistry) { - serviceRegistry.RegisterFrom(); - serviceRegistry.RegisterFrom(); - serviceRegistry.RegisterFrom(); - serviceRegistry.RegisterFrom(); + // serviceRegistry.RegisterFrom(); + // serviceRegistry.RegisterFrom(); + // serviceRegistry.RegisterFrom(); + // serviceRegistry.RegisterFrom(); } - private static void RegisterEntryPoint(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterSingleton(); + private static void RegisterEntryPoint(IServiceRegistry serviceRegistry) + { + // var serviceRegistration = (Game)((PerContainerLifetime)serviceRegistry.AvailableServices.First(x => x.ServiceType == typeof(Game)).Lifetime).GetInstance((args, scope) => new object(), new Scope(new ServiceContainer()), Array.Empty()); + // serviceRegistry.RegisterSingleton(factory => new ImGuiRenderer(factory.GetInstance())); + + // UI + serviceRegistry.RegisterSingleton(_ => + { + var grid = new Grid { RowSpacing = 8, ColumnSpacing = 8 }; + + grid.ColumnsProportions.Add(new Proportion(ProportionType.Auto)); + grid.ColumnsProportions.Add(new Proportion(ProportionType.Auto)); + grid.RowsProportions.Add(new Proportion(ProportionType.Auto)); + grid.RowsProportions.Add(new Proportion(ProportionType.Auto)); + + return grid; + }); + + serviceRegistry.RegisterSingleton(factory => + { + Desktop desktop = new(); + desktop.Root = factory.GetInstance(); + + return desktop; + }); + + // ECS + serviceRegistry.RegisterSingleton(_ => World.Create()); + + serviceRegistry.RegisterSingleton(factory => + { + Texture2D pixel = new(factory.GetInstance().GraphicsDevice, 1, 1); + pixel.SetData(new[] { Color.Gold }); + + return new RootFeature(factory.GetInstance(), + new WorldInitializer(factory.GetInstance(), new WorldEntityFactory(new WorldComponent()), + factory.GetInstance(), + factory.GetInstance()), + new MovementFeature(factory.GetInstance(), + new InputSystem(factory.GetInstance(), new KeyboardInput()), + new MovementSystem(factory.GetInstance(), new SimpleMovement())), + new PreRenderFeature(factory.GetInstance(), + new CharacterMovementAnimationSystem(factory.GetInstance()), + new CameraFollowingSystem(factory.GetInstance())), + new RenderFeature(factory.GetInstance(), + new RenderCharacterMovementAnimationSystem(factory.GetInstance(), + factory.GetInstance())) +#if DEBUG + , + new DebugFeature(factory.GetInstance(), new EntitiesList(factory.GetInstance()), + new FrameCounter(factory.GetInstance()), + new RenderFramesPerSec(factory.GetInstance()), + new PivotRenderSystem(factory.GetInstance(), factory.GetInstance(), pixel)) +#endif + ); + }); + } + // serviceRegistry.RegisterSingleton(); } diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/WorldInitializeFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/WorldInitializeFeatureCompositionRoot.cs index e6c7fd5..4e9ffcd 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/WorldInitializeFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/WorldInitializeFeatureCompositionRoot.cs @@ -1,15 +1,15 @@ -using Features; -using LightInject; - -namespace GameDesktop.CompositionRoots.Features; - -internal class WorldInitializeFeatureCompositionRoot : ICompositionRoot -{ - public void Compose(IServiceRegistry serviceRegistry) - { - RegisterFeature(serviceRegistry); - } - - private static void RegisterFeature(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterSingleton(); -} +// using Features; +// using LightInject; +// +// namespace GameDesktop.CompositionRoots.Features; +// +// internal class WorldInitializeFeatureCompositionRoot : ICompositionRoot +// { +// public void Compose(IServiceRegistry serviceRegistry) +// { +// RegisterFeature(serviceRegistry); +// } +// +// private static void RegisterFeature(IServiceRegistry serviceRegistry) => +// serviceRegistry.RegisterSingleton(); +// } diff --git a/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs index f6631a1..253826d 100644 --- a/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Entitas; using GameDesktop.Resources.Internal; using LightInject; using Microsoft.Xna.Framework.Graphics; @@ -13,36 +12,10 @@ internal class FundamentalCompositionRoot : ICompositionRoot { public void Compose(IServiceRegistry serviceRegistry) { - RegisterContexts(serviceRegistry); - RegisterAllOfMatcher(serviceRegistry); - RegisterAnyOfMatcher(serviceRegistry); RegisterAnimationsFactory(serviceRegistry); serviceRegistry.RegisterSingleton(typeof(AbstractFactory<>)); } - private static void RegisterContexts(IServiceRegistry serviceRegistry) => - serviceRegistry.RegisterInstance(Contexts.sharedInstance); - - private static void RegisterAllOfMatcher(IServiceRegistry serviceRegistry) - { - serviceRegistry.Register[], IGroup>((factory, matchers) => - { - IAllOfMatcher groupMatcher = GameMatcher.AllOf(matchers); - var contexts = factory.GetInstance(); - return contexts.game.GetGroup(groupMatcher); - }, Matcher.AllOf); - } - - private static void RegisterAnyOfMatcher(IServiceRegistry serviceRegistry) - { - serviceRegistry.Register[], IGroup>((factory, matchers) => - { - IAnyOfMatcher groupMatcher = GameMatcher.AnyOf(matchers); - var contexts = factory.GetInstance(); - return contexts.game.GetGroup(groupMatcher); - }, Matcher.AnyOf); - } - private static void RegisterAnimationsFactory(IServiceRegistry serviceRegistry) { // Warning: binding to where T is any type, is dangerous and you should have a different diff --git a/src/Apps/GameDesktop/CompositionRoots/GameCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/GameCompositionRoot.cs index 53584e4..79f7a85 100644 --- a/src/Apps/GameDesktop/CompositionRoots/GameCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/GameCompositionRoot.cs @@ -1,6 +1,9 @@ -using GameDesktop.Resources.Internal; +using System.Linq; +using GameDesktop.Resources.Internal; using LightInject; using Microsoft.Xna.Framework; +using MonoGame.ImGuiNet; +using Myra; using Serilog; namespace GameDesktop.CompositionRoots; @@ -9,22 +12,24 @@ internal class GameCompositionRoot : ICompositionRoot { private const float TargetFramesPerSecond = 120.0f; private const bool IsMouseVisible = true; + private const bool IsFixedTimeStep = false; public void Compose(IServiceRegistry serviceRegistry) { - serviceRegistry.Register(factory => + serviceRegistry.RegisterSingleton(factory => { Game game = new(factory.GetInstance(), - factory.GetInstance(), - TargetFramesPerSecond) + factory.GetInstance()) { - IsMouseVisible = IsMouseVisible, Content = { RootDirectory = AppVariable.ContentRootDirectory, } + IsMouseVisible = IsMouseVisible, + IsFixedTimeStep = IsFixedTimeStep, + Content = { RootDirectory = AppVariable.ContentRootDirectory, }, }; // Hack. Resolving cycle dependency issue (fundamental architecture) // Implicitly adds itself in the game services container. new GraphicsDeviceManager(game); - + return game; }); } diff --git a/src/Apps/GameDesktop/Content/Content.mgcb b/src/Apps/GameDesktop/Content/Content.mgcb index c2bdd81..ddc4c36 100644 --- a/src/Apps/GameDesktop/Content/Content.mgcb +++ b/src/Apps/GameDesktop/Content/Content.mgcb @@ -13,6 +13,3 @@ #---------------------------------- Content ---------------------------------# -#begin SpriteSheets/Player.aseprite -/copy:SpriteSheets/Player.aseprite - diff --git a/src/Apps/GameDesktop/Factories/UIFactory.cs b/src/Apps/GameDesktop/Factories/UIFactory.cs new file mode 100644 index 0000000..5107e62 --- /dev/null +++ b/src/Apps/GameDesktop/Factories/UIFactory.cs @@ -0,0 +1,62 @@ +using Myra.Graphics2D.UI; + +namespace GameDesktop.Factories; + +public class UIFactory +{ + private readonly Grid _grid; + private readonly Label _label; + private readonly ComboBox _comboBox; + private readonly Button _button; + private readonly SpinButton _spinButton; + + public UIFactory(Grid grid, Label label, ComboBox comboBox, Button button, SpinButton spinButton) + { + // Stylesheet.Current.ButtonStyle = new ButtonStyle + // { + // Background = new ColoredRegion(new TextureRegion(pixel, new Rectangle(0, 0, 15, 15)), Color.Gold), + // Padding = new Thickness(5, 5), + // }; + + _grid = grid; + _label = label; + _comboBox = comboBox; + _button = button; + _spinButton = spinButton; + } + + public void Build() + { + BuildComboBox(); + BuildButton(); + BuildSpinButton(); + + Initialize(); + } + + private void BuildComboBox() + { + Grid.SetColumn(_comboBox, 1); + Grid.SetRow(_comboBox, 0); + } + + private void BuildButton() + { + Grid.SetColumn(_button, 0); + Grid.SetRow(_button, 1); + } + + private void BuildSpinButton() + { + Grid.SetColumn(_spinButton, 1); + Grid.SetRow(_spinButton, 1); + } + + private void Initialize() + { + _grid.Widgets.Add(_label); + _grid.Widgets.Add(_comboBox); + _grid.Widgets.Add(_button); + _grid.Widgets.Add(_spinButton); + } +} diff --git a/src/Apps/GameDesktop/Game.cs b/src/Apps/GameDesktop/Game.cs index c1b48b7..0d7c7b7 100644 --- a/src/Apps/GameDesktop/Game.cs +++ b/src/Apps/GameDesktop/Game.cs @@ -1,30 +1,39 @@ -using System; -using Features; +using Features; using GameDesktop.CompositionRoots.Features; +using GameDesktop.Factories; +using ImGuiNET; +using JetBrains.Annotations; +using MonoGame.ImGuiNet; using LightInject; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Myra; using Serilog; +using Myra.Graphics2D.UI; namespace GameDesktop; public class Game : Microsoft.Xna.Framework.Game { - private readonly float _targetTimeStep; - private readonly ILogger _logger; private readonly IServiceContainer _container; - private Entitas.Extended.Feature _rootFeature; + [CanBeNull] private ImGuiRenderer _imGuiRenderer; private SpriteBatch _spriteBatch; - private float _accumulatedTime; + private Desktop _desktop; + + // TODO: Frames updating + // TODO: Player position & other things debug showing, input, etc + // TODO: Nez has cool physics & other projects libs to use as deps + // https://gafferongames.com/post/fix_your_timestep/ + // https://lajbert.wordpress.com/2021/05/02/fix-your-timestep-in-monogame/ + private RootFeature _rootFeature; - public Game(ILogger logger, IServiceContainer container, float targetFramesPerSecond) + public Game(ILogger logger, IServiceContainer container) { _logger = logger; _container = container; - _targetTimeStep = 1 / targetFramesPerSecond; _logger.ForContext().Verbose("ctor"); } @@ -32,15 +41,18 @@ public Game(ILogger logger, IServiceContainer container, float targetFramesPerSe protected override void Initialize() { _logger.ForContext().Verbose($"Initialize(): start; available {GraphicsDevice}"); - _logger.ForContext().Verbose("SpriteBatch initialization..."); - - _container.RegisterSingleton(_ => new SpriteBatch(GraphicsDevice)); - _spriteBatch = _container.GetInstance(); - // GraphicsDeviceManager.PreferredBackBufferWidth = 640; - // GraphicsDeviceManager.PreferredBackBufferHeight = 480; - // GraphicsDeviceManager.ApplyChanges(); - - _logger.ForContext().Verbose("SpriteBatch initialized"); + _logger.ForContext().Verbose("Circular dependencies (external) initialization..."); + RegisterSpriteBatch(); + RegisterMyraUIEnvironment(); +#if DEBUG + RegisterImGuiRenderer(); +#endif + _logger.ForContext().Verbose("Circular dependencies (external) initialized"); + + _logger.ForContext().Verbose("Game services initialization..."); + RegisterRootFeature(); + RegisterMyraUI(); + _logger.ForContext().Verbose("Game services initialized"); base.Initialize(); @@ -49,22 +61,19 @@ protected override void Initialize() protected override void LoadContent() { - _logger.ForContext().Verbose("LoadContent(): start"); - - _container.RegisterFrom(); - - _rootFeature = _container.GetInstance(); - // TODO: Logging with game flags (like LOG_MOVEMENT, etc)? // todo: pass tru logger & log places // TODO: Error handling - _rootFeature.Initialize(); + _logger.ForContext().Verbose("LoadContent(): start"); + + _rootFeature.OnAwake(); + _logger.ForContext().Verbose("LoadContent(): end"); } protected override void BeginRun() { - _logger.ForContext().Verbose("Beginning run..."); + _logger.ForContext().Verbose("Beginning to run..."); base.BeginRun(); @@ -80,35 +89,30 @@ protected override void EndRun() _logger.ForContext().Verbose("Ended"); } - // maybe fixed update is incorrect. needs review in the future - private void FixedUpdate(GameTime gameTime) => _rootFeature.FixedExecute(gameTime); - protected override void Update(GameTime gameTime) { - _accumulatedTime += (float)gameTime.ElapsedGameTime.TotalSeconds; + float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; + _rootFeature.OnFixedUpdate(deltaTime); - while (_accumulatedTime >= _targetTimeStep) - { - FixedUpdate(gameTime); + _rootFeature.OnUpdate(deltaTime); - _accumulatedTime -= _targetTimeStep; - } - - base.Update(gameTime); - _rootFeature.Execute(gameTime); - - LateUpdate(gameTime); + _rootFeature.OnLateUpdate(deltaTime); } - private void LateUpdate(GameTime gameTime) => _rootFeature.LateExecute(gameTime); - protected override void Draw(GameTime gameTime) { + float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; GraphicsDevice.Clear(Color.CornflowerBlue); - _rootFeature.Draw(gameTime, _spriteBatch); + _imGuiRenderer?.BeginLayout(gameTime); + + _spriteBatch.Begin(samplerState: SamplerState.PointClamp); + _rootFeature.OnRender(deltaTime); + _spriteBatch.End(); + + _desktop.Render(); - base.Draw(gameTime); + _imGuiRenderer?.EndLayout(); } protected override void Dispose(bool disposing) @@ -119,4 +123,59 @@ protected override void Dispose(bool disposing) _logger.ForContext().Verbose("Disposed"); } + + private void RegisterSpriteBatch() + { + _container.RegisterSingleton(_ => new SpriteBatch(GraphicsDevice)); + _spriteBatch = _container.GetInstance(); + } + + private void RegisterMyraUIEnvironment() => MyraEnvironment.Game = this; + + private void RegisterImGuiRenderer() + { + _container.RegisterSingleton(factory => + { + ImGuiRenderer imGuiRenderer = new(factory.GetInstance()); + imGuiRenderer.RebuildFontAtlas(); + return imGuiRenderer; + }); + + _imGuiRenderer = _container.GetInstance(); + + ImGui.GetIO().ConfigFlags = ImGuiConfigFlags.DockingEnable; + } + + private void RegisterRootFeature() + { + _container.RegisterFrom(); + _rootFeature = _container.GetInstance(); + } + + private void RegisterMyraUI() + { + // ComboBox + var combo = new ComboBox(); + combo.Items.Add(new ListItem("Red", Color.Red)); + combo.Items.Add(new ListItem("Green", Color.Green)); + combo.Items.Add(new ListItem("Blue", Color.Blue)); + + // Button + var button = new Button { Content = new Label { Text = "Show" } }; + button.Click += (s, a) => + { + var messageBox = Dialog.CreateMessageBox("Message", "Some message!"); + messageBox.ShowModal(_desktop); + }; + + var grid = _container.GetInstance(); + new UIFactory(grid, + new Label { Id = "label", Text = "Hello, World!" }, + combo, + button, + new SpinButton { Width = 100, Nullable = true }) + .Build(); + + _desktop = _container.GetInstance(); + } } diff --git a/src/Apps/GameDesktop/GameDesktop.csproj b/src/Apps/GameDesktop/GameDesktop.csproj index 6f6d886..827b26d 100644 --- a/src/Apps/GameDesktop/GameDesktop.csproj +++ b/src/Apps/GameDesktop/GameDesktop.csproj @@ -2,10 +2,10 @@ Exe - net7.0 Major false default + net8.0 app.manifest @@ -23,6 +23,9 @@ Always + + Always + @@ -45,28 +48,25 @@ - - - - - - - - - + + + + + - - - - + + + + + + - - + diff --git a/src/Apps/GameDesktop/Program.cs b/src/Apps/GameDesktop/Program.cs index 93c7e7a..d71d38a 100644 --- a/src/Apps/GameDesktop/Program.cs +++ b/src/Apps/GameDesktop/Program.cs @@ -19,12 +19,15 @@ try { - ContainerOptions containerOptions = + using ServiceContainer container = new( new ContainerOptions { - LogFactory = _ => entry => logger.ForContext().Verbose($"{entry.Message}") - }; - using ServiceContainer container = new(containerOptions); + EnablePropertyInjection = false, + EnableCurrentScope = false, + LogFactory = _ => entry => logger + .ForContext() + .Verbose($"{entry.Message}"), + }); container.RegisterInstance(container); container.RegisterInstance(configuration); @@ -32,7 +35,7 @@ container.RegisterFrom(); - using Game game = container.GetInstance(); + using var game = container.GetInstance(); game.Run(); } catch (Exception e) diff --git a/src/Libs/Components/Components.csproj b/src/Libs/Components/Components.csproj index 8bf759e..c6a1d5d 100644 --- a/src/Libs/Components/Components.csproj +++ b/src/Libs/Components/Components.csproj @@ -1,23 +1,19 @@ - net7.0 enable enable - <_TargetFrameworkDirectories>Jenny.Plugins.ReferenceAssemblyPathsPreProcessor - <_FullFrameworkReferenceAssemblyPaths>Jenny.Plugins.ReferenceAssemblyPathsPreProcessor true + net8.0 + default - - - - - + - + + \ No newline at end of file diff --git a/src/Libs/Components/Data/CameraComponent.cs b/src/Libs/Components/Data/CameraComponent.cs index 745245d..459760f 100644 --- a/src/Libs/Components/Data/CameraComponent.cs +++ b/src/Libs/Components/Data/CameraComponent.cs @@ -1,11 +1,13 @@ -using Entitas; -using Entitas.CodeGeneration.Attributes; -using Microsoft.Xna.Framework; +// namespace Entitas.Components.Data; +// +// [Unique] +// public class CameraComponent : IComponent +// { +// public Rectangle Size; +// } -namespace Components.Data; - -[Unique] -public class CameraComponent : IComponent -{ - public Rectangle Size; -} +// Camera is a system but a component, +// So, the system would have a target as a dependency, +// And exist only in the current world, +// As well, the system has its own behaviour, +// Thus, there's no reason to migrate the component diff --git a/src/Libs/Components/Data/InventoryComponent.cs b/src/Libs/Components/Data/InventoryComponent.cs new file mode 100644 index 0000000..80d0122 --- /dev/null +++ b/src/Libs/Components/Data/InventoryComponent.cs @@ -0,0 +1,24 @@ +using Scellecs.Morpeh; + +namespace Components.Data; + +public interface IItem +{ + ItemSettings ItemSettings { get; } +} + +public struct ItemSettings(string name, bool isStackable) +{ + public string Name = name; + public bool IsStackable = isStackable; +} + +public struct Slot(IItem item) +{ + public IItem Item = item; +} + +public struct InventoryComponent(Slot[] slots) : IComponent +{ + public Slot[] Slots = slots; +} diff --git a/src/Libs/Components/Data/MovementAnimationComponent.cs b/src/Libs/Components/Data/MovementAnimationComponent.cs deleted file mode 100644 index 78e83e5..0000000 --- a/src/Libs/Components/Data/MovementAnimationComponent.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Components.Tags; -using Microsoft.Xna.Framework; -using MonoGame.Aseprite.Sprites; -using Services.Math; - -namespace Components.Data; - -public class MovementAnimationComponent : DrawableComponent -{ - private const Direction DefaultFacing = Direction.Down; - - public AnimatedSprite? PlayingAnimation; - public Dictionary? IdleAnimations; - public Dictionary? WalkingAnimations; - - public Vector2 FacingDirection = Vector2.UnitY; - public bool HasStopped; - - public MovementAnimationComponent() - { - } - - public MovementAnimationComponent(Dictionary idleAnimations, - Dictionary walkingAnimations) - { - IdleAnimations = idleAnimations; - WalkingAnimations = walkingAnimations; - - PlayingAnimation = idleAnimations[DefaultFacing]; - } -} diff --git a/src/Libs/Components/Data/PivotComponent.cs b/src/Libs/Components/Data/PivotComponent.cs new file mode 100644 index 0000000..bd003e8 --- /dev/null +++ b/src/Libs/Components/Data/PivotComponent.cs @@ -0,0 +1 @@ +namespace Components.Data; diff --git a/src/Libs/Components/Data/RectangleCollisionComponent.cs b/src/Libs/Components/Data/RectangleCollisionComponent.cs index 42c682d..9865d55 100644 --- a/src/Libs/Components/Data/RectangleCollisionComponent.cs +++ b/src/Libs/Components/Data/RectangleCollisionComponent.cs @@ -1,9 +1,9 @@ -using Entitas; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Scellecs.Morpeh; namespace Components.Data; -public class RectangleCollisionComponent : IComponent +public struct RectangleCollisionComponent : IComponent { public Rectangle Size; } diff --git a/src/Libs/Components/Data/SpriteComponent.cs b/src/Libs/Components/Data/SpriteComponent.cs deleted file mode 100644 index 370dff6..0000000 --- a/src/Libs/Components/Data/SpriteComponent.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Components.Tags; -using MonoGame.Aseprite.Sprites; - -namespace Components.Data; - -public class SpriteComponent : DrawableComponent -{ - public Sprite? Sprite; - - public SpriteComponent() - { - } - - public SpriteComponent(Sprite sprite) - { - Sprite = sprite; - } -} diff --git a/src/Libs/Components/Data/TransformComponent.cs b/src/Libs/Components/Data/TransformComponent.cs index 657132c..3e28ebc 100644 --- a/src/Libs/Components/Data/TransformComponent.cs +++ b/src/Libs/Components/Data/TransformComponent.cs @@ -1,12 +1,14 @@ -using Entitas; -using Microsoft.Xna.Framework; +using System.Numerics; +using Scellecs.Morpeh; +using Pivot = Services.Math.Direction; namespace Components.Data; -public class TransformComponent : IComponent +public struct TransformComponent : IComponent { public Vector2 Position; public Vector2 Velocity; + public Pivot Pivot; } // Input Scan System -> Write Velocity diff --git a/src/Libs/Components/Data/WorldComponent.cs b/src/Libs/Components/Data/WorldComponent.cs new file mode 100644 index 0000000..96c7b7d --- /dev/null +++ b/src/Libs/Components/Data/WorldComponent.cs @@ -0,0 +1,8 @@ +using Scellecs.Morpeh; + +namespace Components.Data; + +public struct WorldComponent : IComponent +{ + public float FramesPerSec; +} diff --git a/src/Libs/Components/GeneratedExtended/GameEntity.cs b/src/Libs/Components/GeneratedExtended/GameEntity.cs deleted file mode 100644 index 9cb0416..0000000 --- a/src/Libs/Components/GeneratedExtended/GameEntity.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Components; -using Components.Data; -using Microsoft.Xna.Framework; - -public partial class GameEntity -{ - // TODO: The kind of code generator? - public void AddMovementAnimation(MovementAnimationComponent component) - { - isDrawable = true; - AddMovementAnimation(newFacingDirection: component.FacingDirection, - newPlayingAnimation: component.PlayingAnimation, - newIdleAnimations: component.IdleAnimations, - newWalkingAnimations: component.WalkingAnimations, - newHasStopped: component.HasStopped); - } - - public void AddTransform(TransformComponent component) => - AddTransform(newPosition: component.Position, newVelocity: component.Velocity); - - public void AddCamera(CameraComponent component) => AddCamera(newSize: component.Size); - - public void AddSprite(SpriteComponent component) - { - isDrawable = true; - AddSprite(newSprite: component.Sprite); - } - - public void AddRectangleCollision(RectangleCollisionComponent component) - { - AddRectangleCollision(newSize: component.Size); - } -} diff --git a/src/Libs/Components/Jenny.properties b/src/Libs/Components/Jenny.properties deleted file mode 100644 index 34c34e7..0000000 --- a/src/Libs/Components/Jenny.properties +++ /dev/null @@ -1,50 +0,0 @@ -# Paths have to contain "/" (forward-slashes) for Linux-compatibility -Jenny.SearchPaths = ../External/Jenny/Plugins/Entitas, \ - ../External/Jenny/Plugins/Jenny -Jenny.Plugins = Entitas.CodeGeneration.Plugins, \ - Entitas.Roslyn.CodeGeneration.Plugins, \ - Entitas.VisualDebugging.CodeGeneration.Plugins, \ - Jenny.Plugins -Jenny.PreProcessors = Jenny.Plugins.ValidateProjectPathPreProcessor, \ - Jenny.Plugins.ReferenceAssemblyPathsPreProcessor, \ - Jenny.Plugins.TargetFrameworkProfilePreProcessor -Jenny.DataProviders = Entitas.CodeGeneration.Plugins.ContextDataProvider, \ - Entitas.Roslyn.CodeGeneration.Plugins.CleanupDataProvider, \ - Entitas.Roslyn.CodeGeneration.Plugins.ComponentDataProvider, \ - Entitas.Roslyn.CodeGeneration.Plugins.EntityIndexDataProvider -Jenny.CodeGenerators = Entitas.CodeGeneration.Plugins.ComponentContextApiGenerator, \ - Entitas.CodeGeneration.Plugins.ComponentEntityApiGenerator, \ - Entitas.CodeGeneration.Plugins.ComponentEntityApiInterfaceGenerator, \ - Entitas.CodeGeneration.Plugins.ComponentGenerator, \ - Entitas.CodeGeneration.Plugins.ComponentLookupGenerator, \ - Entitas.CodeGeneration.Plugins.ComponentMatcherApiGenerator, \ - Entitas.CodeGeneration.Plugins.ContextAttributeGenerator, \ - Entitas.CodeGeneration.Plugins.ContextGenerator, \ - Entitas.CodeGeneration.Plugins.ContextMatcherGenerator, \ - Entitas.CodeGeneration.Plugins.ContextsGenerator, \ - Entitas.CodeGeneration.Plugins.EntityGenerator, \ - Entitas.CodeGeneration.Plugins.EntityIndexGenerator, \ - Entitas.CodeGeneration.Plugins.EventEntityApiGenerator, \ - Entitas.CodeGeneration.Plugins.EventListenerComponentGenerator, \ - Entitas.CodeGeneration.Plugins.EventListenerInterfaceGenerator, \ - Entitas.CodeGeneration.Plugins.EventSystemGenerator, \ - Entitas.CodeGeneration.Plugins.EventSystemsGenerator, \ - Entitas.Roslyn.CodeGeneration.Plugins.CleanupSystemGenerator, \ - Entitas.Roslyn.CodeGeneration.Plugins.CleanupSystemsGenerator, \ - Entitas.VisualDebugging.CodeGeneration.Plugins.ContextObserverGenerator, \ - Entitas.VisualDebugging.CodeGeneration.Plugins.FeatureClassGenerator -Jenny.PostProcessors = Jenny.Plugins.AddFileHeaderPostProcessor, \ - Jenny.Plugins.CleanTargetDirectoryPostProcessor, \ - Jenny.Plugins.MergeFilesPostProcessor, \ - Jenny.Plugins.NewLinePostProcessor, \ - Jenny.Plugins.WriteToDiskPostProcessor, \ - Jenny.Plugins.ConsoleWriteLinePostProcessor -Jenny.Server.Port = 3333 -Jenny.Client.Host = localhost -Jenny.Plugins.ProjectPath = ../Entities/Entities.csproj -Jenny.Plugins.ProjectPath = ../Systems/Systems.csproj -Jenny.Plugins.ProjectPath = Components.csproj -Entitas.CodeGeneration.Plugins.Contexts = Game, \ - Input -Entitas.CodeGeneration.Plugins.IgnoreNamespaces = true -Jenny.Plugins.TargetDirectory = . diff --git a/src/Libs/Components/Makefile b/src/Libs/Components/Makefile deleted file mode 100644 index ed372af..0000000 --- a/src/Libs/Components/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -JENNY = ../External/Jenny/Jenny.Generator.Cli.dll - -all: gen - -gen: - dotnet $(JENNY) gen diff --git a/src/Libs/Components/Render/Animation/CharacterAnimatorComponent.cs b/src/Libs/Components/Render/Animation/CharacterAnimatorComponent.cs new file mode 100644 index 0000000..be548b9 --- /dev/null +++ b/src/Libs/Components/Render/Animation/CharacterAnimatorComponent.cs @@ -0,0 +1,11 @@ +using MonoGame.Aseprite.Sprites; +using Scellecs.Morpeh; +using Services.Math; + +namespace Components.Render.Animation; + +public struct CharacterAnimatorComponent(Direction facing, AnimatedSprite animation) : IComponent +{ + public Direction Facing = facing; + public AnimatedSprite Animation = animation; +} diff --git a/src/Libs/Components/Render/Animation/MovementAnimationsComponent.cs b/src/Libs/Components/Render/Animation/MovementAnimationsComponent.cs new file mode 100644 index 0000000..6c8177f --- /dev/null +++ b/src/Libs/Components/Render/Animation/MovementAnimationsComponent.cs @@ -0,0 +1,44 @@ +// namespace Entitas.Components.Data +// { +// public class MovementAnimationComponent : RenderComponent +// { +// private const Direction DefaultFacing = Direction.Down; +// +// public AnimatedSprite? PlayingAnimation; +// public Dictionary? IdleAnimations; +// public Dictionary? WalkingAnimations; +// +// public Vector2 FacingDirection = Vector2.UnitY; +// public bool HasStopped; +// +// public MovementAnimationComponent() +// { +// } +// +// public MovementAnimationComponent(Dictionary idleAnimations, +// Dictionary walkingAnimations) +// { +// IdleAnimations = idleAnimations; +// WalkingAnimations = walkingAnimations; +// +// PlayingAnimation = idleAnimations[DefaultFacing]; +// } +// } +// } + +using Scellecs.Morpeh; +using MonoGame.Aseprite.Sprites; +using Services.Math; + +namespace Components.Render.Animation; + +public struct MovementAnimationsComponent( + Dictionary idleAnimations, + Dictionary walkingAnimations) + : IComponent +{ + public readonly Dictionary IdleAnimations = idleAnimations; + public readonly Dictionary WalkingAnimations = walkingAnimations; +} + +// CharacterAnimatorComponent diff --git a/src/Libs/Components/Render/Static/SpriteComponent.cs b/src/Libs/Components/Render/Static/SpriteComponent.cs new file mode 100644 index 0000000..c8f60da --- /dev/null +++ b/src/Libs/Components/Render/Static/SpriteComponent.cs @@ -0,0 +1,31 @@ +// using Entitas.Components.Tags; +// using MonoGame.Aseprite.Sprites; +// using Scellecs.Morpeh; +// +// namespace Entitas.Components.Data +// { +// public class SpriteComponent : RenderComponent +// { +// public Sprite? Sprite; +// +// public SpriteComponent() +// { +// } +// +// public SpriteComponent(Sprite sprite) +// { +// Sprite = sprite; +// } +// } +// } + + +using Scellecs.Morpeh; +using MonoGame.Aseprite.Sprites; + +namespace Components.Render.Static; + +public struct SpriteComponent(Sprite sprite) : IComponent +{ + public Sprite Sprite { get; private set; } = sprite; +} diff --git a/src/Libs/Components/Tags/CameraComponent.cs b/src/Libs/Components/Tags/CameraComponent.cs new file mode 100644 index 0000000..e5cef6a --- /dev/null +++ b/src/Libs/Components/Tags/CameraComponent.cs @@ -0,0 +1,11 @@ +using System.Numerics; +using Microsoft.Xna.Framework.Graphics; +using Scellecs.Morpeh; + +namespace Components.Tags; + +public struct CameraComponent(Viewport viewport) : IComponent +{ + public Viewport Viewport = viewport; + public Vector2 Position; +} diff --git a/src/Libs/Components/Tags/DrawableComponent.cs b/src/Libs/Components/Tags/DrawableComponent.cs deleted file mode 100644 index 5374a23..0000000 --- a/src/Libs/Components/Tags/DrawableComponent.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Entitas; - -// Tag components are the empty ones and prefixed with is- (e.g. isPlayer) -// When auto-generated -namespace Components.Tags; - -public class DrawableComponent : IComponent -{ -} diff --git a/src/Libs/Components/Tags/InputMovableComponent.cs b/src/Libs/Components/Tags/InputMovableComponent.cs new file mode 100644 index 0000000..919c455 --- /dev/null +++ b/src/Libs/Components/Tags/InputMovableComponent.cs @@ -0,0 +1,7 @@ +using Scellecs.Morpeh; + +namespace Components.Tags; + +public struct InputMovableComponent : IComponent +{ +} diff --git a/src/Libs/Components/Tags/MovableComponent.cs b/src/Libs/Components/Tags/MovableComponent.cs index 0cbefb9..47b7281 100644 --- a/src/Libs/Components/Tags/MovableComponent.cs +++ b/src/Libs/Components/Tags/MovableComponent.cs @@ -1,7 +1,7 @@ -using Entitas; +using Scellecs.Morpeh; namespace Components.Tags; -public class MovableComponent : IComponent +public struct MovableComponent : IComponent { } diff --git a/src/Libs/Components/Tags/PlayerComponent.cs b/src/Libs/Components/Tags/PlayerComponent.cs deleted file mode 100644 index e1c00af..0000000 --- a/src/Libs/Components/Tags/PlayerComponent.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Entitas; - -namespace Components.Tags; - -public class PlayerComponent : IComponent -{ -} diff --git a/src/Libs/Components/Tags/RenderComponent.cs b/src/Libs/Components/Tags/RenderComponent.cs new file mode 100644 index 0000000..e9e533a --- /dev/null +++ b/src/Libs/Components/Tags/RenderComponent.cs @@ -0,0 +1,18 @@ +// namespace Entitas.Components.Tags +// { +// // Tag components are the empty ones and prefixed with is- (e.g. isPlayer) +// // When auto-generated +// public class RenderComponent : IComponent +// { +// } +// } + + +namespace Components.Tags +{ + using Scellecs.Morpeh; + + public struct RenderComponent : IComponent + { + } +} diff --git a/src/Libs/Entities/Entities.csproj b/src/Libs/Entities/Entities.csproj index 262e31d..022c49e 100644 --- a/src/Libs/Entities/Entities.csproj +++ b/src/Libs/Entities/Entities.csproj @@ -1,9 +1,10 @@ - net7.0 enable enable + net8.0 + default diff --git a/src/Libs/Entities/Factories/Characters/DummyEntityFactory.cs b/src/Libs/Entities/Factories/Characters/DummyEntityFactory.cs new file mode 100644 index 0000000..274aa1d --- /dev/null +++ b/src/Libs/Entities/Factories/Characters/DummyEntityFactory.cs @@ -0,0 +1,42 @@ +using Components.Data; +using Components.Render.Static; +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; + +namespace Entities.Factories.Characters; + +public class DummyEntityFactory : EntityFactory +{ + private readonly TransformComponent _transform; + private readonly SpriteComponent _sprite; + private readonly RectangleCollisionComponent _rectangleCollision; + + public DummyEntityFactory(TransformComponent transform, + RectangleCollisionComponent rectangleCollision) + { + _transform = transform; + _rectangleCollision = rectangleCollision; + } + + public DummyEntityFactory(TransformComponent transform, + SpriteComponent sprite, + RectangleCollisionComponent rectangleCollision) : this(transform, rectangleCollision) + { + _sprite = sprite; + } + + protected override void AddTags(Entity e) + { + } + + protected override void AddData(Entity e) + { + e.AddComponent(_transform); + e.AddComponent(_rectangleCollision); + } + + protected override void AddRender(Entity e) + { + e.AddComponent(_sprite); + } +} diff --git a/src/Libs/Entities/Factories/Characters/PlayerEntityFactory.cs b/src/Libs/Entities/Factories/Characters/PlayerEntityFactory.cs new file mode 100644 index 0000000..04a8430 --- /dev/null +++ b/src/Libs/Entities/Factories/Characters/PlayerEntityFactory.cs @@ -0,0 +1,59 @@ +using Components.Data; +using Components.Render.Animation; +using Components.Tags; +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; + +namespace Entities.Factories.Characters; + +// TODO: Might be good, if we create a base Entity class, and derive from that. +// Which will contain components list, it might be easier then +// to debug entities and their components with ImGui. +// But also, for the factory, ig, the view of the entities class will change. +// For now, Imma keep it as it is. +public class PlayerEntityFactory( + InputMovableComponent inputMovable, + MovableComponent movable, + TransformComponent transform, + CameraComponent cameraComponent, + RectangleCollisionComponent rectangleCollision, + InventoryComponent inventoryComponent) + : EntityFactory +{ + private readonly MovementAnimationsComponent _movementAnimations; + private readonly CharacterAnimatorComponent _characterAnimator; + + public PlayerEntityFactory(InputMovableComponent inputMovable, + MovableComponent movable, + TransformComponent transform, + CameraComponent cameraComponent, + RectangleCollisionComponent rectangleCollision, + MovementAnimationsComponent movementAnimations, + CharacterAnimatorComponent characterAnimator, + InventoryComponent inventoryComponent) : this(inputMovable, movable, transform, cameraComponent, + rectangleCollision, inventoryComponent) + { + _movementAnimations = movementAnimations; + _characterAnimator = characterAnimator; + } + + protected override void AddTags(Entity e) + { + e.AddComponent(cameraComponent); + e.AddComponent(inputMovable); + e.AddComponent(movable); + } + + protected override void AddData(Entity e) + { + e.AddComponent(transform); + e.AddComponent(rectangleCollision); + e.AddComponent(inventoryComponent); + } + + protected override void AddRender(Entity e) + { + e.AddComponent(_movementAnimations); + e.AddComponent(_characterAnimator); + } +} diff --git a/src/Libs/Entities/Factories/EntityFactory.cs b/src/Libs/Entities/Factories/EntityFactory.cs new file mode 100644 index 0000000..0029829 --- /dev/null +++ b/src/Libs/Entities/Factories/EntityFactory.cs @@ -0,0 +1,21 @@ +using Scellecs.Morpeh; + +namespace Entities.Factories; + +public abstract class EntityFactory +{ + public Entity CreateEntity(World @in) + { + Entity e = @in.CreateEntity(); + + AddTags(e); + AddData(e); + AddRender(e); + + return e; + } + + protected abstract void AddTags(Entity e); + protected abstract void AddData(Entity e); + protected abstract void AddRender(Entity e); +} diff --git a/src/Libs/Entities/Factories/Meta/WorldEntityFactory.cs b/src/Libs/Entities/Factories/Meta/WorldEntityFactory.cs new file mode 100644 index 0000000..9c5e398 --- /dev/null +++ b/src/Libs/Entities/Factories/Meta/WorldEntityFactory.cs @@ -0,0 +1,28 @@ +using Components.Data; +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; + +namespace Entities.Factories.Meta; + +public class WorldEntityFactory : EntityFactory +{ + private readonly WorldComponent _worldComponent; + + public WorldEntityFactory(WorldComponent worldComponent) + { + _worldComponent = worldComponent; + } + + protected override void AddTags(Entity e) + { + } + + protected override void AddData(Entity e) + { + e.AddComponent(_worldComponent); + } + + protected override void AddRender(Entity e) + { + } +} diff --git a/src/Libs/Entities/PlayerEntity.cs b/src/Libs/Entities/PlayerEntity.cs deleted file mode 100644 index f42b3d1..0000000 --- a/src/Libs/Entities/PlayerEntity.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Components; -using Components.Data; - -namespace Entities; - -public class PlayerEntity -{ - public PlayerEntity(Contexts contexts, - MovementAnimationComponent movementAnimationComponent, - TransformComponent transformComponent, - CameraComponent cameraComponent, - RectangleCollisionComponent rectangleCollisionComponent) - { - GameEntity entity = contexts.game.CreateEntity(); - - entity.isPlayer = true; - entity.isMovable = true; - entity.AddMovementAnimation(movementAnimationComponent); - entity.AddTransform(transformComponent); - entity.AddCamera(cameraComponent); - entity.AddRectangleCollision(rectangleCollisionComponent); - } -} diff --git a/src/Libs/Entities/StaticEntity.cs b/src/Libs/Entities/StaticEntity.cs deleted file mode 100644 index a3b33e2..0000000 --- a/src/Libs/Entities/StaticEntity.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Components; -using Components.Data; -using Microsoft.Xna.Framework; - -namespace Entities; - -public class StaticEntity -{ - public StaticEntity(Contexts contexts, - TransformComponent transformComponent, - SpriteComponent spriteComponent, - RectangleCollisionComponent rectangleCollision) - { - GameEntity e = contexts.game.CreateEntity(); - - e.AddTransform(transformComponent); - e.AddSprite(spriteComponent); - e.AddRectangleCollision(rectangleCollision); - } -} diff --git a/src/Libs/External/Entitas.Extended/Entitas.Extended.csproj b/src/Libs/External/Entitas.Extended/Entitas.Extended.csproj deleted file mode 100644 index d0663cd..0000000 --- a/src/Libs/External/Entitas.Extended/Entitas.Extended.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net7.0 - enable - enable - - - - - - - - - - - - diff --git a/src/Libs/External/Entitas.Extended/Feature.cs b/src/Libs/External/Entitas.Extended/Feature.cs deleted file mode 100644 index 2958192..0000000 --- a/src/Libs/External/Entitas.Extended/Feature.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Entitas.Extended; - -public class Feature : Systems -{ - public Feature(string name) - { - } - - public Feature() - { - } -} diff --git a/src/Libs/External/Entitas.Extended/IDrawSystem.cs b/src/Libs/External/Entitas.Extended/IDrawSystem.cs deleted file mode 100644 index a9bda35..0000000 --- a/src/Libs/External/Entitas.Extended/IDrawSystem.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace Entitas.Extended; - -public interface IDrawSystem : ISystem -{ - void Draw(GameTime gameTime, SpriteBatch spriteBatch); -} diff --git a/src/Libs/External/Entitas.Extended/IExecuteSystem.cs b/src/Libs/External/Entitas.Extended/IExecuteSystem.cs deleted file mode 100644 index 61f8d65..0000000 --- a/src/Libs/External/Entitas.Extended/IExecuteSystem.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Microsoft.Xna.Framework; - -namespace Entitas.Extended; - -public interface IExecuteSystem : ISystem -{ - void Execute(GameTime gameTime); -} diff --git a/src/Libs/External/Entitas.Extended/IFixedExecuteSystem.cs b/src/Libs/External/Entitas.Extended/IFixedExecuteSystem.cs deleted file mode 100644 index 1eaaa95..0000000 --- a/src/Libs/External/Entitas.Extended/IFixedExecuteSystem.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Microsoft.Xna.Framework; - -namespace Entitas.Extended; - -public interface IFixedExecuteSystem : ISystem -{ - void FixedExecute(GameTime gameTime); -} diff --git a/src/Libs/External/Entitas.Extended/ILateExecuteSystem.cs b/src/Libs/External/Entitas.Extended/ILateExecuteSystem.cs deleted file mode 100644 index 21f49b9..0000000 --- a/src/Libs/External/Entitas.Extended/ILateExecuteSystem.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Microsoft.Xna.Framework; - -namespace Entitas.Extended; - -public interface ILateExecuteSystem : ISystem -{ - void LateExecute(GameTime gameTime); -} diff --git a/src/Libs/External/Entitas.Extended/Systems.cs b/src/Libs/External/Entitas.Extended/Systems.cs deleted file mode 100644 index 434d581..0000000 --- a/src/Libs/External/Entitas.Extended/Systems.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace Entitas.Extended; - -// Entitas Extended Systems is compatible with methods linked to MonoGame Framework. -public class Systems : Entitas.Systems, IFixedExecuteSystem, IExecuteSystem, ILateExecuteSystem, IDrawSystem -{ - protected readonly List _fixedExecuteSystems = new(); - protected readonly List _lateExecuteSystems = new(); - protected new readonly List _executeSystems = new(); - protected readonly List _drawSystems = new(); - - public override Entitas.Systems Add(ISystem system) - { - if (system is IFixedExecuteSystem fixedExecuteSystem) - this._fixedExecuteSystems.Add(fixedExecuteSystem); - if (system is IExecuteSystem executeSystem) - this._executeSystems.Add(executeSystem); - if (system is ILateExecuteSystem lateExecuteSystem) - this._lateExecuteSystems.Add(lateExecuteSystem); - if (system is IDrawSystem drawSystem) - this._drawSystems.Add(drawSystem); - return base.Add(system); - } - - public new void Remove(ISystem system) - { - if (system is IFixedExecuteSystem fixedExecuteSystem) - this._fixedExecuteSystems.Remove(fixedExecuteSystem); - if (system is IExecuteSystem executeSystem) - this._executeSystems.Remove(executeSystem); - if (system is ILateExecuteSystem lateExecuteSystem) - this._lateExecuteSystems.Remove(lateExecuteSystem); - if (system is IDrawSystem drawSystem) - this._drawSystems.Remove(drawSystem); - base.Remove(system); - } - - public void FixedExecute(GameTime gameTime) - { - for (int index = 0; index < this._fixedExecuteSystems.Count; ++index) - this._fixedExecuteSystems[index].FixedExecute(gameTime); - } - - public void Execute(GameTime gameTime) - { - for (int index = 0; index < this._executeSystems.Count; ++index) - this._executeSystems[index].Execute(gameTime); - } - - public void LateExecute(GameTime gameTime) - { - for (int index = 0; index < this._lateExecuteSystems.Count; ++index) - this._lateExecuteSystems[index].LateExecute(gameTime); - } - - public void Draw(GameTime gameTime, SpriteBatch spriteBatch) - { - for (int index = 0; index < this._drawSystems.Count; ++index) - this._drawSystems[index].Draw(gameTime, spriteBatch); - } -} diff --git a/src/Libs/External/Jenny/DesperateDevs.Cli.Utils.dll b/src/Libs/External/Jenny/DesperateDevs.Cli.Utils.dll deleted file mode 100644 index 22a3e88..0000000 Binary files a/src/Libs/External/Jenny/DesperateDevs.Cli.Utils.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/DesperateDevs.Extensions.dll b/src/Libs/External/Jenny/DesperateDevs.Extensions.dll deleted file mode 100644 index 687d0fc..0000000 Binary files a/src/Libs/External/Jenny/DesperateDevs.Extensions.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/DesperateDevs.Reflection.dll b/src/Libs/External/Jenny/DesperateDevs.Reflection.dll deleted file mode 100644 index 7f4e2d7..0000000 Binary files a/src/Libs/External/Jenny/DesperateDevs.Reflection.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/DesperateDevs.Serialization.Cli.Utils.dll b/src/Libs/External/Jenny/DesperateDevs.Serialization.Cli.Utils.dll deleted file mode 100644 index 582f9ed..0000000 Binary files a/src/Libs/External/Jenny/DesperateDevs.Serialization.Cli.Utils.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/DesperateDevs.Serialization.dll b/src/Libs/External/Jenny/DesperateDevs.Serialization.dll deleted file mode 100644 index b4fb81f..0000000 Binary files a/src/Libs/External/Jenny/DesperateDevs.Serialization.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Jenny.Generator.Cli.dll b/src/Libs/External/Jenny/Jenny.Generator.Cli.dll deleted file mode 100644 index 438a64c..0000000 Binary files a/src/Libs/External/Jenny/Jenny.Generator.Cli.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Jenny.Generator.Cli.runtimeconfig.json b/src/Libs/External/Jenny/Jenny.Generator.Cli.runtimeconfig.json deleted file mode 100644 index e7b3b03..0000000 --- a/src/Libs/External/Jenny/Jenny.Generator.Cli.runtimeconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "runtimeOptions": { - "tfm": "net6.0", - "framework": { - "name": "Microsoft.NETCore.App", - "version": "6.0.0" - }, - "configProperties": { - "System.Reflection.Metadata.MetadataUpdater.IsSupported": false - } - } -} \ No newline at end of file diff --git a/src/Libs/External/Jenny/Jenny.Generator.dll b/src/Libs/External/Jenny/Jenny.Generator.dll deleted file mode 100644 index c6ca729..0000000 Binary files a/src/Libs/External/Jenny/Jenny.Generator.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Jenny.dll b/src/Libs/External/Jenny/Jenny.dll deleted file mode 100644 index ae41c46..0000000 Binary files a/src/Libs/External/Jenny/Jenny.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Entitas/CHANGELOG.md b/src/Libs/External/Jenny/Plugins/Entitas/CHANGELOG.md deleted file mode 100644 index ba3d779..0000000 --- a/src/Libs/External/Jenny/Plugins/Entitas/CHANGELOG.md +++ /dev/null @@ -1,2437 +0,0 @@ -## [1.14.1] - 2022-09-26 - -### Entitas -- Add `[ThreadStaticAtribute]` at static fields for multi-threaded game servers #919 - -### Entitas.CodeGeneration.Plugins -- Revert "Remove CodeDom" to support reserved C# keywords in component names #1032 -- Update jenny standalone checks to test for `Jenny.Generator.Cli` namespace - -### Entitas.VisualDebugging.Unity -- Fix entities order in visual debugging #1027 -- Create `Entitas.properties` with all required keys #1031 -- Set default systemWarningThreshold if `Entitas.properties` doesn't exists #1031 - -### Entitas.VisualDebugging.CodeGeneration.Plugins -- Prevent #963: Extend generator with adding debug log of exception when registering observers - -### DesperateDevs -- See [CHANGELOG.md](https://github.com/sschmid/DesperateDevs/blob/main/CHANGELOG.md#2022-09-26) - -### Other -- Move projects from `Addons` to `src` folder -- Remove top-level folder in projects -- Convert concatenation to interpolation -- Migrate unit tests from nspec to xunit -- Remove travis.yml -- Remove old Tests project -- Remove PerformanceTests -- Move Entitas.VisualDebugging.* to Entitas.Unity solution folder -- Add `Entitas.CodeGeneration.Program` project -- Apply formatting and syntax updates to Entitas -- Update Desperate Devs packages -- Update packages - -### bee -- Upgrade to bee 1.2.0 -- Add `entitas::new` -- Add `entitas::new_benchmark` -- Add `entitas::nuget` -- Add `entitas::nuget_local` -- Add `entitas::publish` - -## [1.14.0] - 2022-09-02 - -### Notes -- Rename the repository to Entitas: https://github.com/sschmid/Entitas -- Desperate Devs 1.0 is now open-source. Please find changes and upgrade guides here: [CHANGELOG.md](https://github.com/sschmid/DesperateDevs/blob/main/CHANGELOG.md) -- Started migration to a modern SDK-style project structure using [.NET project SDKs](https://docs.microsoft.com/en-us/dotnet/core/project-sdk/overview) -- All projects have been updated to `.NET 6.0` and `.NET Standard 2.1`. -- `Entitas.Roslyn.CodeGeneration.Plugins` is now open-source and part of this Entitas repository -- `main` is new default branch and `master` is obsolete - -### Upgrade -- Rename `CodeGeneratorExtentions` to `CodeGeneratorExtensions` -- Update `Jenny.properties` and rename to `Entitas.CodeGeneration.Plugins.EventListenerInterfaceGenerator` -- `mono Jenny/Jenny.exe` is obsolete. Use `dotnet Jenny/Jenny.Generator.Cli.dll` (requires dotnet) -- Run `dotnet Jenny/Jenny.Generator.Cli.dll auto-import -s` and follow instructions -- Consider using at least these search paths in `Jenny.properties`: -``` -Jenny.SearchPaths = Jenny/Plugins/Entitas, \ - Jenny/Plugins/Jenny, \ - Assets/Entitas -``` -- Some keys in `Jenny.properties` have changed due to renamed namespaces: -``` -Jenny.SearchPaths -Jenny.Plugins -Jenny.PreProcessors -Jenny.DataProviders -Jenny.CodeGenerators -Jenny.PostProcessors -Jenny.Server.Port -Jenny.Client.Host -Jenny.Plugins.ProjectPath -Jenny.Plugins.TargetDirectory -``` -- For reference, see [Match-One Jenny.properties](https://github.com/sschmid/Match-One/blob/main/Jenny.properties) -- Generate using `dotnet Jenny/Jenny.Generator.Cli.dll gen` - -### Entitas -- Add `systems.Remove()` - -### Entitas.CodeGeneration.Plugins -- Fix typo in `CodeGeneratorExtensions` -- Fix typo in `EventListenerInterfaceGenerator` -- Remove CodeDom - -### Entitas.Unity.Editor -- Link chat to [Entitas Discord](https://discord.gg/uHrVx5Z) - -### Other -- Use Desperate Devs 1.0.0 -- Use nuget and delete dependencies -- Remove docs -- Remove doxygen -- Remove tree - -### bee -- Migrate to bee 1.1.0 -- Remove generated folder from VisualDebugging project - -## [1.13.0] - 2019-02-20 -### Added -- Update roslyn -- Update hierarchy icons - -### Changed -- Change Preferences minified and doubleQuoteMode api - -### Fixed -- Fix hierarchy icon null warning - -## [1.12.2] - 2018-12-15 -### Fixed -- Fix EntityLinkHierarchyIcon #843 - -## [1.12.1] - 2018-12-09 -### Added -- Fix Jenny.exe load default `Jenny.properties` when not specified - -## [1.12.0] - 2018-12-09 -### Added -- Add Preferences require concrete properties path -- Add CodeGeneratorPreferencesWindow -- Add EntitasEntityLinkHierarchyIcon - -### Changed -- Move Jenny Unity Preferences to its own editor window `Tools/Jenny/Preferences...` - -### Removed -- Remove EntitasCache - -### Upgrade -- Jenny has been decoupled from Entitas even more -- Jenny now stores its config in Jenny.properties by default -- Entitas now stores its config in Entitas.properties by default -- Please split Preferences.properties into Entitas.properties and Jenny.properties or delete them to automatically create new default files - -## [1.11.0] - 2018-11-19 -### Added -- Add support for multiple event attributes with different event target #810 - -### Upgrade -- All listener interfaces with `EventTarget.Any` need to be renamed - - `IPositionListener` -> `IAnyPositionListener` - - `OnPosition` -> `OnAnyPosition` - -## [1.10.0] - 2018-11-14 -### Changed -- Remove IContext from EntityLink.Link() method signature - -### Upgrade -- Remove IContext from EntityLink.Link() method signature - -## [1.9.2] - 2018-11-04 -### Added -- Hotfix for Unity Asset Store missing mono hosted msbuild - -## [1.9.1] - 2018-11-03 -### Added -- Fix MultiReactive system retaining entities multiple times #818 - -## [1.9.0] - 2018-11-03 -### Added -- Optimize generated code #780 - - This increases entity and component creation performance -- Optimize Visual Debugging performance #799 - - This increases the performance especially when having thousands of entities -- Generate XML documentation #792 - - This will show documentation in the IDE -- Using latest [bee](https://github.com/sschmid/bee) - -### Changed -- Context ctor signature changed. Generate to fix compiler errors. - If you don't use the [Entitas.Roslyn plugins](http://u3d.as/NuJ) from the Unity Asset Store, - you have to manually fix the affected generated context classes. E.g. `Generated/Game/GameContext.cs`, - add `() => new GameEntity()` as a last argument - -```csharp -public sealed partial class GameContext : Entitas.Context { - - public GameContext() - : base( - GameComponentsLookup.TotalComponents, - 0, - new Entitas.ContextInfo( - "Game", - GameComponentsLookup.componentNames, - GameComponentsLookup.componentTypes - ), - (entity) => - -#if (ENTITAS_FAST_AND_UNSAFE) - new Entitas.UnsafeAERC(), -#else - new Entitas.SafeAERC(entity), -#endif - () => new GameEntity() // <---------- update here - ) { - } -} -``` - -- Release retained entities when ReactiveSystem.Execute() has an exception #812 - - This fixes spamming the Unity console with error messages - -# 1.8.2 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -http://u3d.as/NuJ - -### Entitas -⚙️ Add "@" in front of component name if it is a C# keyword #744 #756 @roygear -⚙️ Added convenience ctor to JobSystem to use all available threads on the device -⚙️ JobSystem.Execute() is now virtual - - -### Jenny -🛠 Fixed delays when running `jenny server` -🆕 `jenny wiz` beta. Running Jenny.exe without args will automatically run `jenny wiz` -🆕 `jenny help` aka man page - -Jenny Wizard is wip. If you have feedback or feature request, please add a comment here -https://github.com/sschmid/Entitas/issues/778 - - -# 1.8.1 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Entitas -⚙️ Add "@" in front of component name if it is a C# keyword #744 #756 @roygear -⚙️ Added convenience ctor to JobSystem to use all available threads on the device -⚙️ JobSystem.Execute() is now virtual - - -### Jenny -🛠 Fixed delays when running `jenny server` -🆕 `jenny wiz` beta. Running Jenny.exe without args will automatically run `jenny wiz` -🆕 `jenny help` aka man page - -Jenny Wizard is wip. If you have feedback or feature request, please add a comment here -https://github.com/sschmid/Entitas/issues/778 - - -# 1.8.0 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Entitas -⚙️ Enabled [Event] for non components #743 -⚠️ Renamed `CustomComponentNameAttribute` to `ComponentNameAttribute` - - -### Jenny -⚙️ Added more logs to `gen` command -```csharp -Generating using /Users/sschmid/Dev/C#/Half-life3/Jenny.properties -Generating done (13220 files in 4 seconds) -``` -⚙️ Added group to ICommand to support grouped usage overview -### Asset Store Version - - -# 1.7.0 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Visual Debugging -⚙️ StringTypeDrawer now uses EditorGUILayout.DelayedTextField - -### Code Generator -🆕 Added CleanupAttribute -⚠️ Renamed `UniquePrefixAttribute` to `FlagPrefixAttribute` - -### Asset Store Version -🆕 Cleanup Data Providers and Code Generators - -Instead of manually writing custom systems to remove components or destroy -entities, you can now use the new `[Cleanup]` attribute to automatically -generate `CleanupSystems` for you. - -E.g. adding the `[Cleanup]` attribute to a `DestroyedComponent` can replace -your custom `DestroyEntitySystem`. - -```csharp -[Cleanup(CleanupMode.DestroyEntity)] -public sealed class DestroyedComponent : IComponent { -} -``` - -There are currently two options: -- CleanupMode.DestroyEntity -- CleanupMode.RemoveComponent - -`CleanupMode.DestroyEntity` will generate a system that destroys all -entities which have this component. - -`CleanupMode.RemoveComponent` will generate a system that will remove -this component from all entities which have this component. - - -# 1.6.1 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Entitas -🛠 Fixed context.Reset() which doesn't remove event handlers anymore #725 -🛠 Updated EntitasStats to exclude JobSystem and Feature - -### Jenny -🛠 Fixed Jenny dropdown UI to not show 'mixed...' anymore -⚙️ Added Jenny Server toggle to UI -⚙️ Added dry run option -⚠️ Removed EnsureStandalonePreProcessor -🆕 Added WarnIfCompilationErrorsPreProcessor - - -# 1.6.0 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### General -⚠️ Changed Entitas Asset Store package structure by separating Desperate Devs dlls into their own folder -Please run `jenny auto-import -s` or modify `Preferences.properties` to update the paths to the plugins if necessary - - -### Entitas -🛠 Added support to remove event listeners within event callback #698 - -⚠️ Improved Entitas Event API `[Event(bool)]` #717 -Use "find and replace" to update all your EventAttribute usages -`[Event(true)]` is now `[Event(EventTarget.Self)]` -`[Event(false)]` is now `[Event(EventTarget.Any)]` - -⚙️ Added support for `[DontDrawComponent]` for all components #678 -💄 Updated comments for `group.RemoveAllEventHandlers()` #684 -🛠 Fixed check for updates - - -### DesperateDevs -⚙️ Updated `TargetFrameworkProfilePreProcessor` #721 -🛠 Added `str.ToUnixPath()` - - -# 1.5.2 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Entitas -🛠 Fixed EventSystemsGenerator generated EventSystems per context but those systems contained EventSystems from all context - -### DesperateDevs -🛠 Added TcpMessageParser to reliably receive separate messages from a tcp stream - - - -# 1.5.1 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### DesperateDevs -⚙️ Added better error message to EnsureStandalonePreProcessor - -When EnsureStandalonePreProcessor is activated it will prevent you from accidentally generating in Unity. -To generate in Unity make sure EnsureStandalonePreProcessor is not activated. - - -# 1.5.0 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Entitas -🆕 Added JobSystem for multi threading as a proof of concept. - -```csharp -public sealed class RotateSystem : JobSystem { - - public RotateSystem(GameContext context, int threads) : - base(context.GetGroup(GameMatcher.AllOf(GameMatcher.Rotation, GameMatcher.RotationVector)), threads) { - } - - protected override void Execute(GameEntity entity) { - entity.rotation.value = entity.rotation.value * Quaternion.Euler(entity.rotationVector.value); - } -} -``` - -Limitations: -- Don't use generated methods like Add() and Replace() -- Modify component values directly -See https://github.com/sschmid/Entitas/issues/325#issuecomment-373961878 - -This is not a general purpose solution for all problems. It can be used to solve certain performance intense areas in your game. It can be very useful if there's a very large number of entities that have to be processed, or if the data transformation involves heavy calulations. - -⚠️ EventSystemsGenerator generates EventSystems per context now. -🛠 Removed dependency on Entitas.CodeGeneration.Plugins from Entitas.VisualDebugging.Unity.Editor #312 - -### DesperateDevs -🆕 Added EnsureStandalonePreProcessor to prevent accidentally generating in Unity - - -# 1.4.2 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -This is a hotfix release to patch the bugs introduced by the code generator refactoring from 1.4.0. - -### Entitas -🛠 Fixed needing to generate code twice to when event got removed #620 -⚙️ Added group.AsEnumerable() to support linq -⚙️ Added partial keyword to ComponentEntityApiInterfaceGenerator #607 -⚙️ Changed EntityLink exception to be a warning -⚙️ ComponentData can clone CodeGeneratorData - -### Jenny -🆕 Added ValidateProjectPathPreProcessor #572 #563 - -### DesperateDevs -⚙️ Added logger.Reset() - - -# 1.4.1 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -This is a hotfix release to patch the bugs introduced by the code generator refactoring from 1.4.0. - -### Entitas -🛠 Fixed component name generation for EventType.Removed #631 (thanks to @hegi25) - -### Jenny -🛠 Fixed jenny "Collection was modified; enumeration operation may not execute." #628 -🛠 Fixed jenny "Index was outside the bounds of the array." #628 - - - -# 1.4.0 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -Breaking changes are marked with ⚠️️ - -### Entitas -🆕 Added group.GetEntities(buffer) #624 -🆕 Made group iteration alloc free #624 -⚙️ Added support for multiple events per component -⚙️ Added `removeComponentWhenEmpty` to optionally remove or keep empty listener component -🛠 Fixed accessing non existing component in generated event system for EventType.Removed -🛠 Fixed events inheriting unique attribute from component -⚠️ Removed EventType.AddedOrRemoved -💄 Refactored and simplified all code generators - -# 1.3.0 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -This update improves the new Entitas Events introduced in 1.1.0 - -Breaking changes are marked with ⚠️️ - -### Entitas -⚙️ Added support for multiple event listeners per entity -⚙️ EventInterfaceGenerator generates correct filename matching the class name. Thanks to @c0ffeeartc -⚠️️ Renamed some generators. Please use `auto-import` to update the generator names - - -# 1.2.0 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -This update improves the new Entitas Events introduced in 1.1.0 - -Breaking changes are marked with ⚠️️ - -### Entitas -⚙️ Added support for multiple contexts for events. Context prefix will be skipped if a component only has one context in favour of a nicer API -⚠️️ Passing sender entity as first argument in event delegate -🆕 Added new optional event types `EventType.Added`, `EventType.Removed`, `EventType.AddedOrRemoved` -🛠 Fixed typo `_listsners` in event generator Thanks to @FNGgames - - -### Jenny -🛠 Fixed `scan` command - - -# 1.1.0 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Entitas -🆕 Added Events aka Reactive-UI #591 -⚠️ Changed `ComponentEntityInterfaceGenerator` to generate `IXyzEntity` insetad of `IXyz` to avoid name collisions with `EventInterfaceGenerator` -⚙️ Added enum support for Code Generator Attributes -⚙️ Removed `partial` keyword from ComponentGenerator -⚙️ Removed attributes from generated components - -### Jenny -🆕 Added `Jenny-Auto-Import` scripts to reducde terminal interaction -⚙️ Added silent `-s` info to Jenny help page -⚙️ Using Console.WriteLine when prompting user input to support silent mode -⚙️ CodeGeneratorData can now be cloned - - -# 1.0.0 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Jenny -🛠 Workaround for Unity 2017.3 GUI mask bug (still shows `Mixed...` instead of `Everything` -> Unity bug) #569 - - -# 0.47.9 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Jenny -🛠 Fixed issue with Entitas.Roslyn plugin and non-components with context attibute #564 -🛠 Fixed `auto-import` not making relative search paths on Windows - -### Other -⚙️ Included readme files in zip -⚙️ Updated CONTRIBUTING.md and updated bee 🐝 - - -# 0.47.8 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Jenny -🛠 Fixed `The given assembly name or codebase was invalid` on windows #561 - - -# 0.47.7 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Jenny -🛠 Auto-Import properly handles paths with spaces #555 - - -# 0.47.6 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Jenny -- Using correct properties file for each Unity project by saving only the filename instead of full path - - -# 0.47.5 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Entitas -- Hotfix for EntityLink throwing errors OnApplicationQuit - - -# 0.47.4 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -### Entitas -- Hotfix for broken EntityLink (thanks to @c0ffeeartc for reporting so quickly) - - -# 0.47.3 - -As always, the Unity Asset Store version might take a few days to be processed -and accepted by Unity. Please check for updates in 2 - 4 days here: -https://www.assetstore.unity3d.com/#!/content/87638 - -See and discuss changes in [Milestone 0.47.3](https://github.com/sschmid/Entitas/milestone/17?closed=1) - -(Finally went back to Milestone development :) Transparency FTW!) - -### Entitas -- EntityLink will immediately throw an exception if the gameObject is destroyed but still linked to an entity #470 -- Fixed VisualDebugging Toggle in the Entitas Preferences Window #540 - -### Jenny -- Even more support for multiple properties, see #550 - - -# 0.47.2 - -As always, the Unity Asset Store version might take a few days to be processed and accepted by Unity. -Please check for updates in 2 - 4 days here: https://www.assetstore.unity3d.com/#!/content/87638 - -Here's another update to improve the code generator experience. Thanks again for all your great feedback! -And thanks for going through this with me :) We're almost there! - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas -- Added migration 0.47.2 - -### Jenny -- Added silent mode for `jenny fix` to simplify `jenny auto-import` experience. Use `-s`, e.g `jenny auto-import -s` -- Added a potential fix for `jenny client gen` command never completes #546 -- Renamed keys from `CodeGenerator.*` to `Jenny.*`. Please apply migration 0.47.2 -- Added support to run CLI from any location -- Warning when no properties found -- Removed leading "./" from added searchPaths added by `jenny auto-import` -- The Roslyn foundation moved to DesperateDevs -- Using the latest Roslyn libs - -### Other -- Entitas project cleanup and maintenance -- Added more automation tasks to bee 🐝 - -# 0.47.1 - -As always, the Unity Asset Store version might take a few days to be processed and accepted by Unity. -Please check for updates in 2 - 4 days here: https://www.assetstore.unity3d.com/#!/content/87638 - -### Jenny -- Handling BadImageFormatException -- Not showing warnings for unresolved assemblies anymore -- Fixed closing AssemblyResolver before all plugin dependencies were loaded -- Fixed jenny server construction not complete before executing client command - - -# 0.47.0 - -### General -- Brand new build automation workflow (bee 🐝) -- Completely automated build, sync and release flow for faster future updates (bzzz 🐝) -- Only Entitas.zip is attached to GitHub releases -- Jenny CLI is only bundled in Asset Store version -- Added Assets folder to Entitas.zip #535 -- More flexible plugin-based CLI architecture - -### Jenny -- Unity support for multiple properties files by adding switch button to Entitas Preferences in case multiple properties files exist #536 -- Better CLI support for multiple properties files by showing a warning in case multiple properties files exist #536 -- Fixes for server / client errors (ObjectDisposedException) #529 -- Renamed key `CodeGenerator.CLI.Ignore.UnusedKeys` to `Ignore.Keys` -- `auto-import` reflects assemblies and sets plugins based on content instead of name -- `auto-import` automatically detects custom plugins in Unity project without manually setting up searchPaths -- Added visual lines to `dump` -- Renamed `ICodeGeneratorBase` to `ICodeGenerationPlugin` -- Fixed `IConfigurable` commands not getting configured -- Added minified properties support - -### Asset Store -- Fix for NullReferenceException (Entitas.Roslyn.SymbolExtension.ToCompilableString) #534 -- Support for WrapperComponent #532 - -# 0.46.3 - -As always, the Unity Asset Store version might take a few days to be processed and accepted by Unity. -Please check for updates in 2 - 4 days. - -### Code Generation -- Added `IPreProcessor` -- Added TargetFrameworkProfilePreProcessor -- Fixed problems with Roslyn Generator and Visual Studio on Windows #503 - - -# 0.46.2 - -As always, the Unity Asset Store version might take a few days to be processed and accepted by Unity. -Please check for updates in 2 - 4 days. - -### Code Generation -- Added `IDoctor` for custom diagnosis and custom symptoms treatment :) Will help improving the - code generator setup experience that is aimimg for a one-click setup -- Implemented IDoctor for ComponentDataProvider, EntityIndexDataProvider and DebugLogPostProcessor -- Removed `isEnabledByDefault`from all plugins - -### TCPezy -- ResolveHost returns IPv4 address to fix issue with server / client mode on windows - - -# 0.46.1 - -As always, the Unity Asset Store version might take a few days to be processed and accepted by Unity. -Please check for updates in 2 - 4 days. - -### Entitas.VisualDebugging.CodeGeneration.Plugins -- Added deep device profiling support to generated Feature class #497 - -### Unity -- Added buttons to generate DefaultInstanceDrawer and TypeDrawer -- Added deep device profiling toggle to Entitas Preferences - -Entitas - Deep Device Profiling - - -# 0.46.0 - -As always, the Unity Asset Store version might take a few days to be processed and accepted by Unity. -Please check for updates in 2 - 4 days. - -This release is a maintenance release as announced here: - -https://github.com/sschmid/Entitas/issues/508 - -As the project got more mature the Entitas repository not only contained the ECS core but also a few other -modules like Logging, Serialization, Networking, Code Generator, Common Utils and more. -The goal of this refactoring was to extract reusable modules and increase the focus of the Entitas repository -on ECS. Reusable modules have been successfully extracted to their own standalone projects. Overall, with the -increased focus that is achieved by having standalone projects I expect the quality to raise, too. This is -generally the case when you have reusable code that is battle tested in multiple different scenarios. - -As mentioned in #508 those projects all have the `DesperateDevs` namespace. You maybe already know about -Desperate Devs because of the new YouTube channel where I will upload more and more Video on ECS, -best practices and Software Architecture. Subscribe if you don't want to miss future videos. - -https://www.youtube.com/channel/UC2q7q7tcrwWHu5GSGyt_JEQ - -As a result of this refactoring I was able to remove a lot of noise from the Entitas repository and I could -easily fix platform depended bugs without any distraction. - -entitas-desperatedevs - -Entitas will benefit from having the Desperate Devs dependencies as it enforces modularity and reusability. -Additionally, it will be possible to use awesome tools like TCPezy (DesperateDev.Networking) and Jenny (DesperateDevs.CodeGeneration) independently. - - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Obsolete notice -- Removed methods marked obsolete in 0.42.0 from April 2017 -- Blueprints are now completely removed from the zip files (sources still available) - -### Preferences -- Showing properties name in Edit Button - -### Jenny (aka Code Generator) -- CodeGeneratorPreferencesDrawer will keep unavailable plugins #496 -- Added Display Dialog for auto import -- Added a secret and hidden cli command, can you find it? ❤️ - -### TCPezy (aka entitas server) -- Fixed Unhandled Exception (appeared on Windows only) #489 - -### Other -- Changed language level of all projects to C# 4.0 -- Deleted CodeGenerator Unity Test project - - -# 0.45.1 - -As always, the Unity Asset Store version might take a few days to be processed and accepted by Unity. -Please check for updates in 2 - 4 days. - -### CodeGenerator -- Added Auto Import Button to Entitas Preferences. This will detect plugins and automatically set them in Entitas.properties - - -# 0.45.0 - -Thanks for the feedback on the new code generator so far. This update contains a lot of great improvments. -As always, the Unity Asset Store version might take a few days to be processed and accepted by Unity. -Please check for updates in 2 - 4 days. - - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - - -### Entitas -- Fixed flag components increasing the componentPool stack #445 -- Logging all retained entities in ContextStillHasRetainedEntitiesException #448 -- Added support for multiple indexed members per component #464 - -``` -public sealed class MyComponent : IComponent { - - // Multiple fields are now supported - - [EntityIndex] - public int value; - - [EntityIndex] - public int otherValue; -} - -// will generate -context.GetEntitiesWithMyValue(...); -context.GetEntitiesWithMyOtherValue(...); -``` - - -### CodeGenerator -- Displaying more prominent popup in Unity when trying to generate with compile errors #463 - -![entitas-codegenerator-compileerrorpopup](https://user-images.githubusercontent.com/233700/32519395-e8dccbdc-c40c-11e7-8a6c-08f176b23244.png) - -- AssemblyResolver won't append dll to exe extension -- Changed code generator keys and removed default values -- Changed code generator cli keys and removed default values -- Added auto-import command. Use `entitas auto-import` to automatically populate Entitas.properties -- `entitas status` command will detect potential collisions, e.g. duplicate providers from the default plugins and the roslyn plugins -- `entitas fix` can resolve plugin collisions -- `entitas fix` command will tell you to press any key -- Removed `-a` keepAlive in favour of `entitas server` and `entitas client` -- Fixed client only sending first command to server #482 -- Default Plugins are now in folder called Entitas -- Refactored all commands and simplified many utils methods -- `Entitas.exe` now with capital E - - -### Roslyn -- Added custom support for multi-dimensional arrays types like `int[,,]` #481 -Let me know if more types need custom support. - -### Migration -- Added migration for 0.45.0 - - -# 0.44.0 - -As always, the Unity Asset Store version might take a few days to be processed and accepted by Unity. -Please check for updates in 2 - 4 days. - -### Unity CodeGenerator -- Added new menu item which connects to an external code generator server instance - -### CodeGenerator CLI -- Added server command -- Added client command -- Added startCodeGenerator files for macOS and Windows - -### Example -Start the code generator server by double clicking `startCodeGenerator` on macOS or `startCodeGenerator.bat` on Windows, or use the terminal - -``` -$ mono CodeGenerator/entitas.exe server -``` - -You can now either use the new Unity menu item `Tools/Entitas/Generate with external Code Generator` -which connects to a running server and sends the `gen` command or connect yourself like this - -``` -$ mono CodeGenerator/entitas.exe client gen -``` - -This will connect to a running server and send the `gen` command. This is useful if you want to add your own custom commands -in your IDE like Visual Studio or Rider (or others). - -Using the code generator server and client is optional but can greatly improve your workflow and -can drastically reduce the overhead of generating new files. - - -# 0.43.0 - -As always, the Unity Asset Store version might take a few days to be processed and accepted by Unity. -Please check for updates in 2 - 4 days. - -### Breaking changes -The new code generator is part of `Entitas.Roslyn`. The Roslyn Plugins are now called `Entitas.Roslyn.CodeGeneration.Plugins`. If you already tested the new code generator beta, please update Entitas.properties -- `Entitas.Roslyn.CodeGeneration.Plugins` -- `Entitas.Roslyn.CodeGeneration.Plugins.ComponentDataProvider` -- `Entitas.Roslyn.CodeGeneration.Plugins.EntityIndexDataProvider` - -New mandatory keys have been added to Entitas.properties. You can automatically add them by running `entitas fix` - -### CodeGenerator -- Added `ICodeGeneratorCachable` to cache and share objects between multiple plugins to avoid redundant calculations -- Using the objectCache to share the AssemblyResolver between all plugins -- Added CodeGenerator to default searchPaths -- Added Unity menu item to generate with CLI - -entitas-unity-cli - -### CodeGenerator CLI -- Updated New command to use preferences -- Added CLIConfig with new key `Entitas.CodeGeneration.CodeGenerator.CLI.Ignore.UnusedKeys` to add keys that should be ignored when running `entitas status` or `entitas doctor`. You can automatically ignore keys by pressing `i` - -entitas-cli-ignoreunusedkeys - -- Added support for custom properties files. Each command optionally accepts a path to a properties file. This way you can have multiple different configs how to run the code generator, e.g. one with the reflection-based code generator and one with the roslyn code generator. - -```csharp -entitas gen My.properties -``` -- Pretty CLI - -### Unity -- Added Edit Button to Entitas Preferences - -entitas-preferences-editbutton - -### Asset Store Version -- Changed project structure. The Plugins are now called `Entitas.Roslyn.CodeGeneration.Plugins` -- Using the objectCache to share the ProjectParser between all plugins which speeds up the code generation process -- Updated all packages to latest version and downgraded all projects from .NET 4.6.1 to .NET 4.6 -- Added more dependencies to remove warnings when running `entitas doctor` or `entitas gen` - -entitas-roslyn-nowarnings - - -# 0.42.5 - -### General -- Refactored Preferences to fully embrace Entitas.properties and User.properties - -### CodeGenerator CLI -- Added format command -- keepAlive argument which will keep the process alive. This is very useful when using the new roslyn code generator to avoid reloading the whole parsing infrastructure. Using this argument ith roslyn results in super fast generation time - -```csharp -$ entitas gen -a -``` - - -# 0.42.4 - -### Notes -Entitas development is back on track again and the wait is over. This is probably one of the last updates before Entitas reaches 1.0.0. -This verion has been tested successfully in combination with the new code generator that will work even when the code is not compiling. - -### General -- Added support for User.properties. You can now either overwrite values sepcified in Entitas.properties or use placeholders - -Create a new file called User.properties and specify the keys and values that should be overwritten. -You can also specify placeholers like this `${myPlaceholder}` and specify the key either in Entitas.properties or User.properties. -see: [Match One - Entitas.properties](https://github.com/sschmid/Match-One/blob/master/Entitas.properties) -see: [Match One - User.properties](https://github.com/sschmid/Match-One/blob/master/User.properties) - -### Entitas -- Groups are now enumerable to iterate over groups circumventing the internal caching and potentially reducing memory allocations #408 - -```csharp -foreach (var e in group) { - // Look closely: no group.GetEntities() -} -``` - -### CodeGenerator CLI -- Added commands add, set, remove, dump - -### VisualDebugging -- Fixed Entitas Stats not ignoring built-in MultiReactiveSystem in systems count -- VisualDebugging only lets you add components that the entity doesn't already have -- GUI fixes - -### Other -- Properties are now formatted by default for better readability -- Ensuring dependencies in build scripts - - -# 0.42.3 - -Hotfix release for -- Fix Code Generation NullReferenceException in Unity 2017 #414 - - -# 0.42.2 - -See and discuss changes in [Milestone 0.42.2](https://github.com/sschmid/Entitas/milestone/16) - -### CodeGenerator -- Fix Code Generation NullReferenceException in Unity 2017 #414 -- EntityIndexGenerator is sorting entity indices -- CodeGenerator fix command runs recursively #409 -- Code Generator CLI maintenance - -### VisualDebugging -- Update EntityDrawer to draw correct object type #399 #406 - - -# 0.42.1 - -## Top new features: -Added missing support for flag components in ComponentEntityInterfaceGenerator - -### General -- CodeGenerator CLI + Plugins are now included in zips and not deployed as separate zips - -### CodeGenerator -- Added support for flag components in ComponentEntityInterfaceGenerator -- Removed GameState from default contexts. Defaults are now Game and Input - - -# 0.42.0 - -See and discuss changes in [Milestone 0.42.0](https://github.com/sschmid/Entitas/milestone/15) - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -- Removed Entitas.Blueprints.Unity.* -- Changed ReactiveSystem.GetTrigger method signature -- Marked obsolete: `context.DestroyEntity(entity)`. Use `entity.Destroy()` instead -- Marked obsolete: `context.CreateCollector(matcher, event)`, use new `context.CreateCollector(triggerOnEvent)` when you need `.Removed` or `.AddedOrRemoved` (e.g. GameMatcher.View.Removed()) - -## Top new features: -- Use MultiReactiveSystem to process entities from different contexts in one system (see [Test Example](https://github.com/sschmid/Entitas/blob/develop/Tests/Unity/VisualDebugging/Assets/Examples/VisualDebugging/Systems/SomeMultiReactiveSystem.cs)) -- Use `entity.Destroy()` instead of `context.DestroyEntity(entity)` -- Unit Testing in external console works on Windows now - -### General -- Moved Entitas menu item under the Tools tab -- Removed Entitas.Blueprints.Unity.* from zips -- Creating new zip for code generator default plugins -- UX improvements - -### Entitas -- Added MultiReactiveSystem to support reactive systems observing different contexts #303 -- Added TriggerOnEvent -- Renamed `entity.Destroy()` to `entity.InternalDestroy()` to reduce confusion -- Added `entity.Destroy()` instead of `context.DestroyEntity(entity)` #254 - -### CodeGenerator -- Added ComponentEntityInterfaceGenerator #303 -- Updated ContextObserverGenerator to avoid `System.Security.SecurityException` on Windows #375 -- .ToSafeDirectory() supports empty string and “.” to specify current directory - - -# 0.41.2 - -After installing please check your Entitas.properties. Due to the addition of `IConfigurable` for code generator plugins -some keys in Entitas.properties changed. `entitas.exe doctor`, `entitas.exe status` and `entitas.exe fix` can help you -fixing any issues. A new default Entitas.properties file will be created if none is found. The default Entitas.properties -should work with Unity without modification. For reference take a look at [Match-One - Entitas.properties](https://github.com/sschmid/Match-One/blob/master/Entitas.properties) - -Exiting limitation mentioned in the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) still apply (Entitas.Blueprints.CodeGeneration.Plugins is not supported in the code generator CLI) - -## Top new features: -- UpdateCSProjPostProcessor will update your project.csproj. Generated methods are available immediately without switching to Unity and waiting for the project to be updated. This feels even better when using the new code generator (roslyn coming soon) where you don't even have to compile your project anymore - super fast feedback loops! -- Better out-of-the-box experience when starting a new Unity project. Everything will work without any manual setup. Just generate :) -- Great code generator CLI experience with helpful commands like `status` and `fix` which will let you modify Entitas.properties interactively -- Logo refinements based on magic numbers (1.618 - golden ratio) :D - -### CodeGenerator -- Added `IConfigurable` interface to easily create customizable and configurable code generator plugins -- Fixed `ignoreNamespaces` by using the new `IConfigurable` #376 -- Added UpdateCSProjPostProcessor which updates project.csproj so you don't need to wait for Unity to update your project -- Greatly improved the code generator CLI. `status` and `fix` command will help you a lot to spot and fix problems in Entitas.properties -- Added `Compile.cs` to ensure `Assembly-CSharp.dll` in Unity -- CodeGenFile converts to unix line endings when setting fileContent #352 -- Added progress indicator to code generator CLI when running with `-v` in verbose mode -- Added multiple smaller sub configs for TargetDirectory, ContextNames, Assemblies, ProjectPath, IgnoreNamespaces -- Placeholder `${myPlaceHolder}` in properties will remain even when overwriting -- Caching AssemblyResolver - -### VisualDebugging -- Drawing generic text labels for configurables found in Entitas.properties -- Better error handling when Entitas.properties has problems - -### General -- Refined logo. More pleasant to the eye and more readable in smaller icons - - -# 0.41.1 - -See and discuss changes in [Milestone 0.41.1](https://github.com/sschmid/Entitas/milestone/14) - -### CodeGenerator -- Added ContextMatcherGenerator #358 #358 @marczaku - -```csharp -// instead of -Matcher.AllOf(GameMatcher.Position, GameMatcher.View); - -// you can write -GameMatcher.AllOf(GameMatcher.Position, GameMatcher.View); -``` - -- Added option to ignore namespace in generated api - - Simply add `Entitas.CodeGeneration.Plugins.IgnoreNamespaces = true` to your Entitas.properties - - You can run `entitas status` to see if any plugins require additional keys - -``` -$ entitas status -Missing key: Entitas.CodeGeneration.Plugins.IgnoreNamespaces -``` - -- Added `IConfigurable` to support optional keys needed in Entitas.properties - -### Other -- Added properties.ToDictionary() - - -# 0.41.0 - -See and discuss changes in [Milestone 0.41.0](https://github.com/sschmid/Entitas/milestone/13) - -This milestone paves the way for a more customizable version of Entitas. A streamlined and modular project structure enables -deploying Entitas as Dlls which opens the door for 3rd party Addons and the extendable command line code generator. - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -- Renamed Entitas.properties config keys -- Removed context.DeactivateAndRemoveEntityIndices() -- Removed context.ClearGroups() -- New namespaces as a consequence of project restructuring - -### General -- Project restructuring. All Entitas projects are now in Entitas.sln, including all Addons and Unity projects -- Deploying Entitas as Dlls instead of source code which has multiple benefits, e.g. - - Entitas Unity menu appears even if code doesn't compile - - Enables 3rd party Addons and Plugins - - Enables command line code generator - -### Entitas -- Extracted Automatic Entity Reference Counting (AERC) as a strategy which can be set per context -- Better exception handling for Entitas.properties config -- Renamed config keys -- Removed context.DeactivateAndRemoveEntityIndices() -- Removed context.ClearGroups() - -### CodeGenerator -- Added command line code generator #158 #353 - - Unsupported Plugins: Entitas.Blueprints.CodeGeneration.Plugins, Entitas.CodeGeneration.Unity.Editor -- ContextObserverGenerator puts VisualDebugging in try-catch to support Unit Testing #362 -- Added FeatureClassGenerator and removed Feature class from Entitas to support conditional compilation with `#if UNITY_EDITOR` -- Added MethodData instead of using System.Reflection.MethodInfo -- Added CleanTargetDirectoryPostProcessor - -### VisualDebugging -- Removed Feature class -- UX improvements -- Better exception handling for Entitas.properties config - - -# 0.40.0 - -See and discuss changes in [Milestone 0.40.0](https://github.com/sschmid/Entitas/milestone/12) - -### Note -Please update Entitas.properties by opening Entitas Preferences. Added `assemblyPath` and `codeGeneratorAssemblyPath` -to code generator config. When not selected already, navigate to `Library/ScriptAssemblies/` in your Unity project -and select `Assembly-CSharp.dll` for the assembly and `Assembly-CSharp-Editor.dll` for the code generator assembly. - -### Entitas.CodeGenerator -- Add ConsoleWriteLinePostProcessor #342 -- Make EntitasPreferences.CONFIG_PATH public field in order to customize the path to the config file #342 -- Add CodeGeneratorUtil to simplify creating an instance based on Entitas.properties -- Add `assemblyPath` and `codeGeneratorAssemblyPath` to code generator config - -### Entitas.Unity.VisualDebugging -- Added SystemWarningThreshold to visualize slow systems -- Tinting slow systems red -- Systems list unfolded by default - - -# 0.39.2 - -See and discuss changes in [Milestone 0.39.2](https://github.com/sschmid/Entitas/milestone/11) - -### Entitas -- Optimize group update performance for component add/remove #321 -- Ignore indexed properties in PublicMemberInfo #339 -- More explicit EntityIndex.ToString() -- More explicit EntityLink.ToString() - -### Entitas.Unity.VisualDebugging -- Automatically draw types. No TypeDrawers #327 - - -# 0.39.1 - -See and discuss changes in [Milestone 0.39.1](https://github.com/sschmid/Entitas/milestone/10) - -### Entitas -- Added `entityIndex.ToString()` with name #329 - -### Entitas.CodeGenerator -- Add ContextObserverGenerator #337 -- Simplified EntityIndexGenerator getKey - -### Entitas.Unity.VisualDebugging -- Optimize DebugSystemsInspector #338 - -### Entitas.Unity.Blueprints -- Blueprints not persistent after changes to components. #331 - - -# 0.39.0 - -See and discuss changes in [Milestone 0.39.0](https://github.com/sschmid/Entitas/milestone/9) - -### Entitas -- Added `entityIndex.ToString()` with name #329 - -### Entitas.CodeGenerator -- Add `contexts.Reset()` (#317) -- Removed ComponentDataProvider without namespace #323 -- Don't generate EntityIndex when not specified #326 -- Cache static component index lookup into local var #316 -- Review and check for namespace awareness #328 - - -# 0.38.0 - -See and discuss changes in [Milestone 0.38.0](https://github.com/sschmid/Entitas/milestone/8) - -This seems to be the release of enhancements! Lots of useful improvments and features have been added to -increase productivity and ease of use. - -### Breaking changes -- Removed HideInBlueprintsInspector (#270 #306) -- Changed interface `ITypeDrawer` -- Added Contexts constructor (#286) - -# Entitas -- Using ToString on subclassed components, too (#290) -- Fixed cached entity ToString() wasn’t updated when calling entity.Release() -- Fixed typo `TEntitiy` to `TEntity`(#291) - -# Entitas.Unity -- Simplified DrawTexture -- Refactored EntitasLayout - -# Entitas.CodeGenerator -- Generating Entity Indices (#75 #319) -- Added priority to ICodeGenFilePostProcessor -- Move logic to DebugLogPostProcessor to speed up code generation -- Added MergeFilesPostProcessor (#301) -- Added Contexts constructor (#286) -- Added default context (#288) -- Using MemberData instead of PublicMemberInfo in DataProviders (#280) -- Added progess report to code generator - -# Entitas.Unity.CodeGenerator -- Added cancellable progess bar when generating - -# Entitas.Unity.VisualDebugging -- Redesigned Entitas Preferences Window -- Redesigned DebugSystemsInspector -- Redesigned Type Drawers -- Added component member search (#298) -- Added search field to DictionaryTypeDrawer (#299) -- Better UX, better Buttons -- Entitaslayout.SearchTextField won’t affect GUI.change -- Fixed Hashset changes didn’t replace component -- Added `context.FindContextObserver()` for getting ContextObserver (#295) -- Added default constructor to Feature class (#293) -- Added Entitas Stats Dialog -- EntityDrawer will use pooled components -- Simplified EntityDrawer and TypeDrawers -- Removed TypeEqualityComparer (#289) -- Drawing public fields of unsupported types -- Updated code templates for TypeDrawer and DefaultInstanceCreators (#297) - -# Entitas.Unity.Migration -- Redesigned Entitas Migration Window - -# General -- Using HD header textures - - -# 0.37.0 - -See and discuss changes in [Milestone 0.37.0](https://github.com/sschmid/Entitas/milestone/7) - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -The deed is done. Entitas went type-safe! This was a huge task and I'm happy to finally share this with you guys! -This feature makes Entitas safer and more managable in growing code bases and will eliminate certain kind of bugs. Thanks to @mstrchrstphr -for starting the conversation and proposing solutions. - -### Entitas -- Entitas went type-safe! (#257 #266) -- Entity API doesn't return Entity anymore (e.g. e.AddComponent()) -- Fixed matchers not recalculating hash when changed -- Added EntityIndex support for multiple keys (#279 #281) -- Removed as many virtual keywords as possible - -### Entitas.CodeGenerator -- Entitas went type-safe! (#257 #266) -- Rewrote code generator architecture (#265 #274 #275) -- ComponentsGenerator doesn't generate `e.IsMoveble(value)`. Only `e.isMoveble = value` -- ComponentsGenerator Entity API doesn't return Entity anymore (e.g. e.AddPosition()) -- Added additional ComponentGenerator which respects namespaces (#274) - -### Entitas.Blueprints -- Entitas went type-safe! (#257 #266) - -### Entitas.Migration -- Automatically embedding all migrations to Entitas.Migration.exe - -### Entitas.Unity.Codegenerator -- Added sloc (Source Lines Of Code) and loc (Lines Of Code) info - -### Entitas.Unity.VisualDebugging -- Entitas went type-safe! (#257 #266) -- Added EntityLink (#271) -- Prettier search fields that support multiple search strings - -### Other -- New folder structure with Entitas as the core and everything else as Addons -- Complete reorganization of the project structure (more modular and easier to reason about) - - -# 0.36.0 - -See and discuss changes in [Milestone 0.36.0](https://github.com/sschmid/Entitas/milestone/6) - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas -- Removed pool.CreateSystem() (#233 #237) -- Removed `IEnsureComponents`, `IExcludeComponents`, `ISetPools`, `ISetPool`, `IReactiveSystem`, `IMultiReactiveSystem`, `IEntityCollectorSystem` -- Changed the ReactiveSystem to be an abstract class instead of `IReactiveSystem`. You need to override `GetTrigger`, `Filter` and `Execute`. -This enables filtering entities based on component values (#234) -- Renamed the term Pool to Context (#99 #250) -- Renamed `EntityCollector` to `Collector` (#252 #253) -- Renamed `GroupEventType` to `GroupEvent` and removed the prefix `OnEntity` -- entity.ToString uses component.ToString(). Override ToString() in your components -to get a nice description, e.g. `Health(42)` (#203 #196) - -### Entitas.CodeGenerator -- Removed OldPoolsGenerator -- Fixed code generator line ending for header - -### Entitas.Unity.VisualDebugging -- Improved VisualDebugging performance by reusing StringBuilders -- Added support for `ICleanupSystem` and `ITearDownSystem` -- Changed SystemsMonitor.axisRounding to 1 -- Fix error when turning visual debugging on/off in Unity 5.4 or newer (#222) -- Changed default blueprint creation location (#206 #248) - -### Other -- Simplified build pipeline - - -# 0.35.0 - -See and discuss changes in [Milestone 0.35.0](https://github.com/sschmid/Entitas/milestone/5) - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas -- Fixed adding disabled entities to groups (#192, #193) -- Removed matcher with filter (#194, #195) - -### Other -- Maintenance, cleanup and formatting -- Completely new build system to create new releases - - -# 0.34.0 - -See and discuss changes in [Milestone 0.34.0](https://github.com/sschmid/Entitas/milestone/4) - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas -- Added api to clone entities (#178, #182) - - `pool.CloneEntity(e);` - - `entity.CopyTo(target);` - -- Added EntityIndex constructor with EqualityComparer (#170, #186) -- Rename GroupObserver to EntityCollector (#168, #188) -- Added filter condition to matchers (#165, #189) - - `Matcher.Position.Where(e => e.position.x > 10);` - -### Entitas.Serialization.Blueprints -- Added HideInBlueprintInspectorAttribute (#185) - -### Other -- Improved snippets -- Added Visual Studio snippets (#172) -- Added TestRunner to support test debugging (#175, #176) -- Updated build scripts (#173, #177) -- Added tests for code formatting - - -# 0.33.0 - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas -- Added pools.CreateSystem() -- Added ObjectPool and ObjectCache and updated EntitasCache to use ObjectCache (#157) -- Added entityIndex.Activate() and removing entity indices from pool (#163) -- Renamed IDeinitializeSystem to ITearDownSystem (#164) - -### Entitas.CodeGenerator -- TypeReflectionProvider sorts pool names and ToUppercaseFirst() (#155) -- CodeGeneratorConfig doesn't add default pool anymore (#156) - -### Other -- Added repository icon -- Added snippets (see Snippets folder) - - -# 0.32.0 - -Summer break is over! Entitas development is back on track! -Thanks all of you guys for using and contributing to Entitas. -This release is packed with improvements from all of you, thanks for that! - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### General -- Lots of maintenance, refactoring, documentation and cleanup. Checked every class and every test ;) -- Removed unused usings (#134 @thematthopkins ) -- Added script to generate docset and included it in build script (#141 @mstrchrstphr) -- Updated policy.mdpolicy to support latest Xamarin Studio -- Fixed inconsistent Line endings (#116 @ParagonFable) - -### Entitas -- Added new `Pools` class. There is no static Pools anymore but an instance. -- Added `ISetPools` to inject the shared pools instance -- Removed `pool.CreateSystem()` and `pool.CreateSystem(Type type)` (Apply migration 0.32.0) -- Fixed `pool.CreateSystem()` not creating a ReactiveSystem for IGroupObserverSystem -- Added `EntityIndex` (#154) -- `pool.Reset()` removes all event handlers -- Fixed retain / release didn't update entity toString cache -- Added `EntitasCache` for object pooling of collections to reduce memory allocations -- Updated Entity, Matcher and Pool to use EntitasCache (less garbage :heart:) -- Added `ICleanupSystem` -- Added `IDeinitializeSystem` -- Pushing removed component to component pool after dispatching event - -### Entitas.CodeGenerator -- Fixed ComponentIndicesGenerator with multiple pools (#124) -- CodeGeneratorConfig will add default pool -- Fixed pools order if default pool exists - -### Entitas.Unity.CodeGenerator -- CodeGenerator Preferences is using MaskField instead of Toggles now - -### Entitas.Unity.VisualDebugging -- Less editor repaints for DebugSystemsInspector to improve performance -- Fixed system stats (Log stats) not ignoring Feature class -- Add ITypeDrawer for doubles (#132 @bddckr) -- Added support for enum masks (#132 @bddckr) -- Adjusted foldout spacing in custom inspector (#149 @ByteSheep) - -### Other -- Updated keys for Entitas.properties and moved files from Entitas.Unity to Entitas.Serialization.Configuration -- Moved Properties from Entitas.Unity to Entitas.Serialization - - -# 0.31.2 - -### Entitas.CodeGenerator -- All attributes can now be used for classes, interfaces and structs - - -# 0.31.1 - -### Entitas.CodeGenerator -- Improved component generation for classes and interfaces and added support for default pool [Pool] -- Added support to CustomComponentNameAttribute to generate multiple components with different names for one class or interface - -```csharp -// This will automatically generate PositionComponent and VelocityComponent for you -[Pool, CustomComponentName("Position", "Velocity")] -public struct IntVector2 { - public int x; - public int y; -} -``` - -- Added support for generating components for structs -- Not generating obsolete pool attributes for generated classes - - -# 0.31.0 - -### General -- Removed obsolete code - -### Entitas.CodeGenerator -- Generating components for attributed classes and interfaces - -```csharp -// will automatically generate SomeClassComponent for you -[Core] -public class SomeClass { - public string name; - - public SomeClass(string name) { - this.name = name; - } -} -``` - -- Added support to add empty PoolAttribute to assign component to default pool - -```csharp -// using [Pool] will also add this component to Pools.pool -[Core, Pool] -public class SomeComponent : IComponent { -} -``` - -### Entitas.Unity.VisualDebugging -- Added IComponentDrawer which can draw the whole component -- Added EntitasEntityErrorHierarchyIcon to indicate retained entities in the hierarchy -- Added CharTypeDrawer -- Fixed components not updating in the inspector (#107) -- Improved SystemsMonitor and added average line - -![Entitas-SystemsMonitor](https://cloud.githubusercontent.com/assets/233700/15198441/a515d764-17d7-11e6-965c-83c027fa89f7.png) - -### Entitas.Unity.Serialization.Blueprints -- Fixed finding all BinaryBlueprints even when not loaded -- Correctly saving Blueprints when setting all BinaryBlueprints -- Added BlueprintsNotFoundException -- BinaryBlueprintInspector creates new pools instead of using one of Pools.allPools -- Fixed pool not shown when entering play-mode while a blueprint was selected in the project view -- Not caching blueprints when UNITY_EDITOR to enable live edit - -# 0.30.3 - -### Entitas.CodeGenerator -- Added support for whitespace, '-' and braces in blueprint names - -### Entitas.Unity.Serialization.Blueprints -- Blueprints.FindAllBlueprints orders all blueprints by name -- Fixed pool not shown in hierarchy - - -# 0.30.2 - -### Note -This release introduces Blueprints for Entitas (Beta). Update if you want to -use and play with Blueprints. [Read more...](https://github.com/sschmid/Entitas/wiki/Blueprints-(Beta)) - -### Entitas.CodeGenerator -- Only creating PoolObserver when Application.isPlaying -- Added BlueprintsGenerator - -### Entitas.Unity.VisualDebugging -- Added more options for sorting systems in the inspector -- Removing event handlers from pool observer when leaving play-mode - -### Entitas.Serialization.Blueprints -- Added Blueprints (and more) - -### Entitas.Unity.Serialization.Blueprints -- Added BlueprintInspector (and more) - -### Other -- Moved build scripts into a folder - - -# 0.30.1 - -### Entitas.Unity.VisualDebugging -- Fixed GameObjectDestroyExtension.DestroyGameObject() compile time error (#91) -- Improved SystemsMonitor.Draw() to use correct available width even with scrollbars -- Tweaked drawing systems list -- Added EntitasPoolErrorHierarchyIcon to visualize when there are erros - -### Other -- Updated build_commands.sh to generate C# project from Unity - - -# 0.30.0 - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas -- Added IGroupObserverSystem which allows ReactiveSystems to observe multiple pools -- Added pools.CreateGroupObserver() to simplify creating a GroupObserver for multiple pools - -### Entitas.CodeGenerator -- TypeReflectionProvider ignores abstract IComponents (#88) -- Renamed ComponentsGenerator to ComponentExtensionsGenerator -- Renamed PoolAttributeGenerator to PoolAttributesGenerator - -### Entitas.Unity -- Moved Assets/Entitas.Unity to Assets/Entitas/Unity -- Simplified folder structure in Entitas-Unity.zip - -### Entitas.Unity.CodeGenerator -- Ignoring obsolete code generators -- Generate button changes size depending on generators list height - -### Entitas.Unity.VisualDebugging -- Added Feature class which inherits from Systems or DebugSystems for you, so you don't have to care anymore -- Fixed MissingReferenceException occurring occasionally when stopping game (#71) -- Added support for editing entities in EditorMode (non-playing mode) -- Fixed bug when components are added on entity creation (#87) -- Added clear buttons to search textfields -- Improved DateTimeTypeDrawer -- Added new hierarchy icons for pool and systems - -### Entitas.Migration -- Added M0300 -- Moving Entitas.Migration into Entitas/Migration/Editor when creating Entitas-Unity.zip - - -# 0.29.1 - -### Entitas.CodeGenerator -- Added missing support for components with properties -- Updated ComponentsGenerator to use entity.CreateComponent() - -### Entitas.Unity.CodeGenerator -- Added missing support for components with properties - - -# 0.29.0 - -### Obsolete -Marked old PoolMetaData constructor obsolete. If you encounter compile errors please apply Migration 0.26.0, open C# project and generate again. - -### General -- Unified Entitas sub projects into a single project -- Unified all Unity projects into a single project -- Documentation maintenance - -### Entitas -- Removing all event handler for entity.OnEntityReleased after event got dispatched -- Printing entity in EntityIsNotDestroyedException -- Added TypeExtension.ImplementsInterface() -- Added component types to PoolMetaData -- Made all methods in Systems virtual -- Added auto generated header to generated files - -``` -//------------------------------------------------------------------------------ -// -// This code was generated by Entitas.CodeGenerator.ComponentsGenerator. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ -``` - -### Entitas.CodeGenerator -- Using pool specific componentIds lookup when generating matchers for components with multiple pools -- TypeReflectionProvider ignores interfaces - -### Entitas.Serialization -- Added Entitas.Serialization -- Added PublicMemberInfo - -### Entitas.Unity.CodeGenerator -- Compile errors won't block code generation anymore -- Printing total generated file count when generating - -### Entitas.Unity.VisualDebugging -- Destroying EntityBahviour when entity got released -- Using entity component pool and providing correct previous and new component -- Added unique color for each component in EntityInspector -- Added component search field in EntityInspector - -Entitas-Component-Search - -- 'Destroy Entity' Buttons are now red -- Simplified EntityInspector and made methods static -- Unfolded components info is now shared between entities within same pool -- Added shortcuts to Entitas Preferences and Generate -- Improved TypeDrawers -- Stepper UI tweaks - -![Entitas.Unity.VisualDebugging-Systems](https://cloud.githubusercontent.com/assets/233700/13554882/9c0bd7c0-e3b3-11e5-89ec-65fa888f0a48.png) - -- Renamed 'Script Call Optimization' to 'Optimizations' -- Added EntitasEditorLayout - - -# 0.28.2 - -### Entitas -- Added ReactiveSystem destructor to prevent memory leaks -- Added GroupObserver destructor to prevent memory leaks - -### Entitas.Unity.VisualDebugging -- EntityInspector now supports dropping UnityEngine.Object into fields that are null - -![Entitas.Unity.VisualDebugging-DefaultInstanceCreator](https://cloud.githubusercontent.com/assets/233700/12884636/ea8c468c-ce5f-11e5-91a9-0fdf83de7252.png) - -- UI tweaks - - -# 0.28.1 - -### Entitas.Unity -- Added "Script Call Optimization" to Entitas Preferences Window -- Added priority to IEntitasPreferencesDrawer -- Tweaked UI - -![Entitas.Unity-ScriptCallOptimization](https://cloud.githubusercontent.com/assets/233700/12832387/e893b3ec-cb99-11e5-8ccb-d3478ca0c6dc.png) - -### Entitas.Unity.VisualDebugging -- Added toggle to Entitas Preferences to enable or disable Visual Debugging -- Tweaked UI - -![Entitas.Unity.VisualDebugging-Toggle](https://cloud.githubusercontent.com/assets/233700/12832391/ec74d2e8-cb99-11e5-87b3-f76e2e9ea58d.png) - - -# 0.28.0 - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas -- Added documentation (#55) -- Added an object pool for components (#58) -- Added pool.ClearComponentPool(index) and pool.ClearComponentPools() -- Added ENTITAS_FAST_AND_UNSAFE compiler flag. When set it will speed up e.Retain() and e.Release() (#59) - -### Entitas.CodeGenerator -- Generated component extensions are now reusing components using a component object pool when destroying entities (#58) -- Added tests for testing the logic of generated files -- Decoupling code generation logic by adding Code Generator Intermediate Format (#62) -- Added TypeReflectionProvider -- Supporting components with namespace -- Simplified linq expressions -- Removed generated systems -- The Code Generator is not depending on Entitas anymore - -### Entitas.CodeGenerator.TypeReflection -- Added Entitas.CodeGenerator.TypeReflection project - -### Entitas.Unity -- Added `keys` and `values` getter to Properties - -### Entitas.Unity.VisualDebugging -- Added system search field to DebugSystemsInspector -- UI tweaks and performance optimizations -- Fixed logging wrong system stats -- Added header image and current version label to Entitas Preferences Window - -![Entitas.Unity.Visualdebugging-preferences](https://cloud.githubusercontent.com/assets/233700/12795069/a13e5b6e-cab8-11e5-937d-870790e2bfe1.png) - -### Entitas.Unity.Migration -- Added Entitas.Unity.Migration which provides an easy way to migrate source files -- Added header image and current version label to Entitas Migration Window - -![Entitas.Unity.Migration](https://cloud.githubusercontent.com/assets/233700/12795026/6acf24b4-cab8-11e5-90e3-98a103676d50.png) - -### Other -- Removed redundant files and gitignored Entitas in all Unity projects (#63) -- Removed Unity projects from Entitas.sln -- Removed warnings - - -# 0.27.0 - -### Note -If you're using Entitas with Unity, please open the Entitas preferences and make sure that all your desired code generators are activated. Due to some code generator renamings the ComponentLookupGenerator and the ComponentsGenerator are inactive. Activate them (if desired) and generate. - -### Entitas -- Added `pool.Reset()` which clears all groups, destroys all entities and resets creationIndex - -### Entitas.CodeGenerator -- Renamed some code generators -- Added `CustomPrefixAttribute` to support custom prefixes for flag components -``` -[CustomPrefix("flag")] -public class DestroyComponent : IComponent { -} - -// default -entity.isDestroy = true; - -// with CustomPrefixAttribute -entity.flagDestroy = true; -``` - -### Entitas.Unity -- Added "Feedback" menu item to report bugs, request features, join the chat, read the wiki and donate - -### Entitas.Unity.CodeGenerator -- Removing invalid code generator names from Entitas.properties - -### Entitas.Unity.VisualDebugging -- Lots of UI tweaks -- Added toggle to sort systems by execution duration -- Added toggle to hide empty systems -- ReactiveSystems are highlighted with a white font color -- Added Clear Groups Button -- Added Entity Release Button -- Splitted systems list into initialize and execute systems and visualizing them separately -- Improved stepper UI - -### Entitas.Migration -- All migrations now contain information about on which folder they should be applied - -``` -0.26.0 - - Deactivates code to prevent compile erros - - Use on folder, where generated files are located -``` - -### Other -- Added Commands.GenerateProjectFiles and using it in build.sh -- Updated build.sh and build_commands.sh to include latest MigrationAssistant.exe - - -# 0.26.1 - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - - -# 0.26.0 - -### General -- Updated projects to Unity 5.3 -- Improved all error messages and added hints -- Changed and applied policy.mdpolicy to all sources - -### Entitas.Unity -- Moved Entitas Preferences to its own Editor Window - -![Entitas.Unity - Entitas Preferences Window](https://cloud.githubusercontent.com/assets/233700/12222689/9492611a-b7c3-11e5-880d-c4cc83c9234e.png) - -### Other -- Added runTests.bat for running test on windows (#49) -- Updated license - - -# 0.25.0 - -### Entitas -- Improved AERC performance -- Added group.RemoveAllEventHandlers() -- Added pool.ClearGroups() to remove all groups and remove all their event handlers -- Added pool.ResetCreationIndex() -- Throwing exception when there are retained entities and pool.DestroyAllEntities() is called -- Renamed entity.refCount to entity.retainCount - -### Entitas.Unity.VisualDebugging -- Fixed creating entities -- Showing warning when there are retained entities - -### Other -- Added UnityTests project with Unity Test Tools to fix a Unity specific HashSet bug - - -# 0.24.6 - -### Entitas -- Changed entity.Retain() to accept an owner object - -### Entitas.Unity.VisualDebugging -- Added VisualDebugging support for displaying owners of entities - -![Entitas.Unity.VisualDebugging-RefrenceCount](https://cloud.githubusercontent.com/assets/233700/11320810/0463033a-90a7-11e5-931b-5074b50d7e62.png) - - -# 0.24.5 - -### Entitas -- Fixed dispatching group events after all groups are updated - -### Entitas.CodeGenerator -- Supporting ENTITAS_DISABLE_VISUAL_DEBUGGING compiler flag - - -# 0.24.4 - -### Entitas -- Added entity.componentNames. This field is set by Entitas.Unity.VisualDebugging to provide better error messages -- Added matcher.componentNames. This field is set by Entitas.Unity.CodeGenerator to provide better error messages -- entity.ToString() now removes ComponentSuffix -- Fixed typo - -### Entitas.Unity.CodeGenerator -- ComponentExtensionsGenerator sets matcher.componentNames -- Removed generating unused using in ComponentExtensionsGenerator - -### Other -- Added update_project_dependencies.sh -- Refactored build commands into build_commands.sh - - -# 0.24.3 - -### Entitas -- Added systems.ActivateReactiveSystems() and systems.DeactivateReactiveSystems which should be called when you don't use systems anymore - -### Other -- Merged shell scripts - - -# 0.24.2 - -### General -- Renamed XyzEditor to XyzInspector -- Streamlined naming - -### Entitas.Unity.VisualDebugging -- Simplified adding a component at runtime - -### Other -- buildPackage.sh now creates Entitas-CSharp.zip and Entitas-Unity.zip - - -# 0.24.1 - -### Entitas.Unity.VisualDebugging -- Added support for adding components to multiple entities at once at runtime - -![Entitas.Unity.VisualDebugging-Entity](https://cloud.githubusercontent.com/assets/233700/10293066/d4668120-6bb2-11e5-895e-cfdd25cc2e74.png) - - -# 0.24.0 - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas.Unity.CodeGenerator -- Throwing exception when attempting to generate while Unity is still compiling or assembly won't compile - -### Entitas.Unity.VisualDebugging -- Added support for creating entities and adding components at runtime - -![Entitas.Unity.VisualDebugging-PoolObserver](https://cloud.githubusercontent.com/assets/233700/10291395/d83c3ec4-6ba9-11e5-9c1d-3e18fe2c6370.png) - -![Entitas.Unity.VisualDebugging-Entity](https://cloud.githubusercontent.com/assets/233700/10291401/e15d29be-6ba9-11e5-8fc1-87767430342c.png) - - -# 0.23.0 - -### Breaking changes -Before updating, please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -- Gerneral - - Updated and applied policy - -### Entitas -- Reimplemented new matcher AnyOf and NoneOf - -```csharp -Matcher.AllOf(Matcher.A, Matcher.B) - .AnyOf(Matcher.C, Matcher.D) - .NoneOf(Matcher.E, Matcher.F); - -``` - -### Entitas.CodeGenerator -- Updated generators to work with new matchers -- PoolsGenerator generates Pools.allPools (#39) -- Code Generators convert local newline to unix newline - -### Entitas.Unity.CodeGenerator -- Changed CodeGeneratorConfig.disabledCodeGenerators to CodeGeneratorConfig.enabledCodeGenerators - - -# 0.22.3 - -### Entitas -- Added reactiveSystem.Clear() and systems.ClearReactiveSystems() -- Added IClearReactiveSystem. When implemented, clears reactive system after execute finished - - -# 0.22.2 - -### Fixes -- Entitas - - GroupObserver retains entities only once - -### Entitas.Unity.VisualDebugging -- PoolObserver now shows retained entities -- Destroying EntityBehaviour e.OnEntityReleased instead of e.OnComponentRemoved - -### Other -- New logo - - -# 0.22.1 - -### Entitas -- Throwing an exception when releasing an entity that is not destroyed yet (#32) - -### Entitas.Unity.VisualDebugging -- Added hierarchy icon -- Renamed DebugSystems related classes - -### Other -- buildPackage.sh includes HierarchyIcon.png.meta - - -# 0.22.0 - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -- Entitas - - Restored previous pool.DestroyEntity() behaviour - - IReactiveSystem and IMultiReactiveSystem changed and use `TriggerOnEvent` - - Use the command line tool `MigrationAssistant.exe` to automatically migrate IReactiveSystem - - Renamed IStartSystem.Start to IInitializeSystem.Initialize (#21) - -### Fixes -- Entitas - - e.RemoveAllComponents() updates toString cache, even if entity has no components - -### Entitas -- Added AERC (Automatic Entity Reference Counting) (#30, solves #25) -- Reduced gc allocations in e.RemoveAllComponents() -- Reduced gc allocations in pool.CreateEntity() and pool.DestroyEntity() -- pool.DestroyEntity() will clean suscribed event delegates of entities (#27) -- entity.ToString() will always use component type -- Streamlined and refactored tests and sources - -### Entitas.Unity.VisualDebugging -- Improved SystemMonitorEditor graph performance (#14) - -### Entitas.Migration -- Added M0220 (Migrates IReactiveSystem to combine trigger and eventTypes to TriggerOnEvent) -- Updated migration descriptions - -### Other -- Removed project files -- Renamed updateDependencies.sh to updateProjects.sh -- buildPackage.sh includes EntitasUpgradeGuide.md in Entitas.zip - - -# 0.21.0 - -### Fixes -- Entitas.Migration - - Changed target framework to .NET 3.5 to fix build errors in VisualStudio (#22) - -### Entitas -- Changed pool.DestroyEntity(entity) behaviour - - won't trigger group.OnEntityRemoved anymore - - triggers group.OnEntityWillBeDestroyed - - removes entity from all groupObserver.collectedEntities - - ReactiveSystem doesn't pass on destroyed entities anymore -- ReactiveSystem doesn't call Execute() when filtered entities.Count == 0 - -### Other -- Added project files (#18) - - -# 0.20.0 - -### Breaking changes -- Entitas - - Removed all matchers except AllOfMatcher - -### Entitas -- Added `IEnsureComponents` to optionally ensure entities passed in via ReactiveSystem have certain components -- Added `IExcludeComponents` to optionally exclude entities passed in via ReactiveSystem -- Added support for multiple PoolAttributes on components - -```csharp -[PoolA, PoolB, PoolC] -public class SomeComponent : IComponent {} -``` - -### Entitas.Unity.CodeGenerator -- Added `disabledCodeGenerators` to CodeGeneratorConfig -- Added code generator toggles to CodeGeneratorPreferencesDrawer - -![Entitas.Unity.Codegenerator.disabledcodegenerators](https://cloud.githubusercontent.com/assets/233700/9046406/b4c6b7c2-3a2a-11e5-8624-a8988f684579.png) - -### Entitas.Unity.VisualDebugging -- Nicer stats - - -# 0.19.1 - -### Entitas -- GroupObserver supports observing multiple groups -- Added support for IMultiReactiveSystem -- Added internal entity._isEnabled to prevent modifying pooled entities -- Replaced internal object pool with Stack - -### Entitas.CodeGenerator -- Fixed generated replace method, when replacing non existent component - -### Entitas.Unity.VisualDebugging -- Drastically improved performance and memory usage by caching ToString() and reducing setting gameObject.name - - -# 0.19.0 - -### Breaking changes -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -- Entitas - - Added new e.OnComponentReplaced and removed all *WillBeRemoved events - - Added component index and changed component to OnEntityAdded and OnEntityRemoved - - IReactiveSystem.Execute takes List instead of Entity[] - - Entitas now runs without producing garbage! - -- Entitas.CodeGenerator - - Removed support for properties in components - -- Entitas.Unity.VisualDebugging - - Replaced DebugPool with a more flexible PoolObserver - -### Entitas -- Added group.OnEntityUpdated event with previous and new component - -### Entitas.CodeGenerator -- ComponentExtensionsGenerator generates component object pool -- Converting newlines in generated files to Environment.NewLine (Pull request #11, thanks @movrajr) - -### Other -- Added policy.mdpolicy - - -# 0.18.3 - -### Entitas -- Added ReactiveSystem.Activate() and .Deactivate() - -### Entitas.Unity.VisualDebugging -- Displaying nested systems hierarchy for DebugSystems - -![Entitas.Unity.VisualDebugging-DebugSystemsHierarchy](https://cloud.githubusercontent.com/assets/233700/8761742/6e26dd22-2d61-11e5-943b-94683b7b02ec.png) -![Entitas.Unity.VisualDebugging-DebugSystemsHierarchyEditor](https://cloud.githubusercontent.com/assets/233700/8761746/9628dbfe-2d61-11e5-9b75-570e5c538c0d.png) -- Unchecking a ReacitveSystem in VisualDebugging deactivates it - - -# 0.18.2 - -### Entitas.CodeGenerator -- Fixed #9 - - -# 0.18.1 - -### Entitas.CodeGenerator -- ComponentExtensionsGenerator now supports properties - - -# 0.18.0 - -### Breaking changes -- Use the command line tool `MigrationAssistant.exe` to automatically migrate - - Changed IReactiveSystem.GetTriggeringMatcher to IReactiveSystem.trigger - - Changed IReactiveSystem.GetEventType to IReactiveSystem.eventType - -Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas.Unity -- Fixed code generation issues on Windows by converting and normalizing line endings -- Fixed EntitasCheckForUpdates.CheckForUpdates() by temporarily trusting all sources - - -# 0.17.0 - -### Breaking changes -- Added `systemCodeGenerators` to CodeGenerator.Generate() - -```csharp -CodeGenerator.Generate(Type[] types, string[] poolNames, string dir, - IComponentCodeGenerator[] componentCodeGenerators, - ISystemCodeGenerator[] systemCodeGenerators, - IPoolCodeGenerator[] poolCodeGenerators) -``` - -### Entitas.CodeGenerator -- Added PoolsGenerator which creates a getter for all pools - -```csharp -var pool = Pools.pool; -var metaPool = Pools.meta; -``` - -- Added SystemExtensionsGenerator - -```csharp -new Systems() - .Add(pool.CreateGameBoardSystem()) - .Add(pool.CreateCreateGameBoardCacheSystem()) - .Add(pool.CreateFallSystem()) - .Add(pool.CreateFillSystem()) - - .Add(pool.CreateProcessInputSystem()) - - .Add(pool.CreateRemoveViewSystem()) - .Add(pool.CreateAddViewSystem()) - .Add(pool.CreateRenderPositionSystem()) - - .Add(pool.CreateDestroySystem()) - .Add(pool.CreateScoreSystem()); -``` -- Added Components, Systems & Pools sub folders to generated folder - -### Entitas.Unity -- Properties split with Environment.NewLine instead of '\n' - -### Entitas.Unity.CodeGenerator -- Entitas preferences appends "/Generated/" to generated folder if necessary - -### Entitas.Unity.VisualDebugging -- Using Queue for SystemsDebugEditor.systemMonitorData - - -# 0.16.0 - -### Breaking changes -- Moved system getters from Systems to DebugSystems - -### Entitas.Unity.CodeGenerator -- Generated ComponentIds use array instead of dictionary for component name lookup - -### Entitas.Unity.VisualDebugging -- Added "Step manually" to DebugSystems -- Added activate / deactivate systems at runtime -- Displaying Systems.totalSystemsCount in SystemsDebugEditor -- Added SystemsMonitor visual graph - -![Entitas.Unity.VisualDebugging-DebugSystems](https://cloud.githubusercontent.com/assets/233700/8241713/3bf5e3ce-160b-11e5-8876-497bb09c04b1.png) -- Removed override DebugSystems.DestroyAllEntities() - - -# 0.15.0 - -### Entitas -- Added entitas_version file -- Added CreateSystem(ISystem) to PoolExtensions -- Fixed typo GroupObserver.ClearCollectedEntities() - -### Entitas.Unity -- Added "Check for updates..." menu item - -### Entitas.Unity.VisualDebugging -- Added Stats menu item to log current components, systems and pools - - -# 0.14.0 - -### General -- Upgraded all Unity projects to Unity 5 - -### Entitas -- Added Systems class -- Re-combined pool extensions for creating systems to pool.CreateSystem() and removed pool.CreateStartSystem() and pool.CreateExecuteSystem() -- Fixed: Pool won't destroy entities it doesn't contain - -### Entitas.Unity -- Properties now support multiline values and placeholder replacement with ${key} - -### Entitas.Unity.CodeGenerator -- Added fluent api to Entity - -```csharp -pool.CreateEntity() - .IsGameBoardElement(true) - .IsMovable(true) - .AddPosition(x, y) - .AddResource(Res.Piece0) - .IsInteractive(true); -``` -- CodeGenerator takes arrays of IComponentCodeGenerator and IPoolCodeGenerator to generate files so you can easily provide your own custom code generators -- Added dialog for 'Migrate Matcher' menu item - -### Entitas.Unity.VisualDebugging -- Added DebugSystems - -![Entitas.Unity.VisualDebugging-Systems](https://cloud.githubusercontent.com/assets/233700/7938066/ebe8b4b6-0943-11e5-9cec-ce694d624aca.png) -- Added HashSetTypeDrawer - - -# 0.13.0 - -### Reminder -- Entitas 0.12.0 generates prefixed matchers based on the PoolAttribute and introduces some API changes. Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### General -- Split into multiple modules and seperate projects. Entitas now consists of - - Entitas - - Entitas.CodeGenerator - - Entitas.Unity - - Entitas.Unity.CodeGenerator - - Entitas.Unity.VisualDebugging - -### Entitas.Unity -- Added IEntitasPreferencesDrawer to be able to extend the Entitas preferences panel - -### Entitas.Unity.CodeGenerator -- Entitas preferences internal keys changed. Please check your settings in projectRoot/Entitas.properties and update keys - - Entitas.CodeGenerator.GeneratedFolderPath -> Entitas.Unity.CodeGenerator.GeneratedFolderPath - - Entitas.CodeGenerator.Pools -> Entitas.Unity.CodeGenerator.Pools - -### Entitas.Unity.VisualDebugging -- Added support to set fields to null -- Added support to create a new instance if the value of a field is null -- Added IDefaultInstanceCreator to create default objects for unsupported types -- Added IDefaultInstanceCreator implementations for array, dictionary and string -- Added support to insert and remove elements from lists, arrays and dictionaries - -![Entitas.Unity.VisualDebugging-ITypeDrawer](https://cloud.githubusercontent.com/assets/233700/7339538/226d8028-ec72-11e4-8971-53029fb20da8.png) -- Added name property to DebugPool -- Added VisualDebuggingConfig and VisualDebuggingPreferencesDrawer - -![Entitas.Unity.VisualDebugging-Preferences](https://cloud.githubusercontent.com/assets/233700/7339599/ef454f34-ec74-11e4-9775-963f477bfb16.png) -- EntityDebugEditor can generate IDefaultInstanceCreator and ITypeDrawer implementations for unsupported types -- Fixed: handling null values -- Renamed ICustomTypeDrawer to ITypeDrawer -- Big refactoring to simplify drawing types - -### Other -- buildPackage.sh keeps uncompressed source files in bin folder -- Added updateDependencies.sh which updates all dependencies of Entitas.Unity.CodeGenerator, Entitas.Unity.VisualDebugging and tests -- Renamed and moved files and folders to be more consistent with the new project structure - - -# 0.12.0 - -### Important -- Entitas 0.12.0 generates prefixed matchers based on the PoolAttribute and introduces some API changes. Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas -- Added IStartSystem and pool.CreateStartSystem() extension -- Renamed pool.CreateSystem() to pool.CreateExecuteSystem() -- Added pool.CreateStartSystem() -- Added EntitasUpdater to automatically update the introduced matcher API changes - -### Visual Debugging -- Fixed null exceptions -- Added support for multi dimensional and jagged arrays -- Removed Debug.Log - -### Code Generator -- Added Code Generator PreferenceItem - - set generated folder path - - define multiple pools - -![Entitas.Unity.CodeGenerator-Preferences](https://cloud.githubusercontent.com/assets/233700/7296726/8d74bb5a-e9c2-11e4-8324-10a0db7191ff.png) -- Added PoolAttributeGenerator -- Generated Matcher is now prefixed based on PoolAttribute (e.g. UIMatcher) -- Generating ToString() for matchers to print component name instead of index -- IndicesLookupGenerator generates indices ordered alphabetically -- Added TypeGenerator to streamline string generation from types -- Added support for nested classes - -### Other -- Added Properties and CodeGeneratorConfig to serialize Entitas preferences to file -- Removed warning in AbstractCompoundMatcher -- buildPackage.sh only builds when all tests are passing -- buildPackage.sh deletes meta files before creating zip archive - - -# 0.11.0 - -### Reminder -- Entitas 0.10.0 included lots of renaming. Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) if you are on < v0.10.0 - -### Entitas -- Added AllOfCompoundMatcher -- Added AnyOfMatcher -- Added AnyOfCompoundMatcher -- Added NoneOfMatcher -- Added NoneOfCompoundMatcher -- Updated Entitas to handle any implementation of IMatcher -- Fixed dispatching OnComponentAdded when replacing a non existing component with null -- Optimizations - -### Visual Debugging -- Added support for custom type drawers `ICustomTypeDrawer` -- Added component folding and pooled entities count -- Added groups to PoolDebugEditor - -![Entitas.Unity.VisualDebugging-Groups](https://cloud.githubusercontent.com/assets/233700/6547980/e342b3fe-c5e9-11e4-8caa-77662a14679b.png) -- Added support for IList - -![Entitas.Unity.VisualDebugging-IList](https://cloud.githubusercontent.com/assets/233700/6547984/eecc3e3e-c5e9-11e4-98bb-700a84047abe.png) -- UI improvements - -### Code Generator -- Fixed typeShortcuts to use type.FullName to support UnityEngine.Object (conflicted with System.Object) -- Added EntitasCodeGeneratorMenuItem - -### Other -- Moved and renamed some folders -- Added buildPackage.sh which creates a bin/Entitas.zip with all necessary source files - - -# 0.10.0 - -### Important -- Entitas 0.10.0 includes lots of renaming. Please follow the [Entitas upgrade guide](https://github.com/sschmid/Entitas/blob/master/EntitasUpgradeGuide.md) - -### Entitas -- Added empty ISystem and IExecuteSystem for more flexibility -- Added public creationIndex to Entity -- Observer is now on group not on pool -- Removed WillBeRemovedSystem and observer -- Added CreateSystem to PoolExtension -- Added fast entities count call to Pool -- Added creationIndex to entity.ToString() -- pool.CreateEntity() and pool.DestroyEntity() are now virtual - -### Visual Debugging -- Added VisualDebugging - -### Code Generator -- Supports enums nested in components -- Added option to [DontGenerate] to ignore generating index, too diff --git a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.CodeGeneration.Attributes.dll b/src/Libs/External/Jenny/Plugins/Entitas/Entitas.CodeGeneration.Attributes.dll deleted file mode 100644 index bb401db..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.CodeGeneration.Attributes.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.CodeGeneration.Plugins.dll b/src/Libs/External/Jenny/Plugins/Entitas/Entitas.CodeGeneration.Plugins.dll deleted file mode 100644 index 1555df7..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.CodeGeneration.Plugins.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.Roslyn.CodeGeneration.Plugins.dll b/src/Libs/External/Jenny/Plugins/Entitas/Entitas.Roslyn.CodeGeneration.Plugins.dll deleted file mode 100644 index 1b6d794..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.Roslyn.CodeGeneration.Plugins.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.Unity.dll b/src/Libs/External/Jenny/Plugins/Entitas/Entitas.Unity.dll deleted file mode 100644 index d059a5e..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.Unity.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.VisualDebugging.CodeGeneration.Plugins.dll b/src/Libs/External/Jenny/Plugins/Entitas/Entitas.VisualDebugging.CodeGeneration.Plugins.dll deleted file mode 100644 index 991c3c8..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.VisualDebugging.CodeGeneration.Plugins.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.VisualDebugging.Unity.dll b/src/Libs/External/Jenny/Plugins/Entitas/Entitas.VisualDebugging.Unity.dll deleted file mode 100644 index 8e5e935..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.VisualDebugging.Unity.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.dll b/src/Libs/External/Jenny/Plugins/Entitas/Entitas.dll deleted file mode 100644 index 52c5e9a..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Entitas/Entitas.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Entitas/EntitasUpgradeGuide.md b/src/Libs/External/Jenny/Plugins/Entitas/EntitasUpgradeGuide.md deleted file mode 100644 index f6f0c7f..0000000 --- a/src/Libs/External/Jenny/Plugins/Entitas/EntitasUpgradeGuide.md +++ /dev/null @@ -1,653 +0,0 @@ -Entitas Upgrade Guide -===================== - -Entitas provides automated migration tools to help upgrading to new versions. -You can apply automatic migrations in Unity by opening the Entitas Migration Window -`Tools > Entitas > Migrate...` - -This document contains checklists for every release with breaking changes. - -Entitas 0.47.2 upgrade guide -============================ - -#### Breaking changes - -Apply Migration 0.47.2 to automatically rename the changed keys your properties files. - -The following keys changed from: - -- CodeGenerator.SearchPaths -- CodeGenerator.Plugins -- CodeGenerator.PreProcessors -- CodeGenerator.DataProviders -- CodeGenerator.CodeGenerators -- CodeGenerator.PostProcessors -- CodeGenerator.CLI.Ignore.UnusedKeys or Ignore.Keys - -to: - -- Jenny.SearchPaths -- Jenny.Plugins -- Jenny.PreProcessors -- Jenny.DataProviders -- Jenny.CodeGenerators -- Jenny.PostProcessors -- Jenny.Ignore.Keys - ---- - -Entitas 0.46.0 upgrade guide -============================ - -#### Breaking changes - -Removed methods marked obsolete in 0.42.0 from April 2017 -- `context.CreateCollector(IMatcher matcher, GroupEvent groupEvent)` -- `new Context(int totalComponents, int startCreationIndex, ContextInfo contextInfo)` -- `context.DestroyEntity(TEnity entity)` - -#### After you installed - -First, edit the file `Generated/Feature.cs` and comment or delete the lines with compiler errors. - -Then, run auto-import to use the new DesperateDevs.CodeGeneration.Plugins and generate. - -Entitas.properties can be named differently now. By default it will be called -Preferences.properties. Additionally, you can delete User.properties or rename it -to Xyz.userproperties. If this file doesn't exist, it will automatically be generated for you. -You can have multiple properties and userproperties files now, e.g. -Preferences.properties and Roslyn.properties. In Unity it will automatically find and use -the first file. When using the Code Generator CLI (called Jenny now) you can explicitly -specify files like this - -``` -// will find and use the first file -$ jenny gen - -// specify a file -$ jenny gen Roslyn.properties - -// optionally specify an other userproperties -jenny gen Roslyn.properties My.userproperties -``` - ---- - -Entitas 0.45.0 upgrade guide -============================ - -#### Breaking changes - -Use the command line tool `MigrationAssistant.exe` and apply Migration 0.45.0 to -automatically rename the changed keys in Entitas.properties - -`MigrationAssistant.exe 0.45.0 path/to/project` - -The following keys in Entitas.properties changed from: - -- Entitas.CodeGeneration.CodeGenerator.SearchPaths -- Entitas.CodeGeneration.CodeGenerator.Plugins -- Entitas.CodeGeneration.CodeGenerator.DataProviders -- Entitas.CodeGeneration.CodeGenerator.CodeGenerators -- Entitas.CodeGeneration.CodeGenerator.PostProcessors -- Entitas.CodeGeneration.CodeGenerator.CLI.Ignore.UnusedKeys - -to: - -- CodeGenerator.SearchPaths -- CodeGenerator.Plugins -- CodeGenerator.DataProviders -- CodeGenerator.CodeGenerators -- CodeGenerator.PostProcessors -- CodeGenerator.CLI.Ignore.UnusedKeys - -The default plugins are now in folder called `Entitas` instead of `Default`. Please update -the searchPaths in Entitas.properties. -`Entitas.exe` is now uppercase with capital E - ---- - -Entitas 0.42.0 upgrade guide -============================ - -#### Breaking changes -- Removed Entitas.Blueprints.Unity.* -- Changed ReactiveSystem.GetTrigger method signature -- Marked obsolete: `context.DestroyEntity(entity)`. Use `entity.Destroy()` instead -- Marked obsolete: `context.CreateCollector(matcher, event)`, use new `context.CreateCollector(triggerOnEvent)` when you need `.Removed` or `.AddedOrRemoved` (e.g. `GameMatcher.View.Removed()`) - -#### After you installed -- Removed Entitas.Blueprints.Unity.* - - Remove all Entitas.Blueprints.Unity.* related code - - Remove BinaryBlueprints from your project. Consider using extension methods as described here instead https://github.com/sschmid/Entitas/issues/390 - - Remove from Entitas.properties: - - Entitas.Blueprints.CodeGeneration.Plugins - - Entitas.Blueprints.CodeGeneration.Plugins.BlueprintDataProvider - - Entitas.Blueprints.CodeGeneration.Plugins.BlueprintsGenerator - -- Changed ReactiveSystem.GetTrigger() method signature - - find and replace `protected override Collector` -> `protected override ICollector` - -- Generate - -- Marked obsolete: `context.DestroyEntity(entity)`. Use `entity.Destroy()` instead -- Marked obsolete: `context.CreateCollector(matcher, event)`, use new `context.CreateCollector(triggerOnEvent)` when you need `.Removed` or `.AddedOrRemoved` (e.g. `GameMatcher.View.Removed()`) - ---- - -Entitas 0.41.0 upgrade guide -============================ - -#### Breaking changes -In order to deploy Entitas as Dlls which enables 3rd party Addons and the extendable command line code generator the projects have been restructured. This restructuring has an impact on namespaces. - -#### Before you install -- You're fine - nothing to do for you :heart: - -#### After you installed -- Apply Migrations 0.41.0-1 -- Apply Migrations 0.41.0-2 -- Apply Migrations 0.41.0-3 - -These migrations should update most of the namespaces. Depending on which features of Entitas you have used there might be a chance that not all namespaces have been updated. In this case please fix the remaining namespaces manually. - -Entitas.properties keys have been updated to support the latest code generator. Please open Entitas.properties in your project root and make sure the keys are updated. Here's an example from Match One - -``` -Entitas.CodeGeneration.Project = Assembly-CSharp.csproj -Entitas.CodeGeneration.SearchPaths = Assets/Libraries/Entitas, Assets/Libraries/Entitas/Editor, /Applications/Unity/Unity.app/Contents/Managed -Entitas.CodeGeneration.Assemblies = Library/ScriptAssemblies/Assembly-CSharp.dll -Entitas.CodeGeneration.Plugins = Entitas.CodeGeneration.Plugins, Entitas.CodeGeneration.Unity.Editor, Entitas.VisualDebugging.CodeGeneration.Plugins, Entitas.Blueprints.CodeGeneration.Plugins -Entitas.CodeGeneration.DataProviders = Entitas.Blueprints.CodeGeneration.Plugins.BlueprintDataProvider, Entitas.CodeGeneration.Plugins.ComponentDataProvider, Entitas.CodeGeneration.Plugins.ContextDataProvider, Entitas.CodeGeneration.Plugins.EntityIndexDataProvider -Entitas.CodeGeneration.CodeGenerators = Entitas.Blueprints.CodeGeneration.Plugins.BlueprintsGenerator, Entitas.CodeGeneration.Plugins.ComponentContextGenerator, Entitas.CodeGeneration.Plugins.ComponentEntityGenerator, Entitas.CodeGeneration.Plugins.ComponentGenerator, Entitas.CodeGeneration.Plugins.ComponentsLookupGenerator, Entitas.CodeGeneration.Plugins.ContextAttributeGenerator, Entitas.CodeGeneration.Plugins.ContextGenerator, Entitas.CodeGeneration.Plugins.ContextsGenerator, Entitas.CodeGeneration.Plugins.EntityGenerator, Entitas.CodeGeneration.Plugins.EntityIndexGenerator, Entitas.CodeGeneration.Plugins.MatcherGenerator, Entitas.VisualDebugging.CodeGeneration.Plugins.ContextObserverGenerator, Entitas.VisualDebugging.CodeGeneration.Plugins.FeatureClassGenerator -Entitas.CodeGeneration.PostProcessors = Entitas.CodeGeneration.Plugins.AddFileHeaderPostProcessor, Entitas.CodeGeneration.Plugins.CleanTargetDirectoryPostProcessor, Entitas.CodeGeneration.Plugins.MergeFilesPostProcessor, Entitas.CodeGeneration.Plugins.NewLinePostProcessor, Entitas.CodeGeneration.Plugins.WriteToDiskPostProcessor, Entitas.CodeGeneration.Plugins.ConsoleWriteLinePostProcessor, Entitas.CodeGeneration.Unity.Editor.DebugLogPostProcessor -Entitas.CodeGeneration.TargetDirectory = Assets/Sources/ -Entitas.CodeGeneration.Contexts = Game, GameState, Input -Entitas.VisualDebugging.Unity.SystemWarningThreshold = 8 -Entitas.VisualDebugging.Unity.DefaultInstanceCreatorFolderPath = Assets/Editor/DefaultInstanceCreator/ -Entitas.VisualDebugging.Unity.TypeDrawerFolderPath = Assets/Editor/TypeDrawer/ -``` - -Explanation: -- Entitas.CodeGeneration.Project: Relative path to your project.csproj (when using Unity use `Assembly-CSharp.csproj`) -- Entitas.CodeGeneration.SearchPaths: The new code generator can be extended with 3rd party plugins. Specify all folders where plugin dlls can be found. Plugins may depend on UnityEngine or UnityEditor, if so please specify where those dlls can be found (Unity default on Mac: `/Applications/Unity/Unity.app/Contents/Managed` -- Entitas.CodeGeneration.Assemblies: One or more Dlls that contain your components -- Entitas.CodeGeneration.Plugins: One or more Code Generator Plugin Dlls or namespaces - -If all set up correctly DataProviders, CodeGenerators and PostProcessors can be set in Unity. - -The command line code generator currently doesn't support the following plugins: -- Entitas.Blueprints.CodeGeneration.Plugins (contains Blueprint DataProvider and CodeGenerator) -- Entitas.CodeGeneration.Unity.Editor (contains DebugLogPostProcessor) - -because they use Unity specific api. They will work as expected when generating from within Unity but don't work on the command line. - -To test the config for potential problems, please unzip Entitas-CodeGenerator.zip in the root folder of your project. - ---- - -### Note for Windows users -- Right-click Entitas-CodeGenerator.zip, open properties -- Check "Unblock" -- Hit Apply -- unzip - ---- - -``` -// skip mono on Windows -$ mono ./CodeGenerator/entitas.exe -Entitas Code Generator version 0.41.0 -usage: entitas new [-f] - Creates new Entitas.properties config with default values - entitas edit - Opens Entitas.properties config - entitas doctor - Checks the config for potential problems - entitas status - Lists available and unavailable plugins - entitas fix - Adds missing or removes unused keys interactively - entitas scan - Scans and prints available types found in specified assemblies - entitas dry - Simulates generating files without writing to disk - entitas gen - Generates files based on Entitas.properties - [-v] - verbose output - [-s] - silent output (errors only) -``` - -To check the config for potential problems please run -``` -$ mono ./CodeGenerator/entitas.exe doctor -``` - -The `doctor` command will show you the status and potential problems. Sometime you might get a warning like this: - -``` -- Could not resolve xyz.dll -``` - -This is just a warning. If no error is shown after running the `doctor` command, you can ignore those. All code generator plugins must be resolvable in order to be used. Use the `status` command to see available and unavailable plugins. This command helps you manage the plugins. Add or remove DataProviders, CodeGenerators or PostProcessors and check with `status` until you're happy. As usual, you can also use the Entitas Preferences Window in Unity to set up everything. - -If there are nor problems use the `gen` command to generate or use the green generate button in Unity as usual. - ---- - -Entitas 0.37.0 upgrade guide -============================ - -#### Breaking changes -Entitas went type-safe! This was a huge task and I'm happy to finally share this with you guys! -This feature makes Entitas safer and more managable in growing code bases and will eliminate certain kind of bugs. -This change breaks existing projects! It is possible to manually migrate existing projects but there is no special workflow -other than manually use find / replace to fix all compile errors. I use Entitas 0.37.0 in my current project (500+ systems) -and was able to migrate within less than two days. If you have less systems and components you should be able to migrate within one day. - -Reminder: If you're updating from versions < 0.36.0 you should update to 0.36.0 first. Be aware that existing Blueprints(Beta) are breaking -because of the renaming from `Pool` to `Context`. Existing Binary Blueprints have to be manually updated. - -If you're not sure if you should update you can wait another week. I plan to make a video to show how to upgrade existing projects. -After this you should be able to decide if you want to update or not. - -#### Before you install -- Rename `SingleEntityAttribute` to `UniqueAttribute` -- Change namespace of all attributes in CodeGenerator/Attributes to `Entitas.CodeGenerator.Api` -- Find / replace `using Entitas.CodeGenerator` to `using Entitas.CodeGenerator.Api` in all generated context attributes -- Find / replace `using Entitas.CodeGenerator;` to `using Entitas.CodeGenerator.Api;` in all generated components - -#### After you installed - -After installing Entitas 0.37.0 you most likely end up having lots of compiler errors. The 2 biggest issues are: -- Generated components -- Systems - -There migh also be other issues depending how you used Entitas before, but fixing the generated components and the systems -might already do most of the work. - -##### Problem 1 (Components): -The old generated components extend Entitas.Entity by using `partial class`. -The new version inherits Entitas.Entity to have a new entity type and to get rid of `partial class` to enable -having Entitas as a precompiled dll. - -##### Solution 1 (Components) -The goal is to update the generated components. I see 3 possible workflows to fix them: -1. Delete all components and generated components and use the EntitasLang DSL https://github.com/mzaks/ECS-Lang -2. Temporarily move all the logic (systems) out of your Unity project and delete the generated components. -After this there shouldn't be any compile errors anymore (if so, temporarily move them out if your Unity project). -Now you should be able to re-generate. After that, move all the files back to your Unity project. -3. Manually use find / replace in the generated components folder to migrate the components - -##### Problem 2 (Systems) -All reactive systems need to be updated to be type-safe. - -##### Solution 2 (Systems) -Manually use find / replace to migrate e.g. method signatures and other issues -Take a look at [Match-One AnimatePositionSystem.cs](https://github.com/sschmid/Match-One/blob/develop/Assets/Sources/Logic/View/Systems/AnimatePositionSystem.cs) -to see how the new reactive systems look like. - -##### Other issues -There might be other issues related to the type-safety. Rule of thumb: -- Every occurrences of `Entity` must be typed now, e.g. `GameEntity` -- Every occurrences of `Group` must be typed now, e.g. `IGroup` -- Every occurrences of `Context` must be typed now, e.g. `IContext` or `GameContext` if possible -- Every occurrences of `Collector` must be typed now, e.g. `Collector` -- Every occurrences of `Matcher` must be typed now, e.g. `Matcher.AllOf(...)` - -I recommend using find / replace on ceratin folders to fix those issues efficiently. - ---- - -Entitas 0.36.0 upgrade guide -============================ - -#### Breaking changes -The term `Pool` has been replaced with `Context`. This affects all classes that -contain the word pool. -`EntityCollector` has been renamed to `Collector` -`GroupEventType` has been renamed to `GroupEvent` - - -#### Before you install -- Rename `Pools.CreatePool()` to `Pools.CreateContext` -- Rename `Pool` to `Context` -- Rename `Pools` to `Contexts` -- Rename `Pools.SetAllPools()` to `Pools.SetAllContexts()` -- Rename `PoolAttribute` to `ContextAttribute` -- Rename `EntityCollector` to `Collector` -- Rename `GroupEventType` to `GroupEvent` -- Rename `GroupEventType.OnEntityAdded` to `GroupEvent.Added` -- Rename `GroupEventType.OnEntityRemoved` to `GroupEvent.Removed` -- Rename `GroupEventType.OnEntityAddedOrRemoved` to `GroupEvent.AddedOrRemoved` - -#### After you installed -- Use the command line tool `MigrationAssistant.exe` and apply Migration 0.36.0-2 -- Manually migrate all systems and fix compiler errors -- apply Migration 0.36.0-1 -- Ensure all code generator are selected and generate - ---- - -Entitas 0.35.0 upgrade guide -============================ - -#### Breaking changes -`IMatcher.Where()` has been removed. See #194 - -#### Before you install -- You're fine - nothing to do for you :heart: - -#### After you installed -- Fix all the errors where you used `matcher.Where()` - ---- - -Entitas 0.34.0 upgrade guide -============================ - -#### Breaking changes -`GroupObserver` has been renamed to `EntityCollector`. See #168 - -#### Before you install -- Rename `GroupObserver` to `EntityCollector` -- Rename `.CreateGroupObserver()` to `.CreateEntityCollector()` -- Rename `IGroupObserverSystem` to `IEntityCollectorSystem` -- Find & Replace `public EntityCollector groupObserver` with `public EntityCollector entityCollector` - -#### After you installed -- You're fine - nothing to do for you :heart: - ---- - -Entitas 0.33.0 upgrade guide -============================ - -#### Breaking changes -`IDeinitializeSystem` has been renamed to `ITearDownSystem`. See #164 - -#### Before you install -- Manually rename `IDeinitializeSystem` to `ITearDownSystem` - -#### After you installed -- You're fine - nothing to do for you :heart: - ---- - -Entitas 0.32.0 upgrade guide -============================ - -Use the command line tool `MigrationAssistant.exe` to automatically fix compile errors. -Entitas 0.32.0 introduces a new Pools class. Using the new PoolsGenerator will require -to update your existing project manually. You can still use the old Pools class in your -existing project if you want. If so, please use the OldPoolsGenerator instead of the new one. - ---- - -Entitas 0.30.0 upgrade guide -============================ - -Some code generators got renamed. Apply Migration 0.30.0 - ---- - -Entitas 0.29.0 upgrade guide -============================ - -Marked old PoolMetaData constructor obsolete. If you encounter compile errors -please apply Migration 0.26.0, open C# project and generate again. - ---- - -Entitas 0.28.0 upgrade guide -============================ - -If you're using Entitas with Unity, please open the Entitas preferences and make -sure that all your desired code generators are activated. -Due to some code generator renamings the ComponentIndicesGenerators inactive. - -The SystemsGenerator has been removed. Please use `pool.CreateSystem()` instead. - ---- - -Entitas 0.27.0 upgrade guide -============================ - -If you're using Entitas with Unity, please open the Entitas preferences and make -sure that all your desired code generators are activated. -Due to some code generator renamings the ComponentLookupGenerator and -the ComponentsGenerator are inactive. Activate them (if desired) and generate. - ---- - -Entitas 0.26.0 upgrade guide -============================ - -Use the command line tool `MigrationAssistant.exe` to automatically fix compile errors. -After that generate again. - ---- - -Entitas 0.24.0 upgrade guide -============================ - -To fix the compile errors after updating to Entitas 0.24.0, delete in `Pools.cs` - -```csharp -#if (UNITY_EDITOR) -var poolObserver = new Entitas.Unity.VisualDebugging.PoolObserver(_pool, ComponentIds.componentNames, ComponentIds.componentTypes, "Pool"); -UnityEngine.Object.DontDestroyOnLoad(poolObserver.entitiesContainer); -#endif -``` - -and generate again. - ---- - -Entitas 0.23.0 upgrade guide -============================ - -Entitas 0.23.0 changed and applied naming conventions. -Before updating to this version, follow these steps to prepare your project: - -#### Rename - - Pool.Count -> Pool.count - Group.Count -> Group.count - Properties.count -> Properties.count - -#### Find/Replace in generated folder - - ": AllOfMatcher " -> "" - ": base(new [] { index }) " -> "" - "static AllOfMatcher _matcher" -> "static IMatcher _matcher" - "public static AllOfMatcher" -> "public static IMatcher" - "new Matcher" -> "Matcher.AllOf" - -#### Delete - -In generated ...ComponentIds - - namespace Entitas { - public partial class XYZMatcher { - public Matcher(int index) { - } - - public override string ToString() { - return ComponentIds.IdToString(indices[0]); - } - } - } - ---- - -Entitas 0.22.0 upgrade guide -============================ - -Entitas 0.22.0 changed IReactiveSystem and IMultiReactiveSystem and renamed IStartSystem.Start to IInitializeSystem.Initialize. - -Use the command line tool `MigrationAssistant.exe` to automatically migrate IReactiveSystem. - ---- - -Entitas 0.19.0 upgrade guide -============================ - -Entitas 0.19.0 introduces a few breaking changes: - -Added new e.OnComponentReplaced and removed all *WillBeRemoved events. - -If you used `group.OnEntityWillBeRemoved`, you could replace it either with -```cs -_group.OnEntityRemoved += (group, entity, index, component) => { //... }; -``` -or with -```cs -_group.OnEntityUpdated += (group, entity, index, previousComponent, newComponent) => { // ...}; -``` -If your generated component extensions are not compiling, find/replace `WillRemoveComponent` with `//WillRemoveComponent` -to temporarily ignore the errors. - -IReactiveSystem.Execute takes List instead of Entity[]. Use the command line tool `MigrationAssistant.exe` to automatically migrate. - -``` -$ mono MigrationAssistant.exe -usage: -[-l] - print all available versions -[version] [path] - apply migration of version [version] to source files located at [path] - -$ mono MigrationAssistant.exe -l -0.18.0 - Migrates IReactiveSystem API -0.19.0 - Migrates IReactiveSystem.Execute - -// Example from Math-One example project, where all the systems are located in the Features folder -$ mono MigrationAssistant.exe 0.19.0 /Path/To/Project/Assets/Sources/Features -``` - ---- - -Entitas 0.18.0 upgrade guide -============================ - -Entitas 0.18.0 changes IReactiveSystem. To upgrade your source files, follow these steps -- Install Entitas 0.18.0 (which will result in compiler errors) -- Use the command line tool `MigrationAssistant.exe` to automatically migrate - -``` -$ mono MigrationAssistant.exe -usage: -[-l] - print all available versions -[version] [path] - apply migration of version [version] to source files located at [path] - -$ mono MigrationAssistant.exe -l -0.18.0 - Migrates IReactiveSystem API - -// Example from Math-One example project, where all the systems are located in the Features folder -$ mono MigrationAssistant.exe 0.18.0 /Path/To/Project/Assets/Sources/Features -``` - ---- - -Entitas 0.12.0 upgrade guide -============================ - -Entitas 0.12.0 generates prefixed matchers based on the PoolAttribute and introduces some -API changes. In your existing project with a Entitas version < 0.12.0 manually rename the -following classes and methods. - -## Before installing Entitas 0.12.0 - -#### Rename - - pool.CreateSystem() -> pool.CreateExecuteSystem() - -Now that you're prepared for integrating the latest version, delete your existing version -of Entitas, EntitasCodeGenerator and EntitasUnity. - -#### Delete - - Entitas - EntitasCodeGenerator - EntitasUnity - -## Install Entitas 0.12.0 - -#### Setup Entitas Preferences - - Open the Unity preference panel and select Entitas. Check and update the path to the folder where - the code generator will save all generated files. If you are using the PoolAttribute in your components, - add all custom pool names used in your application. Make sure that all existing custom PoolAttributes call - the base constructor with the same name as the class (without 'Attribute'). - If you are not using the PoolAttribute in your components, you can skip this process. - -```cs -using Entitas.CodeGenerator; - -public class CoreGameAttribute : PoolAttribute { - public CoreGameAttribute() : base("CoreGame") { - } -} -``` - -#### Code Generator - - Use the code generator and generate - -#### Update API - - Click the MenuItem "Entitas/Update API". All occurrences of the old Matcher will be updated - to the new version, which is prefixed based on the PoolAttribute. - -#### Delete - - Delete all custom PoolAttributes - ---- - -Entitas 0.10.0 upgrade guide -============================ - -Beside features, Entitas 0.10.0 includes lots of renaming. If your current Entitas -version is < 0.10.0, you might want to follow the next few simple renaming steps, -to speed up the integration of the latest version of Entitas. -In your existing project with a Entitas version < 0.10.0 manually rename the following -classes and methods. - -## Before installing Entitas 0.10.0 - -#### Rename - - EntityRepository -> Pool - EntityRepository.GetCollection() -> Pool.GetGroup() - - EntityCollection -> Group - EntityCollection.EntityCollectionChange -> Group.GroupChanged - - EntityRepositoryObserver -> GroupObserver - EntityRepositoryObserver.EntityCollectionEventType -> GroupObserver.GroupEventType - - IEntityMatcher -> IMatcher - IEntitySystem -> IExecuteSystem - AllOfEntityMatcher -> AllOfMatcher - EntityRepositoryAttribute -> PoolAttribute - IReactiveSubEntitySystem -> IReactiveSystem - ReactiveEntitySystem -> ReactiveSystem - -#### Delete - - EntityWillBeRemovedEntityRepositoryObserver -> DELETE - IReactiveSubEntityWillBeRemovedSystem -> DELETE - ReactiveEntityWillBeRemovedSystem -> DELETE - -Now that you're prepared for integrating the latest version, delete your existing version -of Entitas, EntitasCodeGenerator and ToolKit. - -#### Delete - - Entitas - EntitasCodeGenerator - ToolKit (unless you use classes from ToolKit. The new version of Entitas doesn't depend on ToolKit anymore) - - -## Install Entitas 0.10.0 - -#### Fix remaining issues - - IReactiveSubEntityWillBeRemovedSystem - - Consider implementing ISystem & ISetPool and use group.OnEntityWillBeRemoved += foobar; - -#### Code Generator - - Use the code generator and generate diff --git a/src/Libs/External/Jenny/Plugins/Entitas/LICENSE.txt b/src/Libs/External/Jenny/Plugins/Entitas/LICENSE.txt deleted file mode 100644 index b283fd8..0000000 --- a/src/Libs/External/Jenny/Plugins/Entitas/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License - -Copyright (c) 2014 - 2022 Simon Schmid - - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/src/Libs/External/Jenny/Plugins/Entitas/README.md b/src/Libs/External/Jenny/Plugins/Entitas/README.md deleted file mode 100644 index 13129cb..0000000 --- a/src/Libs/External/Jenny/Plugins/Entitas/README.md +++ /dev/null @@ -1,208 +0,0 @@ -

- Entitas -

- -

- - Entitas on Discord - - Latest release -

- -

- - Twitter Follow Me - - Twitter Follow Me -

- -

- Entitas is free, but powered by - - your donations - -

- -

- - Join the chat at https://gitter.im/sschmid/Entitas-CSharp -

- -Entitas - The Entity Component System Framework for C# and Unity -================================================================ - -Entitas is a super fast Entity Component System Framework (ECS) specifically made for C# and Unity. Internal caching and blazing fast component access makes it second to none. Several design decisions have been made to work optimal in a garbage collected environment and to go easy on the garbage collector. Entitas comes with an optional code generator which radically reduces the amount of code you have to write and [makes your code read like well written prose.][clean-coders] - -

- - CSharp - - Unity3d - - Unite Europe 2015 - - Unite Europe 2016 - - Wooga - - Gram Games.png -

- ---- - -### **[» Download](#download-entitas)** -### **[» Documentation][documentation]** -### **[» Ask a question][issues-new]** -### **[» Wiki and example projects][wiki]** -### **[» #madeWithEntitas][wiki-games-and-examples]** - ---- - -Video Tutorials & Unity Unite Talks -================= - -| Entitas ECS Unity Tutorial | Entitas ECS Unity Tutorial | Entity system architecture with Unity | ECS architecture with Unity by example | -|:---------------------------------:|:---------------------------------:|:--------------------------------------------------------------------:|:--------------------------------------------------------------------:| -| [![Shmup1][shmup1-thumb]][shmup1] | [![Shmup2][shmup2-thumb]][shmup2] | [![Unite 15][unite15-thumb]][unite15] | [![Unite 16][unite16-thumb]][unite16] | -| Setup & Basics | Git & Unit Tests | [» Open the slides on SlideShare: Unite Europe 2015][unite15-slides] | [» Open the slides on SlideShare: Unite Europe 2016][unite16-slides] | - - -First glimpse -============= - -The optional [code generator][wiki-code-generator] lets you write code that is super fast, safe and literally screams its intent. - -```csharp -public static GameEntity CreateRedGem(this GameContext context, Vector3 position) { - var entity = context.CreateEntity(); - entity.isGameBoardElement = true; - entity.isMovable = true; - entity.AddPosition(position); - entity.AddAsset("RedGem"); - entity.isInteractive = true; - return entity; -} -``` - -```csharp -var entities = context.GetEntities(Matcher.AllOf(GameMatcher.Position, GameMatcher.Velocity)); -foreach(var e in entities) { - var pos = e.position; - var vel = e.velocity; - e.ReplacePosition(pos.value + vel.value); -} -``` - - -Overview -======== - -Entitas is fast, light and gets rid of unnecessary complexity. There are less than a handful classes you have to know to rocket start your game or application: - -- Entity -- Context -- Group -- Entity Collector - -[Read more...][wiki-overview] - - -Code Generator -============== - -The Code Generator generates classes and methods for you, so you can focus on getting the job done. It radically reduces the amount of code you have to write and improves readability by a huge magnitude. It makes your code less error-prone while ensuring best performance. I strongly recommend using it! - -[Read more...][wiki-code-generator] - - -Unity integration -================= - -The optional Unity module integrates Entitas nicely into Unity and provides powerful editor extensions to inspect and debug contexts, groups, entities, components and systems. - -[Read more...][wiki-unity-integration] - -

- Entitas.Unity MenuItems
- Entitas.Unity.VisualDebugging Entity - Entitas.Unity.VisualDebugging Systems -

- - -Entitas deep dive -================= - -[Read the wiki][wiki] or checkout the [example projects][wiki-example-projects] to see Entitas in action. These example projects illustrate how systems, groups, collectors and entities all play together seamlessly. - - -Download Entitas -================ - -Each release is published with zip files containing all source files you need. - -[Show releases][releases] - - -Thanks to -========= - -Big shout out to [@mzaks][github-mzaks], [@cloudjubei][github-cloudjubei] and [@devboy][github-devboy] for endless hours of discussion and helping making Entitas awesome! - - -Maintainer(s) -============= - -- [@sschmid][github-sschmid] | [@s_schmid][twitter-sschmid] | [@entitas_csharp][twitter-entitas_csharp] - - -Different language? -=================== - -Entitas is available in -- [C#](https://github.com/sschmid/Entitas) -- [Swift](https://github.com/mzaks/Entitas-Swift) -- [C++](https://github.com/JuDelCo/Entitas-Cpp) -- [Objective-C](https://github.com/wooga/entitas) -- [Java](https://github.com/Rubentxu/entitas-java) -- [Python](https://github.com/Aenyhm/entitas-python) -- [Scala](https://github.com/darkoverlordofdata/entitas-scala) -- [Go](https://github.com/wooga/go-entitas) -- [F#](https://github.com/darkoverlordofdata/entitas-fsharp) -- [TypeScript](https://github.com/darkoverlordofdata/entitas-ts) -- [Kotlin](https://github.com/darkoverlordofdata/entitas-kotlin) -- [Haskell](https://github.com/mhaemmerle/entitas-haskell) -- [Erlang](https://github.com/mhaemmerle/entitas_erl) -- [Clojure](https://github.com/mhaemmerle/entitas-clj) -- [Crystal](https://github.com/spoved/entitas.cr) - -[clean-coders]: https://cleancoders.com "Clean Coders" - -[documentation]: http://sschmid.github.io/Entitas/ "Entitas Documentation" -[wiki]: https://github.com/sschmid/Entitas/wiki "Entitas Wiki" -[wiki-code-generator]: https://github.com/sschmid/Entitas/wiki/Code-Generator "Wiki - Code Generator" -[wiki-overview]: https://github.com/sschmid/Entitas/wiki/Overview "Wiki - Overview" -[wiki-unity-integration]: https://github.com/sschmid/Entitas/wiki/Unity-integration "Wiki - Unity Integration" -[wiki-example-projects]: https://github.com/sschmid/Entitas/wiki/Example-projects "Wiki - Example Projects" -[wiki-games-and-examples]: https://github.com/sschmid/Entitas/wiki/Made-With-Entitas "Wiki - #madeWithEntitas" - -[shmup1-thumb]: https://raw.githubusercontent.com/sschmid/Entitas/master/Readme/Images/Entitas-Shmup-Part-1.jpg "Video: Entitas - Shmup - Part 1" -[shmup1]: https://www.youtube.com/watch?v=L-18XRTarOM "Video: Entitas - Shmup - Part 1" -[shmup2-thumb]: https://raw.githubusercontent.com/sschmid/Entitas/master/Readme/Images/Entitas-Shmup-Part-2.jpg "Video: Entitas - Shmup - Part 2" -[shmup2]: https://www.youtube.com/watch?v=DZpvUnj2dGI "Video: Entitas - Shmup - Part 2" -[unite15-thumb]: https://raw.githubusercontent.com/sschmid/Entitas/master/Readme/Images/UniteEurope2015-Video.png "Video: Watch the Entitas Talk at Unite Europe 2015" -[unite15]: https://www.youtube.com/watch?v=Re5kGtxTW6E "Video: Watch the Entitas Talk at Unite Europe 2015" -[unite15-slides]: http://www.slideshare.net/sschmid/uniteeurope-2015 "SlideShare: Unite Europe 2015" -[unite16-thumb]: https://raw.githubusercontent.com/sschmid/Entitas/master/Readme/Images/UniteEurope2016-Video.png "Video: Watch the Entitas Talk at Unite Europe 2016" -[unite16]: https://www.youtube.com/watch?v=Phx7IJ3XUzg "Video: Watch the Entitas Talk at Unite Europe 2016" -[unite16-slides]: http://www.slideshare.net/sschmid/uniteeurope-2016 "SlideShare: Unite Europe 2016" - -[releases]: https://github.com/sschmid/Entitas/releases "Releases" -[issues-new]: https://github.com/sschmid/Entitas/issues/new "New issue" - -[twitter-sschmid]: https://twitter.com/s_schmid "s_schmid on Twitter" -[twitter-entitas_csharp]: https://twitter.com/entitas_csharp "entitas_csharp on Twitter" - -[github-sschmid]: https://github.com/sschmid "@sschmid" -[github-mzaks]: https://github.com/mzaks "@mzaks" -[github-cloudjubei]: https://github.com/cloudjubei "@cloudjubei" -[github-devboy]: https://github.com/devboy "@devboy" diff --git a/src/Libs/External/Jenny/Plugins/Entitas/System.CodeDom.dll b/src/Libs/External/Jenny/Plugins/Entitas/System.CodeDom.dll deleted file mode 100644 index 83c4fab..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Entitas/System.CodeDom.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/DesperateDevs.Roslyn.dll b/src/Libs/External/Jenny/Plugins/Jenny/DesperateDevs.Roslyn.dll deleted file mode 100644 index 85fddc9..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/DesperateDevs.Roslyn.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Humanizer.dll b/src/Libs/External/Jenny/Plugins/Jenny/Humanizer.dll deleted file mode 100644 index c9a7ef8..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Humanizer.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Jenny.Plugins.Roslyn.dll b/src/Libs/External/Jenny/Plugins/Jenny/Jenny.Plugins.Roslyn.dll deleted file mode 100644 index e5535ff..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Jenny.Plugins.Roslyn.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Jenny.Plugins.Unity.dll b/src/Libs/External/Jenny/Plugins/Jenny/Jenny.Plugins.Unity.dll deleted file mode 100644 index 0b6d336..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Jenny.Plugins.Unity.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Jenny.Plugins.dll b/src/Libs/External/Jenny/Plugins/Jenny/Jenny.Plugins.dll deleted file mode 100644 index 9ba6bf3..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Jenny.Plugins.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.Bcl.AsyncInterfaces.dll b/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.Bcl.AsyncInterfaces.dll deleted file mode 100644 index fe6ba4c..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.Bcl.AsyncInterfaces.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.Build.Locator.dll b/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.Build.Locator.dll deleted file mode 100644 index 5baaa9c..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.Build.Locator.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.CSharp.Workspaces.dll b/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.CSharp.Workspaces.dll deleted file mode 100644 index d02274e..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.CSharp.Workspaces.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.CSharp.dll b/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.CSharp.dll deleted file mode 100644 index eb19590..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.CSharp.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.Workspaces.MSBuild.dll b/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.Workspaces.MSBuild.dll deleted file mode 100644 index 66dad35..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.Workspaces.MSBuild.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.Workspaces.dll b/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.Workspaces.dll deleted file mode 100644 index cebbf13..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.Workspaces.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.dll b/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.dll deleted file mode 100644 index 401f505..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/Microsoft.CodeAnalysis.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.AttributedModel.dll b/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.AttributedModel.dll deleted file mode 100644 index d37283b..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.AttributedModel.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.Convention.dll b/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.Convention.dll deleted file mode 100644 index b6fa4ab..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.Convention.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.Hosting.dll b/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.Hosting.dll deleted file mode 100644 index c67f1c0..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.Hosting.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.Runtime.dll b/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.Runtime.dll deleted file mode 100644 index 2a4b38c..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.Runtime.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.TypedParts.dll b/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.TypedParts.dll deleted file mode 100644 index 7c0c780..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/System.Composition.TypedParts.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Plugins/Jenny/System.IO.Pipelines.dll b/src/Libs/External/Jenny/Plugins/Jenny/System.IO.Pipelines.dll deleted file mode 100644 index 8ee4dfd..0000000 Binary files a/src/Libs/External/Jenny/Plugins/Jenny/System.IO.Pipelines.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Sherlog.Formatters.dll b/src/Libs/External/Jenny/Sherlog.Formatters.dll deleted file mode 100644 index 42cc38f..0000000 Binary files a/src/Libs/External/Jenny/Sherlog.Formatters.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/Sherlog.dll b/src/Libs/External/Jenny/Sherlog.dll deleted file mode 100644 index 5341da0..0000000 Binary files a/src/Libs/External/Jenny/Sherlog.dll and /dev/null differ diff --git a/src/Libs/External/Jenny/TCPeasy.dll b/src/Libs/External/Jenny/TCPeasy.dll deleted file mode 100644 index 9d5f4fc..0000000 Binary files a/src/Libs/External/Jenny/TCPeasy.dll and /dev/null differ diff --git a/src/Libs/External/MonoGame.ImGuiNet b/src/Libs/External/MonoGame.ImGuiNet new file mode 160000 index 0000000..b4c81c6 --- /dev/null +++ b/src/Libs/External/MonoGame.ImGuiNet @@ -0,0 +1 @@ +Subproject commit b4c81c63cb0cf7ecfbf8877d0f7a6fea301c001f diff --git a/src/Libs/External/Scellecs.Morpeh.Extended/EntityExtensions.cs b/src/Libs/External/Scellecs.Morpeh.Extended/EntityExtensions.cs new file mode 100644 index 0000000..7e3d69e --- /dev/null +++ b/src/Libs/External/Scellecs.Morpeh.Extended/EntityExtensions.cs @@ -0,0 +1,12 @@ +namespace Scellecs.Morpeh.Extended; + +public static class EntityExtensions +{ + public static ref T AddComponent(this Entity e, T component) where T : struct, IComponent + { + ref T added = ref e.AddComponent(); + added = component; + + return ref added; + } +} diff --git a/src/Libs/External/Scellecs.Morpeh.Extended/Feature.cs b/src/Libs/External/Scellecs.Morpeh.Extended/Feature.cs new file mode 100644 index 0000000..2bcdead --- /dev/null +++ b/src/Libs/External/Scellecs.Morpeh.Extended/Feature.cs @@ -0,0 +1,97 @@ +namespace Scellecs.Morpeh.Extended; + +public abstract class Feature +{ + public World World { get; set; } + + private readonly List _features = new(); + private readonly SystemsGroup _initializers; + private readonly SystemsGroup _systems; + private readonly SystemsGroup _fixedSystems; + private readonly SystemsGroup _lateSystems; + private readonly SystemsGroup _cleanupSystems; + private readonly SystemsGroup _renderSystems; + + public void OnAwake() + { + _initializers.Initialize(); + + foreach (Feature feature in _features) feature._initializers.Initialize(); + } + + public virtual void OnUpdate(float deltaTime) + { + _systems.Update(deltaTime); + + foreach (Feature feature in _features) feature._systems.Update(deltaTime); + } + + public virtual void OnFixedUpdate(float deltaTime) + { + _fixedSystems.FixedUpdate(deltaTime); + + foreach (Feature feature in _features) feature._fixedSystems.FixedUpdate(deltaTime); + } + + public virtual void OnLateUpdate(float deltaTime) + { + _lateSystems.LateUpdate(deltaTime); + _cleanupSystems.CleanupUpdate(deltaTime); + + foreach (Feature feature in _features) + { + feature._lateSystems.LateUpdate(deltaTime); + feature._cleanupSystems.CleanupUpdate(deltaTime); + } + } + + public virtual void OnRender(float deltaTime) + { + _renderSystems.Update(deltaTime); + + foreach (Feature feature in _features) feature._renderSystems.Update(deltaTime); + } + + protected Feature(World world) + { + World = world; + + _initializers = world.CreateSystemsGroup(); + _systems = world.CreateSystemsGroup(); + _fixedSystems = world.CreateSystemsGroup(); + _lateSystems = world.CreateSystemsGroup(); + _cleanupSystems = world.CreateSystemsGroup(); + _renderSystems = world.CreateSystemsGroup(); + } + + protected void Add(Feature feature) => _features.Add(feature); + + protected void Add(IInitializer initializer) + { + switch (initializer) + { + case IRenderSystem renderSystem: + _renderSystems.AddSystem(renderSystem); + break; + case ICleanupSystem cleanupSystem: + _cleanupSystems.AddSystem(cleanupSystem); + break; + case ILateSystem lateSystem: + _lateSystems.AddSystem(lateSystem); + break; + case IFixedSystem fixedSystem: + _fixedSystems.AddSystem(fixedSystem); + break; + case ISystem system: + _systems.AddSystem(system); + break; + default: + _initializers.AddInitializer(initializer); + break; + } + } + + public void Dispose() + { + } +} diff --git a/src/Libs/External/Scellecs.Morpeh.Extended/IRenderSystem.cs b/src/Libs/External/Scellecs.Morpeh.Extended/IRenderSystem.cs new file mode 100644 index 0000000..df5520c --- /dev/null +++ b/src/Libs/External/Scellecs.Morpeh.Extended/IRenderSystem.cs @@ -0,0 +1,5 @@ +namespace Scellecs.Morpeh.Extended; + +public interface IRenderSystem : ISystem +{ +} diff --git a/src/Libs/External/Scellecs.Morpeh.Extended/Scellecs.Morpeh.Extended.csproj b/src/Libs/External/Scellecs.Morpeh.Extended/Scellecs.Morpeh.Extended.csproj new file mode 100644 index 0000000..49ede5b --- /dev/null +++ b/src/Libs/External/Scellecs.Morpeh.Extended/Scellecs.Morpeh.Extended.csproj @@ -0,0 +1,14 @@ + + + + enable + enable + net8.0 + default + + + + + + + diff --git a/src/Libs/Features.Debugging/DebugFeature.cs b/src/Libs/Features.Debugging/DebugFeature.cs new file mode 100644 index 0000000..2bb858b --- /dev/null +++ b/src/Libs/Features.Debugging/DebugFeature.cs @@ -0,0 +1,19 @@ +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; +using Systems.Debugging; +using Systems.Debugging.Render; + +namespace GameDesktop; + +public class DebugFeature : Feature +{ + public DebugFeature(World world, + EntitiesList entitiesList, + FrameCounter frameCounter, + RenderFramesPerSec renderFramesPerSec, PivotRenderSystem pivotRenderSystem) : base(world) + { + Add(entitiesList); + Add(frameCounter); + Add(renderFramesPerSec); + } +} diff --git a/src/Libs/Features.Debugging/DebugRootFeature.cs b/src/Libs/Features.Debugging/DebugRootFeature.cs deleted file mode 100644 index 23867f6..0000000 --- a/src/Libs/Features.Debugging/DebugRootFeature.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Systems.Debugging; - -namespace Features.Debugging; - -public sealed class DebugRootFeature : Entitas.Extended.Feature -{ - public DebugRootFeature(DrawRectangleCollisionComponentsSystem drawRectangleCollisionComponentsSystem) - { - Add(drawRectangleCollisionComponentsSystem); - } -} diff --git a/src/Libs/Features.Debugging/Features.Debugging.csproj b/src/Libs/Features.Debugging/Features.Debugging.csproj index 42d7fb2..9af7f57 100644 --- a/src/Libs/Features.Debugging/Features.Debugging.csproj +++ b/src/Libs/Features.Debugging/Features.Debugging.csproj @@ -1,13 +1,14 @@ - net7.0 enable enable + net8.0 + default - + diff --git a/src/Libs/Features/CameraFeature.cs b/src/Libs/Features/CameraFeature.cs deleted file mode 100644 index d225d66..0000000 --- a/src/Libs/Features/CameraFeature.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Entitas.Extended; - -namespace Features; - -public sealed class CameraFeature : Entitas.Extended.Feature -{ - public CameraFeature(IDrawSystem drawSystem) - { - Add(drawSystem); - } -} diff --git a/src/Libs/Features/Features.csproj b/src/Libs/Features/Features.csproj index 6298e7b..68915e7 100644 --- a/src/Libs/Features/Features.csproj +++ b/src/Libs/Features/Features.csproj @@ -1,14 +1,14 @@ - net7.0 enable enable + net8.0 + default - diff --git a/src/Libs/Features/InputFeature.cs b/src/Libs/Features/InputFeature.cs deleted file mode 100644 index 9b6018f..0000000 --- a/src/Libs/Features/InputFeature.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Systems; - -namespace Features; - -public sealed class InputFeature : Entitas.Extended.Feature -{ - public InputFeature(InputSystem inputSystem) - { - Add(inputSystem); - } -} diff --git a/src/Libs/Features/MovementFeature.cs b/src/Libs/Features/MovementFeature.cs index 62bdfec..80b226a 100644 --- a/src/Libs/Features/MovementFeature.cs +++ b/src/Libs/Features/MovementFeature.cs @@ -1,16 +1,16 @@ -using Systems; +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; +using Systems; namespace Features; -public sealed class MovementFeature : Entitas.Extended.Feature +public class MovementFeature : Feature { - public MovementFeature( - CollisionSystem collisionSystem, - MovementSystem movementSystem, - AnimatedMovementSystem animatedMovementSystem) + public MovementFeature(World world, + InputSystem inputSystem, + MovementSystem movementSystem) : base(world) { - Add(collisionSystem); + Add(inputSystem); Add(movementSystem); - Add(animatedMovementSystem); } } diff --git a/src/Libs/Features/PreRenderFeature.cs b/src/Libs/Features/PreRenderFeature.cs new file mode 100644 index 0000000..bf5570f --- /dev/null +++ b/src/Libs/Features/PreRenderFeature.cs @@ -0,0 +1,16 @@ +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; +using Systems.Render; + +namespace Features; + +public class PreRenderFeature : Feature +{ + public PreRenderFeature(World world, + CharacterMovementAnimationSystem characterMovementAnimationSystem, + CameraFollowingSystem cameraFollowingSystem) : base(world) + { + Add(characterMovementAnimationSystem); + Add(cameraFollowingSystem); + } +} diff --git a/src/Libs/Features/RenderFeature.cs b/src/Libs/Features/RenderFeature.cs new file mode 100644 index 0000000..52d9f8a --- /dev/null +++ b/src/Libs/Features/RenderFeature.cs @@ -0,0 +1,14 @@ +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; +using Systems.Render; + +namespace Features; + +public class RenderFeature : Feature +{ + public RenderFeature(World world, + RenderCharacterMovementAnimationSystem renderCharacterMovementAnimationSystem) : base(world) + { + Add(renderCharacterMovementAnimationSystem); + } +} diff --git a/src/Libs/Features/RootFeature.cs b/src/Libs/Features/RootFeature.cs index 815b056..5e06c43 100644 --- a/src/Libs/Features/RootFeature.cs +++ b/src/Libs/Features/RootFeature.cs @@ -1,26 +1,41 @@ -using Features.Debugging; +using GameDesktop; +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; namespace Features; -public sealed class RootFeature : Entitas.Extended.Feature +public class RootFeature : Feature { - public RootFeature(WorldInitializeFeature worldInitializeFeature, - InputFeature inputFeature, - MovementFeature movementFeature, - CameraFeature cameraFeature) + public RootFeature(World world, + WorldInitializer worldInitializer, + MovementFeature movementFeature + ) : base(world) { - Add(worldInitializeFeature); - Add(inputFeature); + Add(worldInitializer); Add(movementFeature); - Add(cameraFeature); } - public RootFeature(DebugRootFeature debugRootFeature, - WorldInitializeFeature worldInitializeFeature, - InputFeature inputFeature, + public RootFeature(World world, + WorldInitializer worldInitializer, + MovementFeature movementFeature, + PreRenderFeature preRenderFeature, + RenderFeature renderFeature + ) : this(world, worldInitializer, movementFeature) + { + Add(preRenderFeature); + Add(renderFeature); + } + +#if DEBUG + public RootFeature(World world, + WorldInitializer worldInitializer, MovementFeature movementFeature, - CameraFeature cameraFeature) : this(worldInitializeFeature, inputFeature, movementFeature, cameraFeature) + PreRenderFeature preRenderFeature, + RenderFeature renderFeature, + DebugFeature debugFeature + ) : this(world, worldInitializer, movementFeature, preRenderFeature, renderFeature) { - Add(debugRootFeature); + Add(debugFeature); } +#endif } diff --git a/src/Libs/Features/WorldInitializeFeature.cs b/src/Libs/Features/WorldInitializeFeature.cs deleted file mode 100644 index b7222f7..0000000 --- a/src/Libs/Features/WorldInitializeFeature.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Entities; -using Services.Factories; - -namespace Features; - -public class WorldInitializeFeature : Entitas.Extended.Feature -{ - private readonly AbstractFactory _playerFactory; - private readonly AbstractFactory _staticEntityFactory; - - public WorldInitializeFeature(AbstractFactory playerFactory, - AbstractFactory staticEntityFactory) - { - _playerFactory = playerFactory; - _staticEntityFactory = staticEntityFactory; - } - - public override void Initialize() - { - _playerFactory.Create(); - _staticEntityFactory.Create(); - } -} diff --git a/src/Libs/Features/WorldInitializer.cs b/src/Libs/Features/WorldInitializer.cs new file mode 100644 index 0000000..5edf675 --- /dev/null +++ b/src/Libs/Features/WorldInitializer.cs @@ -0,0 +1,35 @@ +using Entities.Factories.Characters; +using Entities.Factories.Meta; +using Scellecs.Morpeh; + +namespace Features; + +public class WorldInitializer : IInitializer +{ + public World World { get; set; } + private readonly WorldEntityFactory _worldEntityFactory; + private readonly PlayerEntityFactory _playerEntityFactory; + private readonly DummyEntityFactory _dummyEntityFactory; + + public WorldInitializer(World world, + WorldEntityFactory worldEntityFactory, + PlayerEntityFactory playerEntityFactory, + DummyEntityFactory dummyEntityFactory) + { + World = world; + _worldEntityFactory = worldEntityFactory; + _playerEntityFactory = playerEntityFactory; + _dummyEntityFactory = dummyEntityFactory; + } + + public void OnAwake() + { + _worldEntityFactory.CreateEntity(@in: World); + _playerEntityFactory.CreateEntity(@in: World); + _dummyEntityFactory.CreateEntity(@in: World); + } + + public void Dispose() + { + } +} diff --git a/src/Libs/Services/Movement/IMovement.cs b/src/Libs/Services/Movement/IMovement.cs index f947430..fd79c91 100644 --- a/src/Libs/Services/Movement/IMovement.cs +++ b/src/Libs/Services/Movement/IMovement.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using System.Numerics; namespace Services; diff --git a/src/Libs/Services/Movement/Movement.cs b/src/Libs/Services/Movement/Movement.cs index ced01bc..d7b22e7 100644 --- a/src/Libs/Services/Movement/Movement.cs +++ b/src/Libs/Services/Movement/Movement.cs @@ -1,8 +1,16 @@ -using Microsoft.Xna.Framework; +using System.Numerics; namespace Services.Movement; public class SimpleMovement : IMovement { - public Vector2 Move(Vector2 from, Vector2 by) => from + Vector2.Normalize(by); + public Vector2 Move(Vector2 from, Vector2 by) + { + if (by.Equals(Vector2.Zero)) + { + return from; + } + + return from + Vector2.Normalize(by); + } } diff --git a/src/Libs/Services/Services.csproj b/src/Libs/Services/Services.csproj index 8e60f5d..1c1be8c 100644 --- a/src/Libs/Services/Services.csproj +++ b/src/Libs/Services/Services.csproj @@ -1,14 +1,14 @@ - net7.0 enable enable + net8.0 + default - - + diff --git a/src/Libs/Systems.Debugging/DrawRectangleCollisionComponentsSystem.cs b/src/Libs/Systems.Debugging/DrawRectangleCollisionComponentsSystem.cs index 2b2bacb..58392eb 100644 --- a/src/Libs/Systems.Debugging/DrawRectangleCollisionComponentsSystem.cs +++ b/src/Libs/Systems.Debugging/DrawRectangleCollisionComponentsSystem.cs @@ -1,50 +1,50 @@ -using Entitas; -using Entitas.Extended; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Serilog; - -namespace Systems.Debugging; - -public class DrawRectangleCollisionComponentsSystem : IDrawSystem -{ - private readonly Contexts _contexts; - private readonly IGroup _group; - private readonly ILogger _logger; - - public DrawRectangleCollisionComponentsSystem(Contexts contexts, IGroup group, ILogger logger) - { - _contexts = contexts; - _group = group; - _logger = logger; - } - - // TODO: Move the logic in the release features - // TODO: Pivot & anchors system - // TODO: Make circle colliders & relative system (sloped collision) - public void Draw(GameTime gameTime, SpriteBatch spriteBatch) - { - GameEntity[] entities = _group.GetEntities(); - - spriteBatch.Begin(samplerState: SamplerState.PointClamp); - - Color[] colors = { Color.Black, Color.White }; - int k = 0; - - foreach (GameEntity e in entities) - { - var texture = new Texture2D(spriteBatch.GraphicsDevice, 1, 1); - texture.SetData(new[] { colors[k] }); - - ++k; - if (k == colors.Length) - k = 0; - - spriteBatch.Draw(texture, e.transform.Position, sourceRectangle: e.rectangleCollision.Size, - Color.White); - } - - spriteBatch.End(); - } - -} +// using Entitas; +// using Entitas.Extended; +// using Microsoft.Xna.Framework; +// using Microsoft.Xna.Framework.Graphics; +// using Serilog; +// +// namespace Systems.Debugging; +// +// public class DrawRectangleCollisionComponentsSystem : IDrawSystem +// { +// private readonly Contexts _contexts; +// private readonly IGroup _group; +// private readonly ILogger _logger; +// +// public DrawRectangleCollisionComponentsSystem(Contexts contexts, IGroup group, ILogger logger) +// { +// _contexts = contexts; +// _group = group; +// _logger = logger; +// } +// +// // TODO: Move the logic in the release features +// // TODO: Pivot & anchors system +// // TODO: Make circle colliders & relative system (sloped collision) +// public void Draw(GameTime gameTime, SpriteBatch spriteBatch) +// { +// GameEntity[] entities = _group.GetEntities(); +// +// spriteBatch.Begin(samplerState: SamplerState.PointClamp); +// +// Color[] colors = { Color.Black, Color.White }; +// int k = 0; +// +// foreach (GameEntity e in entities) +// { +// var texture = new Texture2D(spriteBatch.GraphicsDevice, 1, 1); +// texture.SetData(new[] { colors[k] }); +// +// ++k; +// if (k == colors.Length) +// k = 0; +// +// spriteBatch.Draw(texture, e.transform.Position, sourceRectangle: e.rectangleCollision.Size, +// Color.White); +// } +// +// spriteBatch.End(); +// } +// +// } diff --git a/src/Libs/Systems.Debugging/EntitiesList.cs b/src/Libs/Systems.Debugging/EntitiesList.cs new file mode 100644 index 0000000..a717921 --- /dev/null +++ b/src/Libs/Systems.Debugging/EntitiesList.cs @@ -0,0 +1,70 @@ +using Components.Data; +using Components.Render.Animation; +using Components.Render.Static; +using Components.Tags; +using ImGuiNET; +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; + +namespace Systems.Debugging; + +public class EntitiesList : IRenderSystem +{ + public World World { set; get; } + private const float Indentation = 16.0f; + + public EntitiesList(World world) + { + World = world; + } + + public void OnAwake() + { + } + + public void OnUpdate(float deltaTime) + { + Filter filter = World.Filter.With().Build(); + + ImGui.Begin("World"); + + if (ImGui.CollapsingHeader("Entities")) + { + ImGui.Indent(Indentation); + foreach (Entity e in filter) + { + // TODO: By flag components I could decide what entity this is and show the proper name + if (!ImGui.CollapsingHeader($"Entity###{e.ID}")) // ### -> for identical values + { + continue; + } + + ImGui.Indent(Indentation); + + // TODO: collect all the components' names automatically + // TODO: use List types -> Has(typeof(T)) (with underlying Has()); + if (e.Has()) ImGui.TextWrapped(nameof(InventoryComponent)); + if (e.Has()) ImGui.TextWrapped(nameof(TransformComponent)); + if (e.Has()) ImGui.TextWrapped(nameof(CameraComponent)); + if (e.Has()) ImGui.TextWrapped(nameof(RectangleCollisionComponent)); + if (e.Has()) ImGui.TextWrapped(nameof(CharacterAnimatorComponent)); + if (e.Has()) ImGui.TextWrapped(nameof(MovementAnimationsComponent)); + if (e.Has()) ImGui.TextWrapped(nameof(SpriteComponent)); + if (e.Has()) ImGui.TextWrapped(nameof(InputMovableComponent)); + if (e.Has()) ImGui.TextWrapped(nameof(MovableComponent)); + if (e.Has()) ImGui.TextWrapped(nameof(RenderComponent)); + // TODO: menu for each component to edit the values + + ImGui.Unindent(Indentation); + } + + ImGui.Unindent(Indentation); + } + + ImGui.End(); + } + + public void Dispose() + { + } +} diff --git a/src/Libs/Systems.Debugging/FrameCounter.cs b/src/Libs/Systems.Debugging/FrameCounter.cs new file mode 100644 index 0000000..ad328f1 --- /dev/null +++ b/src/Libs/Systems.Debugging/FrameCounter.cs @@ -0,0 +1,43 @@ +using Components.Data; +using Scellecs.Morpeh; + +namespace Systems.Debugging; + +public class FrameCounter : ISystem +{ + private const float UpdateFrequencyInSec = .02f; + private float _elapsedTime; + private int _framesCount; + + public World World { get; set; } + + public FrameCounter(World world) + { + World = world; + } + + public void OnAwake() + { + } + + public void OnUpdate(float deltaTime) + { + ++_framesCount; + _elapsedTime += deltaTime; + + if (_elapsedTime < UpdateFrequencyInSec) + { + return; + } + + World.Filter.With().Build().First().GetComponent().FramesPerSec = + _framesCount / _elapsedTime; + + _framesCount = 0; + _elapsedTime = 0; + } + + public void Dispose() + { + } +} diff --git a/src/Libs/Systems.Debugging/Render/PivotRenderSystem.cs b/src/Libs/Systems.Debugging/Render/PivotRenderSystem.cs new file mode 100644 index 0000000..cb0d069 --- /dev/null +++ b/src/Libs/Systems.Debugging/Render/PivotRenderSystem.cs @@ -0,0 +1,41 @@ +using Components.Data; +using Microsoft.Xna.Framework.Graphics; +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; +using Color = Microsoft.Xna.Framework.Color; + +namespace Systems.Debugging.Render; + +public class PivotRenderSystem : IRenderSystem +{ + private readonly SpriteBatch _spriteBatch; + private readonly Texture2D _pixel; + public World World { get; set; } + + public PivotRenderSystem(World world, SpriteBatch spriteBatch, Texture2D pixel) + { + _spriteBatch = spriteBatch; + _pixel = pixel; + World = world; + } + + public void OnAwake() + { + } + + public void OnUpdate(float deltaTime) + { + Filter filter = World.Filter.With().Build(); + + foreach (Entity e in filter) + { + ref var transform = ref e.GetComponent(); + + _spriteBatch.Draw(texture: _pixel, position: transform.Position, color: Color.Gold); + } + } + + public void Dispose() + { + } +} diff --git a/src/Libs/Systems.Debugging/Render/RenderFramesPerSec.cs b/src/Libs/Systems.Debugging/Render/RenderFramesPerSec.cs new file mode 100644 index 0000000..18f6b2e --- /dev/null +++ b/src/Libs/Systems.Debugging/Render/RenderFramesPerSec.cs @@ -0,0 +1,43 @@ +using Components.Data; +using ImGuiNET; +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; + +namespace Systems.Debugging.Render; + +public class RenderFramesPerSec : IRenderSystem +{ + public World World { get; set; } + + public RenderFramesPerSec(World world) + { + World = world; + } + + public void OnAwake() + { + } + + public void OnUpdate(float deltaTime) + { + var world = World.Filter.With().Build().First().GetComponent(); + + ImGui.Begin("Diagnostics"); + + ImGui.Text($"FPS: {world.FramesPerSec}"); + + ImGui.End(); + } + + public void Dispose() + { + throw new NotImplementedException(); + } +} + +// TODO: Tiles, save system, understand the fps logic +// UI Debug: entities inspector, memory graph, fps setter/limiter +// Testing ECS, workflow cleanup +// camera zoom, pause, scenes (menu, game), content (mechanics: quests, dialogues, details, tree chopping, etc) +// optimization, collisions, events, UI styling +// shaders diff --git a/src/Libs/Systems.Debugging/Systems.Debugging.csproj b/src/Libs/Systems.Debugging/Systems.Debugging.csproj index e5ff67c..df3c260 100644 --- a/src/Libs/Systems.Debugging/Systems.Debugging.csproj +++ b/src/Libs/Systems.Debugging/Systems.Debugging.csproj @@ -1,17 +1,19 @@ - net7.0 enable enable + default + net8.0 - + - + + diff --git a/src/Libs/Systems/AnimatedMovementSystem.cs b/src/Libs/Systems/AnimatedMovementSystem.cs deleted file mode 100644 index 2133102..0000000 --- a/src/Libs/Systems/AnimatedMovementSystem.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Components; -using Components.Data; -using Entitas; -using Entitas.Extended; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using MonoGame.Aseprite.Sprites; -using Serilog; -using Services.Math; -using IExecuteSystem = Entitas.Extended.IExecuteSystem; - -namespace Systems; - -public class AnimatedMovementSystem : IExecuteSystem -{ - private readonly IGroup _group; - private readonly ILogger _logger; - - public AnimatedMovementSystem(IGroup group, ILogger logger) - { - _group = group; - _logger = logger; - } - - // todo: null-checking everywhere - public void Execute(GameTime gameTime) - { - GameEntity[] entities = _group.GetEntities(); - foreach (GameEntity e in entities) - { - Vector2 velocity = e.transform.Velocity; - - // TODO: refactor and put it in a service system? - if (velocity.Equals(Vector2.Zero)) - { - StopFacingTrace(e.movementAnimation); - } - else - { - MoveFacingTrace(e.movementAnimation, velocity); - } - - e.movementAnimation.PlayingAnimation.Update(gameTime); - } - } - - private static void StopFacingTrace(MovementAnimationComponent component) - { - if (component.HasStopped) - { - return; - } - - Direction direction = MathUtils.Rad8DirYFlipped(component.FacingDirection); - - component.PlayingAnimation = component.IdleAnimations[direction]; - component.PlayingAnimation.SetFrame(0); - component.HasStopped = true; - } - - private static void MoveFacingTrace(MovementAnimationComponent component, Vector2 velocity) - { - Direction direction = MathUtils.Rad8DirYFlipped(velocity); - AnimatedSprite walkingAnimation = component.WalkingAnimations[direction]; - - if (AreDifferentSprites(component.PlayingAnimation, walkingAnimation)) - { - component.PlayingAnimation = walkingAnimation; - } - - component.FacingDirection = velocity; - component.HasStopped = false; - } - - private static bool AreDifferentSprites(Sprite left, Sprite right) => - left.Name != right.Name || - left.FlipHorizontally != right.FlipHorizontally; -} diff --git a/src/Libs/Systems/CameraFollowingSystem.cs b/src/Libs/Systems/CameraFollowingSystem.cs deleted file mode 100644 index c08fbf1..0000000 --- a/src/Libs/Systems/CameraFollowingSystem.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Entitas; -using Entitas.Extended; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace Systems; - -public class CameraFollowingSystem : IDrawSystem -{ - private readonly Contexts _contexts; - private readonly IGroup _group; - - public CameraFollowingSystem(Contexts contexts, IGroup group) - { - _contexts = contexts; - _group = group; - } - - // todo: refactor, put the logic in impl - // todo: smooth diagonal movement - private Vector2 GetPosition(GameEntity target) => - new( - (float)target.camera.Size.Width / 2 - - (float)target.movementAnimation.PlayingAnimation.Width / 2, - (float)target.camera.Size.Height / 2 - - (float)target.movementAnimation.PlayingAnimation.Height / 2); - - public void Draw(GameTime gameTime, SpriteBatch spriteBatch) - { - GameEntity[] entities = _group.GetEntities(); - - spriteBatch.Begin(samplerState: SamplerState.PointWrap); - - var target = _contexts.game.cameraEntity; - foreach (GameEntity e in entities) - { - Vector2 otherAt = e.transform.Position - (target?.transform.Position ?? Vector2.Zero); - if (e.hasSprite) - { - e.sprite.Sprite.Draw(spriteBatch, otherAt); - // todo: drawing complex entities' sprite/animated components - } - - target?.movementAnimation.PlayingAnimation.Draw(spriteBatch, GetPosition(target)); - } - - spriteBatch.End(); - } -} diff --git a/src/Libs/Systems/CollisionSystem.cs b/src/Libs/Systems/CollisionSystem.cs index 310c08a..bc9c167 100644 --- a/src/Libs/Systems/CollisionSystem.cs +++ b/src/Libs/Systems/CollisionSystem.cs @@ -1,56 +1,56 @@ -using Entitas; -using Entitas.Extended; -using Microsoft.Xna.Framework; -using Serilog; - -namespace Systems; - -// Input & Collision systems both have to be fixed execute systems, -// otherwise it'll lead to the desynchronized behaviour. -public class CollisionSystem : IFixedExecuteSystem -{ - private readonly IGroup _group; - private readonly ILogger _logger; - - public CollisionSystem(IGroup group, ILogger logger) - { - _group = group; - _logger = logger; - } - - // TODO: Optimize efficiency - public void FixedExecute(GameTime gameTime) - { - GameEntity[] entities = _group.GetEntities(); - - for (int i = 0; i < entities.Length; ++i) - { - GameEntity first = entities[i]; - - for (int j = i + 1; j < entities.Length; ++j) - { - GameEntity second = entities[j]; - - if (AreIntersecting(first, second)) - { - first.transform.Velocity = Vector2.Zero; - second.transform.Velocity = Vector2.Zero; - } - } - } - } - - private static bool AreIntersecting(GameEntity first, GameEntity second) - { - Rectangle firstRectangle = BuildRectangle(first); - Rectangle secondRectangle = BuildRectangle(second); - - Rectangle intersect = Rectangle.Intersect(firstRectangle, secondRectangle); - - return !intersect.IsEmpty; - - Rectangle BuildRectangle(GameEntity x) => new((int)(x.transform.Position.X + x.transform.Velocity.X), - (int)(x.transform.Position.Y + x.transform.Velocity.Y), x.rectangleCollision.Size.Width, - x.rectangleCollision.Size.Height); - } -} +// using Entitas; +// using Entitas.Extended; +// using Microsoft.Xna.Framework; +// using Serilog; +// +// namespace Systems; +// +// // Input & Collision systems both have to be fixed execute systems, +// // otherwise it'll lead to the desynchronized behaviour. +// public class CollisionSystem : IFixedExecuteSystem +// { +// private readonly IGroup _group; +// private readonly ILogger _logger; +// +// public CollisionSystem(IGroup group, ILogger logger) +// { +// _group = group; +// _logger = logger; +// } +// +// // TODO: Optimize efficiency +// public void FixedExecute(GameTime gameTime) +// { +// GameEntity[] entities = _group.GetEntities(); +// +// for (int i = 0; i < entities.Length; ++i) +// { +// GameEntity first = entities[i]; +// +// for (int j = i + 1; j < entities.Length; ++j) +// { +// GameEntity second = entities[j]; +// +// if (AreIntersecting(first, second)) +// { +// first.transform.Velocity = Vector2.Zero; +// second.transform.Velocity = Vector2.Zero; +// } +// } +// } +// } +// +// private static bool AreIntersecting(GameEntity first, GameEntity second) +// { +// Rectangle firstRectangle = BuildRectangle(first); +// Rectangle secondRectangle = BuildRectangle(second); +// +// Rectangle intersect = Rectangle.Intersect(firstRectangle, secondRectangle); +// +// return !intersect.IsEmpty; +// +// Rectangle BuildRectangle(GameEntity x) => new((int)(x.transform.Position.X + x.transform.Velocity.X), +// (int)(x.transform.Position.Y + x.transform.Velocity.Y), x.rectangleCollision.Size.Width, +// x.rectangleCollision.Size.Height); +// } +// } diff --git a/src/Libs/Systems/DefaultDrawSystem.cs b/src/Libs/Systems/DefaultDrawSystem.cs deleted file mode 100644 index b57564a..0000000 --- a/src/Libs/Systems/DefaultDrawSystem.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Entitas; -using Entitas.Extended; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace Systems; - -public class DefaultDrawSystem : IDrawSystem -{ - private readonly IGroup _group; - - public DefaultDrawSystem(IGroup group) - { - _group = group; - } - - public void Draw(GameTime gameTime, SpriteBatch spriteBatch) - { - // todo: refactor, put it in an impl and use the impl as a dep - GameEntity[] entities = _group.GetEntities().OrderBy(x => x.transform.Position.Y).ToArray(); - - spriteBatch.Begin(samplerState: SamplerState.PointWrap); - - foreach (GameEntity e in entities) - { - var position = e.transform.Position; - // todo: refactor, put it in an impl and use the impl as a dep - if (e.hasSprite) - { - e.sprite.Sprite?.Draw(spriteBatch, position); - } - - if (e.hasMovementAnimation) - { - e.movementAnimation.PlayingAnimation?.Draw(spriteBatch, position); - } - } - - spriteBatch.End(); - } - // TODO: When camera following feature is enabled, - // Make it working with other drawing systems, e.g. debug drawing. - // Thus, draw relatively to camera. - // Share rendering results with other systems (sorting, etc) -} diff --git a/src/Libs/Systems/InputSystem.cs b/src/Libs/Systems/InputSystem.cs index d6f5289..6d45046 100644 --- a/src/Libs/Systems/InputSystem.cs +++ b/src/Libs/Systems/InputSystem.cs @@ -1,49 +1,41 @@ -using Entitas; -using Entitas.Extended; -using Microsoft.Xna.Framework; -using Serilog; -using Services.Input; +using Components; +using Components.Data; +using Components.Tags; +using Implementations; +using Scellecs.Morpeh; namespace Systems; -// Input & Collision systems both have to be fixed execute systems, -// otherwise it'll lead to the desynchronized behaviour. -[Input] -public class InputSystem : IFixedExecuteSystem +public class InputSystem : ISystem { private readonly IInputScanner _inputScanner; - private readonly IGroup _group; - private readonly ILogger _logger; + public World World { get; set; } - public InputSystem(IInputScanner inputScanner, IGroup group, ILogger logger) + public InputSystem(World world, IInputScanner inputScanner) { + World = world; _inputScanner = inputScanner; - _group = group; - _logger = logger; } - public void FixedExecute(GameTime gameTime) + public void OnAwake() { - try - { - Vector2 direction = _inputScanner.GetDirection(); + } - if (direction.Equals(Vector2.Zero) is false) - { - _logger.ForContext().Verbose(direction.ToString()!); - } + public void OnUpdate(float deltaTime) + { + Filter filter = World.Filter + .With() + .With() + .Build(); - GameEntity[] entities = _group.GetEntities(); - foreach (GameEntity e in entities) - { - e.transform.Velocity = direction; - } - } - catch (Exception e) + foreach (Entity e in filter) { - _logger.ForContext().Fatal(e.ToString()); - - throw new Exception(e.Message); + ref TransformComponent transform = ref e.GetComponent(); + transform.Velocity = _inputScanner.GetDirection(); } } + + public void Dispose() + { + } } diff --git a/src/Libs/Systems/KeyboardInput.cs b/src/Libs/Systems/KeyboardInput.cs new file mode 100644 index 0000000..ddbd15f --- /dev/null +++ b/src/Libs/Systems/KeyboardInput.cs @@ -0,0 +1,26 @@ +using System.Numerics; +using Microsoft.Xna.Framework.Input; + +namespace Implementations; + +public interface IInputScanner +{ + Vector2 GetDirection(); +} + +public class KeyboardInput : IInputScanner +{ + private static int GetAxisDirection(Keys negative, Keys positive) + { + KeyboardState keyboardState = Keyboard.GetState(); + + int a = keyboardState.IsKeyDown(positive) ? 1 : 0; + int b = keyboardState.IsKeyDown(negative) ? 1 : 0; + + return a - b; + } + + public Vector2 GetDirection() => + new(GetAxisDirection(Keys.Left, Keys.Right), + GetAxisDirection(Keys.Up, Keys.Down)); +} \ No newline at end of file diff --git a/src/Libs/Systems/MovementSystem.cs b/src/Libs/Systems/MovementSystem.cs index 30ed296..cc30009 100644 --- a/src/Libs/Systems/MovementSystem.cs +++ b/src/Libs/Systems/MovementSystem.cs @@ -1,46 +1,45 @@ -using Entitas; -using Entitas.Extended; -using Microsoft.Xna.Framework; -using Serilog; +using System.Numerics; +using Components; +using Components.Data; +using Components.Tags; +using Scellecs.Morpeh; using Services; -using IExecuteSystem = Entitas.Extended.IExecuteSystem; +using Services.Movement; +using Vector2 = System.Numerics.Vector2; namespace Systems; -public class MovementSystem : IExecuteSystem +public class MovementSystem : ISystem { - private readonly IGroup _group; private readonly IMovement _movement; - private readonly ILogger _logger; + public World World { get; set; } - public MovementSystem(IMovement movement, IGroup group, ILogger logger) + public MovementSystem(World world, IMovement movement) { - _group = group; + World = world; _movement = movement; - _logger = logger; } - public void Execute(GameTime fixedGameTime) + public void OnAwake() { - try - { - GameEntity[] entities = _group.GetEntities(); - foreach (GameEntity e in entities) - { - if (e.transform.Velocity.Equals(Vector2.Zero)) - { - continue; - } - - e.transform.Position = _movement.Move(e.transform.Position, e.transform.Velocity); - _logger.ForContext().Verbose(e.transform.Position.ToString()!); - } - } - catch (Exception e) + } + + public void OnUpdate(float deltaTime) + { + Filter filter = World.Filter + .With() + .With() + .Build(); + + foreach (Entity e in filter) { - _logger.ForContext().Fatal(e.ToString()); + ref TransformComponent transform = ref e.GetComponent(); - throw new Exception(e.Message); + transform.Position = _movement.Move(from: transform.Position, by: transform.Velocity); } } + + public void Dispose() + { + } } diff --git a/src/Libs/Systems/Render/CameraFollowingSystem.cs b/src/Libs/Systems/Render/CameraFollowingSystem.cs new file mode 100644 index 0000000..797e6ae --- /dev/null +++ b/src/Libs/Systems/Render/CameraFollowingSystem.cs @@ -0,0 +1,157 @@ +using System.Numerics; +using Components.Data; +using Components.Render.Animation; +using Components.Render.Static; +using Components.Tags; +using Microsoft.Xna.Framework.Graphics; +using Scellecs.Morpeh; + +namespace Systems.Render; + +public class CameraFollowingSystem : ILateSystem +{ + // private readonly ICamera _camera; + public World World { get; set; } + + public CameraFollowingSystem(World world) + { + World = world; + } + + public void OnAwake() + { + } + + public void OnUpdate(float deltaTime) + { + // TODO: Components in the range of visibility (world grid system?) + // Filter filter = World.Filter.With().Build(); + // IEnumerable entities = SortEntitiesByYPosition(filter); + // + // foreach (Entity e in entities) + // { + // _camera.Render(e); + // } + + Entity e = World.Filter.With().Build().First(); + + ref var transform = ref e.GetComponent(); + ref var camera = ref e.GetComponent(); + + camera.Position = GetCenteredPosition(camera.Viewport, off: transform.Position); + } + + private static Vector2 GetCenteredPosition(Viewport viewport, Vector2 off) => new( + off.X - viewport.Width / 2, + off.Y - viewport.Height / 2); + + private static IEnumerable SortEntitiesByYPosition(Filter filter) + { + List entities = new List(); + + foreach (Entity e in filter) + { + entities.Add(e); + } + + return entities.OrderBy(x => + { + ref var transform = ref x.GetComponent(); + return transform.Position.Y; + }); + } + + public void Dispose() + { + } +} + +public interface ICamera +{ + void Render(Entity e); +} + +public class StaticCamera : BaseCamera, ICamera +{ + public StaticCamera(SpriteBatch spriteBatch, Viewport viewport) : base(spriteBatch, viewport) + { + } + + public void Render(Entity e) + { + if (!e.Has()) + { + return; + } + + ref var transform = ref e.GetComponent(); + + base.RenderCharacterAnimator(e, at: transform.Position); + base.RenderSprite(e, at: transform.Position); + } +} + +public class FollowingCamera : BaseCamera, ICamera +{ + private Vector2 _position; + + public FollowingCamera(SpriteBatch spriteBatch, Viewport viewport, Vector2 position) : base(spriteBatch, viewport) + { + _position = position; + } + + public void Render(Entity e) + { + if (!e.Has()) + { + return; + } + + ref var transform = ref e.GetComponent(); + Vector2 position = transform.Position; + + if (e.Has()) + { + // _position = GetCenteredPosition(off: position); + } + + Vector2 relativePosition = position - _position; + + base.RenderCharacterAnimator(e, at: relativePosition); + base.RenderSprite(e, at: relativePosition); + } +} + +public abstract class BaseCamera +{ + private readonly SpriteBatch _spriteBatch; + protected readonly Viewport _viewport; + + protected BaseCamera(SpriteBatch spriteBatch, Viewport viewport) + { + _spriteBatch = spriteBatch; + _viewport = viewport; + } + + protected void RenderCharacterAnimator(Entity e, Vector2 at) + { + if (!e.Has()) + { + return; + } + + ref var animator = ref e.GetComponent(); + animator.Animation.Draw(_spriteBatch, at); + } + + protected void RenderSprite(Entity e, Vector2 at) + { + if (!e.Has()) + { + return; + } + + ref var spriteComponent = ref e.GetComponent(); + spriteComponent.Sprite.Draw(_spriteBatch, at); + } +} diff --git a/src/Libs/Systems/Render/CharacterMovementAnimationSystem.cs b/src/Libs/Systems/Render/CharacterMovementAnimationSystem.cs new file mode 100644 index 0000000..194bf14 --- /dev/null +++ b/src/Libs/Systems/Render/CharacterMovementAnimationSystem.cs @@ -0,0 +1,71 @@ +using System.Numerics; +using Components.Data; +using Components.Render.Animation; +using MonoGame.Aseprite.Sprites; +using Scellecs.Morpeh; +using Services.Math; + +namespace Systems.Render; + +public class CharacterMovementAnimationSystem : ISystem +{ + public World World { get; set; } + + public CharacterMovementAnimationSystem(World world) + { + World = world; + } + + public void OnAwake() + { + } + + public void OnUpdate(float deltaTime) + { + Filter filter = World.Filter + .With() + .With() + .Build(); + + foreach (Entity e in filter) + { + ref var animations = ref e.GetComponent(); + ref var animator = ref e.GetComponent(); + ref var transform = ref e.GetComponent(); + + // 2. And this one could be in the draw state + // animator.Animation.Draw(_spriteBatch, transform.Position); + + // 1. Actually, all of this could be put in the pre-draw + animator.Animation.Update(deltaTime); + + AnimatedSprite animation = GetAnimation(transform, animations, animator); + animator.Facing = GetDirection(transform, animator); + + if (animator.Animation == animation) + { + continue; + } + + animator.Animation = animation; + // .Play() is called in the AnimatedCharactersFactory (on the step of creation), + // otherwise, you'd call it manually here. + } + } + + private static AnimatedSprite GetAnimation(TransformComponent transform, + MovementAnimationsComponent animations, + CharacterAnimatorComponent animator) => + transform.Velocity.Equals(Vector2.Zero) + ? animations.IdleAnimations[animator.Facing] + : animations.WalkingAnimations[animator.Facing]; + + private static Direction GetDirection(TransformComponent transform, CharacterAnimatorComponent animator) => + transform.Velocity.Equals(Vector2.Zero) + ? animator.Facing + : MathUtils.Rad8DirYFlipped(transform.Velocity); + + public void Dispose() + { + } +} diff --git a/src/Libs/Systems/Render/RenderCharacterMovementAnimationSystem.cs b/src/Libs/Systems/Render/RenderCharacterMovementAnimationSystem.cs new file mode 100644 index 0000000..7ac8939 --- /dev/null +++ b/src/Libs/Systems/Render/RenderCharacterMovementAnimationSystem.cs @@ -0,0 +1,79 @@ +using Components.Data; +using Components.Render.Animation; +using Components.Render.Static; +using Components.Tags; +using Microsoft.Xna.Framework.Graphics; +using Scellecs.Morpeh; +using Scellecs.Morpeh.Extended; + +namespace Systems.Render; + +public class RenderCharacterMovementAnimationSystem : IRenderSystem +{ + public World World { get; set; } + private readonly SpriteBatch _spriteBatch; + + + public RenderCharacterMovementAnimationSystem(World world, SpriteBatch spriteBatch) + { + World = world; + _spriteBatch = spriteBatch; + } + + public void OnAwake() + { + } + + public void OnUpdate(float deltaTime) + { + Filter filter = World.Filter.With().Build(); + + var camera = World.Filter + .With() + .Build() + .First() + .GetComponent(); + + IEnumerable entities = SortEntitiesByYPosition(filter); + + foreach (Entity e in entities) + { + ref var transform = ref e.GetComponent(); + var at = transform.Position - camera.Position; + + if (e.Has()) + { + ref var animator = ref e.GetComponent(); + + animator.Animation.Draw(_spriteBatch, at); + } + + if (e.Has()) + { + ref var sprite = ref e.GetComponent(); + + sprite.Sprite.Draw(_spriteBatch, at); + } + } + } + + public void Dispose() + { + } + + private static IEnumerable SortEntitiesByYPosition(Filter filter) + { + List entities = new List(); + + foreach (Entity e in filter) + { + entities.Add(e); + } + + return entities.OrderBy(x => + { + ref var transform = ref x.GetComponent(); + return transform.Position.Y; + }); + } +} diff --git a/src/Libs/Systems/Systems.csproj b/src/Libs/Systems/Systems.csproj index 05bb65b..7f8217e 100644 --- a/src/Libs/Systems/Systems.csproj +++ b/src/Libs/Systems/Systems.csproj @@ -1,23 +1,17 @@ - net7.0 enable enable - <_TargetFrameworkDirectories>Jenny.Plugins.ReferenceAssemblyPathsPreProcessor - <_FullFrameworkReferenceAssemblyPaths>Jenny.Plugins.ReferenceAssemblyPathsPreProcessor true + net8.0 + default - - - - - + - \ No newline at end of file diff --git a/src/UnitTests/UnitTests.Entities/GlobalUsings.cs b/src/UnitTests/UnitTests.Entities/GlobalUsings.cs new file mode 100644 index 0000000..3244567 --- /dev/null +++ b/src/UnitTests/UnitTests.Entities/GlobalUsings.cs @@ -0,0 +1 @@ +global using NUnit.Framework; diff --git a/src/UnitTests/UnitTests.Entities/PlayerEntity.cs b/src/UnitTests/UnitTests.Entities/PlayerEntity.cs new file mode 100644 index 0000000..58a1f9e --- /dev/null +++ b/src/UnitTests/UnitTests.Entities/PlayerEntity.cs @@ -0,0 +1,97 @@ +using System.Numerics; +using Components.Data; +using Components.Render.Animation; +using Components.Tags; +using Entities.Factories.Characters; +using Entities.Factories.Meta; +using Features; +using Implementations; +using Microsoft.Xna.Framework.Graphics; +using Moq; +using Scellecs.Morpeh; +using Services.Movement; +using Systems; + +namespace UnitTests.Entities; + +public class Tests +{ + private World _world; + + [SetUp] + public void Setup() + { + _world = World.Create(); + } + + [TearDown] + public void TearDown() + { + _world.Dispose(); + } + + [Test] + public void PlayerEntity_IsCreatedInTheWorld() + { + Entity playerEntity = new PlayerEntityFactory(new InputMovableComponent(), + new MovableComponent(), + new TransformComponent(), + new CameraComponent(), + new RectangleCollisionComponent(), + new MovementAnimationsComponent(), + new CharacterAnimatorComponent(), + new InventoryComponent()) + .CreateEntity(@in: _world); + + { + _world.TryGetEntity(playerEntity.ID, out Entity result); + + Assert.That(playerEntity.ID, Is.EqualTo(result.ID)); + } + } + + [Test] + public void PlayerEntity_HasComponents() + { + Entity playerEntity = new PlayerEntityFactory(new InputMovableComponent(), + new MovableComponent(), + new TransformComponent(), + new CameraComponent(), + new RectangleCollisionComponent(), + new MovementAnimationsComponent(), + new CharacterAnimatorComponent(), + new InventoryComponent()) + .CreateEntity(@in: _world); + { + _world.TryGetEntity(playerEntity.ID, out Entity result); + + Assert.Multiple(() => + { + Assert.That(result.Has(), Is.True); + Assert.That(result.Has(), Is.True); + }); + } + } + + [Test] + public void WorldSystemAndEntityWorkTogether() + { + var mockInputScanner = new Mock(); + mockInputScanner.Setup(p => p.GetDirection()).Returns(Vector2.One); + + var rootFeature = new RootFeature(_world, + new WorldInitializer(_world, new WorldEntityFactory(new WorldComponent()), + new PlayerEntityFactory(new InputMovableComponent(), new MovableComponent(), new TransformComponent(), + new CameraComponent(new Viewport(0, 0, 640, 480)), new RectangleCollisionComponent(), + new InventoryComponent()), + new DummyEntityFactory(new TransformComponent(), new RectangleCollisionComponent())), + new MovementFeature(_world, new InputSystem(_world, mockInputScanner.Object), + new MovementSystem(_world, new SimpleMovement()))); + + rootFeature.OnAwake(); + + rootFeature.OnUpdate(It.IsAny()); + + mockInputScanner.Verify(p => p.GetDirection(), Times.Once); + } +} diff --git a/src/UnitTests/UnitTests.Entities/UnitTests.Entities.csproj b/src/UnitTests/UnitTests.Entities/UnitTests.Entities.csproj new file mode 100644 index 0000000..7eb915d --- /dev/null +++ b/src/UnitTests/UnitTests.Entities/UnitTests.Entities.csproj @@ -0,0 +1,33 @@ + + + + net8.0 + default + enable + enable + + false + true + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + diff --git a/src/UnitTests/UnitTests.Services/UnitTests.Services.csproj b/src/UnitTests/UnitTests.Services/UnitTests.Services.csproj index 8e368ab..d4d89a6 100644 --- a/src/UnitTests/UnitTests.Services/UnitTests.Services.csproj +++ b/src/UnitTests/UnitTests.Services/UnitTests.Services.csproj @@ -1,7 +1,8 @@ - net7.0 + net8.0 + default enable enable @@ -10,11 +11,14 @@ - - - + + + - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +