From 8e4c6ce552a5cb0e3eb96c4521b254fcba1449e3 Mon Sep 17 00:00:00 2001 From: DCFApixels <99481254+DCFApixels@users.noreply.github.com> Date: Sat, 19 Apr 2025 10:53:52 +0800 Subject: [PATCH] code cleanup --- src/DebugUtils/MetaAttributes/MetaIDAttribute.cs | 2 +- src/EcsWorld.cs | 4 ++-- src/EcsWorld.pools.cs | 2 +- src/EcsWorld.static.cs | 2 +- src/Executors/EcsWhereToGroupExecutor.cs | 6 +++--- src/Executors/MaskQueryExecutor.cs | 2 +- src/Internal/BitsUtility.cs | 2 +- src/Pools/EcsPool.cs | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/DebugUtils/MetaAttributes/MetaIDAttribute.cs b/src/DebugUtils/MetaAttributes/MetaIDAttribute.cs index c42f9bf..22ef974 100644 --- a/src/DebugUtils/MetaAttributes/MetaIDAttribute.cs +++ b/src/DebugUtils/MetaAttributes/MetaIDAttribute.cs @@ -185,7 +185,7 @@ namespace DCFApixels.DragonECS public bool IsCollidingID(string id) { - if(_collidingIDs== null) + if (_collidingIDs == null) { return false; } diff --git a/src/EcsWorld.cs b/src/EcsWorld.cs index f440b2b..891ac6c 100644 --- a/src/EcsWorld.cs +++ b/src/EcsWorld.cs @@ -440,7 +440,7 @@ namespace DCFApixels.DragonECS { for (int i = _emptyEntitiesCount - 1; i >= 0; i--) { - if(_emptyEntities[i] == entityID) + if (_emptyEntities[i] == entityID) { _emptyEntities[i] = _emptyEntities[--_emptyEntitiesCount]; return true; @@ -856,7 +856,7 @@ namespace DCFApixels.DragonECS } _emptyEntitiesCount = 0; - if(count < 0) + if (count < 0) { count = _delEntBufferCount; } diff --git a/src/EcsWorld.pools.cs b/src/EcsWorld.pools.cs index d2216d5..404bc3f 100644 --- a/src/EcsWorld.pools.cs +++ b/src/EcsWorld.pools.cs @@ -314,7 +314,7 @@ namespace DCFApixels.DragonECS slot.count++; slot.version++; var count = _entities[entityID].componentsCount++; - if(count == 0 && IsUsed(entityID)) + if (count == 0 && IsUsed(entityID)) { RemoveFromEmptyEntities(entityID); } diff --git a/src/EcsWorld.static.cs b/src/EcsWorld.static.cs index a2aa691..2d6b980 100644 --- a/src/EcsWorld.static.cs +++ b/src/EcsWorld.static.cs @@ -45,7 +45,7 @@ namespace DCFApixels.DragonECS [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryGetWorld(short worldID, out EcsWorld world) {// ts - if(worldID >= _worlds.Length) + if (worldID >= _worlds.Length) { world = null; return false; diff --git a/src/Executors/EcsWhereToGroupExecutor.cs b/src/Executors/EcsWhereToGroupExecutor.cs index 8d57c6e..ed6b6b6 100644 --- a/src/Executors/EcsWhereToGroupExecutor.cs +++ b/src/Executors/EcsWhereToGroupExecutor.cs @@ -69,19 +69,19 @@ namespace DCFApixels.DragonECS.Internal _version++; _iterator.IterateTo(World.Entities, _filteredAllGroup); #if DEBUG && DRAGONECS_DEEP_DEBUG - if(_filteredGroup == null) + if (_filteredGroup == null) { _filteredGroup = EcsGroup.New(World); } _filteredGroup.Clear(); foreach (var e in World.Entities) { - if(World.IsMatchesMask(Mask, e)) + if (World.IsMatchesMask(Mask, e)) { _filteredGroup.Add(e); } } - if(_filteredAllGroup.SetEquals(_filteredGroup) == false) + if (_filteredAllGroup.SetEquals(_filteredGroup) == false) { throw new System.InvalidOperationException(); } diff --git a/src/Executors/MaskQueryExecutor.cs b/src/Executors/MaskQueryExecutor.cs index 5676805..c7c53c4 100644 --- a/src/Executors/MaskQueryExecutor.cs +++ b/src/Executors/MaskQueryExecutor.cs @@ -125,7 +125,7 @@ namespace DCFApixels.DragonECS.Core _maskInc = mask._incs; _maskExc = mask._excs; _count = 1 + mask._incs.Length + mask._excs.Length; - + _versions = UnmanagedArrayUtility.NewAndInit(_count); } public bool Check() diff --git a/src/Internal/BitsUtility.cs b/src/Internal/BitsUtility.cs index 87c9674..c79115e 100644 --- a/src/Internal/BitsUtility.cs +++ b/src/Internal/BitsUtility.cs @@ -538,7 +538,7 @@ namespace DCFApixels.DragonECS.Internal state ^= state >> 17; state ^= state << 5; return state; - }; + } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static long NextXorShiftState(long state) diff --git a/src/Pools/EcsPool.cs b/src/Pools/EcsPool.cs index 90980b9..3cc73f4 100644 --- a/src/Pools/EcsPool.cs +++ b/src/Pools/EcsPool.cs @@ -447,7 +447,7 @@ namespace DCFApixels.DragonECS [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RemoveListener(IEcsPoolEventListener listener) { _pool.AddListener(listener); } #endif -#endregion + #endregion #region Convertors public static implicit operator ReadonlyEcsPool(EcsPool a) { return new ReadonlyEcsPool(a); }