mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-11-13 09:05:54 +08:00
defines refactoring
This commit is contained in:
parent
35fbebf67f
commit
d83ffba82a
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.PoolsCore;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.PoolsCore;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.RunnersCore;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.RunnersCore;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
@ -115,7 +118,7 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private Pair[] _pairs;
|
private Pair[] _pairs;
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
private EcsProfilerMarker[] _markers;
|
private EcsProfilerMarker[] _markers;
|
||||||
#endif
|
#endif
|
||||||
protected override void OnSetup()
|
protected override void OnSetup()
|
||||||
@ -125,7 +128,7 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
{
|
{
|
||||||
_pairs[i] = new Pair(Process[i]);
|
_pairs[i] = new Pair(Process[i]);
|
||||||
}
|
}
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
_markers = new EcsProfilerMarker[Process.Length];
|
_markers = new EcsProfilerMarker[Process.Length];
|
||||||
for (int i = 0; i < Process.Length; i++)
|
for (int i = 0; i < Process.Length; i++)
|
||||||
{
|
{
|
||||||
@ -135,7 +138,7 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
}
|
}
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++)
|
for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++)
|
||||||
{
|
{
|
||||||
var pair = _pairs[i];
|
var pair = _pairs[i];
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System.Diagnostics;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -231,7 +234,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
internal void ReleaseGroup(EcsGroup group)
|
internal void ReleaseGroup(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (group.World != this) { Throw.World_GroupDoesNotBelongWorld(); }
|
if (group.World != this) { Throw.World_GroupDoesNotBelongWorld(); }
|
||||||
#endif
|
#endif
|
||||||
group._isReleased = true;
|
group._isReleased = true;
|
||||||
@ -304,7 +307,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (index < 0 || index >= Count) { Throw.ArgumentOutOfRange(); }
|
if (index < 0 || index >= Count) { Throw.ArgumentOutOfRange(); }
|
||||||
#endif
|
#endif
|
||||||
return _dense[++index];
|
return _dense[++index];
|
||||||
@ -313,7 +316,7 @@ namespace DCFApixels.DragonECS
|
|||||||
// set
|
// set
|
||||||
// {
|
// {
|
||||||
// // TODO добавить лок енумератора на изменение
|
// // TODO добавить лок енумератора на изменение
|
||||||
//#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
//#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
// if (index < 0 || index >= Count) { Throw.ArgumentOutOfRange(); }
|
// if (index < 0 || index >= Count) { Throw.ArgumentOutOfRange(); }
|
||||||
//#endif
|
//#endif
|
||||||
// var oldValue = _dense[index];
|
// var oldValue = _dense[index];
|
||||||
@ -366,7 +369,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Add/Remove
|
#region Add/Remove
|
||||||
public void AddUnchecked(int entityID)
|
public void AddUnchecked(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID)) { Throw.Group_AlreadyContains(entityID); }
|
if (Has(entityID)) { Throw.Group_AlreadyContains(entityID); }
|
||||||
#endif
|
#endif
|
||||||
Add_Internal(entityID);
|
Add_Internal(entityID);
|
||||||
@ -410,7 +413,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public void RemoveUnchecked(int entityID)
|
public void RemoveUnchecked(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID) == false) { Throw.Group_DoesNotContain(entityID); }
|
if (Has(entityID) == false) { Throw.Group_DoesNotContain(entityID); }
|
||||||
#endif
|
#endif
|
||||||
Remove_Internal(entityID);
|
Remove_Internal(entityID);
|
||||||
@ -428,7 +431,7 @@ namespace DCFApixels.DragonECS
|
|||||||
private void ChangeIndexInSparse(int entityID, int index)
|
private void ChangeIndexInSparse(int entityID, int index)
|
||||||
{
|
{
|
||||||
ref PageSlot page = ref _sparsePages[entityID >> PageSlot.SHIFT];
|
ref PageSlot page = ref _sparsePages[entityID >> PageSlot.SHIFT];
|
||||||
#if DEBUG && DEV_MODE
|
#if DEBUG && DRAGONECS_DEEP_DEBUG
|
||||||
if (page.Count == 0) { throw new Exception(); }
|
if (page.Count == 0) { throw new Exception(); }
|
||||||
#endif
|
#endif
|
||||||
if (page.Count == 1)
|
if (page.Count == 1)
|
||||||
@ -438,7 +441,7 @@ namespace DCFApixels.DragonECS
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int localEntityID = entityID & PageSlot.MASK;
|
int localEntityID = entityID & PageSlot.MASK;
|
||||||
#if DEBUG && DEV_MODE
|
#if DEBUG && DRAGONECS_DEEP_DEBUG
|
||||||
if (page.Indexes[localEntityID] == 0) { throw new Exception(); }
|
if (page.Indexes[localEntityID] == 0) { throw new Exception(); }
|
||||||
#endif
|
#endif
|
||||||
page.Indexes[localEntityID] = index;
|
page.Indexes[localEntityID] = index;
|
||||||
@ -523,7 +526,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region CopyFrom/Clone/Slice/ToSpan/ToArray
|
#region CopyFrom/Clone/Slice/ToSpan/ToArray
|
||||||
public void CopyFrom(EcsGroup group)
|
public void CopyFrom(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (group.World != _source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (group.World != _source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
if (_count > 0)
|
if (_count > 0)
|
||||||
@ -575,7 +578,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public EcsSpan Slice(int start, int length)
|
public EcsSpan Slice(int start, int length)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (start < 0 || start + length > _count) { Throw.ArgumentOutOfRange(); }
|
if (start < 0 || start + length > _count) { Throw.ArgumentOutOfRange(); }
|
||||||
#endif
|
#endif
|
||||||
return new EcsSpan(WorldID, _dense, start + 1, length);
|
return new EcsSpan(WorldID, _dense, start + 1, length);
|
||||||
@ -619,7 +622,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <summary>as Union sets</summary>
|
/// <summary>as Union sets</summary>
|
||||||
public void UnionWith(EcsGroup group)
|
public void UnionWith(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group._source) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source != group._source) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
foreach (var entityID in group) { UnionWithStep(entityID); }
|
foreach (var entityID in group) { UnionWithStep(entityID); }
|
||||||
@ -630,7 +633,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <summary>as Union sets</summary>
|
/// <summary>as Union sets</summary>
|
||||||
public void UnionWith(EcsSpan span)
|
public void UnionWith(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
foreach (var entityID in span) { UnionWithStep(entityID); }
|
foreach (var entityID in span) { UnionWithStep(entityID); }
|
||||||
@ -653,7 +656,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <summary>as Except sets</summary>
|
/// <summary>as Except sets</summary>
|
||||||
public void ExceptWith(EcsGroup group)
|
public void ExceptWith(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (_source != group._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
if (group.Count > Count) //мини оптимизация, итеррируемся по короткому списку
|
if (group.Count > Count) //мини оптимизация, итеррируемся по короткому списку
|
||||||
@ -678,7 +681,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <summary>as Except sets</summary>
|
/// <summary>as Except sets</summary>
|
||||||
public void ExceptWith(EcsSpan span)
|
public void ExceptWith(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
foreach (var entityID in span) { ExceptWithStep_Internal(entityID); }
|
foreach (var entityID in span) { ExceptWithStep_Internal(entityID); }
|
||||||
@ -701,7 +704,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <summary>as Intersect sets</summary>
|
/// <summary>as Intersect sets</summary>
|
||||||
public void IntersectWith(EcsGroup group)
|
public void IntersectWith(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (_source != group._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
for (int i = _count; i > 0; i--)//итерация в обратном порядке исключает ошибки при удалении элементов
|
for (int i = _count; i > 0; i--)//итерация в обратном порядке исключает ошибки при удалении элементов
|
||||||
@ -719,7 +722,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <summary>as Intersect sets</summary>
|
/// <summary>as Intersect sets</summary>
|
||||||
public void IntersectWith(EcsSpan span)
|
public void IntersectWith(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
foreach (var entityID in span)
|
foreach (var entityID in span)
|
||||||
@ -762,7 +765,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <summary>as Symmetric Except sets</summary>
|
/// <summary>as Symmetric Except sets</summary>
|
||||||
public void SymmetricExceptWith(EcsGroup group)
|
public void SymmetricExceptWith(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (_source != group._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
foreach (var entityID in group) { SymmetricExceptWithStep_Internal(entityID); }
|
foreach (var entityID in group) { SymmetricExceptWithStep_Internal(entityID); }
|
||||||
@ -774,7 +777,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <summary>as Symmetric Except sets</summary>
|
/// <summary>as Symmetric Except sets</summary>
|
||||||
public void SymmetricExceptWith(EcsSpan span)
|
public void SymmetricExceptWith(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
foreach (var entityID in span) { SymmetricExceptWithStep_Internal(entityID); }
|
foreach (var entityID in span) { SymmetricExceptWithStep_Internal(entityID); }
|
||||||
@ -824,7 +827,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region SetEquals
|
#region SetEquals
|
||||||
public bool SetEquals(EcsGroup group)
|
public bool SetEquals(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group.World) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (_source != group.World) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
if (group.Count != Count) { return false; }
|
if (group.Count != Count) { return false; }
|
||||||
@ -841,7 +844,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public bool SetEquals(EcsReadonlyGroup group) { return SetEquals(group.GetSource_Internal()); }
|
public bool SetEquals(EcsReadonlyGroup group) { return SetEquals(group.GetSource_Internal()); }
|
||||||
public bool SetEquals(EcsSpan span)
|
public bool SetEquals(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
if (span.Count != Count) { return false; }
|
if (span.Count != Count) { return false; }
|
||||||
@ -871,7 +874,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Overlaps
|
#region Overlaps
|
||||||
public bool Overlaps(EcsGroup group)
|
public bool Overlaps(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group.World) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source != group.World) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
if (group.Count > Count)
|
if (group.Count > Count)
|
||||||
@ -900,7 +903,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public bool Overlaps(EcsReadonlyGroup group) { return Overlaps(group.GetSource_Internal()); }
|
public bool Overlaps(EcsReadonlyGroup group) { return Overlaps(group.GetSource_Internal()); }
|
||||||
public bool Overlaps(EcsSpan span)
|
public bool Overlaps(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
foreach (var entityID in span)
|
foreach (var entityID in span)
|
||||||
@ -928,7 +931,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region IsSubsetOf/IsProperSubsetOf
|
#region IsSubsetOf/IsProperSubsetOf
|
||||||
public bool IsSubsetOf(EcsGroup group)
|
public bool IsSubsetOf(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group._source) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source != group._source) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
if (Count == 0) { return true; }
|
if (Count == 0) { return true; }
|
||||||
@ -939,7 +942,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public bool IsSubsetOf(EcsReadonlyGroup group) { return IsSubsetOf(group.GetSource_Internal()); }
|
public bool IsSubsetOf(EcsReadonlyGroup group) { return IsSubsetOf(group.GetSource_Internal()); }
|
||||||
public bool IsSubsetOf(EcsSpan span)
|
public bool IsSubsetOf(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
if (Count == 0) { return true; }
|
if (Count == 0) { return true; }
|
||||||
@ -957,7 +960,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public bool IsProperSubsetOf(EcsGroup group)
|
public bool IsProperSubsetOf(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group._source) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source != group._source) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
if (Count == 0) { return true; }
|
if (Count == 0) { return true; }
|
||||||
@ -968,7 +971,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public bool IsProperSubsetOf(EcsReadonlyGroup group) { return IsProperSubsetOf(group.GetSource_Internal()); }
|
public bool IsProperSubsetOf(EcsReadonlyGroup group) { return IsProperSubsetOf(group.GetSource_Internal()); }
|
||||||
public bool IsProperSubsetOf(EcsSpan span)
|
public bool IsProperSubsetOf(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
if (Count == 0) { return true; }
|
if (Count == 0) { return true; }
|
||||||
@ -1004,7 +1007,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
HashSet<int> thisHS = new HashSet<int>();
|
HashSet<int> thisHS = new HashSet<int>();
|
||||||
ToCollection(thisHS);
|
ToCollection(thisHS);
|
||||||
#if DEBUG && DEV_MODE
|
#if DEBUG && DRAGONECS_DEEP_DEBUG
|
||||||
if (thisHS.Contains(entityID) && Has(entityID) == false) { throw new Exception(); }
|
if (thisHS.Contains(entityID) && Has(entityID) == false) { throw new Exception(); }
|
||||||
#endif
|
#endif
|
||||||
if (Has(entityID))
|
if (Has(entityID))
|
||||||
@ -1032,7 +1035,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region IsSupersetOf/IsProperSupersetOf
|
#region IsSupersetOf/IsProperSupersetOf
|
||||||
public bool IsSupersetOf(EcsGroup group)
|
public bool IsSupersetOf(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group._source) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source != group._source) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
if (group.Count > Count) { return false; }
|
if (group.Count > Count) { return false; }
|
||||||
@ -1042,7 +1045,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public bool IsSupersetOf(EcsReadonlyGroup group) { return IsSupersetOf(group.GetSource_Internal()); }
|
public bool IsSupersetOf(EcsReadonlyGroup group) { return IsSupersetOf(group.GetSource_Internal()); }
|
||||||
public bool IsSupersetOf(EcsSpan span)
|
public bool IsSupersetOf(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
if (span.Count > Count) { return false; }
|
if (span.Count > Count) { return false; }
|
||||||
@ -1058,7 +1061,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public bool IsProperSupersetOf(EcsGroup group)
|
public bool IsProperSupersetOf(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group._source) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source != group._source) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
if (group.Count >= Count) { return false; }
|
if (group.Count >= Count) { return false; }
|
||||||
@ -1068,7 +1071,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public bool IsProperSupersetOf(EcsReadonlyGroup group) { return IsProperSupersetOf(group.GetSource_Internal()); }
|
public bool IsProperSupersetOf(EcsReadonlyGroup group) { return IsProperSupersetOf(group.GetSource_Internal()); }
|
||||||
public bool IsProperSupersetOf(EcsSpan span)
|
public bool IsProperSupersetOf(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
|
||||||
#endif
|
#endif
|
||||||
if (span.Count >= Count) { return false; }
|
if (span.Count >= Count) { return false; }
|
||||||
@ -1126,7 +1129,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup Union(EcsGroup a, EcsGroup b)
|
public static EcsGroup Union(EcsGroup a, EcsGroup b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a._source != b._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (a._source != b._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = a._source.GetFreeGroup();
|
EcsGroup result = a._source.GetFreeGroup();
|
||||||
@ -1150,7 +1153,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup Union(EcsSpan a, EcsSpan b)
|
public static EcsGroup Union(EcsSpan a, EcsSpan b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a.WorldID != b.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (a.WorldID != b.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = a.World.GetFreeGroup();
|
EcsGroup result = a.World.GetFreeGroup();
|
||||||
@ -1171,7 +1174,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup Except(EcsGroup a, EcsGroup b)
|
public static EcsGroup Except(EcsGroup a, EcsGroup b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a._source != b._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (a._source != b._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = a._source.GetFreeGroup();
|
EcsGroup result = a._source.GetFreeGroup();
|
||||||
@ -1188,7 +1191,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup Except(EcsSpan a, EcsGroup b)
|
public static EcsGroup Except(EcsSpan a, EcsGroup b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a.WorldID != b._source.ID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (a.WorldID != b._source.ID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = b._source.GetFreeGroup();
|
EcsGroup result = b._source.GetFreeGroup();
|
||||||
@ -1205,7 +1208,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup Except(EcsSpan a, EcsSpan b)
|
public static EcsGroup Except(EcsSpan a, EcsSpan b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a.WorldID != b.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (a.WorldID != b.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = a.World.GetFreeGroup();
|
EcsGroup result = a.World.GetFreeGroup();
|
||||||
@ -1226,7 +1229,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup Intersect(EcsGroup a, EcsGroup b)
|
public static EcsGroup Intersect(EcsGroup a, EcsGroup b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a._source != b._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (a._source != b._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = a._source.GetFreeGroup();
|
EcsGroup result = a._source.GetFreeGroup();
|
||||||
@ -1243,7 +1246,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup Intersect(EcsSpan a, EcsGroup b)
|
public static EcsGroup Intersect(EcsSpan a, EcsGroup b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a.WorldID != b._source.ID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (a.WorldID != b._source.ID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = b._source.GetFreeGroup();
|
EcsGroup result = b._source.GetFreeGroup();
|
||||||
@ -1267,7 +1270,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup Intersect(EcsSpan a, EcsSpan b)
|
public static EcsGroup Intersect(EcsSpan a, EcsSpan b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a.WorldID != b.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (a.WorldID != b.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = b.World.GetFreeGroup();
|
EcsGroup result = b.World.GetFreeGroup();
|
||||||
@ -1288,7 +1291,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup SymmetricExcept(EcsGroup a, EcsGroup b)
|
public static EcsGroup SymmetricExcept(EcsGroup a, EcsGroup b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a._source != b._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (a._source != b._source) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = a._source.GetFreeGroup();
|
EcsGroup result = a._source.GetFreeGroup();
|
||||||
@ -1312,7 +1315,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup SymmetricExcept(EcsSpan a, EcsSpan b)
|
public static EcsGroup SymmetricExcept(EcsSpan a, EcsSpan b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a.WorldID != b.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
if (a.WorldID != b.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = a.World.GetFreeGroup();
|
EcsGroup result = a.World.GetFreeGroup();
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|||||||
@ -88,8 +88,16 @@
|
|||||||
#else
|
#else
|
||||||
false;
|
false;
|
||||||
#endif
|
#endif
|
||||||
public const bool DEV_MODE =
|
|
||||||
#if DEV_MODE
|
|
||||||
|
public const bool DRAGONECS_PERF_MODE =
|
||||||
|
#if DRAGONECS_PERF_MODE
|
||||||
|
true;
|
||||||
|
#else
|
||||||
|
false;
|
||||||
|
#endif
|
||||||
|
public const bool DRAGONECS_STAB_MODE =
|
||||||
|
#if DRAGONECS_STAB_MODE
|
||||||
true;
|
true;
|
||||||
#else
|
#else
|
||||||
false;
|
false;
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -10,39 +13,39 @@ namespace DCFApixels.DragonECS
|
|||||||
using static EcsConsts;
|
using static EcsConsts;
|
||||||
public readonly struct EcsProfilerMarker
|
public readonly struct EcsProfilerMarker
|
||||||
{
|
{
|
||||||
#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
public readonly int id;
|
public readonly int id;
|
||||||
#endif
|
#endif
|
||||||
internal EcsProfilerMarker(int id)
|
internal EcsProfilerMarker(int id)
|
||||||
{
|
{
|
||||||
#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
this.id = id;
|
this.id = id;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
public EcsProfilerMarker(string name)
|
public EcsProfilerMarker(string name)
|
||||||
{
|
{
|
||||||
#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
id = DebugService.CurrentThreadInstance.RegisterMark(name);
|
id = DebugService.CurrentThreadInstance.RegisterMark(name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Begin()
|
public void Begin()
|
||||||
{
|
{
|
||||||
#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
DebugService.CurrentThreadInstance.ProfilerMarkBegin(id);
|
DebugService.CurrentThreadInstance.ProfilerMarkBegin(id);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void End()
|
public void End()
|
||||||
{
|
{
|
||||||
#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
DebugService.CurrentThreadInstance.ProfilerMarkEnd(id);
|
DebugService.CurrentThreadInstance.ProfilerMarkEnd(id);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public AutoScope Auto()
|
public AutoScope Auto()
|
||||||
{
|
{
|
||||||
#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
return new AutoScope(id);
|
return new AutoScope(id);
|
||||||
#else
|
#else
|
||||||
return default;
|
return default;
|
||||||
@ -50,13 +53,13 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public readonly ref struct AutoScope
|
public readonly ref struct AutoScope
|
||||||
{
|
{
|
||||||
#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
private readonly int _id;
|
private readonly int _id;
|
||||||
#endif
|
#endif
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public AutoScope(int id)
|
public AutoScope(int id)
|
||||||
{
|
{
|
||||||
#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
_id = id;
|
_id = id;
|
||||||
DebugService.CurrentThreadInstance.ProfilerMarkBegin(id);
|
DebugService.CurrentThreadInstance.ProfilerMarkBegin(id);
|
||||||
#endif
|
#endif
|
||||||
@ -64,7 +67,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
DebugService.CurrentThreadInstance.ProfilerMarkEnd(_id);
|
DebugService.CurrentThreadInstance.ProfilerMarkEnd(_id);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -91,7 +94,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void PrintWarning(object v)
|
public static void PrintWarning(object v)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
OnPrint(DEBUG_WARNING_TAG, v);
|
OnPrint(DEBUG_WARNING_TAG, v);
|
||||||
DebugService.CurrentThreadInstance.PrintWarning(v);
|
DebugService.CurrentThreadInstance.PrintWarning(v);
|
||||||
#endif
|
#endif
|
||||||
@ -99,7 +102,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void PrintError(object v)
|
public static void PrintError(object v)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
OnPrint(DEBUG_ERROR_TAG, v);
|
OnPrint(DEBUG_ERROR_TAG, v);
|
||||||
DebugService.CurrentThreadInstance.PrintError(v);
|
DebugService.CurrentThreadInstance.PrintError(v);
|
||||||
#endif
|
#endif
|
||||||
@ -107,7 +110,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void PrintErrorAndBreak(object v)
|
public static void PrintErrorAndBreak(object v)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
OnPrint(DEBUG_ERROR_TAG, v);
|
OnPrint(DEBUG_ERROR_TAG, v);
|
||||||
DebugService.CurrentThreadInstance.PrintErrorAndBreak(v);
|
DebugService.CurrentThreadInstance.PrintErrorAndBreak(v);
|
||||||
#endif
|
#endif
|
||||||
@ -115,7 +118,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void PrintPass(object v)
|
public static void PrintPass(object v)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
OnPrint(DEBUG_PASS_TAG, v);
|
OnPrint(DEBUG_PASS_TAG, v);
|
||||||
DebugService.CurrentThreadInstance.PrintPass(v);
|
DebugService.CurrentThreadInstance.PrintPass(v);
|
||||||
#endif
|
#endif
|
||||||
@ -123,7 +126,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Print()
|
public static void Print()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
OnPrint(string.Empty, null);
|
OnPrint(string.Empty, null);
|
||||||
DebugService.CurrentThreadInstance.Print();
|
DebugService.CurrentThreadInstance.Print();
|
||||||
#endif
|
#endif
|
||||||
@ -131,7 +134,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Print(object v)
|
public static void Print(object v)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
OnPrint(string.Empty, v);
|
OnPrint(string.Empty, v);
|
||||||
DebugService.CurrentThreadInstance.Print(v);
|
DebugService.CurrentThreadInstance.Print(v);
|
||||||
#endif
|
#endif
|
||||||
@ -139,7 +142,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Print(string tag, object v)
|
public static void Print(string tag, object v)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
OnPrint(tag, v);
|
OnPrint(tag, v);
|
||||||
DebugService.CurrentThreadInstance.Print(tag, v);
|
DebugService.CurrentThreadInstance.Print(tag, v);
|
||||||
#endif
|
#endif
|
||||||
@ -147,7 +150,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Break()
|
public static void Break()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
|
#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
|
||||||
DebugService.CurrentThreadInstance.Break();
|
DebugService.CurrentThreadInstance.Break();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED
|
#if DEBUG || !REFLECTION_DISABLED
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -8,7 +11,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
public static class EcsDebugUtility
|
public static class EcsDebugUtility
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED
|
#if DEBUG || !REFLECTION_DISABLED
|
||||||
private const BindingFlags RFL_FLAGS = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
private const BindingFlags RFL_FLAGS = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -31,7 +34,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
private static string GetGenericTypeName_Internal(Type type, int maxDepth, bool isFull)
|
private static string GetGenericTypeName_Internal(Type type, int maxDepth, bool isFull)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||||
string typeName = isFull ? type.FullName : type.Name;
|
string typeName = isFull ? type.FullName : type.Name;
|
||||||
if (!type.IsGenericType || maxDepth == 0)
|
if (!type.IsGenericType || maxDepth == 0)
|
||||||
{
|
{
|
||||||
@ -68,7 +71,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
internal static string AutoToString(object target, Type type, bool isWriteName)
|
internal static string AutoToString(object target, Type type, bool isWriteName)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||||
#pragma warning disable IL2070 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The parameter of method does not have matching annotations.
|
#pragma warning disable IL2070 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The parameter of method does not have matching annotations.
|
||||||
var fields = type.GetFields(RFL_FLAGS);
|
var fields = type.GetFields(RFL_FLAGS);
|
||||||
#pragma warning restore IL2070
|
#pragma warning restore IL2070
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS.Core
|
namespace DCFApixels.DragonECS.Core
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED
|
#if DEBUG || !REFLECTION_DISABLED
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -326,7 +329,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
private static bool CheckEcsMemener(Type checkedType)
|
private static bool CheckEcsMemener(Type checkedType)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED
|
#if DEBUG || !REFLECTION_DISABLED
|
||||||
return checkedType.IsInterface == false && checkedType.IsAbstract == false && typeof(IEcsMember).IsAssignableFrom(checkedType);
|
return checkedType.IsInterface == false && checkedType.IsAbstract == false && typeof(IEcsMember).IsAssignableFrom(checkedType);
|
||||||
#else
|
#else
|
||||||
EcsDebug.PrintWarning($"Reflection is not available, the {nameof(TypeMeta)}.{nameof(CheckEcsMemener)} method does not work.");
|
EcsDebug.PrintWarning($"Reflection is not available, the {nameof(TypeMeta)}.{nameof(CheckEcsMemener)} method does not work.");
|
||||||
@ -335,7 +338,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public static bool IsHasMeta(Type type)
|
public static bool IsHasMeta(Type type)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED
|
#if DEBUG || !REFLECTION_DISABLED
|
||||||
return CheckEcsMemener(type) || Attribute.GetCustomAttributes(type, typeof(EcsMetaAttribute), false).Length > 0;
|
return CheckEcsMemener(type) || Attribute.GetCustomAttributes(type, typeof(EcsMetaAttribute), false).Length > 0;
|
||||||
#else
|
#else
|
||||||
EcsDebug.PrintWarning($"Reflection is not available, the {nameof(TypeMeta)}.{nameof(IsHasMeta)} method does not work.");
|
EcsDebug.PrintWarning($"Reflection is not available, the {nameof(TypeMeta)}.{nameof(IsHasMeta)} method does not work.");
|
||||||
@ -344,7 +347,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public static bool IsHasMetaID(Type type)
|
public static bool IsHasMetaID(Type type)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED
|
#if DEBUG || !REFLECTION_DISABLED
|
||||||
return type.HasAttribute<MetaIDAttribute>();
|
return type.HasAttribute<MetaIDAttribute>();
|
||||||
#else
|
#else
|
||||||
EcsDebug.PrintWarning($"Reflection is not available, the {nameof(TypeMeta)}.{nameof(IsHasMetaID)} method does not work.");
|
EcsDebug.PrintWarning($"Reflection is not available, the {nameof(TypeMeta)}.{nameof(IsHasMetaID)} method does not work.");
|
||||||
@ -413,7 +416,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public static (string, bool) GetMetaName(Type type)
|
public static (string, bool) GetMetaName(Type type)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||||
bool isCustom = type.TryGetAttribute(out MetaNameAttribute atr) && string.IsNullOrEmpty(atr.name) == false;
|
bool isCustom = type.TryGetAttribute(out MetaNameAttribute atr) && string.IsNullOrEmpty(atr.name) == false;
|
||||||
if (isCustom)
|
if (isCustom)
|
||||||
{
|
{
|
||||||
@ -455,7 +458,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public static (MetaColor, bool) GetColor(TypeMeta meta)
|
public static (MetaColor, bool) GetColor(TypeMeta meta)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||||
bool isCustom = meta.Type.TryGetAttribute(out MetaColorAttribute atr);
|
bool isCustom = meta.Type.TryGetAttribute(out MetaColorAttribute atr);
|
||||||
return (isCustom ? atr.color : AutoColor(meta), isCustom);
|
return (isCustom ? atr.color : AutoColor(meta), isCustom);
|
||||||
#else
|
#else
|
||||||
@ -468,7 +471,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region GetGroup
|
#region GetGroup
|
||||||
public static MetaGroup GetGroup(Type type)
|
public static MetaGroup GetGroup(Type type)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||||
return type.TryGetAttribute(out MetaGroupAttribute atr) ? atr.Data : MetaGroup.FromNameSpace(type);
|
return type.TryGetAttribute(out MetaGroupAttribute atr) ? atr.Data : MetaGroup.FromNameSpace(type);
|
||||||
#else
|
#else
|
||||||
EcsDebug.PrintWarning($"Reflection is not available, the {nameof(MetaGenerator)}.{nameof(GetGroup)} method does not work.");
|
EcsDebug.PrintWarning($"Reflection is not available, the {nameof(MetaGenerator)}.{nameof(GetGroup)} method does not work.");
|
||||||
@ -480,7 +483,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region GetDescription
|
#region GetDescription
|
||||||
public static MetaDescription GetDescription(Type type)
|
public static MetaDescription GetDescription(Type type)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||||
bool isCustom = type.TryGetAttribute(out MetaDescriptionAttribute atr);
|
bool isCustom = type.TryGetAttribute(out MetaDescriptionAttribute atr);
|
||||||
return isCustom ? atr.Data : MetaDescription.Empty;
|
return isCustom ? atr.Data : MetaDescription.Empty;
|
||||||
#else
|
#else
|
||||||
@ -493,7 +496,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region GetTags
|
#region GetTags
|
||||||
public static IReadOnlyList<string> GetTags(Type type)
|
public static IReadOnlyList<string> GetTags(Type type)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||||
var atr = type.GetCustomAttribute<MetaTagsAttribute>();
|
var atr = type.GetCustomAttribute<MetaTagsAttribute>();
|
||||||
return atr != null ? atr.Tags : Array.Empty<string>();
|
return atr != null ? atr.Tags : Array.Empty<string>();
|
||||||
#else
|
#else
|
||||||
@ -504,12 +507,12 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region GetMetaID
|
#region GetMetaID
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||||
private static Dictionary<string, Type> _idTypePairs = new Dictionary<string, Type>();
|
private static Dictionary<string, Type> _idTypePairs = new Dictionary<string, Type>();
|
||||||
#endif
|
#endif
|
||||||
public static string GetMetaID(Type type)
|
public static string GetMetaID(Type type)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||||
var atr = type.GetCustomAttribute<MetaIDAttribute>();
|
var atr = type.GetCustomAttribute<MetaIDAttribute>();
|
||||||
|
|
||||||
if (atr == null)
|
if (atr == null)
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using DCFApixels.DragonECS.PoolsCore;
|
using DCFApixels.DragonECS.PoolsCore;
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -358,7 +361,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Debug utils
|
#region Debug utils
|
||||||
private static string CreateLogString(short worldID, int[] inc, int[] exc)
|
private static string CreateLogString(short worldID, int[] inc, int[] exc)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if DEBUG
|
||||||
string converter(int o) { return EcsDebugUtility.GetGenericTypeName(EcsWorld.GetWorld(worldID).AllPools[o].ComponentType, 1); }
|
string converter(int o) { return EcsDebugUtility.GetGenericTypeName(EcsWorld.GetWorld(worldID).AllPools[o].ComponentType, 1); }
|
||||||
return $"Inc({string.Join(", ", inc.Select(converter))}) Exc({string.Join(", ", exc.Select(converter))})";
|
return $"Inc({string.Join(", ", inc.Select(converter))}) Exc({string.Join(", ", exc.Select(converter))})";
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using DCFApixels.DragonECS.RunnersCore;
|
using DCFApixels.DragonECS.RunnersCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
@ -298,12 +301,12 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Build
|
#region Build
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
private static EcsProfilerMarker _buildMarker = new EcsProfilerMarker("EcsPipeline.Build");
|
private static EcsProfilerMarker _buildMarker = new EcsProfilerMarker("EcsPipeline.Build");
|
||||||
#endif
|
#endif
|
||||||
public EcsPipeline Build()
|
public EcsPipeline Build()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
_buildMarker.Begin();
|
_buildMarker.Begin();
|
||||||
#endif
|
#endif
|
||||||
var it = new LinkedListIterator<SystemNode>(_systemNodes, _systemNodesCount, _startIndex);
|
var it = new LinkedListIterator<SystemNode>(_systemNodes, _systemNodesCount, _startIndex);
|
||||||
@ -369,7 +372,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
item.Declare(pipeline);
|
item.Declare(pipeline);
|
||||||
}
|
}
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
_buildMarker.End();
|
_buildMarker.End();
|
||||||
#endif
|
#endif
|
||||||
return pipeline;
|
return pipeline;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using DCFApixels.DragonECS.RunnersCore;
|
using DCFApixels.DragonECS.RunnersCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
@ -42,7 +45,7 @@ namespace DCFApixels.DragonECS
|
|||||||
private bool _isInit = false;
|
private bool _isInit = false;
|
||||||
private bool _isDestoryed = false;
|
private bool _isDestoryed = false;
|
||||||
|
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
private static EcsProfilerMarker _initMarker = new EcsProfilerMarker("EcsPipeline.Init");
|
private static EcsProfilerMarker _initMarker = new EcsProfilerMarker("EcsPipeline.Init");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -137,7 +140,7 @@ namespace DCFApixels.DragonECS
|
|||||||
return (TRunner)result;
|
return (TRunner)result;
|
||||||
}
|
}
|
||||||
TRunner runnerInstance = new TRunner();
|
TRunner runnerInstance = new TRunner();
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
EcsRunner.CheckRunnerTypeIsValide(runnerType, runnerInstance.Interface);
|
EcsRunner.CheckRunnerTypeIsValide(runnerType, runnerInstance.Interface);
|
||||||
#endif
|
#endif
|
||||||
runnerInstance.Init_Internal(this);
|
runnerInstance.Init_Internal(this);
|
||||||
@ -185,7 +188,7 @@ namespace DCFApixels.DragonECS
|
|||||||
EcsDebug.PrintWarning($"This {nameof(EcsPipeline)} has already been initialized");
|
EcsDebug.PrintWarning($"This {nameof(EcsPipeline)} has already been initialized");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
_initMarker.Begin();
|
_initMarker.Begin();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -196,7 +199,7 @@ namespace DCFApixels.DragonECS
|
|||||||
_isInit = true;
|
_isInit = true;
|
||||||
|
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
_initMarker.End();
|
_initMarker.End();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -204,7 +207,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!_isInit) { Throw.Pipeline_MethodCalledBeforeInitialisation(nameof(Run)); }
|
if (!_isInit) { Throw.Pipeline_MethodCalledBeforeInitialisation(nameof(Run)); }
|
||||||
if (_isDestoryed) { Throw.Pipeline_MethodCalledAfterDestruction(nameof(Run)); }
|
if (_isDestoryed) { Throw.Pipeline_MethodCalledAfterDestruction(nameof(Run)); }
|
||||||
#endif
|
#endif
|
||||||
@ -212,7 +215,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Destroy()
|
public void Destroy()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!_isInit) { Throw.Pipeline_MethodCalledBeforeInitialisation(nameof(Destroy)); }
|
if (!_isInit) { Throw.Pipeline_MethodCalledBeforeInitialisation(nameof(Destroy)); }
|
||||||
#endif
|
#endif
|
||||||
if (_isDestoryed)
|
if (_isDestoryed)
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using DCFApixels.DragonECS.RunnersCore;
|
using DCFApixels.DragonECS.RunnersCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -130,7 +133,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region RunHelper
|
#region RunHelper
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
public
|
public
|
||||||
#else
|
#else
|
||||||
public readonly
|
public readonly
|
||||||
@ -138,7 +141,7 @@ namespace DCFApixels.DragonECS
|
|||||||
struct RunHelper
|
struct RunHelper
|
||||||
{
|
{
|
||||||
private readonly EcsProcess<TProcess> _process;
|
private readonly EcsProcess<TProcess> _process;
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
private Delegate _cacheCheck;
|
private Delegate _cacheCheck;
|
||||||
private bool _cacheCheckInit;
|
private bool _cacheCheckInit;
|
||||||
private readonly EcsProfilerMarker[] _markers;
|
private readonly EcsProfilerMarker[] _markers;
|
||||||
@ -146,7 +149,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public RunHelper(EcsRunner<TProcess> runner) : this(runner,
|
public RunHelper(EcsRunner<TProcess> runner) : this(runner,
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
typeof(TProcess).ToMeta().Name)
|
typeof(TProcess).ToMeta().Name)
|
||||||
#else
|
#else
|
||||||
string.Empty)
|
string.Empty)
|
||||||
@ -156,7 +159,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public RunHelper(EcsRunner<TProcess> runner, string methodName)
|
public RunHelper(EcsRunner<TProcess> runner, string methodName)
|
||||||
{
|
{
|
||||||
_process = runner.Process;
|
_process = runner.Process;
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
_cacheCheck = null;
|
_cacheCheck = null;
|
||||||
_cacheCheckInit = false;
|
_cacheCheckInit = false;
|
||||||
_markers = new EcsProfilerMarker[_process.Length];
|
_markers = new EcsProfilerMarker[_process.Length];
|
||||||
@ -169,7 +172,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Utils
|
#region Utils
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private void CheckCache(Delegate d)
|
private void CheckCache(Delegate d)
|
||||||
{
|
{
|
||||||
@ -196,7 +199,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Run(Action<TProcess> translationCallback)
|
public void Run(Action<TProcess> translationCallback)
|
||||||
{
|
{
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
CheckCache(translationCallback);
|
CheckCache(translationCallback);
|
||||||
for (int i = 0, n = _process.Length < _markers.Length ? _process.Length : _markers.Length; i < n; i++)
|
for (int i = 0, n = _process.Length < _markers.Length ? _process.Length : _markers.Length; i < n; i++)
|
||||||
{
|
{
|
||||||
@ -235,7 +238,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Run<TData>(ActionWithData<TProcess, TData> translationCallback, ref TData data)
|
public void Run<TData>(ActionWithData<TProcess, TData> translationCallback, ref TData data)
|
||||||
{
|
{
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
CheckCache(translationCallback);
|
CheckCache(translationCallback);
|
||||||
for (int i = 0, n = _process.Length < _markers.Length ? _process.Length : _markers.Length; i < n; i++)
|
for (int i = 0, n = _process.Length < _markers.Length ? _process.Length : _markers.Length; i < n; i++)
|
||||||
{
|
{
|
||||||
@ -275,7 +278,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region RunHelperWithFinally
|
#region RunHelperWithFinally
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
public
|
public
|
||||||
#else
|
#else
|
||||||
public readonly
|
public readonly
|
||||||
@ -283,7 +286,7 @@ namespace DCFApixels.DragonECS
|
|||||||
struct RunHelperWithFinally<TProcessFinally> where TProcessFinally : class, IEcsProcess
|
struct RunHelperWithFinally<TProcessFinally> where TProcessFinally : class, IEcsProcess
|
||||||
{
|
{
|
||||||
private readonly Pair[] _pairs;
|
private readonly Pair[] _pairs;
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
private Delegate _cacheCheck;
|
private Delegate _cacheCheck;
|
||||||
private Delegate _cacheCheckF;
|
private Delegate _cacheCheckF;
|
||||||
private bool _cacheCheckInit;
|
private bool _cacheCheckInit;
|
||||||
@ -292,7 +295,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public RunHelperWithFinally(EcsRunner<TProcess> runner) : this(runner,
|
public RunHelperWithFinally(EcsRunner<TProcess> runner) : this(runner,
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
typeof(TProcess).ToMeta().Name)
|
typeof(TProcess).ToMeta().Name)
|
||||||
#else
|
#else
|
||||||
string.Empty)
|
string.Empty)
|
||||||
@ -306,7 +309,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
_pairs[i] = new Pair(runner.Process[i]);
|
_pairs[i] = new Pair(runner.Process[i]);
|
||||||
}
|
}
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
_cacheCheck = null;
|
_cacheCheck = null;
|
||||||
_cacheCheckF = null;
|
_cacheCheckF = null;
|
||||||
_cacheCheckInit = false;
|
_cacheCheckInit = false;
|
||||||
@ -330,7 +333,7 @@ namespace DCFApixels.DragonECS
|
|||||||
runFinally = run as TProcessFinally;
|
runFinally = run as TProcessFinally;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private void CheckCache(Delegate d, Delegate df)
|
private void CheckCache(Delegate d, Delegate df)
|
||||||
{
|
{
|
||||||
@ -360,7 +363,7 @@ namespace DCFApixels.DragonECS
|
|||||||
Action<TProcess> translationCallback,
|
Action<TProcess> translationCallback,
|
||||||
Action<TProcessFinally> translationFinnalyCallback)
|
Action<TProcessFinally> translationFinnalyCallback)
|
||||||
{
|
{
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
CheckCache(translationCallback, translationFinnalyCallback);
|
CheckCache(translationCallback, translationFinnalyCallback);
|
||||||
for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++)
|
for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++)
|
||||||
{
|
{
|
||||||
@ -414,7 +417,7 @@ namespace DCFApixels.DragonECS
|
|||||||
ActionWithData<TProcessFinally, TData> translationFinnalyCallback,
|
ActionWithData<TProcessFinally, TData> translationFinnalyCallback,
|
||||||
ref TData data)
|
ref TData data)
|
||||||
{
|
{
|
||||||
#if DEBUG && !DISABLE_DEBUG
|
#if DEBUG
|
||||||
CheckCache(translationCallback, translationFinnalyCallback);
|
CheckCache(translationCallback, translationFinnalyCallback);
|
||||||
for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++)
|
for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
@ -339,14 +342,14 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Inc/Exc/Combine/Except
|
#region Inc/Exc/Combine/Except
|
||||||
public void Inc(EcsTypeCode typeCode)
|
public void Inc(EcsTypeCode typeCode)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_inc.Contains(typeCode) || _exc.Contains(typeCode)) { Throw.ConstraintIsAlreadyContainedInMask(); }
|
if (_inc.Contains(typeCode) || _exc.Contains(typeCode)) { Throw.ConstraintIsAlreadyContainedInMask(); }
|
||||||
#endif
|
#endif
|
||||||
_inc.Add(typeCode);
|
_inc.Add(typeCode);
|
||||||
}
|
}
|
||||||
public void Exc(EcsTypeCode typeCode)
|
public void Exc(EcsTypeCode typeCode)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_inc.Contains(typeCode) || _exc.Contains(typeCode)) { Throw.ConstraintIsAlreadyContainedInMask(); }
|
if (_inc.Contains(typeCode) || _exc.Contains(typeCode)) { Throw.ConstraintIsAlreadyContainedInMask(); }
|
||||||
#endif
|
#endif
|
||||||
_exc.Add(typeCode);
|
_exc.Add(typeCode);
|
||||||
@ -451,7 +454,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Debug utils
|
#region Debug utils
|
||||||
private static string CreateLogString(EcsTypeCode[] inc, EcsTypeCode[] exc)
|
private static string CreateLogString(EcsTypeCode[] inc, EcsTypeCode[] exc)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if DEBUG
|
||||||
string converter(EcsTypeCode o) { return EcsTypeCodeManager.FindTypeOfCode(o).ToString(); }
|
string converter(EcsTypeCode o) { return EcsTypeCodeManager.FindTypeOfCode(o).ToString(); }
|
||||||
return $"Inc({string.Join(", ", inc.Select(converter))}) Exc({string.Join(", ", exc.Select(converter))})";
|
return $"Inc({string.Join(", ", inc.Select(converter))}) Exc({string.Join(", ", exc.Select(converter))})";
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.PoolsCore;
|
using DCFApixels.DragonECS.PoolsCore;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using DCFApixels.DragonECS.PoolsCore;
|
using DCFApixels.DragonECS.PoolsCore;
|
||||||
using System;
|
using System;
|
||||||
@ -219,7 +222,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
if (ID == NULL_WORLD_ID)
|
if (ID == NULL_WORLD_ID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if DEBUG
|
||||||
Throw.World_WorldCantBeDestroyed();
|
Throw.World_WorldCantBeDestroyed();
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
@ -328,7 +331,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public int NewEntity(int entityID)
|
public int NewEntity(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (entityID < _entities.Length && IsUsed(entityID)) { Throw.World_EntityIsAlreadyСontained(entityID); }
|
if (entityID < _entities.Length && IsUsed(entityID)) { Throw.World_EntityIsAlreadyСontained(entityID); }
|
||||||
#endif
|
#endif
|
||||||
_entityDispenser.Use(entityID);
|
_entityDispenser.Use(entityID);
|
||||||
@ -378,7 +381,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void DelEntity(int entityID)
|
public void DelEntity(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (IsUsed(entityID) == false) { Throw.World_EntityIsNotContained(entityID); }
|
if (IsUsed(entityID) == false) { Throw.World_EntityIsNotContained(entityID); }
|
||||||
#endif
|
#endif
|
||||||
UpVersion();
|
UpVersion();
|
||||||
@ -408,7 +411,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void InitEntitySlot(int entityID, short gen)
|
public void InitEntitySlot(int entityID, short gen)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Count > 0) { Throw.World_MethodCalledAfterEntityCreation(nameof(InitEntitySlot)); }
|
if (Count > 0) { Throw.World_MethodCalledAfterEntityCreation(nameof(InitEntitySlot)); }
|
||||||
#endif
|
#endif
|
||||||
_entityDispenser.Upsize(entityID);
|
_entityDispenser.Upsize(entityID);
|
||||||
@ -428,7 +431,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool IsAlive(entlong entity)
|
public bool IsAlive(entlong entity)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (entity.GetWorldIDUnchecked() != ID) { Throw.World_MaskDoesntBelongWorld(); }
|
if (entity.GetWorldIDUnchecked() != ID) { Throw.World_MaskDoesntBelongWorld(); }
|
||||||
#endif
|
#endif
|
||||||
ref var slot = ref _entities[entity.GetIDUnchecked()];
|
ref var slot = ref _entities[entity.GetIDUnchecked()];
|
||||||
@ -465,7 +468,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public bool IsMatchesMask(EcsMask mask, int entityID)
|
public bool IsMatchesMask(EcsMask mask, int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (mask.WorldID != ID) { Throw.World_MaskDoesntBelongWorld(); }
|
if (mask.WorldID != ID) { Throw.World_MaskDoesntBelongWorld(); }
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0, iMax = mask._incs.Length; i < iMax; i++)
|
for (int i = 0, iMax = mask._incs.Length; i < iMax; i++)
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using DCFApixels.DragonECS.PoolsCore;
|
using DCFApixels.DragonECS.PoolsCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -15,7 +18,7 @@ namespace DCFApixels.DragonECS
|
|||||||
internal PoolSlot[] _poolSlots;
|
internal PoolSlot[] _poolSlots;
|
||||||
private int _poolsCount;
|
private int _poolsCount;
|
||||||
|
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
private int _lockedPoolCount = 0;
|
private int _lockedPoolCount = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -43,7 +46,7 @@ namespace DCFApixels.DragonECS
|
|||||||
ref var result = ref _pools[componentTypeID];
|
ref var result = ref _pools[componentTypeID];
|
||||||
if (result != _nullPool)
|
if (result != _nullPool)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if DEBUG
|
||||||
if (result.ComponentTypeID != componentTypeID) { Throw.UndefinedException(); }
|
if (result.ComponentTypeID != componentTypeID) { Throw.UndefinedException(); }
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
@ -149,7 +152,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region FindOrAutoCreatePool/InitPool
|
#region FindOrAutoCreatePool/InitPool
|
||||||
public void InitPool(IEcsPoolImplementation poolImplementation)
|
public void InitPool(IEcsPoolImplementation poolImplementation)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Count > 0) { Throw.World_MethodCalledAfterEntityCreation(nameof(InitEntitySlot)); }
|
if (Count > 0) { Throw.World_MethodCalledAfterEntityCreation(nameof(InitEntitySlot)); }
|
||||||
#endif
|
#endif
|
||||||
InitPool_Internal(poolImplementation);
|
InitPool_Internal(poolImplementation);
|
||||||
@ -162,7 +165,7 @@ namespace DCFApixels.DragonECS
|
|||||||
if (_poolTypeCode_2_CmpTypeIDs.TryGetValue(poolTypeCode, out int cmpTypeID))
|
if (_poolTypeCode_2_CmpTypeIDs.TryGetValue(poolTypeCode, out int cmpTypeID))
|
||||||
{
|
{
|
||||||
var pool = _pools[cmpTypeID];
|
var pool = _pools[cmpTypeID];
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if ((pool is TPool) == false) { Throw.UndefinedException(); }
|
if ((pool is TPool) == false) { Throw.UndefinedException(); }
|
||||||
#endif
|
#endif
|
||||||
return (TPool)pool;
|
return (TPool)pool;
|
||||||
@ -279,7 +282,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
DelEntity(entityID);
|
DelEntity(entityID);
|
||||||
}
|
}
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (count < 0) Throw.World_InvalidIncrementComponentsBalance();
|
if (count < 0) Throw.World_InvalidIncrementComponentsBalance();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -320,7 +323,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
DelEntity(entityID);
|
DelEntity(entityID);
|
||||||
}
|
}
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (count < 0) Throw.World_InvalidIncrementComponentsBalance();
|
if (count < 0) Throw.World_InvalidIncrementComponentsBalance();
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
@ -399,7 +402,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region LockPool/UnLockPool
|
#region LockPool/UnLockPool
|
||||||
public void LockPool_Debug(int componentTypeID)
|
public void LockPool_Debug(int componentTypeID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
ref var slot = ref _poolSlots[componentTypeID];
|
ref var slot = ref _poolSlots[componentTypeID];
|
||||||
if (slot.lockedCounter == 0)
|
if (slot.lockedCounter == 0)
|
||||||
{
|
{
|
||||||
@ -413,7 +416,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void UnlockPool_Debug(int componentTypeID)
|
public void UnlockPool_Debug(int componentTypeID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
ref var slot = ref _poolSlots[componentTypeID];
|
ref var slot = ref _poolSlots[componentTypeID];
|
||||||
slot.lockedCounter--;
|
slot.lockedCounter--;
|
||||||
if (slot.lockedCounter <= 0)
|
if (slot.lockedCounter <= 0)
|
||||||
@ -431,7 +434,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public bool CheckPoolLocked_Debug(int componentTypeID)
|
public bool CheckPoolLocked_Debug(int componentTypeID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
return _poolSlots[componentTypeID].lockedCounter != 0;
|
return _poolSlots[componentTypeID].lockedCounter != 0;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
@ -444,7 +447,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
public long version;
|
public long version;
|
||||||
public int count;
|
public int count;
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
public int lockedCounter;
|
public int lockedCounter;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -143,7 +146,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static ref T GetForWorldUnchecked(short worldID)
|
public static ref T GetForWorldUnchecked(short worldID)
|
||||||
{// ts
|
{// ts
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_mapping[worldID] <= 0) { Throw.ArgumentOutOfRange(); }
|
if (_mapping[worldID] <= 0) { Throw.ArgumentOutOfRange(); }
|
||||||
#endif
|
#endif
|
||||||
return ref _items[_mapping[worldID]];
|
return ref _items[_mapping[worldID]];
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
#if ENABLE_IL2CPP
|
#if ENABLE_IL2CPP
|
||||||
@ -71,7 +74,7 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private void ExecuteFor_Iternal(EcsSpan span)
|
private void ExecuteFor_Iternal(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (span.IsNull) { Throw.ArgumentNull(nameof(span)); }
|
if (span.IsNull) { Throw.ArgumentNull(nameof(span)); }
|
||||||
if (span.WorldID != World.ID) { Throw.Quiery_ArgumentDifferentWorldsException(); }
|
if (span.WorldID != World.ID) { Throw.Quiery_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
#if ENABLE_IL2CPP
|
#if ENABLE_IL2CPP
|
||||||
using Unity.IL2CPP.CompilerServices;
|
using Unity.IL2CPP.CompilerServices;
|
||||||
@ -70,7 +73,7 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private void ExecuteFor_Iternal(EcsSpan span)
|
private void ExecuteFor_Iternal(EcsSpan span)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (span.IsNull) { Throw.ArgumentNull(nameof(span)); }
|
if (span.IsNull) { Throw.ArgumentNull(nameof(span)); }
|
||||||
if (span.WorldID != World.ID) { Throw.Quiery_ArgumentDifferentWorldsException(); }
|
if (span.WorldID != World.ID) { Throw.Quiery_ArgumentDifferentWorldsException(); }
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Core;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS.Internal
|
namespace DCFApixels.DragonECS.Internal
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -13,7 +16,7 @@ namespace DCFApixels.DragonECS
|
|||||||
private Dictionary<Type, InjectionNodeBase> _nodes = new Dictionary<Type, InjectionNodeBase>(32);
|
private Dictionary<Type, InjectionNodeBase> _nodes = new Dictionary<Type, InjectionNodeBase>(32);
|
||||||
private bool _isInit = false;
|
private bool _isInit = false;
|
||||||
|
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
private HashSet<Type> _requiredInjectionTypes = new HashSet<Type>();
|
private HashSet<Type> _requiredInjectionTypes = new HashSet<Type>();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -47,7 +50,7 @@ namespace DCFApixels.DragonECS
|
|||||||
branch = new InjectionBranch(this, objType);
|
branch = new InjectionBranch(this, objType);
|
||||||
InitBranch(branch);
|
InitBranch(branch);
|
||||||
|
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
foreach (var requiredInjectionType in _requiredInjectionTypes)
|
foreach (var requiredInjectionType in _requiredInjectionTypes)
|
||||||
{
|
{
|
||||||
if (requiredInjectionType.IsAssignableFrom(objType))
|
if (requiredInjectionType.IsAssignableFrom(objType))
|
||||||
@ -141,7 +144,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
_isInit = true;
|
_isInit = true;
|
||||||
|
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
var systems = _pipeline.AllSystems;
|
var systems = _pipeline.AllSystems;
|
||||||
var injectType = typeof(IEcsInject<>);
|
var injectType = typeof(IEcsInject<>);
|
||||||
foreach (var system in systems)
|
foreach (var system in systems)
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
namespace DCFApixels.DragonECS
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
public interface IEcsInjectProcess : IEcsProcess { }
|
public interface IEcsInjectProcess : IEcsProcess { }
|
||||||
[MetaName(nameof(Inject))]
|
[MetaName(nameof(Inject))]
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
#if ENABLE_IL2CPP
|
#if ENABLE_IL2CPP
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
//SparseArray. Analogous to Dictionary<int, T>, but faster.
|
//SparseArray. Analogous to Dictionary<int, T>, but faster.
|
||||||
//Benchmark result of indexer.get speed test with 300 elements:
|
//Benchmark result of indexer.get speed test with 300 elements:
|
||||||
//[Dictinary: 5.786us] [SparseArray: 2.047us].
|
//[Dictinary: 5.786us] [SparseArray: 2.047us].
|
||||||
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.Contracts;
|
using System.Diagnostics.Contracts;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
using DCFApixels.DragonECS.Core;
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using DCFApixels.DragonECS.PoolsCore;
|
using DCFApixels.DragonECS.PoolsCore;
|
||||||
@ -91,7 +94,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public ref T Add(int entityID)
|
public ref T Add(int entityID)
|
||||||
{
|
{
|
||||||
ref int itemIndex = ref _mapping[entityID];
|
ref int itemIndex = ref _mapping[entityID];
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (itemIndex > 0) { EcsPoolThrowHelper.ThrowAlreadyHasComponent<T>(entityID); }
|
if (itemIndex > 0) { EcsPoolThrowHelper.ThrowAlreadyHasComponent<T>(entityID); }
|
||||||
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
||||||
#endif
|
#endif
|
||||||
@ -119,7 +122,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public ref T Get(int entityID)
|
public ref T Get(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
if (!Has(entityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
||||||
#endif
|
#endif
|
||||||
#if !DISABLE_POOLS_EVENTS
|
#if !DISABLE_POOLS_EVENTS
|
||||||
@ -130,7 +133,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public ref readonly T Read(int entityID)
|
public ref readonly T Read(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
if (!Has(entityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
||||||
#endif
|
#endif
|
||||||
return ref _items[_mapping[entityID]];
|
return ref _items[_mapping[entityID]];
|
||||||
@ -140,7 +143,7 @@ namespace DCFApixels.DragonECS
|
|||||||
ref int itemIndex = ref _mapping[entityID];
|
ref int itemIndex = ref _mapping[entityID];
|
||||||
if (itemIndex <= 0)
|
if (itemIndex <= 0)
|
||||||
{ //Add block
|
{ //Add block
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
||||||
#endif
|
#endif
|
||||||
if (_recycledItemsCount > 0)
|
if (_recycledItemsCount > 0)
|
||||||
@ -174,11 +177,11 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Del(int entityID)
|
public void Del(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
||||||
#endif
|
#endif
|
||||||
ref int itemIndex = ref _mapping[entityID];
|
ref int itemIndex = ref _mapping[entityID];
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (itemIndex <= 0) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
if (itemIndex <= 0) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
||||||
#endif
|
#endif
|
||||||
DisableComponent(ref _items[itemIndex]);
|
DisableComponent(ref _items[itemIndex]);
|
||||||
@ -203,14 +206,14 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, int toEntityID)
|
public void Copy(int fromEntityID, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
|
if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
|
||||||
#endif
|
#endif
|
||||||
CopyComponent(ref Get(fromEntityID), ref TryAddOrGet(toEntityID));
|
CopyComponent(ref Get(fromEntityID), ref TryAddOrGet(toEntityID));
|
||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
|
if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
|
||||||
#endif
|
#endif
|
||||||
CopyComponent(ref Get(fromEntityID), ref toWorld.GetPool<T>().TryAddOrGet(toEntityID));
|
CopyComponent(ref Get(fromEntityID), ref toWorld.GetPool<T>().TryAddOrGet(toEntityID));
|
||||||
@ -218,7 +221,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public void ClearAll()
|
public void ClearAll()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
||||||
#endif
|
#endif
|
||||||
_recycledItemsCount = 0; // ñïåðåäè ïîòîìó ÷òîáû îáíóëÿëîñü, òàê êàê Del íå îáíóëÿåò
|
_recycledItemsCount = 0; // ñïåðåäè ïîòîìó ÷òîáû îáíóëÿëîñü, òàê êàê Del íå îáíóëÿåò
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using DCFApixels.DragonECS.PoolsCore;
|
using DCFApixels.DragonECS.PoolsCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -84,7 +87,7 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if (DEBUG)
|
||||||
throw new NullInstanceException();
|
throw new NullInstanceException();
|
||||||
#else
|
#else
|
||||||
return EcsWorld.GetWorld(0);
|
return EcsWorld.GetWorld(0);
|
||||||
@ -102,25 +105,25 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
}
|
}
|
||||||
void IEcsPool.Del(int entityID)
|
void IEcsPool.Del(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if (DEBUG)
|
||||||
throw new NullInstanceException();
|
throw new NullInstanceException();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void IEcsPool.AddEmpty(int entityID)
|
void IEcsPool.AddEmpty(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if (DEBUG)
|
||||||
throw new NullInstanceException();
|
throw new NullInstanceException();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void IEcsPool.AddRaw(int entityID, object dataRaw)
|
void IEcsPool.AddRaw(int entityID, object dataRaw)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if (DEBUG)
|
||||||
throw new NullInstanceException();
|
throw new NullInstanceException();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
object IEcsReadonlyPool.GetRaw(int entityID)
|
object IEcsReadonlyPool.GetRaw(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if (DEBUG)
|
||||||
throw new NullInstanceException();
|
throw new NullInstanceException();
|
||||||
#else
|
#else
|
||||||
return null;
|
return null;
|
||||||
@ -128,25 +131,25 @@ namespace DCFApixels.DragonECS.Internal
|
|||||||
}
|
}
|
||||||
void IEcsPool.SetRaw(int entity, object dataRaw)
|
void IEcsPool.SetRaw(int entity, object dataRaw)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if (DEBUG)
|
||||||
throw new NullInstanceException();
|
throw new NullInstanceException();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void IEcsReadonlyPool.Copy(int fromEntityID, int toEntityID)
|
void IEcsReadonlyPool.Copy(int fromEntityID, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if (DEBUG)
|
||||||
throw new NullInstanceException();
|
throw new NullInstanceException();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void IEcsReadonlyPool.Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
void IEcsReadonlyPool.Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if (DEBUG)
|
||||||
throw new NullInstanceException();
|
throw new NullInstanceException();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void IEcsPool.ClearAll()
|
void IEcsPool.ClearAll()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if (DEBUG)
|
||||||
throw new NullInstanceException();
|
throw new NullInstanceException();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
using DCFApixels.DragonECS.Core;
|
using DCFApixels.DragonECS.Core;
|
||||||
using DCFApixels.DragonECS.PoolsCore;
|
using DCFApixels.DragonECS.PoolsCore;
|
||||||
using System;
|
using System;
|
||||||
@ -7,9 +10,6 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
|
||||||
using System.Reflection;
|
|
||||||
#endif
|
|
||||||
#if ENABLE_IL2CPP
|
#if ENABLE_IL2CPP
|
||||||
using Unity.IL2CPP.CompilerServices;
|
using Unity.IL2CPP.CompilerServices;
|
||||||
#endif
|
#endif
|
||||||
@ -52,12 +52,12 @@ namespace DCFApixels.DragonECS
|
|||||||
private EcsWorld.PoolsMediator _mediator;
|
private EcsWorld.PoolsMediator _mediator;
|
||||||
|
|
||||||
#region CheckValide
|
#region CheckValide
|
||||||
#if (DEBUG && !DISABLE_DEBUG)
|
#if DEBUG
|
||||||
private static bool _isInvalidType;
|
private static bool _isInvalidType;
|
||||||
static EcsTagPool()
|
static EcsTagPool()
|
||||||
{
|
{
|
||||||
#pragma warning disable IL2090 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The generic parameter of the source method or type does not have matching annotations.
|
#pragma warning disable IL2090 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The generic parameter of the source method or type does not have matching annotations.
|
||||||
_isInvalidType = typeof(T).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Length > 0;
|
_isInvalidType = typeof(T).GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic).Length > 0;
|
||||||
#pragma warning restore IL2090
|
#pragma warning restore IL2090
|
||||||
}
|
}
|
||||||
public EcsTagPool()
|
public EcsTagPool()
|
||||||
@ -103,7 +103,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Method
|
#region Method
|
||||||
public void Add(int entityID)
|
public void Add(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID)) { EcsPoolThrowHelper.ThrowAlreadyHasComponent<T>(entityID); }
|
if (Has(entityID)) { EcsPoolThrowHelper.ThrowAlreadyHasComponent<T>(entityID); }
|
||||||
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
||||||
#endif
|
#endif
|
||||||
@ -128,7 +128,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Del(int entityID)
|
public void Del(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
if (!Has(entityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
||||||
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
||||||
#endif
|
#endif
|
||||||
@ -149,14 +149,14 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, int toEntityID)
|
public void Copy(int fromEntityID, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
|
if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
|
||||||
#endif
|
#endif
|
||||||
TryAdd(toEntityID);
|
TryAdd(toEntityID);
|
||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
|
if (!Has(fromEntityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(fromEntityID); }
|
||||||
#endif
|
#endif
|
||||||
toWorld.GetPool<T>().TryAdd(toEntityID);
|
toWorld.GetPool<T>().TryAdd(toEntityID);
|
||||||
@ -189,7 +189,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public void ClearAll()
|
public void ClearAll()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
|
||||||
#endif
|
#endif
|
||||||
if (_count <= 0) { return; }
|
if (_count <= 0) { return; }
|
||||||
@ -245,14 +245,14 @@ namespace DCFApixels.DragonECS
|
|||||||
void IEcsPool.AddRaw(int entityID, object dataRaw) { Add(entityID); }
|
void IEcsPool.AddRaw(int entityID, object dataRaw) { Add(entityID); }
|
||||||
object IEcsReadonlyPool.GetRaw(int entityID)
|
object IEcsReadonlyPool.GetRaw(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
||||||
#endif
|
#endif
|
||||||
return _fakeComponent;
|
return _fakeComponent;
|
||||||
}
|
}
|
||||||
void IEcsPool.SetRaw(int entityID, object dataRaw)
|
void IEcsPool.SetRaw(int entityID, object dataRaw)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -263,14 +263,14 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
ref readonly T IEcsStructPool<T>.Read(int entityID)
|
ref readonly T IEcsStructPool<T>.Read(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
||||||
#endif
|
#endif
|
||||||
return ref _fakeComponent;
|
return ref _fakeComponent;
|
||||||
}
|
}
|
||||||
ref T IEcsStructPool<T>.Get(int entityID)
|
ref T IEcsStructPool<T>.Get(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent<T>(entityID); }
|
||||||
#endif
|
#endif
|
||||||
return ref _fakeComponent;
|
return ref _fakeComponent;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
public interface ITemplateNode
|
public interface ITemplateNode
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
using System;
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
#pragma warning disable IDE1006
|
#if DISABLE_DEBUG
|
||||||
|
#undef DEBUG
|
||||||
|
#endif
|
||||||
|
#pragma warning disable IDE1006
|
||||||
#pragma warning disable CS8981
|
#pragma warning disable CS8981
|
||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
@ -56,7 +59,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||||
#endif
|
#endif
|
||||||
return _id;
|
return _id;
|
||||||
@ -67,7 +70,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||||
#endif
|
#endif
|
||||||
return _gen;
|
return _gen;
|
||||||
@ -78,7 +81,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||||
#endif
|
#endif
|
||||||
return GetWorld_Internal();
|
return GetWorld_Internal();
|
||||||
@ -89,7 +92,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||||
#endif
|
#endif
|
||||||
return _world;
|
return _world;
|
||||||
@ -141,7 +144,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Unpack(out int id, out EcsWorld world)
|
public void Unpack(out int id, out EcsWorld world)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||||
#endif
|
#endif
|
||||||
world = EcsWorld.GetWorld(_world);
|
world = EcsWorld.GetWorld(_world);
|
||||||
@ -150,7 +153,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Unpack(out int id, out short gen, out EcsWorld world)
|
public void Unpack(out int id, out short gen, out EcsWorld world)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||||
#endif
|
#endif
|
||||||
world = EcsWorld.GetWorld(_world);
|
world = EcsWorld.GetWorld(_world);
|
||||||
@ -160,7 +163,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Unpack(out int id, out short worldID)
|
public void Unpack(out int id, out short worldID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||||
#endif
|
#endif
|
||||||
worldID = _world;
|
worldID = _world;
|
||||||
@ -169,7 +172,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Unpack(out int id, out short gen, out short worldID)
|
public void Unpack(out int id, out short gen, out short worldID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||||
#endif
|
#endif
|
||||||
worldID = _world;
|
worldID = _world;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user