mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-17 17:34:36 +08:00
add EcsWorld.GetPoolInstanceMarker
This commit is contained in:
parent
0182614819
commit
dd5a81334c
@ -83,6 +83,11 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
return GetUnchecked<PoolCache<TPool>>(worldID).Instance;
|
return GetUnchecked<PoolCache<TPool>>(worldID).Instance;
|
||||||
}
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public GetPoolInstanceMarker GetPoolInstance()
|
||||||
|
{
|
||||||
|
return new GetPoolInstanceMarker(this);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ComponentInfo
|
#region ComponentInfo
|
||||||
@ -418,6 +423,24 @@ namespace DCFApixels.DragonECS
|
|||||||
public bool locked;
|
public bool locked;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
public readonly ref struct GetPoolInstanceMarker
|
||||||
|
{
|
||||||
|
public readonly EcsWorld World;
|
||||||
|
public GetPoolInstanceMarker(EcsWorld world)
|
||||||
|
{
|
||||||
|
World = world;
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public TPool GetInstance<TPool>() where TPool : IEcsPoolImplementation, new()
|
||||||
|
{
|
||||||
|
return World.GetPoolInstance<TPool>();
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public TPool GetInstanceUnchecked<TPool>() where TPool : IEcsPoolImplementation, new()
|
||||||
|
{
|
||||||
|
return World.GetPoolInstanceUnchecked<TPool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,6 +340,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public static implicit operator EcsPool<T>(IncludeMarker a) { return a.GetInstance<EcsPool<T>>(); }
|
public static implicit operator EcsPool<T>(IncludeMarker a) { return a.GetInstance<EcsPool<T>>(); }
|
||||||
public static implicit operator EcsPool<T>(ExcludeMarker a) { return a.GetInstance<EcsPool<T>>(); }
|
public static implicit operator EcsPool<T>(ExcludeMarker a) { return a.GetInstance<EcsPool<T>>(); }
|
||||||
public static implicit operator EcsPool<T>(OptionalMarker a) { return a.GetInstance<EcsPool<T>>(); }
|
public static implicit operator EcsPool<T>(OptionalMarker a) { return a.GetInstance<EcsPool<T>>(); }
|
||||||
|
public static implicit operator EcsPool<T>(EcsWorld.GetPoolInstanceMarker a) { return a.GetInstance<EcsPool<T>>(); }
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
public static class EcsPoolExt
|
public static class EcsPoolExt
|
||||||
|
@ -291,6 +291,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public static implicit operator EcsTagPool<T>(IncludeMarker a) { return a.GetInstance<EcsTagPool<T>>(); }
|
public static implicit operator EcsTagPool<T>(IncludeMarker a) { return a.GetInstance<EcsTagPool<T>>(); }
|
||||||
public static implicit operator EcsTagPool<T>(ExcludeMarker a) { return a.GetInstance<EcsTagPool<T>>(); }
|
public static implicit operator EcsTagPool<T>(ExcludeMarker a) { return a.GetInstance<EcsTagPool<T>>(); }
|
||||||
public static implicit operator EcsTagPool<T>(OptionalMarker a) { return a.GetInstance<EcsTagPool<T>>(); }
|
public static implicit operator EcsTagPool<T>(OptionalMarker a) { return a.GetInstance<EcsTagPool<T>>(); }
|
||||||
|
public static implicit operator EcsTagPool<T>(EcsWorld.GetPoolInstanceMarker a) { return a.GetInstance<EcsTagPool<T>>(); }
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
public static class EcsTagPoolExt
|
public static class EcsTagPoolExt
|
||||||
|
Loading…
Reference in New Issue
Block a user