mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2026-04-21 17:35:56 +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
|
||||
|
||||
internal static void Clear()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_metaCache.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -467,6 +467,11 @@ namespace DCFApixels.DragonECS
|
||||
public delegate void OnBuildApectHandler(object aspect, EcsMask mask);
|
||||
public static event OnBuildApectHandler OnAfterInit = delegate { };
|
||||
#endregion
|
||||
|
||||
internal static void Clear()
|
||||
{
|
||||
_staticMaskCache.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
#endregion
|
||||
|
||||
internal static void Clear()
|
||||
{
|
||||
_allWorldComponentPools.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -357,6 +357,12 @@ namespace DCFApixels.DragonECS
|
||||
instance.Inject(_injectedData);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Clear()
|
||||
{
|
||||
_Empty_Internal._injections.Clear();
|
||||
_Empty_Internal._nodes.Clear();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -53,6 +53,11 @@ namespace DCFApixels.DragonECS.Core.Internal
|
||||
return null;
|
||||
}
|
||||
public static IEnumerable<TypeCodeInfo> GetDeclaredTypes() { return _codes.Select(o => new TypeCodeInfo(o.Key, o.Value)); }
|
||||
|
||||
internal static void Clear()
|
||||
{
|
||||
_codes.Clear();
|
||||
}
|
||||
}
|
||||
#if ENABLE_IL2CPP
|
||||
[Il2CppSetOption(Option.NullChecks, false)]
|
||||
|
||||
@ -102,6 +102,11 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
return GetAllConfigs().GetEnumerator();
|
||||
}
|
||||
|
||||
internal static void Clear()
|
||||
{
|
||||
Empty._storage.Clear();
|
||||
}
|
||||
}
|
||||
public static class ConfigContainerExtensions
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user