mirror of
https://github.com/DCFApixels/DragonECS-AutoInjections.git
synced 2025-09-18 05:04:35 +08:00
rename EcsSystems to EcsPipeline
This commit is contained in:
parent
1757121e6d
commit
1ba431c0b4
@ -6,16 +6,14 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
internal class AutoInjectionMap
|
internal class AutoInjectionMap
|
||||||
{
|
{
|
||||||
private readonly EcsSystems _source;
|
private readonly EcsPipeline _source;
|
||||||
|
|
||||||
private Dictionary<Type, List<FiledRecord>> _systems;
|
private Dictionary<Type, List<FiledRecord>> _systems;
|
||||||
|
|
||||||
public AutoInjectionMap(EcsSystems source)
|
public AutoInjectionMap(EcsPipeline source)
|
||||||
{
|
{
|
||||||
_source = source;
|
_source = source;
|
||||||
|
|
||||||
var allsystems = _source.AllSystems;
|
var allsystems = _source.AllSystems;
|
||||||
|
|
||||||
_systems = new Dictionary<Type, List<FiledRecord>>();
|
_systems = new Dictionary<Type, List<FiledRecord>>();
|
||||||
foreach (var system in allsystems)
|
foreach (var system in allsystems)
|
||||||
{
|
{
|
||||||
@ -68,24 +66,24 @@ namespace DCFApixels.DragonECS
|
|||||||
[DebugHide, DebugColor(DebugColor.Gray)]
|
[DebugHide, DebugColor(DebugColor.Gray)]
|
||||||
public class AutoInjectSystem : IEcsPreInitSystem, IEcsPreInject
|
public class AutoInjectSystem : IEcsPreInitSystem, IEcsPreInject
|
||||||
{
|
{
|
||||||
private EcsSystems _systems;
|
private EcsPipeline _pipeline;
|
||||||
private List<object> _injectQueue = new List<object>();
|
private List<object> _injectQueue = new List<object>();
|
||||||
|
|
||||||
private AutoInjectionMap _autoInjectionMap;
|
private AutoInjectionMap _autoInjectionMap;
|
||||||
|
|
||||||
public void PreInject(object obj)
|
public void PreInject(object obj)
|
||||||
{
|
{
|
||||||
if(_systems == null)
|
if(_pipeline == null)
|
||||||
{
|
{
|
||||||
_injectQueue.Add(obj);
|
_injectQueue.Add(obj);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AutoInject(obj);
|
AutoInject(obj);
|
||||||
}
|
}
|
||||||
public void PreInit(EcsSystems systems)
|
public void PreInit(EcsPipeline pipeline)
|
||||||
{
|
{
|
||||||
_systems = systems;
|
_pipeline = pipeline;
|
||||||
_autoInjectionMap = new AutoInjectionMap(_systems);
|
_autoInjectionMap = new AutoInjectionMap(_pipeline);
|
||||||
|
|
||||||
foreach (var obj in _injectQueue)
|
foreach (var obj in _injectQueue)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public static class AutoInjectSystemExtensions
|
public static class AutoInjectSystemExtensions
|
||||||
{
|
{
|
||||||
public static EcsSystems.Builder AutoInject(this EcsSystems.Builder self)
|
public static EcsPipeline.Builder AutoInject(this EcsPipeline.Builder self)
|
||||||
{
|
{
|
||||||
self.Add(new AutoInjectSystem());
|
self.Add(new AutoInjectSystem());
|
||||||
return self;
|
return self;
|
||||||
|
Loading…
Reference in New Issue
Block a user