mirror of
https://github.com/DCFApixels/DragonECS-AutoInjections.git
synced 2025-09-18 21:35:07 +08:00
update
This commit is contained in:
parent
92697989e1
commit
b801139e1c
@ -141,10 +141,10 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
private readonly struct InjectedPropertyRecord
|
||||
{
|
||||
public readonly IEcsSystem target;
|
||||
public readonly IEcsProcess target;
|
||||
public readonly IInjectedProperty property;
|
||||
public EcsInjectAttribute Attribute => property.GetAutoInjectAttribute();
|
||||
public InjectedPropertyRecord(IEcsSystem target, IInjectedProperty property)
|
||||
public InjectedPropertyRecord(IEcsProcess target, IInjectedProperty property)
|
||||
{
|
||||
this.target = target;
|
||||
this.property = property;
|
||||
@ -154,33 +154,30 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
[MetaTags(MetaTags.HIDDEN)]
|
||||
[MetaColor(MetaColor.Gray)]
|
||||
public class AutoInjectSystem : IEcsInject<object>, IEcsPipelineMember, IEcsPreInitInjectProcess
|
||||
public class AutoInjectSystem : IEcsInject<object>, IEcsPipelineMember, IOnInitInjectionComplete
|
||||
{
|
||||
private EcsPipeline _pipeline;
|
||||
EcsPipeline IEcsPipelineMember.Pipeline { get => _pipeline; set => _pipeline = value; }
|
||||
|
||||
private List<object> _delayedInjects = new List<object>();
|
||||
private AutoInjectionMap _autoInjectionMap;
|
||||
private bool _preInitInjectCompleted = false;
|
||||
|
||||
private bool _isInitInjectionCompleted;
|
||||
public void Inject(object obj)
|
||||
{
|
||||
if (!_preInitInjectCompleted)
|
||||
{
|
||||
_delayedInjects.Add(obj);
|
||||
}
|
||||
else
|
||||
if (_isInitInjectionCompleted)
|
||||
{
|
||||
_autoInjectionMap.Inject(obj.GetType(), obj);
|
||||
}
|
||||
}
|
||||
public void OnPreInitInjectionBefore(EcsPipeline pipeline)
|
||||
else
|
||||
{
|
||||
_pipeline = pipeline;
|
||||
_delayedInjects.Add(obj);
|
||||
}
|
||||
public void OnPreInitInjectionAfter()
|
||||
}
|
||||
|
||||
public void OnInitInjectionComplete()
|
||||
{
|
||||
_autoInjectionMap = new AutoInjectionMap(_pipeline);
|
||||
_preInitInjectCompleted = true;
|
||||
_isInitInjectionCompleted = true;
|
||||
|
||||
foreach (var obj in _delayedInjects)
|
||||
{
|
||||
|
@ -1,7 +0,0 @@
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public interface IInjectRaw : IEcsSystem
|
||||
{
|
||||
void Inject(object obj);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user