mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
fixes
This commit is contained in:
parent
b5300f7b43
commit
0b6c1e8d26
@ -107,7 +107,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public bool IsSubsetOf(EcsGroup group) => _source.IsSubsetOf(group);
|
public bool IsSubsetOf(EcsGroup group) => _source.IsSubsetOf(group);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool IsSupersetOf(EcsReadonlyGroup group) => _source.Overlaps(group._source);
|
public bool IsSupersetOf(EcsReadonlyGroup group) => _source.IsSupersetOf(group._source);
|
||||||
public bool IsSupersetOf(EcsGroup group) => _source.IsSupersetOf(group);
|
public bool IsSupersetOf(EcsGroup group) => _source.IsSupersetOf(group);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -648,7 +648,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public Enumerator(EcsGroup group)
|
public Enumerator(EcsGroup group)
|
||||||
{
|
{
|
||||||
_dense = group._dense;
|
_dense = group._dense;
|
||||||
_index = (uint)(group._count > _dense.Length ? _dense.Length : group._count);
|
_index = (uint)(group._count > _dense.Length ? _dense.Length : group._count) + 1;
|
||||||
}
|
}
|
||||||
public int Current
|
public int Current
|
||||||
{
|
{
|
||||||
@ -689,7 +689,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
world = group.World;
|
world = group.World;
|
||||||
_dense = group._dense;
|
_dense = group._dense;
|
||||||
_index = (uint)(group._count > _dense.Length ? _dense.Length : group._count);
|
_index = (uint)(group._count > _dense.Length ? _dense.Length : group._count) + 1;
|
||||||
}
|
}
|
||||||
public entlong Current
|
public entlong Current
|
||||||
{
|
{
|
||||||
@ -698,7 +698,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
object IEnumerator.Current => Current;
|
object IEnumerator.Current => Current;
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool MoveNext() => ++_index > 0; // <= потму что отсчет начинается с индекса 1 //_count < _dense.Length дает среде понять что проверки на выход за границы не нужны
|
public bool MoveNext() => --_index > 0; // <= потму что отсчет начинается с индекса 1 //_count < _dense.Length дает среде понять что проверки на выход за границы не нужны
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Dispose() { }
|
public void Dispose() { }
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
@ -64,7 +64,8 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static ref T GetForWorld(int worldID)
|
public static ref T GetForWorld(int worldID)
|
||||||
{
|
{
|
||||||
return ref _items[GetItemIndex(worldID)];
|
int index = GetItemIndex(worldID);
|
||||||
|
return ref _items[index];
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static ref T GetForWorldUnchecked(int worldID)
|
public static ref T GetForWorldUnchecked(int worldID)
|
||||||
@ -78,8 +79,11 @@ namespace DCFApixels.DragonECS
|
|||||||
public static int GetItemIndex(int worldID)
|
public static int GetItemIndex(int worldID)
|
||||||
{
|
{
|
||||||
if (_mapping.Length < Worlds.Length)
|
if (_mapping.Length < Worlds.Length)
|
||||||
|
{
|
||||||
Array.Resize(ref _mapping, Worlds.Length);
|
Array.Resize(ref _mapping, Worlds.Length);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ref short itemIndex = ref _mapping[worldID];
|
ref short itemIndex = ref _mapping[worldID];
|
||||||
if (itemIndex <= 0)
|
if (itemIndex <= 0)
|
||||||
{
|
{
|
||||||
@ -92,6 +96,10 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
itemIndex = ++_count;
|
itemIndex = ++_count;
|
||||||
}
|
}
|
||||||
|
if(_items.Length <= itemIndex)
|
||||||
|
{
|
||||||
|
Array.Resize(ref _items, _items.Length << 1);
|
||||||
|
}
|
||||||
_interface.Init(ref _items[itemIndex], Worlds[worldID]);
|
_interface.Init(ref _items[itemIndex], Worlds[worldID]);
|
||||||
_dataReleaseres.Add(new Releaser());
|
_dataReleaseres.Add(new Releaser());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user