From 0ed91a08da5b057e79b9f95d87a722cb0a166da6 Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:58:19 +0800 Subject: [PATCH] code cleanup --- src/Debug/EcsDebugUtility.cs | 6 +++--- src/EcsRunner.cs | 2 -- src/EcsWorld.pools.cs | 4 ++-- src/Injections/Injector.cs | 2 +- src/Pools/EcsPoolBase.cs | 6 +++--- src/Pools/EcsTagPool.cs | 1 - 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Debug/EcsDebugUtility.cs b/src/Debug/EcsDebugUtility.cs index 8806499..c115fcf 100644 --- a/src/Debug/EcsDebugUtility.cs +++ b/src/Debug/EcsDebugUtility.cs @@ -397,7 +397,7 @@ namespace DCFApixels.DragonECS } public static TypeMetaDataCached GetCachedTypeMeta(Type type) { - if(_metaCache.TryGetValue(type, out TypeMetaDataCached result) == false) + if (_metaCache.TryGetValue(type, out TypeMetaDataCached result) == false) { result = new TypeMetaDataCached(type); _metaCache.Add(type, result); @@ -440,7 +440,7 @@ namespace DCFApixels.DragonECS this.group = group; this.color = color; this.description = description; - this.tags = tags; + this.tags = tags; } } @@ -533,7 +533,7 @@ namespace DCFApixels.DragonECS { get { - if(_typeMetaData == null) + if (_typeMetaData == null) { _typeMetaData = new TypeMetaData( Type, diff --git a/src/EcsRunner.cs b/src/EcsRunner.cs index 68eb516..fdb6f7b 100644 --- a/src/EcsRunner.cs +++ b/src/EcsRunner.cs @@ -1,9 +1,7 @@ using DCFApixels.DragonECS.Internal; using DCFApixels.DragonECS.RunnersCore; using System; -using System.Collections.Generic; using System.Linq; -using System.Text.RegularExpressions; using static DCFApixels.DragonECS.EcsDebugUtility; namespace DCFApixels.DragonECS diff --git a/src/EcsWorld.pools.cs b/src/EcsWorld.pools.cs index 5f07ede..26a0acb 100644 --- a/src/EcsWorld.pools.cs +++ b/src/EcsWorld.pools.cs @@ -275,7 +275,7 @@ namespace DCFApixels.DragonECS [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool HasEntityComponent(int entityID, EcsMaskChunck maskBit) { - return (_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] & maskBit.mask) == maskBit.mask; + return (_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] & maskBit.mask) == maskBit.mask; } #endregion @@ -311,7 +311,7 @@ namespace DCFApixels.DragonECS { return World.TryUnregisterEntityComponent(entityID, componentTypeID, maskBit); } - + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetComponentCount(int componentTypeID) { diff --git a/src/Injections/Injector.cs b/src/Injections/Injector.cs index e78ba79..e47a0c8 100644 --- a/src/Injections/Injector.cs +++ b/src/Injections/Injector.cs @@ -118,7 +118,7 @@ namespace DCFApixels.DragonECS if (_nodes.TryGetValue(type, out InjectionNodeBase oldNode)) { Throw.Exception("Already declared"); - } + } InitNode(injectionProperty); #if !REFLECTION_DISABLED if (IsCanInstantiated(type)) diff --git a/src/Pools/EcsPoolBase.cs b/src/Pools/EcsPoolBase.cs index fbfe294..4241d20 100644 --- a/src/Pools/EcsPoolBase.cs +++ b/src/Pools/EcsPoolBase.cs @@ -36,20 +36,20 @@ namespace DCFApixels.DragonECS #endregion } /// A pool for struct components. - public interface IEcsStructPool : IEcsPool where T: struct + public interface IEcsStructPool : IEcsPool where T : struct { ref T Add(int entityID); ref readonly T Read(int entityID); ref T Get(int entityID); } /// A pool for reference components of type T that instantiates components itself. - public interface IEcsClassPool : IEcsPool where T: class + public interface IEcsClassPool : IEcsPool where T : class { T Add(int entityID); T Get(int entityID); } /// A pool for reference components of type T, which does not instantiate components itself but receives components from external sources.. - public interface IEcsHybridPool : IEcsPool where T: class + public interface IEcsHybridPool : IEcsPool where T : class { void Add(int entityID, T component); T Get(int entityID); diff --git a/src/Pools/EcsTagPool.cs b/src/Pools/EcsTagPool.cs index 57e8462..e954204 100644 --- a/src/Pools/EcsTagPool.cs +++ b/src/Pools/EcsTagPool.cs @@ -1,4 +1,3 @@ -using DCFApixels.DragonECS.Internal; using System; using System.Collections; using System.Collections.Generic;