mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 18:14:37 +08:00
update exceptions
This commit is contained in:
parent
f07a489d96
commit
9a6010efdb
@ -2,7 +2,6 @@
|
|||||||
using DCFApixels.DragonECS.RunnersCore;
|
using DCFApixels.DragonECS.RunnersCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using static DCFApixels.DragonECS.EcsThrowHalper;
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
using System;
|
using DCFApixels.DragonECS.Internal;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using static DCFApixels.DragonECS.EcsThrowHalper;
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
using System;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System.Linq;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
|
||||||
using static DCFApixels.DragonECS.EcsThrowHalper;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
|
@ -6,21 +6,20 @@ using System.Collections.Generic;
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using static DCFApixels.DragonECS.EcsThrowHalper;
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
public sealed class EcsPipeline
|
public sealed class EcsPipeline
|
||||||
{
|
{
|
||||||
private IEcsProcess[] _allSystems;
|
private IEcsProcess[] _allSystems;
|
||||||
private Dictionary<Type, IEcsRunner> _runners;
|
private Dictionary<Type, IEcsRunner> _runners = new Dictionary<Type, IEcsRunner>();
|
||||||
private IEcsRunProcess _runRunnerCache;
|
private IEcsRunProcess _runRunnerCache;
|
||||||
|
|
||||||
private ReadOnlyCollection<IEcsProcess> _allSystemsSealed;
|
private ReadOnlyCollection<IEcsProcess> _allSystemsSealed;
|
||||||
private ReadOnlyDictionary<Type, IEcsRunner> _allRunnersSealed;
|
private ReadOnlyDictionary<Type, IEcsRunner> _allRunnersSealed;
|
||||||
|
|
||||||
private bool _isInit;
|
private bool _isInit = false;
|
||||||
private bool _isDestoryed;
|
private bool _isDestoryed = false;
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
public ReadOnlyCollection<IEcsProcess> AllSystems => _allSystemsSealed;
|
public ReadOnlyCollection<IEcsProcess> AllSystems => _allSystemsSealed;
|
||||||
@ -33,13 +32,8 @@ namespace DCFApixels.DragonECS
|
|||||||
private EcsPipeline(IEcsProcess[] systems)
|
private EcsPipeline(IEcsProcess[] systems)
|
||||||
{
|
{
|
||||||
_allSystems = systems;
|
_allSystems = systems;
|
||||||
_runners = new Dictionary<Type, IEcsRunner>();
|
|
||||||
|
|
||||||
_allSystemsSealed = new ReadOnlyCollection<IEcsProcess>(_allSystems);
|
_allSystemsSealed = new ReadOnlyCollection<IEcsProcess>(_allSystems);
|
||||||
_allRunnersSealed = new ReadOnlyDictionary<Type, IEcsRunner>(_runners);
|
_allRunnersSealed = new ReadOnlyDictionary<Type, IEcsRunner>(_runners);
|
||||||
|
|
||||||
_isInit = false;
|
|
||||||
_isDestoryed = false;
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -87,7 +81,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_isInit) Throw.Pipeline_MethodCalledBeforeInitialisation(nameof(Run));
|
if (!_isInit) Throw.Pipeline_MethodCalledBeforeInitialisation(nameof(Run));
|
||||||
if (_isDestoryed) Throw.Pipeline_MethodCalledAfterDestruction(nameof(Run));
|
if (_isDestoryed) Throw.Pipeline_MethodCalledAfterDestruction(nameof(Run));
|
||||||
#endif
|
#endif
|
||||||
_runRunnerCache.Run(this);
|
_runRunnerCache.Run(this);
|
||||||
@ -95,9 +89,9 @@ namespace DCFApixels.DragonECS
|
|||||||
public void Destroy()
|
public void Destroy()
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_isInit) Throw.Pipeline_MethodCalledBeforeInitialisation(nameof(Destroy));
|
if (!_isInit) Throw.Pipeline_MethodCalledBeforeInitialisation(nameof(Destroy));
|
||||||
#endif
|
#endif
|
||||||
if (_isDestoryed == true)
|
if (_isDestoryed)
|
||||||
{
|
{
|
||||||
EcsDebug.PrintWarning($"This {nameof(EcsPipeline)} has already been destroyed");
|
EcsDebug.PrintWarning($"This {nameof(EcsPipeline)} has already been destroyed");
|
||||||
return;
|
return;
|
||||||
|
@ -3,7 +3,6 @@ using DCFApixels.DragonECS.Utils;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using static DCFApixels.DragonECS.EcsThrowHalper;
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using static DCFApixels.DragonECS.EcsPoolThrowHalper;
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
@ -53,7 +52,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
ref int itemIndex = ref _mapping[entityID];
|
ref int itemIndex = ref _mapping[entityID];
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (itemIndex > 0) ThrowAlreadyHasComponent<T>(entityID);
|
if (itemIndex > 0) EcsPoolThrowHalper.ThrowAlreadyHasComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
if (_recycledItemsCount > 0)
|
if (_recycledItemsCount > 0)
|
||||||
{
|
{
|
||||||
@ -74,7 +73,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public ref T Get(int entityID)
|
public ref T Get(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
_listeners.InvokeOnGet(entityID);
|
_listeners.InvokeOnGet(entityID);
|
||||||
return ref _items[_mapping[entityID]];
|
return ref _items[_mapping[entityID]];
|
||||||
@ -83,7 +82,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public ref readonly T Read(int entityID)
|
public ref readonly T Read(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
return ref _items[_mapping[entityID]];
|
return ref _items[_mapping[entityID]];
|
||||||
}
|
}
|
||||||
@ -117,7 +116,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public void Del(int entityID)
|
public void Del(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
ref int itemIndex = ref _mapping[entityID];
|
ref int itemIndex = ref _mapping[entityID];
|
||||||
_componentResetHandler.Reset(ref _items[itemIndex]);
|
_componentResetHandler.Reset(ref _items[itemIndex]);
|
||||||
@ -136,14 +135,14 @@ namespace DCFApixels.DragonECS
|
|||||||
public void Copy(int fromEntityID, int toEntityID)
|
public void Copy(int fromEntityID, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) EcsPoolThrowHalper.ThrowNotHaveComponent<T>(fromEntityID);
|
||||||
#endif
|
#endif
|
||||||
_componentCopyHandler.Copy(ref Get(fromEntityID), ref TryAddOrGet(toEntityID));
|
_componentCopyHandler.Copy(ref Get(fromEntityID), ref TryAddOrGet(toEntityID));
|
||||||
}
|
}
|
||||||
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
public void Copy(int fromEntityID, EcsWorld toWorld, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) EcsPoolThrowHalper.ThrowNotHaveComponent<T>(fromEntityID);
|
||||||
#endif
|
#endif
|
||||||
_componentCopyHandler.Copy(ref Get(fromEntityID), ref toWorld.GetPool<T>().TryAddOrGet(toEntityID));
|
_componentCopyHandler.Copy(ref Get(fromEntityID), ref toWorld.GetPool<T>().TryAddOrGet(toEntityID));
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@ -57,11 +58,11 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
public static void ThrowAlreadyHasComponent<T>(int entityID)
|
public static void ThrowAlreadyHasComponent<T>(int entityID)
|
||||||
{
|
{
|
||||||
throw new EcsFrameworkException($"Entity({entityID}) already has component {typeof(T).Name}.");
|
throw new EcsFrameworkException($"Entity({entityID}) already has component {EcsDebugUtility.GetGenericTypeName<T>()}.");
|
||||||
}
|
}
|
||||||
public static void ThrowNotHaveComponent<T>(int entityID)
|
public static void ThrowNotHaveComponent<T>(int entityID)
|
||||||
{
|
{
|
||||||
throw new EcsFrameworkException($"Entity({entityID}) has no component {typeof(T).Name}.");
|
throw new EcsFrameworkException($"Entity({entityID}) has no component {EcsDebugUtility.GetGenericTypeName<T>()}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class IEcsPoolImplementationExtensions
|
public static class IEcsPoolImplementationExtensions
|
||||||
|
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using static DCFApixels.DragonECS.EcsPoolThrowHalper;
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
@ -42,7 +41,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public void Add(int entityID)
|
public void Add(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (Has(entityID)) ThrowAlreadyHasComponent<T>(entityID);
|
if (Has(entityID)) EcsPoolThrowHalper.ThrowAlreadyHasComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
_count++;
|
_count++;
|
||||||
_mapping[entityID] = true;
|
_mapping[entityID] = true;
|
||||||
@ -67,7 +66,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public void Del(int entityID)
|
public void Del(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
_mapping[entityID] = false;
|
_mapping[entityID] = false;
|
||||||
_count--;
|
_count--;
|
||||||
@ -81,14 +80,14 @@ namespace DCFApixels.DragonECS
|
|||||||
public void Copy(int fromEntityID, int toEntityID)
|
public void Copy(int fromEntityID, int toEntityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) EcsPoolThrowHalper.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) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(fromEntityID)) ThrowNotHaveComponent<T>(fromEntityID);
|
if (!Has(fromEntityID)) EcsPoolThrowHalper.ThrowNotHaveComponent<T>(fromEntityID);
|
||||||
#endif
|
#endif
|
||||||
toWorld.GetPool<T>().TryAdd(toEntityID);
|
toWorld.GetPool<T>().TryAdd(toEntityID);
|
||||||
}
|
}
|
||||||
@ -137,14 +136,14 @@ namespace DCFApixels.DragonECS
|
|||||||
ref readonly T IEcsStructPool<T>.Read(int entityID)
|
ref readonly T IEcsStructPool<T>.Read(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
return ref _fakeComponent;
|
return ref _fakeComponent;
|
||||||
}
|
}
|
||||||
ref T IEcsStructPool<T>.Get(int entityID)
|
ref T IEcsStructPool<T>.Get(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
return ref _fakeComponent;
|
return ref _fakeComponent;
|
||||||
}
|
}
|
||||||
@ -152,14 +151,14 @@ namespace DCFApixels.DragonECS
|
|||||||
object IEcsPool.GetRaw(int entityID)
|
object IEcsPool.GetRaw(int entityID)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) EcsPoolThrowHalper.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) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (!Has(entityID)) ThrowNotHaveComponent<T>(entityID);
|
if (!Has(entityID)) EcsPoolThrowHalper.ThrowNotHaveComponent<T>(entityID);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -4,33 +4,18 @@ using System.Runtime.Serialization;
|
|||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
public class EcsThrowHalper
|
namespace Internal
|
||||||
{
|
{
|
||||||
public static readonly EcsThrowHalper Throw = new EcsThrowHalper();
|
internal static class Throw
|
||||||
private EcsThrowHalper() { }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class EcsThrowHalper_Core
|
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public static void Pool_AlreadyHasComponent<T>(this EcsThrowHalper _, int entityID)
|
internal static void ArgumentNull()
|
||||||
{
|
|
||||||
throw new EcsFrameworkException($"Entity({entityID}) already has component {EcsDebugUtility.GetGenericTypeName<T>()}.");
|
|
||||||
}
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
||||||
public static void Pool_NotHaveComponent<T>(this EcsThrowHalper _, int entityID)
|
|
||||||
{
|
|
||||||
throw new EcsFrameworkException($"Entity({entityID}) has no component {EcsDebugUtility.GetGenericTypeName<T>()}.");
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
||||||
internal static void ArgumentNull(this EcsThrowHalper _)
|
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void ConstraintIsAlreadyContainedInMask(this EcsThrowHalper _, Type type)
|
internal static void ConstraintIsAlreadyContainedInMask(Type type)
|
||||||
{
|
{
|
||||||
throw new EcsFrameworkException($"The {EcsDebugUtility.GetGenericTypeName(type)} constraint is already contained in the mask.");
|
throw new EcsFrameworkException($"The {EcsDebugUtility.GetGenericTypeName(type)} constraint is already contained in the mask.");
|
||||||
}
|
}
|
||||||
@ -41,56 +26,56 @@ namespace DCFApixels.DragonECS
|
|||||||
// throw new ArgumentException("The groups belong to different worlds.");
|
// throw new ArgumentException("The groups belong to different worlds.");
|
||||||
//}
|
//}
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void ArgumentOutOfRange(this EcsThrowHalper _)
|
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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void Group_AlreadyContains(this EcsThrowHalper _, int entityID)
|
internal static void Group_AlreadyContains(int entityID)
|
||||||
{
|
{
|
||||||
throw new EcsFrameworkException($"This group already contains entity {entityID}.");
|
throw new EcsFrameworkException($"This group already contains entity {entityID}.");
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void Group_DoesNotContain(this EcsThrowHalper _, int entityID)
|
internal static void Group_DoesNotContain(int entityID)
|
||||||
{
|
{
|
||||||
throw new EcsFrameworkException($"This group does not contain entity {entityID}.");
|
throw new EcsFrameworkException($"This group does not contain entity {entityID}.");
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void Group_ArgumentDifferentWorldsException(this EcsThrowHalper _)
|
internal static void Group_ArgumentDifferentWorldsException()
|
||||||
{
|
{
|
||||||
throw new ArgumentException("The groups belong to different worlds.");
|
throw new ArgumentException("The groups belong to different worlds.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void Pipeline_MethodCalledAfterInitialisation(this EcsThrowHalper _, string methodName)
|
internal static void Pipeline_MethodCalledAfterInitialisation(string methodName)
|
||||||
{
|
{
|
||||||
throw new MethodAccessException($"It is forbidden to call {methodName}, after initialization {nameof(EcsPipeline)}.");
|
throw new MethodAccessException($"It is forbidden to call {methodName}, after initialization {nameof(EcsPipeline)}.");
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void Pipeline_MethodCalledBeforeInitialisation(this EcsThrowHalper _, string methodName)
|
internal static void Pipeline_MethodCalledBeforeInitialisation(string methodName)
|
||||||
{
|
{
|
||||||
throw new MethodAccessException($"It is forbidden to call {methodName}, before initialization {nameof(EcsPipeline)}.");
|
throw new MethodAccessException($"It is forbidden to call {methodName}, before initialization {nameof(EcsPipeline)}.");
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void Pipeline_MethodCalledAfterDestruction(this EcsThrowHalper _, string methodName)
|
internal static void Pipeline_MethodCalledAfterDestruction(string methodName)
|
||||||
{
|
{
|
||||||
throw new MethodAccessException($"It is forbidden to call {methodName}, after destroying {nameof(EcsPipeline)}.");
|
throw new MethodAccessException($"It is forbidden to call {methodName}, after destroying {nameof(EcsPipeline)}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void World_InvalidIncrementComponentsBalance(this EcsThrowHalper _)
|
internal static void World_InvalidIncrementComponentsBalance()
|
||||||
{
|
{
|
||||||
throw new MethodAccessException("Invalid increment components balance.");
|
throw new MethodAccessException("Invalid increment components balance.");
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void World_GroupDoesNotBelongWorld(this EcsThrowHalper _)
|
internal static void World_GroupDoesNotBelongWorld()
|
||||||
{
|
{
|
||||||
throw new MethodAccessException("The Group does not belong in this world.");
|
throw new MethodAccessException("The Group does not belong in this world.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
internal static void Ent_ThrowIsNotAlive(this EcsThrowHalper _, 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.");
|
||||||
@ -98,6 +83,7 @@ namespace DCFApixels.DragonECS
|
|||||||
throw new EcsFrameworkException($"The {entity} is not alive.");
|
throw new EcsFrameworkException($"The {entity} is not alive.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class EcsFrameworkException : Exception
|
public class EcsFrameworkException : Exception
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#pragma warning disable IDE1006
|
#pragma warning disable IDE1006
|
||||||
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using static DCFApixels.DragonECS.EcsThrowHalper;
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user