mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2026-04-22 01:45:55 +08:00
Add static method to clear static fields
This commit is contained in:
parent
4512245e57
commit
7b75720999
@ -623,5 +623,13 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
internal static void Clear()
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
_metaCache.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -467,6 +467,11 @@ namespace DCFApixels.DragonECS
|
|||||||
public delegate void OnBuildApectHandler(object aspect, EcsMask mask);
|
public delegate void OnBuildApectHandler(object aspect, EcsMask mask);
|
||||||
public static event OnBuildApectHandler OnAfterInit = delegate { };
|
public static event OnBuildApectHandler OnAfterInit = delegate { };
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
internal static void Clear()
|
||||||
|
{
|
||||||
|
_staticMaskCache.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region EcsAspect.Builder.Extensions
|
#region EcsAspect.Builder.Extensions
|
||||||
|
|||||||
18
src/EcsStaticCleaner.cs
Normal file
18
src/EcsStaticCleaner.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using DCFApixels.DragonECS.Core.Internal;
|
||||||
|
|
||||||
|
namespace DCFApixels.DragonECS
|
||||||
|
{
|
||||||
|
public static class EcsStaticCleaner
|
||||||
|
{
|
||||||
|
public static void ResetAll()
|
||||||
|
{
|
||||||
|
TypeMeta.Clear();
|
||||||
|
Injector.InjectionList.Clear();
|
||||||
|
// MemoryAllocator.Clear();
|
||||||
|
EcsTypeCodeManager.Clear();
|
||||||
|
ConfigContainer.Clear();
|
||||||
|
EcsAspect.Clear();
|
||||||
|
EcsWorld.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -346,5 +346,10 @@ namespace DCFApixels.DragonECS
|
|||||||
return FindPoolInstance(componentType);
|
return FindPoolInstance(componentType);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
internal static void Clear()
|
||||||
|
{
|
||||||
|
_allWorldComponentPools.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -357,6 +357,12 @@ namespace DCFApixels.DragonECS
|
|||||||
instance.Inject(_injectedData);
|
instance.Inject(_injectedData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void Clear()
|
||||||
|
{
|
||||||
|
_Empty_Internal._injections.Clear();
|
||||||
|
_Empty_Internal._nodes.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,11 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static IEnumerable<TypeCodeInfo> GetDeclaredTypes() { return _codes.Select(o => new TypeCodeInfo(o.Key, o.Value)); }
|
public static IEnumerable<TypeCodeInfo> GetDeclaredTypes() { return _codes.Select(o => new TypeCodeInfo(o.Key, o.Value)); }
|
||||||
|
|
||||||
|
internal static void Clear()
|
||||||
|
{
|
||||||
|
_codes.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#if ENABLE_IL2CPP
|
#if ENABLE_IL2CPP
|
||||||
[Il2CppSetOption(Option.NullChecks, false)]
|
[Il2CppSetOption(Option.NullChecks, false)]
|
||||||
|
|||||||
@ -102,6 +102,11 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
return GetAllConfigs().GetEnumerator();
|
return GetAllConfigs().GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void Clear()
|
||||||
|
{
|
||||||
|
Empty._storage.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static class ConfigContainerExtensions
|
public static class ConfigContainerExtensions
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user