diff --git a/LICENSE b/LICENSE.md
similarity index 100%
rename from LICENSE
rename to LICENSE.md
diff --git a/LICENSE.meta b/LICENSE.md.meta
similarity index 100%
rename from LICENSE.meta
rename to LICENSE.md.meta
diff --git a/src/Builtin/Aspects.cs b/src/Builtin/Aspects.cs
index 39a3586..8cfe332 100644
--- a/src/Builtin/Aspects.cs
+++ b/src/Builtin/Aspects.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.PoolsCore;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.PoolsCore;
namespace DCFApixels.DragonECS
{
diff --git a/src/Builtin/BaseProcesses.cs b/src/Builtin/BaseProcesses.cs
index ba689b1..f83fb09 100644
--- a/src/Builtin/BaseProcesses.cs
+++ b/src/Builtin/BaseProcesses.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.RunnersCore;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.RunnersCore;
using System;
namespace DCFApixels.DragonECS
@@ -115,7 +118,7 @@ namespace DCFApixels.DragonECS.Internal
}
}
private Pair[] _pairs;
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
private EcsProfilerMarker[] _markers;
#endif
protected override void OnSetup()
@@ -125,7 +128,7 @@ namespace DCFApixels.DragonECS.Internal
{
_pairs[i] = new Pair(Process[i]);
}
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
_markers = new EcsProfilerMarker[Process.Length];
for (int i = 0; i < Process.Length; i++)
{
@@ -135,7 +138,7 @@ namespace DCFApixels.DragonECS.Internal
}
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++)
{
var pair = _pairs[i];
diff --git a/src/Builtin/Worlds.cs b/src/Builtin/Worlds.cs
index 27f627a..e7697be 100644
--- a/src/Builtin/Worlds.cs
+++ b/src/Builtin/Worlds.cs
@@ -1,4 +1,7 @@
-using System.Diagnostics;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System.Diagnostics;
namespace DCFApixels.DragonECS
{
diff --git a/src/Collections/EcsGroup.cs b/src/Collections/EcsGroup.cs
index 7ef02b5..9c3b1ab 100644
--- a/src/Collections/EcsGroup.cs
+++ b/src/Collections/EcsGroup.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -231,7 +234,7 @@ namespace DCFApixels.DragonECS
}
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(); }
#endif
group._isReleased = true;
@@ -304,7 +307,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (index < 0 || index >= Count) { Throw.ArgumentOutOfRange(); }
#endif
return _dense[++index];
@@ -313,7 +316,7 @@ namespace DCFApixels.DragonECS
// set
// {
// // TODO добавить лок енумератора на изменение
- //#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+ //#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
// if (index < 0 || index >= Count) { Throw.ArgumentOutOfRange(); }
//#endif
// var oldValue = _dense[index];
@@ -366,7 +369,7 @@ namespace DCFApixels.DragonECS
#region Add/Remove
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); }
#endif
Add_Internal(entityID);
@@ -410,7 +413,7 @@ namespace DCFApixels.DragonECS
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); }
#endif
Remove_Internal(entityID);
@@ -428,7 +431,7 @@ namespace DCFApixels.DragonECS
private void ChangeIndexInSparse(int entityID, int index)
{
ref PageSlot page = ref _sparsePages[entityID >> PageSlot.SHIFT];
-#if DEBUG && DEV_MODE
+#if DEBUG && DRAGONECS_DEEP_DEBUG
if (page.Count == 0) { throw new Exception(); }
#endif
if (page.Count == 1)
@@ -438,7 +441,7 @@ namespace DCFApixels.DragonECS
else
{
int localEntityID = entityID & PageSlot.MASK;
-#if DEBUG && DEV_MODE
+#if DEBUG && DRAGONECS_DEEP_DEBUG
if (page.Indexes[localEntityID] == 0) { throw new Exception(); }
#endif
page.Indexes[localEntityID] = index;
@@ -523,7 +526,7 @@ namespace DCFApixels.DragonECS
#region CopyFrom/Clone/Slice/ToSpan/ToArray
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(); }
#endif
if (_count > 0)
@@ -575,7 +578,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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(); }
#endif
return new EcsSpan(WorldID, _dense, start + 1, length);
@@ -619,7 +622,7 @@ namespace DCFApixels.DragonECS
/// as Union sets
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();
#endif
foreach (var entityID in group) { UnionWithStep(entityID); }
@@ -630,7 +633,7 @@ namespace DCFApixels.DragonECS
/// as Union sets
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();
#endif
foreach (var entityID in span) { UnionWithStep(entityID); }
@@ -653,7 +656,7 @@ namespace DCFApixels.DragonECS
/// as Except sets
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(); }
#endif
if (group.Count > Count) //мини оптимизация, итеррируемся по короткому списку
@@ -678,7 +681,7 @@ namespace DCFApixels.DragonECS
/// as Except sets
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(); }
#endif
foreach (var entityID in span) { ExceptWithStep_Internal(entityID); }
@@ -701,7 +704,7 @@ namespace DCFApixels.DragonECS
/// as Intersect sets
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(); }
#endif
for (int i = _count; i > 0; i--)//итерация в обратном порядке исключает ошибки при удалении элементов
@@ -719,7 +722,7 @@ namespace DCFApixels.DragonECS
/// as Intersect sets
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(); }
#endif
foreach (var entityID in span)
@@ -762,7 +765,7 @@ namespace DCFApixels.DragonECS
/// as Symmetric Except sets
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(); }
#endif
foreach (var entityID in group) { SymmetricExceptWithStep_Internal(entityID); }
@@ -774,7 +777,7 @@ namespace DCFApixels.DragonECS
/// as Symmetric Except sets
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(); }
#endif
foreach (var entityID in span) { SymmetricExceptWithStep_Internal(entityID); }
@@ -824,7 +827,7 @@ namespace DCFApixels.DragonECS
#region SetEquals
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(); }
#endif
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(EcsSpan span)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
#endif
if (span.Count != Count) { return false; }
@@ -871,7 +874,7 @@ namespace DCFApixels.DragonECS
#region Overlaps
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();
#endif
if (group.Count > Count)
@@ -900,7 +903,7 @@ namespace DCFApixels.DragonECS
public bool Overlaps(EcsReadonlyGroup group) { return Overlaps(group.GetSource_Internal()); }
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();
#endif
foreach (var entityID in span)
@@ -928,7 +931,7 @@ namespace DCFApixels.DragonECS
#region IsSubsetOf/IsProperSubsetOf
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();
#endif
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(EcsSpan span)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
#endif
if (Count == 0) { return true; }
@@ -957,7 +960,7 @@ namespace DCFApixels.DragonECS
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();
#endif
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(EcsSpan span)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
#endif
if (Count == 0) { return true; }
@@ -1004,7 +1007,7 @@ namespace DCFApixels.DragonECS
{
HashSet thisHS = new HashSet();
ToCollection(thisHS);
-#if DEBUG && DEV_MODE
+#if DEBUG && DRAGONECS_DEEP_DEBUG
if (thisHS.Contains(entityID) && Has(entityID) == false) { throw new Exception(); }
#endif
if (Has(entityID))
@@ -1032,7 +1035,7 @@ namespace DCFApixels.DragonECS
#region IsSupersetOf/IsProperSupersetOf
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();
#endif
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(EcsSpan span)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
#endif
if (span.Count > Count) { return false; }
@@ -1058,7 +1061,7 @@ namespace DCFApixels.DragonECS
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();
#endif
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(EcsSpan span)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
#endif
if (span.Count >= Count) { return false; }
@@ -1126,7 +1129,7 @@ namespace DCFApixels.DragonECS
/// new group from pool
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(); }
#endif
EcsGroup result = a._source.GetFreeGroup();
@@ -1150,7 +1153,7 @@ namespace DCFApixels.DragonECS
/// new group from pool
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(); }
#endif
EcsGroup result = a.World.GetFreeGroup();
@@ -1171,7 +1174,7 @@ namespace DCFApixels.DragonECS
/// new group from pool
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(); }
#endif
EcsGroup result = a._source.GetFreeGroup();
@@ -1188,7 +1191,7 @@ namespace DCFApixels.DragonECS
/// new group from pool
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(); }
#endif
EcsGroup result = b._source.GetFreeGroup();
@@ -1205,7 +1208,7 @@ namespace DCFApixels.DragonECS
/// new group from pool
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(); }
#endif
EcsGroup result = a.World.GetFreeGroup();
@@ -1226,7 +1229,7 @@ namespace DCFApixels.DragonECS
/// new group from pool
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(); }
#endif
EcsGroup result = a._source.GetFreeGroup();
@@ -1243,7 +1246,7 @@ namespace DCFApixels.DragonECS
/// new group from pool
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(); }
#endif
EcsGroup result = b._source.GetFreeGroup();
@@ -1267,7 +1270,7 @@ namespace DCFApixels.DragonECS
/// new group from pool
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(); }
#endif
EcsGroup result = b.World.GetFreeGroup();
@@ -1288,7 +1291,7 @@ namespace DCFApixels.DragonECS
/// new group from pool
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(); }
#endif
EcsGroup result = a._source.GetFreeGroup();
@@ -1312,7 +1315,7 @@ namespace DCFApixels.DragonECS
/// new group from pool
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(); }
#endif
EcsGroup result = a.World.GetFreeGroup();
diff --git a/src/Collections/EcsSpan.cs b/src/Collections/EcsSpan.cs
index 16aae99..58bc198 100644
--- a/src/Collections/EcsSpan.cs
+++ b/src/Collections/EcsSpan.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using System;
using System.Collections.Generic;
using System.ComponentModel;
diff --git a/src/Consts.cs b/src/Consts.cs
index 772f20f..1cf09da 100644
--- a/src/Consts.cs
+++ b/src/Consts.cs
@@ -88,9 +88,17 @@
#else
false;
#endif
- public const bool DEV_MODE =
-#if DEV_MODE
- true;
+
+
+ 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;
#else
false;
#endif
diff --git a/src/DataInterfaces.cs b/src/DataInterfaces.cs
index 986dcf5..c2ce421 100644
--- a/src/DataInterfaces.cs
+++ b/src/DataInterfaces.cs
@@ -1,3 +1,6 @@
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS
diff --git a/src/DebugUtils/EcsDebug.cs b/src/DebugUtils/EcsDebug.cs
index 68a6175..2fa721f 100644
--- a/src/DebugUtils/EcsDebug.cs
+++ b/src/DebugUtils/EcsDebug.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -10,39 +13,39 @@ namespace DCFApixels.DragonECS
using static EcsConsts;
public readonly struct EcsProfilerMarker
{
-#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
public readonly int id;
#endif
internal EcsProfilerMarker(int id)
{
-#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
this.id = id;
#endif
}
public EcsProfilerMarker(string name)
{
-#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
id = DebugService.CurrentThreadInstance.RegisterMark(name);
#endif
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Begin()
{
-#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
DebugService.CurrentThreadInstance.ProfilerMarkBegin(id);
#endif
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void End()
{
-#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
DebugService.CurrentThreadInstance.ProfilerMarkEnd(id);
#endif
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public AutoScope Auto()
{
-#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
return new AutoScope(id);
#else
return default;
@@ -50,13 +53,13 @@ namespace DCFApixels.DragonECS
}
public readonly ref struct AutoScope
{
-#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
private readonly int _id;
#endif
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public AutoScope(int id)
{
-#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
_id = id;
DebugService.CurrentThreadInstance.ProfilerMarkBegin(id);
#endif
@@ -64,7 +67,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Dispose()
{
-#if ((DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER)
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
DebugService.CurrentThreadInstance.ProfilerMarkEnd(_id);
#endif
}
@@ -91,7 +94,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void PrintWarning(object v)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
OnPrint(DEBUG_WARNING_TAG, v);
DebugService.CurrentThreadInstance.PrintWarning(v);
#endif
@@ -99,7 +102,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void PrintError(object v)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
OnPrint(DEBUG_ERROR_TAG, v);
DebugService.CurrentThreadInstance.PrintError(v);
#endif
@@ -107,7 +110,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void PrintErrorAndBreak(object v)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
OnPrint(DEBUG_ERROR_TAG, v);
DebugService.CurrentThreadInstance.PrintErrorAndBreak(v);
#endif
@@ -115,7 +118,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void PrintPass(object v)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
OnPrint(DEBUG_PASS_TAG, v);
DebugService.CurrentThreadInstance.PrintPass(v);
#endif
@@ -123,7 +126,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Print()
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
OnPrint(string.Empty, null);
DebugService.CurrentThreadInstance.Print();
#endif
@@ -131,7 +134,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Print(object v)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
OnPrint(string.Empty, v);
DebugService.CurrentThreadInstance.Print(v);
#endif
@@ -139,7 +142,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Print(string tag, object v)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
OnPrint(tag, v);
DebugService.CurrentThreadInstance.Print(tag, v);
#endif
@@ -147,7 +150,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Break()
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_DEBUGGER
+#if DEBUG || ENABLE_DRAGONECS_DEBUGGER
DebugService.CurrentThreadInstance.Break();
#endif
}
diff --git a/src/DebugUtils/EcsDebugUtility.cs b/src/DebugUtils/EcsDebugUtility.cs
index a4406b4..9d9e3ed 100644
--- a/src/DebugUtils/EcsDebugUtility.cs
+++ b/src/DebugUtils/EcsDebugUtility.cs
@@ -1,6 +1,9 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Collections.Generic;
-#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED
+#if DEBUG || !REFLECTION_DISABLED
using System.Reflection;
#endif
@@ -8,7 +11,7 @@ namespace DCFApixels.DragonECS
{
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;
#endif
@@ -31,7 +34,7 @@ namespace DCFApixels.DragonECS
}
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;
if (!type.IsGenericType || maxDepth == 0)
{
@@ -68,7 +71,7 @@ namespace DCFApixels.DragonECS
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.
var fields = type.GetFields(RFL_FLAGS);
#pragma warning restore IL2070
diff --git a/src/DebugUtils/MetaAttributes/EcsMetaAttribute.cs b/src/DebugUtils/MetaAttributes/EcsMetaAttribute.cs
index 75a3002..b95af50 100644
--- a/src/DebugUtils/MetaAttributes/EcsMetaAttribute.cs
+++ b/src/DebugUtils/MetaAttributes/EcsMetaAttribute.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
namespace DCFApixels.DragonECS.Core
{
diff --git a/src/DebugUtils/MetaAttributes/MetaColorAttribute.cs b/src/DebugUtils/MetaAttributes/MetaColorAttribute.cs
index 1c9a54e..7d5e930 100644
--- a/src/DebugUtils/MetaAttributes/MetaColorAttribute.cs
+++ b/src/DebugUtils/MetaAttributes/MetaColorAttribute.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.Internal;
using System;
using System.Runtime.InteropServices;
diff --git a/src/DebugUtils/MetaAttributes/MetaDescriptionAttribute.cs b/src/DebugUtils/MetaAttributes/MetaDescriptionAttribute.cs
index 41823af..4119212 100644
--- a/src/DebugUtils/MetaAttributes/MetaDescriptionAttribute.cs
+++ b/src/DebugUtils/MetaAttributes/MetaDescriptionAttribute.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using System;
namespace DCFApixels.DragonECS
diff --git a/src/DebugUtils/MetaAttributes/MetaGroupAttribute.cs b/src/DebugUtils/MetaAttributes/MetaGroupAttribute.cs
index 3a548b8..f2545d7 100644
--- a/src/DebugUtils/MetaAttributes/MetaGroupAttribute.cs
+++ b/src/DebugUtils/MetaAttributes/MetaGroupAttribute.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/src/DebugUtils/MetaAttributes/MetaIDAttribute.cs b/src/DebugUtils/MetaAttributes/MetaIDAttribute.cs
index 3aa3dc4..55f4b71 100644
--- a/src/DebugUtils/MetaAttributes/MetaIDAttribute.cs
+++ b/src/DebugUtils/MetaAttributes/MetaIDAttribute.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.Internal;
using System;
using System.Runtime.InteropServices;
diff --git a/src/DebugUtils/MetaAttributes/MetaNameAttribute.cs b/src/DebugUtils/MetaAttributes/MetaNameAttribute.cs
index a2fb22d..c82632b 100644
--- a/src/DebugUtils/MetaAttributes/MetaNameAttribute.cs
+++ b/src/DebugUtils/MetaAttributes/MetaNameAttribute.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using System;
namespace DCFApixels.DragonECS
diff --git a/src/DebugUtils/MetaAttributes/MetaTagsAttribute.cs b/src/DebugUtils/MetaAttributes/MetaTagsAttribute.cs
index e4a5d7a..ee7816f 100644
--- a/src/DebugUtils/MetaAttributes/MetaTagsAttribute.cs
+++ b/src/DebugUtils/MetaAttributes/MetaTagsAttribute.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using System;
using System.Collections.Generic;
diff --git a/src/DebugUtils/TypeMeta.cs b/src/DebugUtils/TypeMeta.cs
index 20aca4b..1a822ba 100644
--- a/src/DebugUtils/TypeMeta.cs
+++ b/src/DebugUtils/TypeMeta.cs
@@ -1,10 +1,13 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.Internal;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
-#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED
+#if DEBUG || !REFLECTION_DISABLED
using System.Reflection;
#endif
@@ -326,7 +329,7 @@ namespace DCFApixels.DragonECS
}
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);
#else
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)
{
-#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED
+#if DEBUG || !REFLECTION_DISABLED
return CheckEcsMemener(type) || Attribute.GetCustomAttributes(type, typeof(EcsMetaAttribute), false).Length > 0;
#else
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)
{
-#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED
+#if DEBUG || !REFLECTION_DISABLED
return type.HasAttribute();
#else
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)
{
-#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;
if (isCustom)
{
@@ -455,7 +458,7 @@ namespace DCFApixels.DragonECS
}
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);
return (isCustom ? atr.color : AutoColor(meta), isCustom);
#else
@@ -468,7 +471,7 @@ namespace DCFApixels.DragonECS
#region GetGroup
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);
#else
EcsDebug.PrintWarning($"Reflection is not available, the {nameof(MetaGenerator)}.{nameof(GetGroup)} method does not work.");
@@ -480,7 +483,7 @@ namespace DCFApixels.DragonECS
#region GetDescription
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);
return isCustom ? atr.Data : MetaDescription.Empty;
#else
@@ -493,7 +496,7 @@ namespace DCFApixels.DragonECS
#region GetTags
public static IReadOnlyList GetTags(Type type)
{
-#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
+#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
var atr = type.GetCustomAttribute();
return atr != null ? atr.Tags : Array.Empty();
#else
@@ -504,12 +507,12 @@ namespace DCFApixels.DragonECS
#endregion
#region GetMetaID
-#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
+#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
private static Dictionary _idTypePairs = new Dictionary();
#endif
public static string GetMetaID(Type type)
{
-#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
+#if DEBUG || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
var atr = type.GetCustomAttribute();
if (atr == null)
diff --git a/src/EcsAspect.cs b/src/EcsAspect.cs
index cfe522a..1f56e26 100644
--- a/src/EcsAspect.cs
+++ b/src/EcsAspect.cs
@@ -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.PoolsCore;
using System;
diff --git a/src/EcsMask.cs b/src/EcsMask.cs
index fef1042..d6b843b 100644
--- a/src/EcsMask.cs
+++ b/src/EcsMask.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.Internal;
using System;
using System.Collections.Generic;
@@ -358,7 +361,7 @@ namespace DCFApixels.DragonECS
#region Debug utils
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); }
return $"Inc({string.Join(", ", inc.Select(converter))}) Exc({string.Join(", ", exc.Select(converter))})";
#else
diff --git a/src/EcsPipeline.Builder.cs b/src/EcsPipeline.Builder.cs
index 672b119..a44a608 100644
--- a/src/EcsPipeline.Builder.cs
+++ b/src/EcsPipeline.Builder.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using DCFApixels.DragonECS.RunnersCore;
using System;
using System.Collections;
@@ -298,13 +301,13 @@ namespace DCFApixels.DragonECS
#endregion
#region Build
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
- private static EcsProfilerMarker _buildBarker = new EcsProfilerMarker("EcsPipeline.Build");
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
+ private static EcsProfilerMarker _buildMarker = new EcsProfilerMarker("EcsPipeline.Build");
#endif
public EcsPipeline Build()
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
- _buildBarker.Begin();
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
+ _buildMarker.Begin();
#endif
var it = new LinkedListIterator(_systemNodes, _systemNodesCount, _startIndex);
@@ -369,8 +372,8 @@ namespace DCFApixels.DragonECS
{
item.Declare(pipeline);
}
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
- _buildBarker.End();
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
+ _buildMarker.End();
#endif
return pipeline;
}
diff --git a/src/EcsPipeline.cs b/src/EcsPipeline.cs
index 89403df..3c0d1be 100644
--- a/src/EcsPipeline.cs
+++ b/src/EcsPipeline.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using DCFApixels.DragonECS.RunnersCore;
using System;
using System.Collections;
@@ -32,7 +35,6 @@ namespace DCFApixels.DragonECS
public sealed partial class EcsPipeline
{
private readonly IConfigContainer _configs;
- private Injector.Builder _injectorBuilder;
private Injector _injector;
private IEcsProcess[] _allSystems;
@@ -43,7 +45,7 @@ namespace DCFApixels.DragonECS
private bool _isInit = 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");
#endif
@@ -79,8 +81,15 @@ namespace DCFApixels.DragonECS
{
_configs = configs;
_allSystems = systems;
- _injectorBuilder = injectorBuilder;
- _injectorBuilder.Inject(this);
+ injectorBuilder.Inject(this);
+
+ var members = GetProcess();
+ for (int i = 0; i < members.Length; i++)
+ {
+ members[i].Pipeline = this;
+ }
+
+ _injector = injectorBuilder.Build(this);
}
#endregion
@@ -130,14 +139,18 @@ namespace DCFApixels.DragonECS
{
return (TRunner)result;
}
- TRunner instance = new TRunner();
+ TRunner runnerInstance = new TRunner();
#if DEBUG
- EcsRunner.CheckRunnerTypeIsValide(runnerType, instance.Interface);
+ EcsRunner.CheckRunnerTypeIsValide(runnerType, runnerInstance.Interface);
#endif
- instance.Init_Internal(this);
- _runners.Add(runnerType, instance);
- _runners.Add(instance.Interface, instance);
- return instance;
+ runnerInstance.Init_Internal(this);
+ _runners.Add(runnerType, runnerInstance);
+ _runners.Add(runnerInstance.Interface, runnerInstance);
+ Injector.ExtractAllTo(runnerInstance);
+
+ // init after.
+ Injector.Inject(runnerInstance);
+ return runnerInstance;
}
public T GetRunner() where T : IEcsProcess
{
@@ -175,16 +188,9 @@ namespace DCFApixels.DragonECS
EcsDebug.PrintWarning($"This {nameof(EcsPipeline)} has already been initialized");
return;
}
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
_initMarker.Begin();
#endif
- var members = GetProcess();
- for (int i = 0; i < members.Length; i++)
- {
- members[i].Pipeline = this;
- }
- _injector = _injectorBuilder.Build(this);
- _injectorBuilder = null;
GetRunnerInstance().PreInit();
GetRunnerInstance().Init();
@@ -193,7 +199,7 @@ namespace DCFApixels.DragonECS
_isInit = true;
GC.Collect();
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
_initMarker.End();
#endif
}
@@ -201,7 +207,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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 (_isDestoryed) { Throw.Pipeline_MethodCalledAfterDestruction(nameof(Run)); }
#endif
@@ -209,7 +215,7 @@ namespace DCFApixels.DragonECS
}
public void Destroy()
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!_isInit) { Throw.Pipeline_MethodCalledBeforeInitialisation(nameof(Destroy)); }
#endif
if (_isDestoryed)
diff --git a/src/EcsRunner.cs b/src/EcsRunner.cs
index c6b7230..45adcd4 100644
--- a/src/EcsRunner.cs
+++ b/src/EcsRunner.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using DCFApixels.DragonECS.RunnersCore;
using System;
using System.Linq;
@@ -130,7 +133,7 @@ namespace DCFApixels.DragonECS
#endregion
#region RunHelper
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
public
#else
public readonly
@@ -138,7 +141,7 @@ namespace DCFApixels.DragonECS
struct RunHelper
{
private readonly EcsProcess _process;
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
private Delegate _cacheCheck;
private bool _cacheCheckInit;
private readonly EcsProfilerMarker[] _markers;
@@ -146,7 +149,7 @@ namespace DCFApixels.DragonECS
#region Constructors
public RunHelper(EcsRunner runner) : this(runner,
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
typeof(TProcess).ToMeta().Name)
#else
string.Empty)
@@ -156,7 +159,7 @@ namespace DCFApixels.DragonECS
public RunHelper(EcsRunner runner, string methodName)
{
_process = runner.Process;
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
_cacheCheck = null;
_cacheCheckInit = false;
_markers = new EcsProfilerMarker[_process.Length];
@@ -169,7 +172,7 @@ namespace DCFApixels.DragonECS
#endregion
#region Utils
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void CheckCache(Delegate d)
{
@@ -196,7 +199,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Run(Action translationCallback)
{
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
CheckCache(translationCallback);
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)]
public void Run(ActionWithData translationCallback, ref TData data)
{
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
CheckCache(translationCallback);
for (int i = 0, n = _process.Length < _markers.Length ? _process.Length : _markers.Length; i < n; i++)
{
@@ -275,7 +278,7 @@ namespace DCFApixels.DragonECS
#endregion
#region RunHelperWithFinally
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
public
#else
public readonly
@@ -283,7 +286,7 @@ namespace DCFApixels.DragonECS
struct RunHelperWithFinally where TProcessFinally : class, IEcsProcess
{
private readonly Pair[] _pairs;
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
private Delegate _cacheCheck;
private Delegate _cacheCheckF;
private bool _cacheCheckInit;
@@ -292,7 +295,7 @@ namespace DCFApixels.DragonECS
#region Constructors
public RunHelperWithFinally(EcsRunner runner) : this(runner,
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
typeof(TProcess).ToMeta().Name)
#else
string.Empty)
@@ -306,7 +309,7 @@ namespace DCFApixels.DragonECS
{
_pairs[i] = new Pair(runner.Process[i]);
}
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
_cacheCheck = null;
_cacheCheckF = null;
_cacheCheckInit = false;
@@ -330,7 +333,7 @@ namespace DCFApixels.DragonECS
runFinally = run as TProcessFinally;
}
}
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void CheckCache(Delegate d, Delegate df)
{
@@ -360,7 +363,7 @@ namespace DCFApixels.DragonECS
Action translationCallback,
Action translationFinnalyCallback)
{
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
CheckCache(translationCallback, translationFinnalyCallback);
for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++)
{
@@ -414,7 +417,7 @@ namespace DCFApixels.DragonECS
ActionWithData translationFinnalyCallback,
ref TData data)
{
-#if DEBUG && !DISABLE_DEBUG
+#if DEBUG
CheckCache(translationCallback, translationFinnalyCallback);
for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++)
{
diff --git a/src/EcsStaticMask.cs b/src/EcsStaticMask.cs
index 26a9f91..3c86716 100644
--- a/src/EcsStaticMask.cs
+++ b/src/EcsStaticMask.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.Internal;
using System;
using System.Collections.Concurrent;
@@ -339,14 +342,14 @@ namespace DCFApixels.DragonECS
#region Inc/Exc/Combine/Except
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(); }
#endif
_inc.Add(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(); }
#endif
_exc.Add(typeCode);
@@ -451,7 +454,7 @@ namespace DCFApixels.DragonECS
#region Debug utils
private static string CreateLogString(EcsTypeCode[] inc, EcsTypeCode[] exc)
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if DEBUG
string converter(EcsTypeCode o) { return EcsTypeCodeManager.FindTypeOfCode(o).ToString(); }
return $"Inc({string.Join(", ", inc.Select(converter))}) Exc({string.Join(", ", exc.Select(converter))})";
#else
diff --git a/src/EcsWorld.cache.cs b/src/EcsWorld.cache.cs
index bcffb82..31fcfb2 100644
--- a/src/EcsWorld.cache.cs
+++ b/src/EcsWorld.cache.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.PoolsCore;
namespace DCFApixels.DragonECS
diff --git a/src/EcsWorld.cs b/src/EcsWorld.cs
index 5860d73..caf7099 100644
--- a/src/EcsWorld.cs
+++ b/src/EcsWorld.cs
@@ -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.PoolsCore;
using System;
@@ -215,7 +218,7 @@ namespace DCFApixels.DragonECS
}
if (ID == NULL_WORLD_ID)
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if DEBUG
Throw.World_WorldCantBeDestroyed();
#endif
return;
@@ -324,7 +327,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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); }
#endif
_entityDispenser.Use(entityID);
@@ -374,7 +377,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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); }
#endif
UpVersion();
@@ -404,7 +407,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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)); }
#endif
_entityDispenser.Upsize(entityID);
@@ -424,7 +427,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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(); }
#endif
ref var slot = ref _entities[entity.GetIDUnchecked()];
@@ -461,7 +464,7 @@ namespace DCFApixels.DragonECS
}
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(); }
#endif
for (int i = 0, iMax = mask._incs.Length; i < iMax; i++)
diff --git a/src/EcsWorld.pools.cs b/src/EcsWorld.pools.cs
index 8c9e2f0..6ed215b 100644
--- a/src/EcsWorld.pools.cs
+++ b/src/EcsWorld.pools.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using DCFApixels.DragonECS.PoolsCore;
using System;
using System.Linq;
@@ -15,7 +18,7 @@ namespace DCFApixels.DragonECS
internal PoolSlot[] _poolSlots;
private int _poolsCount;
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
private int _lockedPoolCount = 0;
#endif
@@ -43,7 +46,7 @@ namespace DCFApixels.DragonECS
ref var result = ref _pools[componentTypeID];
if (result != _nullPool)
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if DEBUG
if (result.ComponentTypeID != componentTypeID) { Throw.UndefinedException(); }
#endif
return result;
@@ -149,7 +152,7 @@ namespace DCFApixels.DragonECS
#region FindOrAutoCreatePool/InitPool
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)); }
#endif
InitPool_Internal(poolImplementation);
@@ -162,7 +165,7 @@ namespace DCFApixels.DragonECS
if (_poolTypeCode_2_CmpTypeIDs.TryGetValue(poolTypeCode, out int 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(); }
#endif
return (TPool)pool;
@@ -279,7 +282,7 @@ namespace DCFApixels.DragonECS
{
DelEntity(entityID);
}
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (count < 0) Throw.World_InvalidIncrementComponentsBalance();
#endif
}
@@ -320,7 +323,7 @@ namespace DCFApixels.DragonECS
{
DelEntity(entityID);
}
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (count < 0) Throw.World_InvalidIncrementComponentsBalance();
#endif
return true;
@@ -399,7 +402,7 @@ namespace DCFApixels.DragonECS
#region LockPool/UnLockPool
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];
if (slot.lockedCounter == 0)
{
@@ -413,7 +416,7 @@ namespace DCFApixels.DragonECS
}
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];
slot.lockedCounter--;
if (slot.lockedCounter <= 0)
@@ -431,7 +434,7 @@ namespace DCFApixels.DragonECS
}
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;
#else
return false;
@@ -444,7 +447,7 @@ namespace DCFApixels.DragonECS
{
public long version;
public int count;
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
public int lockedCounter;
#endif
}
diff --git a/src/EcsWorld.static.cs b/src/EcsWorld.static.cs
index 1311bd8..8e76d0e 100644
--- a/src/EcsWorld.static.cs
+++ b/src/EcsWorld.static.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -143,7 +146,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ref T GetForWorldUnchecked(short worldID)
{// ts
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_mapping[worldID] <= 0) { Throw.ArgumentOutOfRange(); }
#endif
return ref _items[_mapping[worldID]];
diff --git a/src/Executors/EcsWhereExecutor.cs b/src/Executors/EcsWhereExecutor.cs
index 9cb4df3..9ee401c 100644
--- a/src/Executors/EcsWhereExecutor.cs
+++ b/src/Executors/EcsWhereExecutor.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using System;
using System.Runtime.CompilerServices;
#if ENABLE_IL2CPP
@@ -71,7 +74,7 @@ namespace DCFApixels.DragonECS.Internal
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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.WorldID != World.ID) { Throw.Quiery_ArgumentDifferentWorldsException(); }
#endif
diff --git a/src/Executors/EcsWhereToGroupExecutor.cs b/src/Executors/EcsWhereToGroupExecutor.cs
index 8f9d046..150fde9 100644
--- a/src/Executors/EcsWhereToGroupExecutor.cs
+++ b/src/Executors/EcsWhereToGroupExecutor.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using System.Runtime.CompilerServices;
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
@@ -70,7 +73,7 @@ namespace DCFApixels.DragonECS.Internal
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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.WorldID != World.ID) { Throw.Quiery_ArgumentDifferentWorldsException(); }
#endif
diff --git a/src/Executors/MaskQueryExecutor.cs b/src/Executors/MaskQueryExecutor.cs
index 6d8d3c4..de96a69 100644
--- a/src/Executors/MaskQueryExecutor.cs
+++ b/src/Executors/MaskQueryExecutor.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.Internal;
using System;
using System.Collections.Generic;
diff --git a/src/Executors/Queries.cs b/src/Executors/Queries.cs
index 96d0eed..0335890 100644
--- a/src/Executors/Queries.cs
+++ b/src/Executors/Queries.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Core;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.Internal;
using System;
diff --git a/src/Injections/EcsPipelineExtensions.cs b/src/Injections/EcsPipelineExtensions.cs
index d698db6..53a2cbf 100644
--- a/src/Injections/EcsPipelineExtensions.cs
+++ b/src/Injections/EcsPipelineExtensions.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
namespace DCFApixels.DragonECS
{
diff --git a/src/Injections/Graph/InjectionBranch.cs b/src/Injections/Graph/InjectionBranch.cs
index feee2fd..17708ac 100644
--- a/src/Injections/Graph/InjectionBranch.cs
+++ b/src/Injections/Graph/InjectionBranch.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS.Internal
diff --git a/src/Injections/Graph/InjectionNode.cs b/src/Injections/Graph/InjectionNode.cs
index 8851f71..54bed3e 100644
--- a/src/Injections/Graph/InjectionNode.cs
+++ b/src/Injections/Graph/InjectionNode.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS
@@ -6,16 +9,11 @@ namespace DCFApixels.DragonECS
public abstract class InjectionNodeBase
{
private readonly Type _type;
- public Type Type
- {
- get { return _type; }
- }
+ public Type Type { get { return _type; } }
public abstract object CurrentInjectedDependencyRaw { get; }
- protected InjectionNodeBase(Type type)
- {
- _type = type;
- }
+ protected InjectionNodeBase(Type type) { _type = type; }
public abstract void Inject(object obj);
+ public abstract void ExtractTo(object target);
public abstract void Init(EcsPipeline pipeline);
}
}
@@ -23,6 +21,7 @@ namespace DCFApixels.DragonECS.Internal
{
internal sealed class InjectionNode : InjectionNodeBase
{
+ private EcsPipeline _pipeline;
private EcsProcess> _process;
private T _currentInjectedDependency;
public sealed override object CurrentInjectedDependencyRaw
@@ -38,6 +37,7 @@ namespace DCFApixels.DragonECS.Internal
public InjectionNode() : base(typeof(T)) { }
public sealed override void Init(EcsPipeline pipeline)
{
+ _pipeline = pipeline;
_process = pipeline.GetProcess>();
}
public sealed override void Inject(object raw)
@@ -48,6 +48,24 @@ namespace DCFApixels.DragonECS.Internal
{
_process[i].Inject(obj);
}
+ foreach (var runner in _pipeline.AllRunners)
+ {
+ ExtractTo_Internal(runner.Value);
+ }
+ }
+ public sealed override void ExtractTo(object target)
+ {
+ if (_currentInjectedDependency == null) { return; }
+ ExtractTo_Internal(target);
+ }
+ private void ExtractTo_Internal(object target)
+ {
+ var type = target.GetType();
+ var intrfs = type.GetInterfaces();
+ if (target is IEcsInject intrf)
+ {
+ intrf.Inject(_currentInjectedDependency);
+ }
}
}
}
diff --git a/src/Injections/Injector.cs b/src/Injections/Injector.cs
index 3efe4bf..3f22a65 100644
--- a/src/Injections/Injector.cs
+++ b/src/Injections/Injector.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -13,7 +16,7 @@ namespace DCFApixels.DragonECS
private Dictionary _nodes = new Dictionary(32);
private bool _isInit = false;
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
private HashSet _requiredInjectionTypes = new HashSet();
#endif
@@ -47,7 +50,7 @@ namespace DCFApixels.DragonECS
branch = new InjectionBranch(this, objType);
InitBranch(branch);
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
foreach (var requiredInjectionType in _requiredInjectionTypes)
{
if (requiredInjectionType.IsAssignableFrom(objType))
@@ -62,6 +65,15 @@ namespace DCFApixels.DragonECS
}
branch.Inject(raw);
}
+ public void ExtractAllTo(object target)
+ {
+ if (target is IEcsInjectProcess == false) { return; }
+
+ foreach (var node in _nodes)
+ {
+ node.Value.ExtractTo(target);
+ }
+ }
public T Extract()
{
return (T)Extract_Internal(typeof(T));
@@ -132,7 +144,7 @@ namespace DCFApixels.DragonECS
}
_isInit = true;
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
var systems = _pipeline.AllSystems;
var injectType = typeof(IEcsInject<>);
foreach (var system in systems)
diff --git a/src/Injections/Utils/Interfaces.cs b/src/Injections/Utils/Interfaces.cs
index e7bc9ad..14f07f0 100644
--- a/src/Injections/Utils/Interfaces.cs
+++ b/src/Injections/Utils/Interfaces.cs
@@ -1,11 +1,16 @@
-namespace DCFApixels.DragonECS
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+
+namespace DCFApixels.DragonECS
{
+ public interface IEcsInjectProcess : IEcsProcess { }
[MetaName(nameof(Inject))]
[MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsConsts.PACK_GROUP, EcsConsts.DI_GROUP)]
[MetaDescription(EcsConsts.AUTHOR, "The interface of the dependency injection process.")]
[MetaID("4C86537C92019AA24383CBF53CBD456C")]
- public interface IEcsInject : IEcsProcess
+ public interface IEcsInject : IEcsInjectProcess
{
void Inject(T obj);
}
diff --git a/src/Internal/ArraySortHalperX.cs b/src/Internal/ArraySortHalperX.cs
index b66873d..4b80ddc 100644
--- a/src/Internal/ArraySortHalperX.cs
+++ b/src/Internal/ArraySortHalperX.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
#if ENABLE_IL2CPP
diff --git a/src/Internal/ArrayUtility.cs b/src/Internal/ArrayUtility.cs
index e95d43f..4927430 100644
--- a/src/Internal/ArrayUtility.cs
+++ b/src/Internal/ArrayUtility.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/Internal/BitsUtility.cs b/src/Internal/BitsUtility.cs
index f96435e..87c9674 100644
--- a/src/Internal/BitsUtility.cs
+++ b/src/Internal/BitsUtility.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
diff --git a/src/Internal/EcsTypeCodeManager.cs b/src/Internal/EcsTypeCodeManager.cs
index 4a7cfec..52cb11e 100644
--- a/src/Internal/EcsTypeCodeManager.cs
+++ b/src/Internal/EcsTypeCodeManager.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
diff --git a/src/Internal/IdDispenser.cs b/src/Internal/IdDispenser.cs
index cd978d4..3ac1a83 100644
--- a/src/Internal/IdDispenser.cs
+++ b/src/Internal/IdDispenser.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/src/Internal/ReflectionUtility.cs b/src/Internal/ReflectionUtility.cs
index 38e2168..1aab8d2 100644
--- a/src/Internal/ReflectionUtility.cs
+++ b/src/Internal/ReflectionUtility.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Reflection;
using System.Runtime.CompilerServices;
diff --git a/src/Internal/SparseArray.cs b/src/Internal/SparseArray.cs
index 4854e82..30a0c01 100644
--- a/src/Internal/SparseArray.cs
+++ b/src/Internal/SparseArray.cs
@@ -1,6 +1,9 @@
//SparseArray. Analogous to Dictionary, but faster.
//Benchmark result of indexer.get speed test with 300 elements:
//[Dictinary: 5.786us] [SparseArray: 2.047us].
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
using System;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
diff --git a/src/Internal/StructList.cs b/src/Internal/StructList.cs
index b5f63e2..d7ad9aa 100644
--- a/src/Internal/StructList.cs
+++ b/src/Internal/StructList.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
diff --git a/src/Internal/UnsafeArray.cs b/src/Internal/UnsafeArray.cs
index 93f577e..eeba2fe 100644
--- a/src/Internal/UnsafeArray.cs
+++ b/src/Internal/UnsafeArray.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/src/Pools/EcsPool.cs b/src/Pools/EcsPool.cs
index fc3a1e1..b20d19a 100644
--- a/src/Pools/EcsPool.cs
+++ b/src/Pools/EcsPool.cs
@@ -89,13 +89,18 @@ namespace DCFApixels.DragonECS
{
get { return false; }
}
+ public ref T this[int index]
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get { return ref Get(index); }
+ }
#endregion
#region Methods
public ref T Add(int 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(entityID); }
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif
@@ -120,7 +125,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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(entityID); }
#endif
#if !DISABLE_POOLS_EVENTS
@@ -131,7 +136,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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(entityID); }
#endif
return ref _items[_mapping[entityID]];
@@ -183,11 +188,11 @@ namespace DCFApixels.DragonECS
}
public void Del(int entityID)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif
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(entityID); }
#endif
DisableComponent(ref _items[itemIndex]);
@@ -216,14 +221,14 @@ namespace DCFApixels.DragonECS
}
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(fromEntityID); }
#endif
CopyComponent(ref Get(fromEntityID), ref TryAddOrGet(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(fromEntityID); }
#endif
CopyComponent(ref Get(fromEntityID), ref toWorld.GetPool().TryAddOrGet(toEntityID));
@@ -231,7 +236,7 @@ namespace DCFApixels.DragonECS
public void ClearAll()
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif
if (_itemsCount <= 0) { return; }
@@ -269,7 +274,7 @@ namespace DCFApixels.DragonECS
//_sparseEntities = new int[_capacity];
//_denseEntitiesDelayed = new int[_capacity];
//for (int i = 0; i < _capacity; i++)
- //{// , free index- _denseEntitiesDelayed 0, free index
+ //{// ����� �������������� ��� ����� ������ ����������, � ������ ������ free index-� ���� _denseEntitiesDelayed ���������� 0, �� free index ���������� ����� ���������
// _denseEntitiesDelayed[i] = i;
//}
}
diff --git a/src/Pools/EcsPoolBase.cs b/src/Pools/EcsPoolBase.cs
index cb2d6ec..4ea5d54 100644
--- a/src/Pools/EcsPoolBase.cs
+++ b/src/Pools/EcsPoolBase.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using DCFApixels.DragonECS.PoolsCore;
using System;
using System.Collections.Generic;
@@ -84,7 +87,7 @@ namespace DCFApixels.DragonECS.Internal
{
get
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if (DEBUG)
throw new NullInstanceException();
#else
return EcsWorld.GetWorld(0);
@@ -102,25 +105,25 @@ namespace DCFApixels.DragonECS.Internal
}
void IEcsPool.Del(int entityID)
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if (DEBUG)
throw new NullInstanceException();
#endif
}
void IEcsPool.AddEmpty(int entityID)
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if (DEBUG)
throw new NullInstanceException();
#endif
}
void IEcsPool.AddRaw(int entityID, object dataRaw)
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if (DEBUG)
throw new NullInstanceException();
#endif
}
object IEcsReadonlyPool.GetRaw(int entityID)
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if (DEBUG)
throw new NullInstanceException();
#else
return null;
@@ -128,25 +131,25 @@ namespace DCFApixels.DragonECS.Internal
}
void IEcsPool.SetRaw(int entity, object dataRaw)
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if (DEBUG)
throw new NullInstanceException();
#endif
}
void IEcsReadonlyPool.Copy(int fromEntityID, int toEntityID)
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if (DEBUG)
throw new NullInstanceException();
#endif
}
void IEcsReadonlyPool.Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if (DEBUG)
throw new NullInstanceException();
#endif
}
void IEcsPool.ClearAll()
{
-#if (DEBUG && !DISABLE_DEBUG)
+#if (DEBUG)
throw new NullInstanceException();
#endif
}
diff --git a/src/Pools/EcsTagPool.cs b/src/Pools/EcsTagPool.cs
index e4b25af..5ce4f10 100644
--- a/src/Pools/EcsTagPool.cs
+++ b/src/Pools/EcsTagPool.cs
@@ -1,3 +1,6 @@
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
using DCFApixels.DragonECS.Core;
using DCFApixels.DragonECS.PoolsCore;
using System;
@@ -7,9 +10,6 @@ using System.Runtime.CompilerServices;
using System.Diagnostics;
using DCFApixels.DragonECS.Internal;
using System.ComponentModel;
-#if (DEBUG && !DISABLE_DEBUG)
-using System.Reflection;
-#endif
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
#endif
@@ -52,12 +52,12 @@ namespace DCFApixels.DragonECS
private EcsWorld.PoolsMediator _mediator;
#region CheckValide
-#if (DEBUG && !DISABLE_DEBUG)
+#if DEBUG
private static bool _isInvalidType;
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.
- _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
}
public EcsTagPool()
@@ -91,12 +91,19 @@ namespace DCFApixels.DragonECS
{
get { return false; }
}
+ public bool this[int index]
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get { return Has(index); }
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ set { Set(index, value); }
+ }
#endregion
#region Method
public void Add(int entityID)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (Has(entityID)) { EcsPoolThrowHelper.ThrowAlreadyHasComponent(entityID); }
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif
@@ -121,7 +128,7 @@ namespace DCFApixels.DragonECS
}
public void Del(int entityID)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!Has(entityID)) { EcsPoolThrowHelper.ThrowNotHaveComponent(entityID); }
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif
@@ -142,14 +149,14 @@ namespace DCFApixels.DragonECS
}
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(fromEntityID); }
#endif
TryAdd(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(fromEntityID); }
#endif
toWorld.GetPool().TryAdd(toEntityID);
@@ -182,7 +189,7 @@ namespace DCFApixels.DragonECS
public void ClearAll()
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_isLocked) { EcsPoolThrowHelper.ThrowPoolLocked(); }
#endif
if (_count <= 0) { return; }
@@ -238,14 +245,14 @@ namespace DCFApixels.DragonECS
void IEcsPool.AddRaw(int entityID, object dataRaw) { Add(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(entityID); }
#endif
return _fakeComponent;
}
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(entityID); }
#endif
}
@@ -256,14 +263,14 @@ namespace DCFApixels.DragonECS
}
ref readonly T IEcsStructPool.Read(int entityID)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent(entityID); }
#endif
return ref _fakeComponent;
}
ref T IEcsStructPool.Get(int entityID)
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (Has(entityID) == false) { EcsPoolThrowHelper.ThrowNotHaveComponent(entityID); }
#endif
return ref _fakeComponent;
diff --git a/src/Utils/AllowedInWorldsAttribute.cs b/src/Utils/AllowedInWorldsAttribute.cs
index 038cda3..d85eaa6 100644
--- a/src/Utils/AllowedInWorldsAttribute.cs
+++ b/src/Utils/AllowedInWorldsAttribute.cs
@@ -1,4 +1,7 @@
-using DCFApixels.DragonECS.Internal;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using DCFApixels.DragonECS.Internal;
using System;
namespace DCFApixels.DragonECS
diff --git a/src/Utils/EcsPipelineTemplate.cs b/src/Utils/EcsPipelineTemplate.cs
index 3532f83..d24b065 100644
--- a/src/Utils/EcsPipelineTemplate.cs
+++ b/src/Utils/EcsPipelineTemplate.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Runtime.Serialization;
namespace DCFApixels.DragonECS
diff --git a/src/Utils/Exceptions.cs b/src/Utils/Exceptions.cs
index 19a4aa6..8628a33 100644
--- a/src/Utils/Exceptions.cs
+++ b/src/Utils/Exceptions.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS
diff --git a/src/Utils/IConfigContainer.cs b/src/Utils/IConfigContainer.cs
index 4a57087..98192f0 100644
--- a/src/Utils/IConfigContainer.cs
+++ b/src/Utils/IConfigContainer.cs
@@ -1,4 +1,7 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+using System;
using System.Collections;
using System.Collections.Generic;
diff --git a/src/Utils/ITemplateNode.cs b/src/Utils/ITemplateNode.cs
index c4419ef..bd5cb8a 100644
--- a/src/Utils/ITemplateNode.cs
+++ b/src/Utils/ITemplateNode.cs
@@ -1,3 +1,7 @@
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+
namespace DCFApixels.DragonECS
{
public interface ITemplateNode
diff --git a/src/Utils/UncheckedCoreUtility.cs b/src/Utils/UncheckedCoreUtility.cs
index 1609a7a..3ae009f 100644
--- a/src/Utils/UncheckedCoreUtility.cs
+++ b/src/Utils/UncheckedCoreUtility.cs
@@ -1,4 +1,8 @@
-using System;
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+
+using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
diff --git a/src/entlong.cs b/src/entlong.cs
index d2180a3..43994c1 100644
--- a/src/entlong.cs
+++ b/src/entlong.cs
@@ -1,4 +1,7 @@
-#pragma warning disable IDE1006
+#if DISABLE_DEBUG
+#undef DEBUG
+#endif
+#pragma warning disable IDE1006
#pragma warning disable CS8981
using DCFApixels.DragonECS.Internal;
using System;
@@ -56,7 +59,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
#endif
return _id;
@@ -67,7 +70,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
#endif
return _gen;
@@ -78,7 +81,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
#endif
return GetWorld_Internal();
@@ -89,7 +92,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
-#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
+#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
#endif
return _world;
@@ -141,7 +144,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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); }
#endif
world = EcsWorld.GetWorld(_world);
@@ -150,7 +153,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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); }
#endif
world = EcsWorld.GetWorld(_world);
@@ -160,7 +163,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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); }
#endif
worldID = _world;
@@ -169,7 +172,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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); }
#endif
worldID = _world;