rename IEntitiesCollection to IEntityStorage

This commit is contained in:
Mikhail 2024-02-11 00:42:49 +08:00
parent 5d5ab2daeb
commit 91370afce9
5 changed files with 19 additions and 17 deletions

View File

@ -146,7 +146,7 @@
public static EcsSpan Where<TCollection, A0, A1>(this TCollection entities, out A0 a0, out A1 a1) public static EcsSpan Where<TCollection, A0, A1>(this TCollection entities, out A0 a0, out A1 a1)
where A0 : EcsAspect where A0 : EcsAspect
where A1 : EcsAspect where A1 : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().Where(out a0, out a1); return entities.ToSpan().Where(out a0, out a1);
} }
@ -171,7 +171,7 @@
where A0 : EcsAspect where A0 : EcsAspect
where A1 : EcsAspect where A1 : EcsAspect
where A2 : EcsAspect where A2 : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().Where(out a0, out a1, out a2); return entities.ToSpan().Where(out a0, out a1, out a2);
} }
@ -199,7 +199,7 @@
where A1 : EcsAspect where A1 : EcsAspect
where A2 : EcsAspect where A2 : EcsAspect
where A3 : EcsAspect where A3 : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().Where(out a0, out a1, out a2, out a3); return entities.ToSpan().Where(out a0, out a1, out a2, out a3);
} }
@ -230,7 +230,7 @@
where A2 : EcsAspect where A2 : EcsAspect
where A3 : EcsAspect where A3 : EcsAspect
where A4 : EcsAspect where A4 : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().Where(out a0, out a1, out a2, out a3, out a4); return entities.ToSpan().Where(out a0, out a1, out a2, out a3, out a4);
} }
@ -264,7 +264,7 @@
where A3 : EcsAspect where A3 : EcsAspect
where A4 : EcsAspect where A4 : EcsAspect
where A5 : EcsAspect where A5 : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().Where(out a0, out a1, out a2, out a3, out a4, out a5); return entities.ToSpan().Where(out a0, out a1, out a2, out a3, out a4, out a5);
} }
@ -296,7 +296,7 @@
public static EcsReadonlyGroup WhereToGroup<TCollection, A0, A1>(this TCollection entities, out A0 a0, out A1 a1) public static EcsReadonlyGroup WhereToGroup<TCollection, A0, A1>(this TCollection entities, out A0 a0, out A1 a1)
where A0 : EcsAspect where A0 : EcsAspect
where A1 : EcsAspect where A1 : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().WhereToGroup(out a0, out a1); return entities.ToSpan().WhereToGroup(out a0, out a1);
} }
@ -321,7 +321,7 @@
where A0 : EcsAspect where A0 : EcsAspect
where A1 : EcsAspect where A1 : EcsAspect
where A2 : EcsAspect where A2 : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().WhereToGroup(out a0, out a1, out a2); return entities.ToSpan().WhereToGroup(out a0, out a1, out a2);
} }
@ -349,7 +349,7 @@
where A1 : EcsAspect where A1 : EcsAspect
where A2 : EcsAspect where A2 : EcsAspect
where A3 : EcsAspect where A3 : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().WhereToGroup(out a0, out a1, out a2, out a3); return entities.ToSpan().WhereToGroup(out a0, out a1, out a2, out a3);
} }
@ -380,7 +380,7 @@
where A2 : EcsAspect where A2 : EcsAspect
where A3 : EcsAspect where A3 : EcsAspect
where A4 : EcsAspect where A4 : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().WhereToGroup(out a0, out a1, out a2, out a3, out a4); return entities.ToSpan().WhereToGroup(out a0, out a1, out a2, out a3, out a4);
} }
@ -414,7 +414,7 @@
where A3 : EcsAspect where A3 : EcsAspect
where A4 : EcsAspect where A4 : EcsAspect
where A5 : EcsAspect where A5 : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().WhereToGroup(out a0, out a1, out a2, out a3, out a4, out a5); return entities.ToSpan().WhereToGroup(out a0, out a1, out a2, out a3, out a4, out a5);
} }

View File

@ -1,11 +1,11 @@
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
public sealed class EcsDefaultWorld : EcsWorld public sealed class EcsDefaultWorld : EcsWorld, IEntityStorage
{ {
public EcsDefaultWorld() : base(null) { } public EcsDefaultWorld() : base(null) { }
public EcsDefaultWorld(IEcsWorldConfig config) : base(config) { } public EcsDefaultWorld(IEcsWorldConfig config) : base(config) { }
} }
public sealed class EcsEventWorld : EcsWorld public sealed class EcsEventWorld : EcsWorld, IEntityStorage
{ {
public EcsEventWorld() : base(null) { } public EcsEventWorld() : base(null) { }
public EcsEventWorld(IEcsWorldConfig config) : base(config) { } public EcsEventWorld(IEcsWorldConfig config) : base(config) { }

View File

@ -144,7 +144,7 @@ namespace DCFApixels.DragonECS
} }
[DebuggerTypeProxy(typeof(DebuggerProxy))] [DebuggerTypeProxy(typeof(DebuggerProxy))]
public unsafe class EcsGroup : IDisposable, IEnumerable<int>, IEntitiesCollection public unsafe class EcsGroup : IDisposable, IEnumerable<int>, IEntityStorage
{ {
private EcsWorld _source; private EcsWorld _source;
private int[] _dense; private int[] _dense;

View File

@ -6,7 +6,7 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
public abstract partial class EcsWorld: IEntitiesCollection public abstract partial class EcsWorld: IEntityStorage
{ {
public readonly short id; public readonly short id;
private IEcsWorldConfig _config; private IEcsWorldConfig _config;
@ -26,6 +26,8 @@ namespace DCFApixels.DragonECS
private int _freeSpace; private int _freeSpace;
private bool _isEnableAutoReleaseDelEntBuffer = true; private bool _isEnableAutoReleaseDelEntBuffer = true;
private long _version = 0;
private List<WeakReference<EcsGroup>> _groups = new List<WeakReference<EcsGroup>>(); private List<WeakReference<EcsGroup>> _groups = new List<WeakReference<EcsGroup>>();
private Stack<EcsGroup> _groupsPool = new Stack<EcsGroup>(64); private Stack<EcsGroup> _groupsPool = new Stack<EcsGroup>(64);

View File

@ -1,6 +1,6 @@
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
public interface IEntitiesCollection public interface IEntityStorage
{ {
EcsSpan ToSpan(); EcsSpan ToSpan();
} }
@ -9,7 +9,7 @@
#region Where #region Where
public static EcsSpan Where<TCollection, TAspect>(this TCollection entities, out TAspect aspect) public static EcsSpan Where<TCollection, TAspect>(this TCollection entities, out TAspect aspect)
where TAspect : EcsAspect where TAspect : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().Where(out aspect); return entities.ToSpan().Where(out aspect);
} }
@ -58,7 +58,7 @@
#region WhereToGroup #region WhereToGroup
public static EcsReadonlyGroup WhereToGroup<TCollection ,TAspect>(this TCollection entities, out TAspect aspect) public static EcsReadonlyGroup WhereToGroup<TCollection ,TAspect>(this TCollection entities, out TAspect aspect)
where TAspect : EcsAspect where TAspect : EcsAspect
where TCollection : IEntitiesCollection where TCollection : IEntityStorage
{ {
return entities.ToSpan().WhereToGroup(out aspect); return entities.ToSpan().WhereToGroup(out aspect);
} }