simple refactoring

This commit is contained in:
DCFApixels 2025-03-10 22:55:34 +08:00
parent 5ba5b7094d
commit 67fb791544
3 changed files with 38 additions and 38 deletions

View File

@ -31,39 +31,39 @@ namespace DCFApixels.DragonECS
}
#region IEcsAspectExtensions tmp
// public static class IEcsAspectExtensions
// {
// public static void Apply(this IEcsAspect aspect, short worldID, int entityID)
// {
// EcsWorld world = EcsWorld.GetWorld(worldID);
// EcsMask mask = aspect.Mask;
// foreach (var incTypeID in mask._incs)
// {
// var pool = world.FindPoolInstance(incTypeID);
// if (pool != null)
// {
// if (pool.Has(entityID) == false)
// {
// pool.AddEmpty(entityID);
// }
// }
//#if DEBUG
// else
// {
// EcsDebug.PrintWarning("Component has not been added because the pool has not been initialized yet.");
// }
//#endif
// }
// foreach (var excTypeID in mask._excs)
// {
// var pool = world.FindPoolInstance(excTypeID);
// if (pool != null && pool.Has(entityID))
// {
// pool.Del(entityID);
// }
// }
// }
// }
// public static class IEcsAspectExtensions
// {
// public static void Apply(this IEcsAspect aspect, short worldID, int entityID)
// {
// EcsWorld world = EcsWorld.GetWorld(worldID);
// EcsMask mask = aspect.Mask;
// foreach (var incTypeID in mask._incs)
// {
// var pool = world.FindPoolInstance(incTypeID);
// if (pool != null)
// {
// if (pool.Has(entityID) == false)
// {
// pool.AddEmpty(entityID);
// }
// }
//#if DEBUG
// else
// {
// EcsDebug.PrintWarning("Component has not been added because the pool has not been initialized yet.");
// }
//#endif
// }
// foreach (var excTypeID in mask._excs)
// {
// var pool = world.FindPoolInstance(excTypeID);
// if (pool != null && pool.Has(entityID))
// {
// pool.Del(entityID);
// }
// }
// }
// }
#endregion
public static partial class API
@ -227,7 +227,7 @@ namespace DCFApixels.DragonECS
//Building
TAspect newAspect = new TAspect();
EcsAspect builtinAspect = newAspect as EcsAspect;
if(builtinAspect != null)
if (builtinAspect != null)
{
builtinAspect._source = world;
builtinAspect.Init(builder);
@ -244,7 +244,7 @@ namespace DCFApixels.DragonECS
}
}
EcsMask mask = staticMask.ToMask(world);
if(builtinAspect != null)
if (builtinAspect != null)
{
builtinAspect._mask = mask;
//var pools = new IEcsPool[builder._poolsBufferCount];

View File

@ -377,7 +377,7 @@ namespace DCFApixels.DragonECS
}
finally
{
if(pair.runFinally != null)
if (pair.runFinally != null)
{
translationFinnalyCallback(pair.runFinally);
}

View File

@ -8,8 +8,8 @@ namespace DCFApixels.DragonECS
{
public partial class EcsWorld
{
private SparseArray<int> _poolTypeCode_2_CmpTypeIDs = new SparseArray<int>();
private SparseArray<int> _cmpTypeCode_2_CmpTypeIDs = new SparseArray<int>();
private readonly SparseArray<int> _poolTypeCode_2_CmpTypeIDs = new SparseArray<int>();
private readonly SparseArray<int> _cmpTypeCode_2_CmpTypeIDs = new SparseArray<int>();
internal IEcsPoolImplementation[] _pools;
internal PoolSlot[] _poolSlots;