remove world interface

This commit is contained in:
Mikhail 2023-04-24 00:31:03 +08:00
parent 65861cb798
commit cb25943b55
4 changed files with 4 additions and 55 deletions

View File

@ -17,7 +17,7 @@ namespace DCFApixels.DragonECS
#endregion
#region Properties
public IEcsWorld World
public EcsWorld World
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _source.World;

View File

@ -12,7 +12,6 @@ namespace DCFApixels.DragonECS
private EcsWorld _targetWorld;
private EcsAttachPool<TAttachComponent> _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();

View File

@ -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<EcsGroup>(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

View File

@ -1,34 +0,0 @@
using System;
namespace DCFApixels.DragonECS
{
public interface IEcsTable
{
#region Properties
/// <summary>Table Archetype</summary>
public Type Archetype { get; }
public int Count { get; }
public int Capacity { get; }
public EcsReadonlyGroup Entities => default;
#endregion
#region Methods
public int GetComponentID<T>();
public TPool GetPool<TComponent, TPool>() where TComponent : struct where TPool : EcsPoolBase<TComponent>, new();
public ReadOnlySpan<EcsPoolBase> GetAllPools();
public TQuery Select<TQuery>() where TQuery : EcsQueryBase;
public TQuery Where<TQuery>(out TQuery query) where TQuery : EcsQuery;
// public TQuery Join<TQuery>(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
}
}