remove useless EcsAspectBuilderBase

This commit is contained in:
Mikhail 2024-02-11 01:28:18 +08:00
parent 186ef6bd1a
commit 6c449c94f6
4 changed files with 19 additions and 28 deletions

View File

@ -29,7 +29,7 @@ namespace DCFApixels.DragonECS
#region Builder #region Builder
protected virtual void Init(Builder b) { } protected virtual void Init(Builder b) { }
public sealed class Builder : EcsAspectBuilderBase public sealed class Builder
{ {
private EcsWorld _world; private EcsWorld _world;
private EcsMask.Builder _maskBuilder; private EcsMask.Builder _maskBuilder;
@ -87,17 +87,17 @@ namespace DCFApixels.DragonECS
} }
#region Include/Exclude/Optional/Combine #region Include/Exclude/Optional/Combine
public sealed override TPool Include<TPool>() public TPool Include<TPool>() where TPool : IEcsPoolImplementation, new()
{ {
IncludeImplicit(typeof(TPool).GetGenericArguments()[0]); IncludeImplicit(typeof(TPool).GetGenericArguments()[0]);
return _world.GetPool<TPool>(); return _world.GetPool<TPool>();
} }
public sealed override TPool Exclude<TPool>() public TPool Exclude<TPool>() where TPool : IEcsPoolImplementation, new()
{ {
ExcludeImplicit(typeof(TPool).GetGenericArguments()[0]); ExcludeImplicit(typeof(TPool).GetGenericArguments()[0]);
return _world.GetPool<TPool>(); return _world.GetPool<TPool>();
} }
public sealed override TPool Optional<TPool>() public TPool Optional<TPool>() where TPool : IEcsPoolImplementation, new()
{ {
return _world.GetPool<TPool>(); return _world.GetPool<TPool>();
} }
@ -390,13 +390,4 @@ namespace DCFApixels.DragonECS
} }
#endregion #endregion
} }
#region BuilderBase
public abstract class EcsAspectBuilderBase
{
public abstract TPool Include<TPool>() where TPool : IEcsPoolImplementation, new();
public abstract TPool Exclude<TPool>() where TPool : IEcsPoolImplementation, new();
public abstract TPool Optional<TPool>() where TPool : IEcsPoolImplementation, new();
}
#endregion
} }

View File

