mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
refactoring
This commit is contained in:
parent
f15de024f5
commit
ffeddfae8a
@ -4,19 +4,19 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
public interface IEcsPreInitProcess : IEcsSystem
|
||||
{
|
||||
public void PreInit(EcsPipeline pipeline);
|
||||
void PreInit(EcsPipeline pipeline);
|
||||
}
|
||||
public interface IEcsInitProcess : IEcsSystem
|
||||
{
|
||||
public void Init(EcsPipeline pipeline);
|
||||
void Init(EcsPipeline pipeline);
|
||||
}
|
||||
public interface IEcsRunProcess : IEcsSystem
|
||||
{
|
||||
public void Run(EcsPipeline pipeline);
|
||||
void Run(EcsPipeline pipeline);
|
||||
}
|
||||
public interface IEcsDestroyProcess : IEcsSystem
|
||||
{
|
||||
public void Destroy(EcsPipeline pipeline);
|
||||
void Destroy(EcsPipeline pipeline);
|
||||
}
|
||||
public interface IEcsBaseSystem : IEcsInitProcess, IEcsRunProcess, IEcsDestroyProcess { }
|
||||
|
||||
|
@ -38,16 +38,16 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
public interface IEcsPreInject : IEcsSystem
|
||||
{
|
||||
public void PreInject(object obj);
|
||||
void PreInject(object obj);
|
||||
}
|
||||
public interface IEcsInject<T> : IEcsSystem
|
||||
{
|
||||
public void Inject(T obj);
|
||||
void Inject(T obj);
|
||||
}
|
||||
public interface IEcsPreInitInjectProcess : IEcsSystem
|
||||
{
|
||||
public void OnPreInitInjectionBefore();
|
||||
public void OnPreInitInjectionAfter();
|
||||
void OnPreInitInjectionBefore();
|
||||
void OnPreInitInjectionAfter();
|
||||
}
|
||||
|
||||
namespace Internal
|
||||
@ -127,9 +127,7 @@ namespace DCFApixels.DragonECS
|
||||
EcsRunner.Destroy(injectCallbacksRunner);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPreInitInjectionBefore() { }
|
||||
|
||||
public void OnPreInitInjectionAfter()
|
||||
{
|
||||
_injectController = null;
|
||||
|
@ -6,12 +6,9 @@ namespace DCFApixels.DragonECS
|
||||
public class SystemsBlockMarkerSystem : IEcsSystem
|
||||
{
|
||||
public readonly string name;
|
||||
|
||||
public SystemsBlockMarkerSystem(string name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
public SystemsBlockMarkerSystem(string name) { this.name = name; }
|
||||
}
|
||||
|
||||
[DebugHide, DebugColor(DebugColor.Grey)]
|
||||
public class DeleteEmptyEntitesSystem : IEcsRunProcess, IEcsPreInject
|
||||
{
|
||||
@ -21,7 +18,6 @@ namespace DCFApixels.DragonECS
|
||||
if (obj is EcsWorld world)
|
||||
_worlds.Add(world);
|
||||
}
|
||||
|
||||
public void Run(EcsPipeline pipeline)
|
||||
{
|
||||
foreach (var world in _worlds)
|
||||
@ -36,7 +32,6 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
private TWorld _world;
|
||||
public void Inject(TWorld obj) => _world = obj;
|
||||
|
||||
private sealed class Subject : EcsSubject
|
||||
{
|
||||
public EcsPool<TComponent> pool;
|
||||
@ -63,7 +58,7 @@ namespace DCFApixels.DragonECS
|
||||
b.AddUnique(new DeleteOneFrameComponentSystem<TWorld, TComponent>(), AUTO_DEL_LAYER);
|
||||
return b;
|
||||
}
|
||||
/// <summary> for EcsDefaultWorld </summary>
|
||||
/// <summary>for EcsDefaultWorld</summary>
|
||||
public static EcsPipeline.Builder AutoDel<TComponent>(this EcsPipeline.Builder b)
|
||||
where TComponent : struct, IEcsComponent
|
||||
{
|
||||
|
@ -4,15 +4,15 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
public interface IEcsComponentAdd : IEcsSystem
|
||||
{
|
||||
public void OnComponentAdd<T>(int entityID);
|
||||
void OnComponentAdd<T>(int entityID);
|
||||
}
|
||||
public interface IEcsComponentWrite : IEcsSystem
|
||||
{
|
||||
public void OnComponentWrite<T>(int entityID);
|
||||
void OnComponentWrite<T>(int entityID);
|
||||
}
|
||||
public interface IEcsComponentDel : IEcsSystem
|
||||
{
|
||||
public void OnComponentDel<T>(int entityID);
|
||||
void OnComponentDel<T>(int entityID);
|
||||
}
|
||||
public interface IEcsComponentLifecycle : IEcsComponentAdd, IEcsComponentWrite, IEcsComponentDel { }
|
||||
|
||||
@ -46,11 +46,11 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
public interface IEcsEntityCreate : IEcsSystem
|
||||
{
|
||||
public void OnEntityCreate(int entityID);
|
||||
void OnEntityCreate(int entityID);
|
||||
}
|
||||
public interface IEcsEntityDestroy : IEcsSystem
|
||||
{
|
||||
public void OnEntityDestroy(int entityID);
|
||||
void OnEntityDestroy(int entityID);
|
||||
}
|
||||
public interface IEcsEntityLifecycle : IEcsEntityCreate, IEcsEntityDestroy { }
|
||||
|
||||
@ -76,11 +76,11 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
public interface IEcsWorldCreate : IEcsSystem
|
||||
{
|
||||
public void OnWorldCreate(EcsWorld world);
|
||||
void OnWorldCreate(EcsWorld world);
|
||||
}
|
||||
public interface IEcsWorldDestroy : IEcsSystem
|
||||
{
|
||||
public void OnWorldDestroy(EcsWorld world);
|
||||
void OnWorldDestroy(EcsWorld world);
|
||||
}
|
||||
public interface IEcsWorldLifecycle : IEcsWorldCreate, IEcsWorldDestroy { }
|
||||
|
||||
|
@ -19,13 +19,11 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
color = new ColorRecord(r, g, b);
|
||||
}
|
||||
|
||||
public DebugColorAttribute(DebugColor color)
|
||||
{
|
||||
this.color = new ColorRecord((int)color);
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 4)]
|
||||
private readonly struct ColorRecord // Union
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
friendlyName += ">";
|
||||
return friendlyName;
|
||||
#else
|
||||
#else //optimization for release build
|
||||
return type.Name;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user