add EcsAspect events

This commit is contained in:
DCFApixels 2025-03-13 11:19:02 +08:00
parent 8b28069338
commit bf99b9f483

View File

@ -127,7 +127,6 @@ namespace DCFApixels.DragonECS
internal EcsWorld _source; internal EcsWorld _source;
internal EcsMask _mask; internal EcsMask _mask;
private bool _isBuilt = false; private bool _isBuilt = false;
//private IEcsPool[] _pools;
#region Properties #region Properties
public EcsMask Mask public EcsMask Mask
@ -232,6 +231,7 @@ namespace DCFApixels.DragonECS
builtinAspect._source = world; builtinAspect._source = world;
builtinAspect.Init(builder); builtinAspect.Init(builder);
} }
OnInit(newAspect, builder);
//Build Mask //Build Mask
if (staticMask == null) if (staticMask == null)
@ -253,6 +253,9 @@ namespace DCFApixels.DragonECS
} }
_constructorBuildersStackIndex--; _constructorBuildersStackIndex--;
OnAfterInit(newAspect, mask);
return (newAspect, mask); return (newAspect, mask);
} }
#endregion #endregion
@ -430,6 +433,14 @@ namespace DCFApixels.DragonECS
} }
} }
#endregion #endregion
#region Events
public delegate void OnInitApectHandler(object aspect, Builder builder);
public static event OnInitApectHandler OnInit = delegate { };
public delegate void OnBuildApectHandler(object aspect, EcsMask mask);
public static event OnBuildApectHandler OnAfterInit = delegate { };
#endregion
} }
#region EcsAspect.Builder.Extensions #region EcsAspect.Builder.Extensions