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

View File

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

View File

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