This commit is contained in:
Mikhail 2024-08-05 11:13:13 +08:00
parent 9c2fe13194
commit e42d2edbbf
3 changed files with 23 additions and 6 deletions

View File

@ -1,4 +1,5 @@
using System.Runtime.CompilerServices; using DCFApixels.DragonECS.Internal;
using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
@ -52,8 +53,8 @@ namespace DCFApixels.DragonECS
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
//_executeMarker.Begin(); //_executeMarker.Begin();
if (span.IsNull) throw new System.ArgumentNullException();//TODO составить текст исключения. if (span.IsNull) { Throw.ArgumentNull(nameof(span)); }
if (span.WorldID != WorldID) throw new System.ArgumentException();//TODO составить текст исключения. if (span.WorldID != WorldID) { Throw.Quiery_ArgumentDifferentWorldsException(); }
#endif #endif
EcsSpan result; EcsSpan result;
if (_lastWorldVersion != World.Version) if (_lastWorldVersion != World.Version)

View File

@ -1,4 +1,5 @@
using System.Runtime.CompilerServices; using DCFApixels.DragonECS.Internal;
using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
@ -54,8 +55,8 @@ namespace DCFApixels.DragonECS
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
_executeMarker.Begin(); _executeMarker.Begin();
if (span.IsNull) throw new System.ArgumentNullException();//TODO составить текст исключения. if (span.IsNull) { Throw.ArgumentNull(nameof(span)); }
if (span.WorldID != WorldID) throw new System.ArgumentException();//TODO составить текст исключения. if (span.WorldID != WorldID) { Throw.Quiery_ArgumentDifferentWorldsException(); }
#endif #endif
if (_lastWorldVersion != World.Version) if (_lastWorldVersion != World.Version)
{ {

View File

@ -113,10 +113,20 @@ namespace DCFApixels.DragonECS.Internal
internal static void Ent_ThrowIsNotAlive(entlong entity) internal static void Ent_ThrowIsNotAlive(entlong entity)
{ {
if (entity.IsNull) if (entity.IsNull)
{
throw new EcsFrameworkException($"The {entity} is null."); throw new EcsFrameworkException($"The {entity} is null.");
}
else else
{
throw new EcsFrameworkException($"The {entity} is not alive."); throw new EcsFrameworkException($"The {entity} is not alive.");
} }
}
[MethodImpl(MethodImplOptions.NoInlining)]
internal static void Quiery_ArgumentDifferentWorldsException()
{
throw new ArgumentException("The groups belong to different worlds.");
}
[MethodImpl(MethodImplOptions.NoInlining)] [MethodImpl(MethodImplOptions.NoInlining)]
@ -125,6 +135,11 @@ namespace DCFApixels.DragonECS.Internal
throw new ArgumentNullException(); throw new ArgumentNullException();
} }
[MethodImpl(MethodImplOptions.NoInlining)] [MethodImpl(MethodImplOptions.NoInlining)]
internal static void ArgumentNull(string paramName)
{
throw new ArgumentNullException(paramName);
}
[MethodImpl(MethodImplOptions.NoInlining)]
internal static void ArgumentOutOfRange() internal static void ArgumentOutOfRange()
{ {
throw new ArgumentOutOfRangeException($"index is less than 0 or is equal to or greater than Count."); throw new ArgumentOutOfRangeException($"index is less than 0 or is equal to or greater than Count.");