@ -254,17 +254,17 @@ namespace DCFApixels.DragonECS
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsHybridPool<T> Include<T>(this EcsAspectBuilderBase self) where T : IEcsHybridComponent public static EcsHybridPool<T> Include<T>(this EcsAspect.Builder self) where T : IEcsHybridComponent
{ {
return self.Include<EcsHybridPool<T>>(); return self.Include<EcsHybridPool<T>>();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsHybridPool<T> Exclude<T>(this EcsAspectBuilderBase self) where T : IEcsHybridComponent public static EcsHybridPool<T> Exclude<T>(this EcsAspect.Builder self) where T : IEcsHybridComponent
{ {
return self.Exclude<EcsHybridPool<T>>(); return self.Exclude<EcsHybridPool<T>>();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsHybridPool<T> Optional<T>(this EcsAspectBuilderBase self) where T : IEcsHybridComponent public static EcsHybridPool<T> Optional<T>(this EcsAspect.Builder self) where T : IEcsHybridComponent
{ {
return self.Optional<EcsHybridPool<T>>(); return self.Optional<EcsHybridPool<T>>();
} }
@ -283,17 +283,17 @@ namespace DCFApixels.DragonECS
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsHybridPool<T> IncludeHybrid<T>(this EcsAspectBuilderBase self) where T : IEcsHybridComponent public static EcsHybridPool<T> IncludeHybrid<T>(this EcsAspect.Builder self) where T : IEcsHybridComponent
{ {
return self.Include<EcsHybridPool<T>>(); return self.Include<EcsHybridPool<T>>();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsHybridPool<T> ExcludeHybrid<T>(this EcsAspectBuilderBase self) where T : IEcsHybridComponent public static EcsHybridPool<T> ExcludeHybrid<T>(this EcsAspect.Builder self) where T : IEcsHybridComponent
{ {
return self.Exclude<EcsHybridPool<T>>(); return self.Exclude<EcsHybridPool<T>>();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsHybridPool<T> OptionalHybrid<T>(this EcsAspectBuilderBase self) where T : IEcsHybridComponent public static EcsHybridPool<T> OptionalHybrid<T>(this EcsAspect.Builder self) where T : IEcsHybridComponent
{ {
return self.Optional<EcsHybridPool<T>>(); return self.Optional<EcsHybridPool<T>>();
} }

View File

@ -239,17 +239,17 @@ namespace DCFApixels.DragonECS
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsPool<TComponent> Include<TComponent>(this EcsAspectBuilderBase self) where TComponent : struct, IEcsComponent public static EcsPool<TComponent> Include<TComponent>(this EcsAspect.Builder self) where TComponent : struct, IEcsComponent
{ {
return self.Include<EcsPool<TComponent>>(); return self.Include<EcsPool<TComponent>>();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsPool<TComponent> Exclude<TComponent>(this EcsAspectBuilderBase self) where TComponent : struct, IEcsComponent public static EcsPool<TComponent> Exclude<TComponent>(this EcsAspect.Builder self) where TComponent : struct, IEcsComponent
{ {
return self.Exclude<EcsPool<TComponent>>(); return self.Exclude<EcsPool<TComponent>>();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsPool<TComponent> Optional<TComponent>(this EcsAspectBuilderBase self) where TComponent : struct, IEcsComponent public static EcsPool<TComponent> Optional<TComponent>(this EcsAspect.Builder self) where TComponent : struct, IEcsComponent
{ {
return self.Optional<EcsPool<TComponent>>(); return self.Optional<EcsPool<TComponent>>();
} }

View File

@ -213,17 +213,17 @@ namespace DCFApixels.DragonECS
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsTagPool<TTagComponent> Include<TTagComponent>(this EcsAspectBuilderBase self) where TTagComponent : struct, IEcsTagComponent public static EcsTagPool<TTagComponent> Include<TTagComponent>(this EcsAspect.Builder self) where TTagComponent : struct, IEcsTagComponent
{ {
return self.Include<EcsTagPool<TTagComponent>>(); return self.Include<EcsTagPool<TTagComponent>>();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsTagPool<TTagComponent> Exclude<TTagComponent>(this EcsAspectBuilderBase self) where TTagComponent : struct, IEcsTagComponent public static EcsTagPool<TTagComponent> Exclude<TTagComponent>(this EcsAspect.Builder self) where TTagComponent : struct, IEcsTagComponent
{ {
return self.Exclude<EcsTagPool<TTagComponent>>(); return self.Exclude<EcsTagPool<TTagComponent>>();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsTagPool<TTagComponent> Optional<TTagComponent>(this EcsAspectBuilderBase self) where TTagComponent : struct, IEcsTagComponent public static EcsTagPool<TTagComponent> Optional<TTagComponent>(this EcsAspect.Builder self) where TTagComponent : struct, IEcsTagComponent
{ {
return self.Optional<EcsTagPool<TTagComponent>>(); return self.Optional<EcsTagPool<TTagComponent>>();
} }
@ -242,17 +242,17 @@ namespace DCFApixels.DragonECS
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsTagPool<TTagComponent> IncludeTag<TTagComponent>(this EcsAspectBuilderBase self) where TTagComponent : struct, IEcsTagComponent public static EcsTagPool<TTagComponent> IncludeTag<TTagComponent>(this EcsAspect.Builder self) where TTagComponent : struct, IEcsTagComponent
{ {
return self.Include<EcsTagPool<TTagComponent>>(); return self.Include<EcsTagPool<TTagComponent>>();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsTagPool<TTagComponent> ExcludeTag<TTagComponent>(this EcsAspectBuilderBase self) where TTagComponent : struct, IEcsTagComponent public static EcsTagPool<TTagComponent> ExcludeTag<TTagComponent>(this EcsAspect.Builder self) where TTagComponent : struct, IEcsTagComponent
{ {
return self.Exclude<EcsTagPool<TTagComponent>>(); return self.Exclude<EcsTagPool<TTagComponent>>();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static EcsTagPool<TTagComponent> OptionalTag<TTagComponent>(this EcsAspectBuilderBase self) where TTagComponent : struct, IEcsTagComponent public static EcsTagPool<TTagComponent> OptionalTag<TTagComponent>(this EcsAspect.Builder self) where TTagComponent : struct, IEcsTagComponent
{ {
return self.Optional<EcsTagPool<TTagComponent>>(); return self.Optional<EcsTagPool<TTagComponent>>();
} }