2023-05-30 04:32:09 +08:00
|
|
|
|
using System;
|
2023-06-26 01:57:50 +08:00
|
|
|
|
using System.Runtime.CompilerServices;
|
2023-05-30 04:32:09 +08:00
|
|
|
|
|
2024-02-14 03:04:05 +08:00
|
|
|
|
namespace DCFApixels.DragonECS
|
|
|
|
|
{
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class EcsFrameworkException : Exception
|
|
|
|
|
{
|
|
|
|
|
public EcsFrameworkException() { }
|
|
|
|
|
public EcsFrameworkException(string message) : base(EcsConsts.EXCEPTION_MESSAGE_PREFIX + message) { }
|
|
|
|
|
public EcsFrameworkException(string message, Exception inner) : base(EcsConsts.EXCEPTION_MESSAGE_PREFIX + message, inner) { }
|
|
|
|
|
}
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class EcsRunnerImplementationException : EcsFrameworkException
|
|
|
|
|
{
|
|
|
|
|
public EcsRunnerImplementationException() { }
|
|
|
|
|
public EcsRunnerImplementationException(string message) : base(EcsConsts.EXCEPTION_MESSAGE_PREFIX + message) { }
|
|
|
|
|
public EcsRunnerImplementationException(string message, Exception inner) : base(EcsConsts.EXCEPTION_MESSAGE_PREFIX + message, inner) { }
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-26 18:59:07 +08:00
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DragonECS.Internal
|
2023-05-30 04:32:09 +08:00
|
|
|
|
{
|
2024-01-26 18:59:07 +08:00
|
|
|
|
internal static class Throw
|
2023-06-26 01:57:50 +08:00
|
|
|
|
{
|
2024-01-26 18:59:07 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void ArgumentNull()
|
2023-06-26 01:57:50 +08:00
|
|
|
|
{
|
2024-01-26 18:59:07 +08:00
|
|
|
|
throw new ArgumentNullException();
|
|
|
|
|
}
|
2023-06-26 01:57:50 +08:00
|
|
|
|
|
2024-01-26 18:59:07 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void ConstraintIsAlreadyContainedInMask(Type type)
|
|
|
|
|
{
|
|
|
|
|
throw new EcsFrameworkException($"The {EcsDebugUtility.GetGenericTypeName(type)} constraint is already contained in the mask.");
|
|
|
|
|
}
|
2023-06-26 01:57:50 +08:00
|
|
|
|
|
2024-01-26 18:59:07 +08:00
|
|
|
|
//[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
//public static void ArgumentDifferentWorldsException()
|
|
|
|
|
//{
|
|
|
|
|
// throw new ArgumentException("The groups belong to different worlds.");
|
|
|
|
|
//}
|
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void ArgumentOutOfRange()
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentOutOfRangeException($"index is less than 0 or is equal to or greater than Count.");
|
|
|
|
|
}
|
2023-06-26 01:57:50 +08:00
|
|
|
|
|
2024-01-26 18:59:07 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void Group_AlreadyContains(int entityID)
|
|
|
|
|
{
|
|
|
|
|
throw new EcsFrameworkException($"This group already contains entity {entityID}.");
|
|
|
|
|
}
|
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void Group_DoesNotContain(int entityID)
|
|
|
|
|
{
|
|
|
|
|
throw new EcsFrameworkException($"This group does not contain entity {entityID}.");
|
|
|
|
|
}
|
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void Group_ArgumentDifferentWorldsException()
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException("The groups belong to different worlds.");
|
|
|
|
|
}
|
2023-06-26 01:57:50 +08:00
|
|
|
|
|
2024-01-26 18:59:07 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void Pipeline_MethodCalledAfterInitialisation(string methodName)
|
|
|
|
|
{
|
|
|
|
|
throw new MethodAccessException($"It is forbidden to call {methodName}, after initialization {nameof(EcsPipeline)}.");
|
|
|
|
|
}
|
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void Pipeline_MethodCalledBeforeInitialisation(string methodName)
|
|
|
|
|
{
|
|
|
|
|
throw new MethodAccessException($"It is forbidden to call {methodName}, before initialization {nameof(EcsPipeline)}.");
|
|
|
|
|
}
|
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void Pipeline_MethodCalledAfterDestruction(string methodName)
|
|
|
|
|
{
|
|
|
|
|
throw new MethodAccessException($"It is forbidden to call {methodName}, after destroying {nameof(EcsPipeline)}.");
|
|
|
|
|
}
|
2023-06-26 01:57:50 +08:00
|
|
|
|
|
2024-01-26 18:59:07 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void World_InvalidIncrementComponentsBalance()
|
|
|
|
|
{
|
|
|
|
|
throw new MethodAccessException("Invalid increment components balance.");
|
|
|
|
|
}
|
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void World_GroupDoesNotBelongWorld()
|
|
|
|
|
{
|
|
|
|
|
throw new MethodAccessException("The Group does not belong in this world.");
|
|
|
|
|
}
|
2024-02-11 22:10:05 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
public static void World_MaskDoesntBelongWorld()
|
|
|
|
|
{
|
|
|
|
|
throw new EcsFrameworkException($"The mask doesn't belong in this world");
|
|
|
|
|
}
|
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
public static void World_EntityIsNotContained(int entityID)
|
|
|
|
|
{
|
|
|
|
|
throw new EcsFrameworkException($"An entity with identifier {entityID} is not contained in this world");
|
|
|
|
|
}
|
2024-02-14 01:04:22 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
public static void World_EntityIsAlreadyСontained(int entityID)
|
|
|
|
|
{
|
|
|
|
|
throw new EcsFrameworkException($"An entity with identifier {entityID} is already contained in this world");
|
|
|
|
|
}
|
2024-02-14 21:13:00 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
public static void World_PoolAlreadyCreated()
|
|
|
|
|
{
|
|
|
|
|
throw new EcsFrameworkException("The pool has already been created.");
|
|
|
|
|
}
|
2024-03-10 21:38:43 +08:00
|
|
|
|
public static void World_WorldCantBeDestroyed()
|
|
|
|
|
{
|
|
|
|
|
throw new EcsFrameworkException("This world can't be destroyed");
|
|
|
|
|
}
|
2024-02-14 21:13:00 +08:00
|
|
|
|
|
2024-01-26 18:59:07 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void Ent_ThrowIsNotAlive(entlong entity)
|
|
|
|
|
{
|
|
|
|
|
if (entity.IsNull)
|
|
|
|
|
throw new EcsFrameworkException($"The {entity} is null.");
|
|
|
|
|
else
|
|
|
|
|
throw new EcsFrameworkException($"The {entity} is not alive.");
|
2023-06-26 01:57:50 +08:00
|
|
|
|
}
|
2024-02-03 01:12:53 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void UndefinedException()
|
|
|
|
|
{
|
|
|
|
|
throw new Exception();
|
|
|
|
|
}
|
2024-02-24 02:26:42 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
|
|
|
internal static void Exception(string message)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(message);
|
|
|
|
|
}
|
2023-06-26 01:57:50 +08:00
|
|
|
|
}
|
2024-01-26 18:59:07 +08:00
|
|
|
|
}
|
2023-06-26 01:57:50 +08:00
|
|
|
|
|