diff --git a/src/Builtin/BaseProcesses.cs b/src/Builtin/BaseProcesses.cs index 76ac5db..a84d757 100644 --- a/src/Builtin/BaseProcesses.cs +++ b/src/Builtin/BaseProcesses.cs @@ -3,19 +3,19 @@ namespace DCFApixels.DragonECS { #region Interfaces - public interface IEcsPreInitProcess : IEcsSystem + public interface IEcsPreInitProcess : IEcsProcess { void PreInit(EcsPipeline pipeline); } - public interface IEcsInitProcess : IEcsSystem + public interface IEcsInitProcess : IEcsProcess { void Init(EcsPipeline pipeline); } - public interface IEcsRunProcess : IEcsSystem + public interface IEcsRunProcess : IEcsProcess { void Run(EcsPipeline pipeline); } - public interface IEcsDestroyProcess : IEcsSystem + public interface IEcsDestroyProcess : IEcsProcess { void Destroy(EcsPipeline pipeline); } diff --git a/src/Builtin/InjectSystem.cs b/src/Builtin/InjectSystem.cs index 856670b..88654f2 100644 --- a/src/Builtin/InjectSystem.cs +++ b/src/Builtin/InjectSystem.cs @@ -5,15 +5,15 @@ using System.Linq; namespace DCFApixels.DragonECS { - public interface IEcsPreInject : IEcsSystem + public interface IEcsPreInject : IEcsProcess { void PreInject(object obj); } - public interface IEcsInject : IEcsSystem + public interface IEcsInject : IEcsProcess { void Inject(T obj); } - public interface IEcsPreInitInjectProcess : IEcsSystem + public interface IEcsPreInitInjectProcess : IEcsProcess { void OnPreInitInjectionBefore(); void OnPreInitInjectionAfter(); diff --git a/src/Builtin/Systems.cs b/src/Builtin/Systems.cs index c4eab58..1d6bc1e 100644 --- a/src/Builtin/Systems.cs +++ b/src/Builtin/Systems.cs @@ -6,7 +6,7 @@ namespace DCFApixels.DragonECS namespace Internal { [DebugHide, DebugColor(DebugColor.Black)] - public class SystemsLayerMarkerSystem : IEcsSystem + public class SystemsLayerMarkerSystem : IEcsProcess { public readonly string name; public SystemsLayerMarkerSystem(string name) => this.name = name; diff --git a/src/EcsPipeline.cs b/src/EcsPipeline.cs index 39cdc8d..e160021 100644 --- a/src/EcsPipeline.cs +++ b/src/EcsPipeline.cs @@ -11,30 +11,30 @@ namespace DCFApixels.DragonECS { public sealed class EcsPipeline { - private IEcsSystem[] _allSystems; + private IEcsProcess[] _allSystems; private Dictionary _runners; private IEcsRunProcess _runRunnerCache; - private ReadOnlyCollection _allSystemsSealed; + private ReadOnlyCollection _allSystemsSealed; private ReadOnlyDictionary _allRunnersSealed; private bool _isInit; private bool _isDestoryed; #region Properties - public ReadOnlyCollection AllSystems => _allSystemsSealed; + public ReadOnlyCollection AllSystems => _allSystemsSealed; public ReadOnlyDictionary AllRunners => _allRunnersSealed; public bool IsInit => _isInit; public bool IsDestoryed => _isDestoryed; #endregion #region Constructors - private EcsPipeline(IEcsSystem[] systems) + private EcsPipeline(IEcsProcess[] systems) { _allSystems = systems; _runners = new Dictionary(); - _allSystemsSealed = new ReadOnlyCollection(_allSystems); + _allSystemsSealed = new ReadOnlyCollection(_allSystems); _allRunnersSealed = new ReadOnlyDictionary(_runners); _isInit = false; @@ -43,7 +43,7 @@ namespace DCFApixels.DragonECS #endregion #region Runners - public T GetRunner() where T : IEcsSystem + public T GetRunner() where T : IEcsProcess { Type type = typeof(T); if (_runners.TryGetValue(type, out IEcsRunner result)) @@ -132,7 +132,7 @@ namespace DCFApixels.DragonECS { private const int KEYS_CAPACITY = 4; private HashSet _uniqueTypes; - private readonly Dictionary> _systems; + private readonly Dictionary> _systems; private readonly string _basicLayer; public readonly LayerList Layers; public Builder() @@ -142,14 +142,14 @@ namespace DCFApixels.DragonECS Layers.Insert(EcsConsts.BASIC_LAYER, EcsConsts.PRE_BEGIN_LAYER, EcsConsts.BEGIN_LAYER); Layers.InsertAfter(EcsConsts.BASIC_LAYER, EcsConsts.END_LAYER, EcsConsts.POST_END_LAYER); _uniqueTypes = new HashSet(); - _systems = new Dictionary>(KEYS_CAPACITY); + _systems = new Dictionary>(KEYS_CAPACITY); } - public Builder Add(IEcsSystem system, string layerName = null) + public Builder Add(IEcsProcess system, string layerName = null) { AddInternal(system, layerName, false); return this; } - public Builder AddUnique(IEcsSystem system, string layerName = null) + public Builder AddUnique(IEcsProcess system, string layerName = null) { AddInternal(system, layerName, true); return this; @@ -161,13 +161,13 @@ namespace DCFApixels.DragonECS list.RemoveAll(o => o is TSystem); return this; } - private void AddInternal(IEcsSystem system, string layerName, bool isUnique) + private void AddInternal(IEcsProcess system, string layerName, bool isUnique) { if (layerName == null) layerName = _basicLayer; - List list; + List list; if (!_systems.TryGetValue(layerName, out list)) { - list = new List { new SystemsLayerMarkerSystem(layerName.ToString()) }; + list = new List { new SystemsLayerMarkerSystem(layerName.ToString()) }; _systems.Add(layerName, list); } if ((_uniqueTypes.Add(system.GetType()) == false && isUnique)) @@ -185,8 +185,8 @@ namespace DCFApixels.DragonECS public EcsPipeline Build() { Add(new DeleteEmptyEntitesSystem(), EcsConsts.POST_END_LAYER); - List result = new List(32); - List basicBlockList = _systems[_basicLayer]; + List result = new List(32); + List basicBlockList = _systems[_basicLayer]; foreach (var item in _systems) { if (!Layers.Contains(item.Key)) @@ -315,12 +315,12 @@ namespace DCFApixels.DragonECS public static class EcsPipelineExtensions { public static bool IsNullOrDestroyed(this EcsPipeline self) => self == null || self.IsDestoryed; - public static EcsPipeline.Builder Add(this EcsPipeline.Builder self, IEnumerable range, string layerName = null) + public static EcsPipeline.Builder Add(this EcsPipeline.Builder self, IEnumerable range, string layerName = null) { foreach (var item in range) self.Add(item, layerName); return self; } - public static EcsPipeline.Builder AddUnique(this EcsPipeline.Builder self, IEnumerable range, string layerName = null) + public static EcsPipeline.Builder AddUnique(this EcsPipeline.Builder self, IEnumerable range, string layerName = null) { foreach (var item in range) self.AddUnique(item, layerName); return self; diff --git a/src/EcsRunner.cs b/src/EcsRunner.cs index 40fd715..b3b8b7f 100644 --- a/src/EcsRunner.cs +++ b/src/EcsRunner.cs @@ -23,7 +23,7 @@ namespace DCFApixels.DragonECS public EcsRunnerFilterAttribute(object filter) : this(null, filter) { } } - public interface IEcsSystem { } + public interface IEcsProcess { } namespace RunnersCore { @@ -103,7 +103,7 @@ namespace DCFApixels.DragonECS } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static void InitFor() where TInterface : IEcsSystem + internal static void InitFor() where TInterface : IEcsProcess { Type interfaceType = typeof(TInterface); @@ -122,8 +122,8 @@ namespace DCFApixels.DragonECS #if UNITY_2020_3_OR_NEWER [UnityEngine.Scripting.RequireDerived, UnityEngine.Scripting.Preserve] #endif - public abstract class EcsRunner : IEcsSystem, IEcsRunner - where TInterface : IEcsSystem + public abstract class EcsRunner : IEcsProcess, IEcsRunner + where TInterface : IEcsProcess { #region Register private static Type _subclass; @@ -142,9 +142,9 @@ namespace DCFApixels.DragonECS { throw new ArgumentException($"{typeof(TInterface).FullName} is not interface"); } - if (interfaces.Length != 1 || interfaces[0] != typeof(IEcsSystem)) + if (interfaces.Length != 1 || interfaces[0] != typeof(IEcsProcess)) { - throw new ArgumentException($"{typeof(TInterface).FullName} does not directly inherit the {nameof(IEcsSystem)} interface"); + throw new ArgumentException($"{typeof(TInterface).FullName} does not directly inherit the {nameof(IEcsProcess)} interface"); } #endif _subclass = subclass; @@ -152,15 +152,15 @@ namespace DCFApixels.DragonECS #endregion #region FilterSystems - private static TInterface[] FilterSystems(IEnumerable targets) + private static TInterface[] FilterSystems(IEnumerable targets) { return targets.Where(o => o is TInterface).Select(o => (TInterface)o).ToArray(); } - private static TInterface[] FilterSystems(IEnumerable targets, object filter) + private static TInterface[] FilterSystems(IEnumerable targets, object filter) { Type interfaceType = typeof(TInterface); - IEnumerable newTargets; + IEnumerable newTargets; if (filter != null) { @@ -189,7 +189,7 @@ namespace DCFApixels.DragonECS { if (_subclass == null) EcsRunnerActivator.InitFor(); var instance = (EcsRunner)Activator.CreateInstance(_subclass); - return (TInterface)(IEcsSystem)instance.Set(source, targets, isHasFilter, filter); + return (TInterface)(IEcsProcess)instance.Set(source, targets, isHasFilter, filter); } public static TInterface Instantiate(EcsPipeline source) { @@ -253,11 +253,11 @@ namespace DCFApixels.DragonECS #region Extensions public static class EcsRunner { - public static void Destroy(IEcsSystem runner) => ((IEcsRunner)runner).Destroy(); + public static void Destroy(IEcsProcess runner) => ((IEcsRunner)runner).Destroy(); } public static class IEcsSystemExtensions { - public static bool IsRunner(this IEcsSystem self) + public static bool IsRunner(this IEcsProcess self) { return self is IEcsRunner; }