53 Commits

Author SHA1 Message Date
DrSmugleaf
fe1648d290 Make EntitySystemManager.DependencyCollection inject EntityQuery, make BUIs inject systems and entity queries (#6394)
* Make EntitySystemManager.DependencyCollection inject EntityQuery

* Make BUIs inject systems and entity queries

* Fix import

* We parallelize those

* RIDER I BEG YOU

* Mocked unit tests are my passion

* Perhaps we do not care about fractional milliseconds

* Forgor to make it debug only

* Use Parallel.For instead of ForEach

* Rider I am going to become the joker

* Fix EntMan resolve

* Now with lazy resolve technology

* Use GetOrAdd
2026-02-05 21:35:52 +01:00
PJB3005
bb81d88653 Add [NotContentImplementable] to shared interfaces 2025-12-20 16:49:35 +01:00
metalgearsloth
663b83821a Revert "Obsolete static IoC methods (#6232)" (#6296)
This reverts commit 14439784dd.
2025-11-15 11:26:52 +11:00
Leon Friedrich
14439784dd Obsolete static IoC methods (#6232) 2025-11-13 21:35:14 +11:00
Kara
bb5cb10d57 Generic variants of AssertEqual methods (#4756)
* Generic variants of `AssertEqual` methods

* Remove invalid AssertionMethod
2023-12-23 13:52:08 +11:00
Leon Friedrich
19ff7f25ca Slightly speed up IDependencyCollection (#4716) 2023-12-16 00:23:12 +01:00
Pieter-Jan Briers
816a535a92 Fix obsoletion warnings for BinaryFormatter stuff
This became an outright warning in .NET 8. Into the trash, never used it.
2023-12-15 19:37:13 +01:00
Pieter-Jan Briers
a200d73ef9 Use FrozenDictionary in DependencyCollection.
Did not test the perf of this at all but it's the perfect use case so...
2023-12-15 19:28:56 +01:00
Pieter-Jan Briers
1631d93e41 Remove AggressiveOptimization attributes.
This isn't a magic "make code go fast" button, none of these usages were correct.
2023-06-25 09:33:10 +02:00
Leon Friedrich
c90907ba92 Add dependency injection option to IDynamicTypeFactory (#3911) 2023-04-12 03:05:31 +10:00
Pieter-Jan Briers
a0b067a062 Add command to dump injector cache list.
To allow me to figure out how big it is.
2022-12-21 00:03:22 +01:00
Pieter-Jan Briers
d1eb70da07 DependencyCollection is now thread safe.
We can now safely run stuff in parallel with registrations and all that goodness.
2022-12-17 00:38:34 +01:00
Leon Friedrich
c0f384ac96 Add IDependencyCollection.FromParent() (#3541) 2022-12-02 10:19:51 +11:00
Pieter-Jan Briers
1646297039 Remove most static IoCManager. accesses from engine. (#3466)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2022-11-15 22:00:28 +11:00
Pieter-Jan Briers
490a4efff8 IoCManager.InitThread now returns new IDependencyCollection. 2022-11-12 12:24:31 +01:00
Pieter-Jan Briers
a416eedff0 Fix some bad doc comment links to IoCManager.Resolve{T}() 2022-11-12 12:23:12 +01:00
Pieter-Jan Briers
2fe0c94d84 Register<T> extension for IDependencyCollection. 2022-11-12 12:12:05 +01:00
Pieter-Jan Briers
2f22de4eff Make IoC Register have where TInterface : class 2022-11-12 12:11:19 +01:00
Vera Aguilera Puerto
d404494018 ViewVariables Exorcism Part 1: Of paths and commands (#3214) 2022-10-14 19:03:44 +02:00
Pieter-Jan Briers
8b8e499615 Avoid TLS lookup in IoCManager.Resolve<T>(ref T) if instance provided. 2022-05-23 23:33:01 +02:00
Pieter-Jan Briers
de4d255841 Analyzer to enforce classes to be either [Virtual], abstract, or sealed. (#2469)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2022-02-05 19:31:58 +01:00
Acruid
97f5131ce0 Fixed bug where _pendingResolves was not getting cleared. (#2328)
Added an option to defer field DI for RegisteredInstances until BuildGraph is called. This lets you register instances that contain dependency fields that are not instantiated yet.
2021-12-12 16:12:52 -08:00
Acruid
424e0768c8 Fixed some code that I forgot to change to help IoC instantiate protected constructors. 2021-11-17 03:10:12 -08:00
Acruid
e1b9327ec0 Misc Engine Tweaks (#2238) 2021-11-17 09:39:18 +01:00
Vera Aguilera Puerto
6cf5021efa Add Resolves to IoCManager and EntitySystemManager (#2231) 2021-11-14 19:41:34 +01:00
Pieter-Jan Briers
5ab6aba20b More implicit use attributes.
This means that entity systems and IoC managers should no longer need [UsedImplicitly] to suppress "object never instantiated" warnings.
2021-08-24 03:13:23 +02:00
Paul Ritter
8c1e075c91 EntitySystem DependencyCollection & EntitySystem dependencies (#1890)
* started work

* tests

* namespace

* working

* thonk

Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
Co-authored-by: Vera Aguilera Puerto <gradientvera@outlook.com>
2021-07-26 12:10:03 +02:00
Acruid
e5fd4f5700 DependencyCollection Children (#1833)
Adds a new register function for registering a simple Type without an interface.
2021-06-21 02:15:23 +02:00
Pieter-Jan Briers
1147d6fd9a Do not cache injector delegates for entity system creation. 2021-06-21 01:44:36 +02:00
Pieter-Jan Briers
a266e21d9e Add single-type IoC register call. 2021-05-24 22:05:15 +02:00
Acruid
f9074811f9 Adds constructor injection to the IoCManager & DependencyCollection. 2021-03-25 01:16:08 -07:00
Acruid
2183cd7ca1 Massive Namespace Cleanup (#1544)
* Removed the Interfaces folder.
* All objects inside the GameObjects subfolders are now in the GameObjects namespace.
* Added a Resharper DotSettings file to mark the GameObjects subfolders as not providing namespaces.
* Simplified Robust.client.Graphics namespace.
* Automated remove redundant using statements.
2021-02-10 23:27:19 -08:00
Acruid
bded7ad228 You can now provide a factory delegate to IoC register calls. 2021-02-06 23:00:08 -08:00
Pieter-Jan Briers
a41f64f30e sandboxing (#1408) 2020-11-26 23:37:31 +01:00
DrSmugleaf
b8e5b47e7a Use 'new' expression in places where the type is evident for the engine (#1415)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2020-11-26 00:16:55 +01:00
Pieter-Jan Briers
362b7804d9 Fix issues with .NET 5. 2020-11-11 00:46:35 +01:00
Pieter-Jan Briers
5faa8a59c1 Add some [Pure] annotations. 2020-08-29 07:53:50 +02:00
Acruid
1513389fc1 Adds a property to IoCManager that gives access to the IDependencyCollection singleton of the thread. 2020-08-18 16:29:57 -07:00
Pieter-Jan Briers
8f590a7ba9 DependencyCollection.RegisterInstance no longer caches injectors.
Small optimization.
2020-07-09 02:55:04 +02:00
Pieter-Jan Briers
41f1dd3fa0 Hopefully fix parallel game states 2020-06-24 22:55:59 +02:00
Pieter-Jan Briers
67efd69679 Add explicit update dependency specification between entity systems.
This allows a system to say "I want to update after this other system does".

Based on @chairbender's work with the input binding stuff.
2020-06-19 00:18:59 +02:00
Pieter-Jan Briers
ec0f4b35f7 Enable nullable reference types on Robust.Shared and fix all warnings. (#1109) 2020-06-08 01:13:01 +02:00
PrPleGoo
bb0e6917b8 Decimal reagents requirements (#1018) 2020-03-28 13:48:57 +01:00
Pieter-Jan Briers
761b06d68a Add threading assertions to IoCManager. 2019-12-22 21:47:00 +01:00
Pieter-Jan Briers
31adf9e4fc Mention thread locality in IoCManager documentation. 2019-12-01 15:12:06 +01:00
Pieter-Jan Briers
73a34fc53a Use DynamicMethod for dependency injection. (#864)
* Use DynamicMethod for dependency injection.

Should be way faster to initialize types and also have no allocation overhead

* Cleanup, don't make injectors for types without dependencies

* Fix Framework, maybe?

* Test the new system explicitly.
2019-09-09 01:43:22 +02:00
Pieter-Jan Briers
85a4375905 Various performance optimizations. 2019-08-01 00:10:20 +02:00
Acruid
b26a370504 You can now call IoCManager.Clear() regardless of the container being instantiated for your thread. Previously you would get a null exception. Now the function does nothing (as expected) if the container does not exist. 2019-07-29 11:39:42 -07:00
Pieter-Jan Briers
414bd95eb2 DynamicTypeFactory improvements:
Can now make instances with constructor arguments.
Adds some helpers.
2019-07-23 21:08:01 +02:00
Pieter-Jan Briers
bb4a1eda8e Project file refactor (#819)
* Project file refactor

Move all the .csproj files to the new .NET Core style.
This doesn't make any difference for compiling for Framework,
but it does reduce a ton of useless boilerplate.

As an extension of this, killed a bunch of uncompiled & unmaintained .cs files.

Compiling for release (to profile) works now.
Removed AnyCPU targets from the solution file.

* Fix compiler warnings.
2019-05-28 00:16:01 +02:00