From cb25943b55892f9f0f751f53bd2f03c26e3bf873 Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Mon, 24 Apr 2023 00:31:03 +0800 Subject: [PATCH] remove world interface --- src/EcsGroup.cs | 2 +- src/EcsJoinQuery.cs | 3 ++- src/EcsWorld.cs | 20 +------------------- src/Interfaces/IEcsTable.cs | 34 ---------------------------------- 4 files changed, 4 insertions(+), 55 deletions(-) delete mode 100644 src/Interfaces/IEcsTable.cs diff --git a/src/EcsGroup.cs b/src/EcsGroup.cs index 695dd9d..47dd3bc 100644 --- a/src/EcsGroup.cs +++ b/src/EcsGroup.cs @@ -17,7 +17,7 @@ namespace DCFApixels.DragonECS #endregion #region Properties - public IEcsWorld World + public EcsWorld World { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => _source.World; diff --git a/src/EcsJoinQuery.cs b/src/EcsJoinQuery.cs index 3c375bb..c84237a 100644 --- a/src/EcsJoinQuery.cs +++ b/src/EcsJoinQuery.cs @@ -12,7 +12,6 @@ namespace DCFApixels.DragonECS private EcsWorld _targetWorld; private EcsAttachPool _targetPool; - private int _targetWorldCapacity = -1; private int _targetPoolCapacity = -1; @@ -45,6 +44,8 @@ namespace DCFApixels.DragonECS public sealed override void ExecuteJoin() { _execute.Begin(); + + _isJoinExecuted = false; if (_isInitTargetWorlds == false) { InitTargetWorlds(); diff --git a/src/EcsWorld.cs b/src/EcsWorld.cs index ffaf4eb..a26559d 100644 --- a/src/EcsWorld.cs +++ b/src/EcsWorld.cs @@ -5,22 +5,7 @@ using System.Runtime.InteropServices; namespace DCFApixels.DragonECS { - public interface IEcsWorld : IEcsTable - { - #region Properties - public int UniqueID { get; } - public EcsPipeline Pipeline { get; } - #endregion - - #region Entities - public EcsEntity NewEntity(); - public void DelEntity(EcsEntity entity); - public bool EntityIsAlive(int entityID, short gen); - public EcsEntity GetEcsEntity(int entityID); - #endregion - } - - public abstract class EcsWorld : IEcsWorld + public abstract class EcsWorld { private const short GEN_BITS = 0x7fff; private const short DEATH_GEN_BIT = short.MinValue; @@ -265,19 +250,16 @@ namespace DCFApixels.DragonECS #endregion #region Groups - void IEcsTable.RegisterGroup(EcsGroup group) => RegisterGroup(group); internal void RegisterGroup(EcsGroup group) { _groups.Add(new WeakReference(group)); } - EcsGroup IEcsTable.GetGroupFromPool() => GetGroupFromPool(); internal EcsGroup GetGroupFromPool() { if (_groupsPool.Count <= 0) return new EcsGroup(this); return _groupsPool.Pop(); } - void IEcsTable.ReleaseGroup(EcsGroup group) => ReleaseGroup(group); internal void ReleaseGroup(EcsGroup group) { #if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS diff --git a/src/Interfaces/IEcsTable.cs b/src/Interfaces/IEcsTable.cs deleted file mode 100644 index 2062dae..0000000 --- a/src/Interfaces/IEcsTable.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; - -namespace DCFApixels.DragonECS -{ - public interface IEcsTable - { - #region Properties - /// Table Archetype - public Type Archetype { get; } - public int Count { get; } - public int Capacity { get; } - public EcsReadonlyGroup Entities => default; - #endregion - - #region Methods - public int GetComponentID(); - public TPool GetPool() where TComponent : struct where TPool : EcsPoolBase, new(); - public ReadOnlySpan GetAllPools(); - public TQuery Select() where TQuery : EcsQueryBase; - public TQuery Where(out TQuery query) where TQuery : EcsQuery; - // public TQuery Join(out TQuery query) where TQuery : EcsJoinQueryBase; - - public bool IsMaskCompatible(EcsComponentMask mask, int entityID); - - public void Destroy(); - #endregion - - #region Internal Methods - internal void RegisterGroup(EcsGroup group); - internal EcsGroup GetGroupFromPool(); - internal void ReleaseGroup(EcsGroup group); - #endregion - } -}