mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-19 02:24:37 +08:00
refactoring
rename directive to DISABLE_DRAGONECS_ASSERT_CHEKS
This commit is contained in:
parent
1ad7fbabdb
commit
32429e5af8
@ -19,16 +19,13 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public readonly ref struct AutoScope
|
public readonly ref struct AutoScope
|
||||||
{
|
{
|
||||||
private readonly int id;
|
private readonly int _id;
|
||||||
public AutoScope(int id)
|
public AutoScope(int id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
_id = id;
|
||||||
EcsDebug.ProfileMarkBegin(id);
|
EcsDebug.ProfileMarkBegin(id);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose() => EcsDebug.ProfileMarkEnd(_id);
|
||||||
{
|
|
||||||
EcsDebug.ProfileMarkEnd(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,20 +34,19 @@ namespace DCFApixels.DragonECS
|
|||||||
public static void Set<T>() where T : DebugService, new() => DebugService.Set<T>();
|
public static void Set<T>() where T : DebugService, new() => DebugService.Set<T>();
|
||||||
public static void Set(DebugService service) => DebugService.Set(service);
|
public static void Set(DebugService service) => DebugService.Set(service);
|
||||||
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Print(object v) => DebugService.Instance.Print(v);
|
public static void Print(object v) => DebugService.Instance.Print(v);
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Print(string tag, object v)
|
public static void Print(string tag, object v)
|
||||||
{
|
{
|
||||||
#if !DISABLE_DRAGONECS_DEBUG
|
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||||
DebugService.Instance.Print(tag, v);
|
DebugService.Instance.Print(tag, v);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static int RegisterMark(string name)
|
public static int RegisterMark(string name)
|
||||||
{
|
{
|
||||||
#if !DISABLE_DRAGONECS_DEBUG
|
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||||
return DebugService.Instance.RegisterMark(name);
|
return DebugService.Instance.RegisterMark(name);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
@ -59,21 +55,21 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void DeleteMark(string name)
|
public static void DeleteMark(string name)
|
||||||
{
|
{
|
||||||
#if !DISABLE_DRAGONECS_DEBUG
|
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||||
DebugService.Instance.DeleteMark(name);
|
DebugService.Instance.DeleteMark(name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void ProfileMarkBegin(int id)
|
public static void ProfileMarkBegin(int id)
|
||||||
{
|
{
|
||||||
#if !DISABLE_DRAGONECS_DEBUG
|
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||||
DebugService.Instance.ProfileMarkBegin(id);
|
DebugService.Instance.ProfileMarkBegin(id);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void ProfileMarkEnd(int id)
|
public static void ProfileMarkEnd(int id)
|
||||||
{
|
{
|
||||||
#if !DISABLE_DRAGONECS_DEBUG
|
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||||
DebugService.Instance.ProfileMarkEnd(id);
|
DebugService.Instance.ProfileMarkEnd(id);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -145,7 +141,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public DefaultDebugService()
|
public DefaultDebugService()
|
||||||
{
|
{
|
||||||
#if !DISABLE_DRAGONECS_DEBUG
|
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||||
_stopwatchs = new Stopwatch[64];
|
_stopwatchs = new Stopwatch[64];
|
||||||
_stopwatchsNames= new string[64];
|
_stopwatchsNames= new string[64];
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
using static DCFApixels.DragonECS.EcsGroup.ThrowHalper;
|
using static DCFApixels.DragonECS.EcsGroup.ThrowHalper;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (index < 0 || index >= Count) ThrowArgumentOutOfRange();
|
if (index < 0 || index >= Count) ThrowArgumentOutOfRange();
|
||||||
#endif
|
#endif
|
||||||
return _dense[index];
|
return _dense[index];
|
||||||
@ -183,7 +183,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
internal void AddInternal(int entityID)
|
internal void AddInternal(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID)) ThrowAlreadyContains(entityID);
|
if (Has(entityID)) ThrowAlreadyContains(entityID);
|
||||||
#endif
|
#endif
|
||||||
if (++_count >= _dense.Length)
|
if (++_count >= _dense.Length)
|
||||||
@ -201,7 +201,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
internal void RemoveInternal(int entityID)
|
internal void RemoveInternal(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowDoesNotContain(entityID);
|
if (!Has(entityID)) ThrowDoesNotContain(entityID);
|
||||||
#endif
|
#endif
|
||||||
_dense[_sparse[entityID]] = _dense[_count];
|
_dense[_sparse[entityID]] = _dense[_count];
|
||||||
@ -235,7 +235,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public void CopyFrom(EcsReadonlyGroup group) => CopyFrom(group.GetGroupInternal());
|
public void CopyFrom(EcsReadonlyGroup group) => CopyFrom(group.GetGroupInternal());
|
||||||
public void CopyFrom(EcsGroup group)
|
public void CopyFrom(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (group.World != _source) throw new ArgumentException("groupFilter.WorldIndex != WorldIndex");
|
if (group.World != _source) throw new ArgumentException("groupFilter.WorldIndex != WorldIndex");
|
||||||
#endif
|
#endif
|
||||||
if(_count > 0)
|
if(_count > 0)
|
||||||
@ -258,7 +258,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) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group.World) throw new ArgumentException("WorldIndex != groupFilter.WorldIndex");
|
if (_source != group.World) throw new ArgumentException("WorldIndex != groupFilter.WorldIndex");
|
||||||
#endif
|
#endif
|
||||||
foreach (var item in group)
|
foreach (var item in group)
|
||||||
@ -272,7 +272,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) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group.World) throw new ArgumentException("WorldIndex != groupFilter.WorldIndex");
|
if (_source != group.World) throw new ArgumentException("WorldIndex != groupFilter.WorldIndex");
|
||||||
#endif
|
#endif
|
||||||
foreach (var item in this)
|
foreach (var item in this)
|
||||||
@ -286,7 +286,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <summary>as Intersect sets</summary>
|
/// <summary>as Intersect sets</summary>
|
||||||
public void AndWith(EcsGroup group)
|
public void AndWith(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (World != group.World) throw new ArgumentException("WorldIndex != groupFilter.WorldIndex");
|
if (World != group.World) throw new ArgumentException("WorldIndex != groupFilter.WorldIndex");
|
||||||
#endif
|
#endif
|
||||||
foreach (var item in this)
|
foreach (var item in this)
|
||||||
@ -300,7 +300,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <summary>as Symmetric Except sets</summary>
|
/// <summary>as Symmetric Except sets</summary>
|
||||||
public void XorWith(EcsGroup group)
|
public void XorWith(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_source != group.World) throw new ArgumentException("WorldIndex != groupFilter.WorldIndex");
|
if (_source != group.World) throw new ArgumentException("WorldIndex != groupFilter.WorldIndex");
|
||||||
#endif
|
#endif
|
||||||
foreach (var item in group)
|
foreach (var item in group)
|
||||||
@ -316,7 +316,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) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a._source != b._source) throw new ArgumentException("a.WorldIndex != b.WorldIndex");
|
if (a._source != b._source) throw new ArgumentException("a.WorldIndex != b.WorldIndex");
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = a._source.GetGroupFromPool();
|
EcsGroup result = a._source.GetGroupFromPool();
|
||||||
@ -330,7 +330,7 @@ namespace DCFApixels.DragonECS
|
|||||||
/// <returns>new group from pool</returns>
|
/// <returns>new group from pool</returns>
|
||||||
public static EcsGroup And(EcsGroup a, EcsGroup b)
|
public static EcsGroup And(EcsGroup a, EcsGroup b)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a._source != b._source) throw new ArgumentException("a.WorldIndex != b.WorldIndex");
|
if (a._source != b._source) throw new ArgumentException("a.WorldIndex != b.WorldIndex");
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = a._source.GetGroupFromPool();
|
EcsGroup result = a._source.GetGroupFromPool();
|
||||||
@ -344,7 +344,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) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (a._source != b._source) throw new ArgumentException("a.WorldIndex != b.WorldIndex");
|
if (a._source != b._source) throw new ArgumentException("a.WorldIndex != b.WorldIndex");
|
||||||
#endif
|
#endif
|
||||||
EcsGroup result = a._source.GetGroupFromPool();
|
EcsGroup result = a._source.GetGroupFromPool();
|
||||||
@ -461,7 +461,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ThrowHalper
|
#region ThrowHalper
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
internal static class ThrowHalper
|
internal static class ThrowHalper
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
|
@ -90,7 +90,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
CheckBeforeInitForMethod(nameof(Run));
|
CheckBeforeInitForMethod(nameof(Run));
|
||||||
CheckAfterDestroyForMethod(nameof(Run));
|
CheckAfterDestroyForMethod(nameof(Run));
|
||||||
#endif
|
#endif
|
||||||
@ -101,7 +101,7 @@ namespace DCFApixels.DragonECS
|
|||||||
if (_isEmptyDummy)
|
if (_isEmptyDummy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
CheckBeforeInitForMethod(nameof(Run));
|
CheckBeforeInitForMethod(nameof(Run));
|
||||||
#endif
|
#endif
|
||||||
if (_isDestoryed == true)
|
if (_isDestoryed == true)
|
||||||
@ -115,7 +115,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region StateChecks
|
#region StateChecks
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
private void CheckBeforeInitForMethod(string methodName)
|
private void CheckBeforeInitForMethod(string methodName)
|
||||||
{
|
{
|
||||||
if (!_isInit)
|
if (!_isInit)
|
||||||
|
@ -57,7 +57,7 @@ namespace DCFApixels.DragonECS
|
|||||||
.Where(type => type.BaseType != null && type.BaseType.IsGenericType && runnerBaseType == type.BaseType.GetGenericTypeDefinition()));
|
.Where(type => type.BaseType != null && type.BaseType.IsGenericType && runnerBaseType == type.BaseType.GetGenericTypeDefinition()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
for (int i = 0; i < runnerHandlerTypes.Count; i++)
|
for (int i = 0; i < runnerHandlerTypes.Count; i++)
|
||||||
{
|
{
|
||||||
var e = CheckRunnerValide(runnerHandlerTypes[i]);
|
var e = CheckRunnerValide(runnerHandlerTypes[i]);
|
||||||
@ -130,7 +130,7 @@ namespace DCFApixels.DragonECS
|
|||||||
private static Type _subclass;
|
private static Type _subclass;
|
||||||
internal static void Register(Type subclass)
|
internal static void Register(Type subclass)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_subclass != null)
|
if (_subclass != null)
|
||||||
{
|
{
|
||||||
throw new EcsRunnerImplementationException($"The Runner<{typeof(TInterface).FullName}> can have only one implementing subclass");
|
throw new EcsRunnerImplementationException($"The Runner<{typeof(TInterface).FullName}> can have only one implementing subclass");
|
||||||
|
@ -83,7 +83,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public void IncludeImplicit<TComponent>()
|
public void IncludeImplicit<TComponent>()
|
||||||
{
|
{
|
||||||
int id = _world.GetComponentID<TComponent>();
|
int id = _world.GetComponentID<TComponent>();
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_inc.Contains(id) || _exc.Contains(id)) throw new EcsFrameworkException($"{typeof(TComponent).Name} already in constraints list.");
|
if (_inc.Contains(id) || _exc.Contains(id)) throw new EcsFrameworkException($"{typeof(TComponent).Name} already in constraints list.");
|
||||||
#endif
|
#endif
|
||||||
_inc.Add(_world.GetComponentID<TComponent>());
|
_inc.Add(_world.GetComponentID<TComponent>());
|
||||||
@ -91,7 +91,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public void ExcludeImplicit<TComponent>()
|
public void ExcludeImplicit<TComponent>()
|
||||||
{
|
{
|
||||||
int id = _world.GetComponentID<TComponent>();
|
int id = _world.GetComponentID<TComponent>();
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_inc.Contains(id) || _exc.Contains(id)) throw new EcsFrameworkException($"{typeof(TComponent).Name} already in constraints list.");
|
if (_inc.Contains(id) || _exc.Contains(id)) throw new EcsFrameworkException($"{typeof(TComponent).Name} already in constraints list.");
|
||||||
#endif
|
#endif
|
||||||
_exc.Add(_world.GetComponentID<TComponent>());
|
_exc.Add(_world.GetComponentID<TComponent>());
|
||||||
|
@ -255,7 +255,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region IsMatchesMask
|
#region IsMatchesMask
|
||||||
public bool IsMatchesMask(EcsMask mask, int entityID)
|
public bool IsMatchesMask(EcsMask mask, int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (mask._worldType != Archetype)
|
if (mask._worldType != Archetype)
|
||||||
throw new EcsFrameworkException("mask.WorldArchetypeType != typeof(TTableArhetype)");
|
throw new EcsFrameworkException("mask.WorldArchetypeType != typeof(TTableArhetype)");
|
||||||
#endif
|
#endif
|
||||||
@ -384,7 +384,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
var count = --_componentCounts[entityID];
|
var count = --_componentCounts[entityID];
|
||||||
if(count == 0 && _allEntites.Has(entityID)) DelEntity(entityID);
|
if(count == 0 && _allEntites.Has(entityID)) DelEntity(entityID);
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (count < 0) throw new EcsFrameworkException("нарушен баланс инкремента/декремента компонентов");
|
if (count < 0) throw new EcsFrameworkException("нарушен баланс инкремента/декремента компонентов");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
internal void ReleaseGroup(EcsGroup group)
|
internal void ReleaseGroup(EcsGroup group)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (group.World != this)
|
if (group.World != this)
|
||||||
throw new ArgumentException("groupFilter.WorldIndex != this");
|
throw new ArgumentException("groupFilter.WorldIndex != this");
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,12 +45,12 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
_executeJoin.Begin();
|
_executeJoin.Begin();
|
||||||
var world = _subject.World;
|
var world = _subject.World;
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (sourceGroup.IsNull) throw new System.ArgumentNullException();//TODO составить текст исключения.
|
if (sourceGroup.IsNull) throw new System.ArgumentNullException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
if (!_isInitTargetWorld)
|
if (!_isInitTargetWorld)
|
||||||
InitTargetWorlds(sourceGroup.World);
|
InitTargetWorlds(sourceGroup.World);
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
else
|
else
|
||||||
if (_targetWorld != sourceGroup.World) throw new System.ArgumentException();//TODO составить текст исключения. это проверка на то что пользователь использует правильный мир
|
if (_targetWorld != sourceGroup.World) throw new System.ArgumentException();//TODO составить текст исключения. это проверка на то что пользователь использует правильный мир
|
||||||
#endif
|
#endif
|
||||||
@ -151,35 +151,35 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public bool Has(int attachedEnttiyID)
|
public bool Has(int attachedEnttiyID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return _executer.Has(attachedEnttiyID);
|
return _executer.Has(attachedEnttiyID);
|
||||||
}
|
}
|
||||||
public EntityLinkedList.EnumerableSpan GetNodes(int entityID)
|
public EntityLinkedList.EnumerableSpan GetNodes(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return _executer.GetNodes(entityID);
|
return _executer.GetNodes(entityID);
|
||||||
}
|
}
|
||||||
public int GetNode(int entityID)
|
public int GetNode(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return _executer.GetNode(entityID);
|
return _executer.GetNode(entityID);
|
||||||
}
|
}
|
||||||
public int GetNodesCount(int entityID)
|
public int GetNodesCount(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return _executer.GetNodesCount(entityID);
|
return _executer.GetNodesCount(entityID);
|
||||||
}
|
}
|
||||||
public bool HasNode(int entityID, int attachedEntityID)
|
public bool HasNode(int entityID, int attachedEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return _executer.HasNode(entityID, attachedEntityID);
|
return _executer.HasNode(entityID, attachedEntityID);
|
||||||
|
@ -47,12 +47,12 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
var world = _subject.World;
|
var world = _subject.World;
|
||||||
_executeJoin.Begin();
|
_executeJoin.Begin();
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (sourceGroup.IsNull) throw new ArgumentNullException();//TODO составить текст исключения.
|
if (sourceGroup.IsNull) throw new ArgumentNullException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
if (!_isInitTargetWorld)
|
if (!_isInitTargetWorld)
|
||||||
InitTargetWorlds(sourceGroup.World);
|
InitTargetWorlds(sourceGroup.World);
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
else
|
else
|
||||||
if (_targetWorld != sourceGroup.World) throw new ArgumentException();//TODO составить текст исключения. это проверка на то что пользователь использует правильный мир
|
if (_targetWorld != sourceGroup.World) throw new ArgumentException();//TODO составить текст исключения. это проверка на то что пользователь использует правильный мир
|
||||||
#endif
|
#endif
|
||||||
@ -160,35 +160,35 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public bool Has(int attachedEnttiyID)
|
public bool Has(int attachedEnttiyID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return _executer.Has(attachedEnttiyID);
|
return _executer.Has(attachedEnttiyID);
|
||||||
}
|
}
|
||||||
public EntityLinkedList.EnumerableSpan GetNodes(int entityID)
|
public EntityLinkedList.EnumerableSpan GetNodes(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return _executer.GetNodes(entityID);
|
return _executer.GetNodes(entityID);
|
||||||
}
|
}
|
||||||
public int GetNode(int entityID)
|
public int GetNode(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return _executer.GetNode(entityID);
|
return _executer.GetNode(entityID);
|
||||||
}
|
}
|
||||||
public int GetNodesCount(int entityID)
|
public int GetNodesCount(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return _executer.GetNodesCount(entityID);
|
return _executer.GetNodesCount(entityID);
|
||||||
}
|
}
|
||||||
public bool HasNode(int entityID, int attachedEntityID)
|
public bool HasNode(int entityID, int attachedEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return _executer.HasNode(entityID, attachedEntityID);
|
return _executer.HasNode(entityID, attachedEntityID);
|
||||||
|
@ -30,7 +30,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
using (_executeWhere.Auto())
|
using (_executeWhere.Auto())
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (sourceGroup.IsNull) throw new System.ArgumentNullException();//TODO составить текст исключения.
|
if (sourceGroup.IsNull) throw new System.ArgumentNullException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
_subject.GetIteratorFor(sourceGroup).CopyTo(_filteredGroup);
|
_subject.GetIteratorFor(sourceGroup).CopyTo(_filteredGroup);
|
||||||
@ -62,7 +62,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public EcsGroup.Enumerator GetEnumerator()
|
public EcsGroup.Enumerator GetEnumerator()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
if (!IsRelevant) throw new System.InvalidOperationException();//TODO составить текст исключения.
|
||||||
#endif
|
#endif
|
||||||
return group.GetEnumerator();
|
return group.GetEnumerator();
|
||||||
|
@ -30,7 +30,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
private short _sanitizeTargetWorld = -1;
|
private short _sanitizeTargetWorld = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Methods
|
#region Methods
|
||||||
public void Add(int entityID, entlong target)
|
public void Add(int entityID, entlong target)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_sanitizeTargetWorld > 0 && target.world != _sanitizeTargetWorld) ThrowWorldDifferent<T>(entityID);
|
if (_sanitizeTargetWorld > 0 && target.world != _sanitizeTargetWorld) ThrowWorldDifferent<T>(entityID);
|
||||||
_sanitizeTargetWorld = target.world;
|
_sanitizeTargetWorld = target.world;
|
||||||
if (Has(entityID)) ThrowAlreadyHasComponent<T>(entityID);
|
if (Has(entityID)) ThrowAlreadyHasComponent<T>(entityID);
|
||||||
@ -80,7 +80,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Set(int entityID, entlong target)
|
public void Set(int entityID, entlong target)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
if (_sanitizeTargetWorld >= 0 && target.world != _sanitizeTargetWorld) ThrowWorldDifferent<T>(entityID);
|
if (_sanitizeTargetWorld >= 0 && target.world != _sanitizeTargetWorld) ThrowWorldDifferent<T>(entityID);
|
||||||
_sanitizeTargetWorld = target.world;
|
_sanitizeTargetWorld = target.world;
|
||||||
@ -98,7 +98,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) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
return ref _items[entityID];
|
return ref _items[entityID];
|
||||||
@ -110,7 +110,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Del(int entityID)
|
public void Del(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
_entities.Remove(entityID);
|
_entities.Remove(entityID);
|
||||||
@ -125,7 +125,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, int toEntityID)
|
public void Copy(int fromEntityID, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
||||||
#endif
|
#endif
|
||||||
if (Has(toEntityID))
|
if (Has(toEntityID))
|
||||||
@ -135,7 +135,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
||||||
#endif
|
#endif
|
||||||
if (Has(toEntityID))
|
if (Has(toEntityID))
|
||||||
@ -168,7 +168,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
ref T IEcsPool<T>.Write(int entityID)
|
ref T IEcsPool<T>.Write(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
return ref _items[entityID];
|
return ref _items[entityID];
|
||||||
|
@ -59,7 +59,7 @@ namespace DCFApixels.DragonECS
|
|||||||
// using (_addMark.Auto())
|
// using (_addMark.Auto())
|
||||||
// {
|
// {
|
||||||
ref int itemIndex = ref _mapping[entityID];
|
ref int itemIndex = ref _mapping[entityID];
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (itemIndex > 0) ThrowAlreadyHasComponent<T>(entityID);
|
if (itemIndex > 0) ThrowAlreadyHasComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
if (_recycledItemsCount > 0)
|
if (_recycledItemsCount > 0)
|
||||||
@ -82,7 +82,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public ref T Write(int entityID)
|
public ref T Write(int entityID)
|
||||||
{
|
{
|
||||||
// using (_writeMark.Auto())
|
// using (_writeMark.Auto())
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
_listeners.InvokeOnWrite(entityID);
|
_listeners.InvokeOnWrite(entityID);
|
||||||
@ -92,7 +92,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public ref readonly T Read(int entityID)
|
public ref readonly T Read(int entityID)
|
||||||
{
|
{
|
||||||
// using (_readMark.Auto())
|
// using (_readMark.Auto())
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
return ref _items[_mapping[entityID]];
|
return ref _items[_mapping[entityID]];
|
||||||
@ -126,7 +126,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Del(int entityID)
|
public void Del(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
ref int itemIndex = ref _mapping[entityID];
|
ref int itemIndex = ref _mapping[entityID];
|
||||||
@ -145,14 +145,14 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, int toEntityID)
|
public void Copy(int fromEntityID, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
||||||
#endif
|
#endif
|
||||||
_componentCopyHandler.Copy(ref Write(fromEntityID), ref TryAddOrWrite(toEntityID));
|
_componentCopyHandler.Copy(ref Write(fromEntityID), ref TryAddOrWrite(toEntityID));
|
||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
||||||
#endif
|
#endif
|
||||||
_componentCopyHandler.Copy(ref Write(fromEntityID), ref toWorld.GetPool<T>().TryAddOrWrite(toEntityID));
|
_componentCopyHandler.Copy(ref Write(fromEntityID), ref toWorld.GetPool<T>().TryAddOrWrite(toEntityID));
|
||||||
|
@ -47,7 +47,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Methods
|
#region Methods
|
||||||
public ref T Add(int entityID)
|
public ref T Add(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID)) ThrowAlreadyHasComponent<T>(entityID);
|
if (Has(entityID)) ThrowAlreadyHasComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
_mapping[entityID] = ++_count;
|
_mapping[entityID] = ++_count;
|
||||||
@ -58,7 +58,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public ref T Write(int entityID)
|
public ref T Write(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
_listeners.InvokeOnWrite(entityID);
|
_listeners.InvokeOnWrite(entityID);
|
||||||
@ -74,7 +74,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) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
return ref _component;
|
return ref _component;
|
||||||
@ -86,7 +86,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Del(int entityID)
|
public void Del(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
_mapping[entityID] = 0;
|
_mapping[entityID] = 0;
|
||||||
@ -100,14 +100,14 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, int toEntityID)
|
public void Copy(int fromEntityID, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
||||||
#endif
|
#endif
|
||||||
TryAddOrWrite(toEntityID);
|
TryAddOrWrite(toEntityID);
|
||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
||||||
#endif
|
#endif
|
||||||
toWorld.GetPool<T>().TryAddOrWrite(toEntityID);
|
toWorld.GetPool<T>().TryAddOrWrite(toEntityID);
|
||||||
|
@ -43,7 +43,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Method
|
#region Method
|
||||||
public void Add(int entityID)
|
public void Add(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID)) ThrowAlreadyHasComponent<T>(entityID);
|
if (Has(entityID)) ThrowAlreadyHasComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
_count++;
|
_count++;
|
||||||
@ -68,7 +68,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Del(int entityID)
|
public void Del(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
_mapping[entityID] = false;
|
_mapping[entityID] = false;
|
||||||
@ -82,14 +82,14 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, int toEntityID)
|
public void Copy(int fromEntityID, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) 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) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
||||||
#endif
|
#endif
|
||||||
toWorld.GetPool<T>().TryAdd(toEntityID);
|
toWorld.GetPool<T>().TryAdd(toEntityID);
|
||||||
@ -138,14 +138,14 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
ref readonly T IEcsPool<T>.Read(int entityID)
|
ref readonly T IEcsPool<T>.Read(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
return ref _fakeComponent;
|
return ref _fakeComponent;
|
||||||
}
|
}
|
||||||
ref T IEcsPool<T>.Write(int entityID)
|
ref T IEcsPool<T>.Write(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
return ref _fakeComponent;
|
return ref _fakeComponent;
|
||||||
@ -153,14 +153,14 @@ namespace DCFApixels.DragonECS
|
|||||||
void IEcsPool.AddRaw(int entityID, object dataRaw) => Add(entityID);
|
void IEcsPool.AddRaw(int entityID, object dataRaw) => Add(entityID);
|
||||||
object IEcsPool.GetRaw(int entityID)
|
object IEcsPool.GetRaw(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) 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) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) ThrowIsNotAlive(this);
|
if (!IsAlive) ThrowIsNotAlive(this);
|
||||||
#endif
|
#endif
|
||||||
return id;
|
return id;
|
||||||
@ -52,7 +52,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) ThrowIsNotAlive(this);
|
if (!IsAlive) ThrowIsNotAlive(this);
|
||||||
#endif
|
#endif
|
||||||
return gen;
|
return gen;
|
||||||
@ -63,7 +63,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) ThrowIsNotAlive(this);
|
if (!IsAlive) ThrowIsNotAlive(this);
|
||||||
#endif
|
#endif
|
||||||
return EcsWorld.Worlds[world];
|
return EcsWorld.Worlds[world];
|
||||||
@ -75,7 +75,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!IsAlive) ThrowIsNotAlive(this);
|
if (!IsAlive) ThrowIsNotAlive(this);
|
||||||
#endif
|
#endif
|
||||||
return world;
|
return world;
|
||||||
|
Loading…
Reference in New Issue
Block a user