mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 18:14: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
|
||||
{
|
||||
private readonly int id;
|
||||
private readonly int _id;
|
||||
public AutoScope(int id)
|
||||
{
|
||||
this.id = id;
|
||||
_id = id;
|
||||
EcsDebug.ProfileMarkBegin(id);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
EcsDebug.ProfileMarkEnd(id);
|
||||
}
|
||||
public void Dispose() => 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(DebugService service) => DebugService.Set(service);
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Print(object v) => DebugService.Instance.Print(v);
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Print(string tag, object v)
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUG
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
DebugService.Instance.Print(tag, v);
|
||||
#endif
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int RegisterMark(string name)
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUG
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
return DebugService.Instance.RegisterMark(name);
|
||||
#else
|
||||
return 0;
|
||||
@ -59,21 +55,21 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void DeleteMark(string name)
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUG
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
DebugService.Instance.DeleteMark(name);
|
||||
#endif
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void ProfileMarkBegin(int id)
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUG
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
DebugService.Instance.ProfileMarkBegin(id);
|
||||
#endif
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void ProfileMarkEnd(int id)
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUG
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
DebugService.Instance.ProfileMarkEnd(id);
|
||||
#endif
|
||||
}
|
||||
@ -145,7 +141,7 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
public DefaultDebugService()
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUG
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
_stopwatchs = new Stopwatch[64];
|
||||
_stopwatchsNames= new string[64];
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
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;
|
||||
#endif
|
||||
|
||||
@ -130,7 +130,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (index < 0 || index >= Count) ThrowArgumentOutOfRange();
|
||||
#endif
|
||||
return _dense[index];
|
||||
@ -183,7 +183,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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);
|
||||
#endif
|
||||
if (++_count >= _dense.Length)
|
||||
@ -201,7 +201,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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);
|
||||
#endif
|
||||
_dense[_sparse[entityID]] = _dense[_count];
|
||||
@ -235,7 +235,7 @@ namespace DCFApixels.DragonECS
|
||||
public void CopyFrom(EcsReadonlyGroup group) => CopyFrom(group.GetGroupInternal());
|
||||
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");
|
||||
#endif
|
||||
if(_count > 0)
|
||||
@ -258,7 +258,7 @@ namespace DCFApixels.DragonECS
|
||||
/// <summary>as Union sets</summary>
|
||||
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");
|
||||
#endif
|
||||
foreach (var item in group)
|
||||
@ -272,7 +272,7 @@ namespace DCFApixels.DragonECS
|
||||
/// <summary>as Except sets</summary>
|
||||
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");
|
||||
#endif
|
||||
foreach (var item in this)
|
||||
@ -286,7 +286,7 @@ namespace DCFApixels.DragonECS
|
||||
/// <summary>as Intersect sets</summary>
|
||||
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");
|
||||
#endif
|
||||
foreach (var item in this)
|
||||
@ -300,7 +300,7 @@ namespace DCFApixels.DragonECS
|
||||
/// <summary>as Symmetric Except sets</summary>
|
||||
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");
|
||||
#endif
|
||||
foreach (var item in group)
|
||||
@ -316,7 +316,7 @@ namespace DCFApixels.DragonECS
|
||||
/// <returns>new group from pool</returns>
|
||||
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");
|
||||
#endif
|
||||
EcsGroup result = a._source.GetGroupFromPool();
|
||||
@ -330,7 +330,7 @@ namespace DCFApixels.DragonECS
|
||||
/// <returns>new group from pool</returns>
|
||||
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");
|
||||
#endif
|
||||
EcsGroup result = a._source.GetGroupFromPool();
|
||||
@ -344,7 +344,7 @@ namespace DCFApixels.DragonECS
|
||||
/// <returns>new group from pool</returns>
|
||||
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");
|
||||
#endif
|
||||
EcsGroup result = a._source.GetGroupFromPool();
|
||||
@ -461,7 +461,7 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
#region ThrowHalper
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
internal static class ThrowHalper
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
|
@ -90,7 +90,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Run()
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
CheckBeforeInitForMethod(nameof(Run));
|
||||
CheckAfterDestroyForMethod(nameof(Run));
|
||||
#endif
|
||||
@ -101,7 +101,7 @@ namespace DCFApixels.DragonECS
|
||||
if (_isEmptyDummy)
|
||||
return;
|
||||
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
CheckBeforeInitForMethod(nameof(Run));
|
||||
#endif
|
||||
if (_isDestoryed == true)
|
||||
@ -115,7 +115,7 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
#region StateChecks
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
private void CheckBeforeInitForMethod(string methodName)
|
||||
{
|
||||
if (!_isInit)
|
||||
|
@ -57,7 +57,7 @@ namespace DCFApixels.DragonECS
|
||||
.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++)
|
||||
{
|
||||
var e = CheckRunnerValide(runnerHandlerTypes[i]);
|
||||
@ -130,7 +130,7 @@ namespace DCFApixels.DragonECS
|
||||
private static 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)
|
||||
{
|
||||
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>()
|
||||
{
|
||||
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.");
|
||||
#endif
|
||||
_inc.Add(_world.GetComponentID<TComponent>());
|
||||
@ -91,7 +91,7 @@ namespace DCFApixels.DragonECS
|
||||
public void ExcludeImplicit<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.");
|
||||
#endif
|
||||
_exc.Add(_world.GetComponentID<TComponent>());
|
||||
|
@ -255,7 +255,7 @@ namespace DCFApixels.DragonECS
|
||||
#region IsMatchesMask
|
||||
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)
|
||||
throw new EcsFrameworkException("mask.WorldArchetypeType != typeof(TTableArhetype)");
|
||||
#endif
|
||||
@ -384,7 +384,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
var count = --_componentCounts[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("нарушен баланс инкремента/декремента компонентов");
|
||||
#endif
|
||||
}
|
||||
@ -402,7 +402,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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)
|
||||
throw new ArgumentException("groupFilter.WorldIndex != this");
|
||||
#endif
|
||||
|
@ -45,12 +45,12 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
_executeJoin.Begin();
|
||||
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 составить текст исключения.
|
||||
#endif
|
||||
if (!_isInitTargetWorld)
|
||||
InitTargetWorlds(sourceGroup.World);
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
else
|
||||
if (_targetWorld != sourceGroup.World) throw new System.ArgumentException();//TODO составить текст исключения. это проверка на то что пользователь использует правильный мир
|
||||
#endif
|
||||
@ -151,35 +151,35 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
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 составить текст исключения.
|
||||
#endif
|
||||
return _executer.Has(attachedEnttiyID);
|
||||
}
|
||||
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 составить текст исключения.
|
||||
#endif
|
||||
return _executer.GetNodes(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 составить текст исключения.
|
||||
#endif
|
||||
return _executer.GetNode(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 составить текст исключения.
|
||||
#endif
|
||||
return _executer.GetNodesCount(entityID);
|
||||
}
|
||||
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 составить текст исключения.
|
||||
#endif
|
||||
return _executer.HasNode(entityID, attachedEntityID);
|
||||
|
@ -47,12 +47,12 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
var world = _subject.World;
|
||||
_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 составить текст исключения.
|
||||
#endif
|
||||
if (!_isInitTargetWorld)
|
||||
InitTargetWorlds(sourceGroup.World);
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
else
|
||||
if (_targetWorld != sourceGroup.World) throw new ArgumentException();//TODO составить текст исключения. это проверка на то что пользователь использует правильный мир
|
||||
#endif
|
||||
@ -160,35 +160,35 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
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 составить текст исключения.
|
||||
#endif
|
||||
return _executer.Has(attachedEnttiyID);
|
||||
}
|
||||
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 составить текст исключения.
|
||||
#endif
|
||||
return _executer.GetNodes(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 составить текст исключения.
|
||||
#endif
|
||||
return _executer.GetNode(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 составить текст исключения.
|
||||
#endif
|
||||
return _executer.GetNodesCount(entityID);
|
||||
}
|
||||
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 составить текст исключения.
|
||||
#endif
|
||||
return _executer.HasNode(entityID, attachedEntityID);
|
||||
|
@ -30,7 +30,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
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 составить текст исключения.
|
||||
#endif
|
||||
_subject.GetIteratorFor(sourceGroup).CopyTo(_filteredGroup);
|
||||
@ -62,7 +62,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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 составить текст исключения.
|
||||
#endif
|
||||
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;
|
||||
#endif
|
||||
|
||||
@ -61,7 +61,7 @@ namespace DCFApixels.DragonECS
|
||||
#region Methods
|
||||
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);
|
||||
_sanitizeTargetWorld = target.world;
|
||||
if (Has(entityID)) ThrowAlreadyHasComponent<T>(entityID);
|
||||
@ -80,7 +80,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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 (_sanitizeTargetWorld >= 0 && target.world != _sanitizeTargetWorld) ThrowWorldDifferent<T>(entityID);
|
||||
_sanitizeTargetWorld = target.world;
|
||||
@ -98,7 +98,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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);
|
||||
#endif
|
||||
return ref _items[entityID];
|
||||
@ -110,7 +110,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
_entities.Remove(entityID);
|
||||
@ -125,7 +125,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
if (Has(toEntityID))
|
||||
@ -135,7 +135,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
if (Has(toEntityID))
|
||||
@ -168,7 +168,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
return ref _items[entityID];
|
||||
|
@ -59,7 +59,7 @@ namespace DCFApixels.DragonECS
|
||||
// using (_addMark.Auto())
|
||||
// {
|
||||
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);
|
||||
#endif
|
||||
if (_recycledItemsCount > 0)
|
||||
@ -82,7 +82,7 @@ namespace DCFApixels.DragonECS
|
||||
public ref T Write(int entityID)
|
||||
{
|
||||
// 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);
|
||||
#endif
|
||||
_listeners.InvokeOnWrite(entityID);
|
||||
@ -92,7 +92,7 @@ namespace DCFApixels.DragonECS
|
||||
public ref readonly T Read(int entityID)
|
||||
{
|
||||
// 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);
|
||||
#endif
|
||||
return ref _items[_mapping[entityID]];
|
||||
@ -126,7 +126,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
ref int itemIndex = ref _mapping[entityID];
|
||||
@ -145,14 +145,14 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
_componentCopyHandler.Copy(ref Write(fromEntityID), ref TryAddOrWrite(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);
|
||||
#endif
|
||||
_componentCopyHandler.Copy(ref Write(fromEntityID), ref toWorld.GetPool<T>().TryAddOrWrite(toEntityID));
|
||||
|
@ -47,7 +47,7 @@ namespace DCFApixels.DragonECS
|
||||
#region Methods
|
||||
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);
|
||||
#endif
|
||||
_mapping[entityID] = ++_count;
|
||||
@ -58,7 +58,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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);
|
||||
#endif
|
||||
_listeners.InvokeOnWrite(entityID);
|
||||
@ -74,7 +74,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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);
|
||||
#endif
|
||||
return ref _component;
|
||||
@ -86,7 +86,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
_mapping[entityID] = 0;
|
||||
@ -100,14 +100,14 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
TryAddOrWrite(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);
|
||||
#endif
|
||||
toWorld.GetPool<T>().TryAddOrWrite(toEntityID);
|
||||
|
@ -43,7 +43,7 @@ namespace DCFApixels.DragonECS
|
||||
#region Method
|
||||
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);
|
||||
#endif
|
||||
_count++;
|
||||
@ -68,7 +68,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
_mapping[entityID] = false;
|
||||
@ -82,14 +82,14 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
TryAdd(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);
|
||||
#endif
|
||||
toWorld.GetPool<T>().TryAdd(toEntityID);
|
||||
@ -138,14 +138,14 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
return ref _fakeComponent;
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
return ref _fakeComponent;
|
||||
@ -153,14 +153,14 @@ namespace DCFApixels.DragonECS
|
||||
void IEcsPool.AddRaw(int entityID, object dataRaw) => Add(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);
|
||||
#endif
|
||||
return _fakeComponent;
|
||||
}
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (!IsAlive) ThrowIsNotAlive(this);
|
||||
#endif
|
||||
return id;
|
||||
@ -52,7 +52,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (!IsAlive) ThrowIsNotAlive(this);
|
||||
#endif
|
||||
return gen;
|
||||
@ -63,7 +63,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (!IsAlive) ThrowIsNotAlive(this);
|
||||
#endif
|
||||
return EcsWorld.Worlds[world];
|
||||
@ -75,7 +75,7 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DRAGONECS_NO_SANITIZE_CHECKS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (!IsAlive) ThrowIsNotAlive(this);
|
||||
#endif
|
||||
return world;
|
||||
|
Loading…
Reference in New Issue
Block a user