-onAdd/onRemove order is determined by system priority
-fixed many bug with onAdd/onRemove -onAdd/onRemove now works even when system haven't update callback
This commit is contained in:
parent
c64d621f0e
commit
280d7b8ec4
2 changed files with 148 additions and 11 deletions
|
|
@ -170,11 +170,11 @@ struct TestSystem
|
|||
//foreach(i;0..data.length)
|
||||
//writeln("Entity added ID: ",data.entites[i].id.id);
|
||||
}
|
||||
|
||||
/*
|
||||
void onRemove(EntitiesData data)
|
||||
{
|
||||
//writeln("Entity destroyed ID: ",data.entites[0].id);
|
||||
}
|
||||
}*/
|
||||
|
||||
bool onBegin()
|
||||
{
|
||||
|
|
@ -256,6 +256,57 @@ struct TestSystemWithHighPriority
|
|||
}*/
|
||||
}
|
||||
|
||||
struct Sys1
|
||||
{
|
||||
mixin ECS.System;
|
||||
|
||||
struct EntitiesData
|
||||
{
|
||||
TestComp[] comp;
|
||||
}
|
||||
|
||||
void onAdd(EntitiesData data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct Sys2
|
||||
{
|
||||
mixin ECS.System;
|
||||
|
||||
struct EntitiesData
|
||||
{
|
||||
TestComp[] comp;
|
||||
}
|
||||
|
||||
void onAdd(EntitiesData data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct Sys3
|
||||
{
|
||||
mixin ECS.System;
|
||||
|
||||
struct EntitiesData
|
||||
{
|
||||
TestComp[] comp;
|
||||
}
|
||||
|
||||
void onAdd(EntitiesData data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void update(EntitiesData data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
import std.meta;
|
||||
|
||||
struct TestSystem2
|
||||
|
|
@ -402,6 +453,9 @@ int main()
|
|||
gEM.registerSystem!TestSystemWithHighPriority(100,"fixed");
|
||||
gEM.registerSystem!TestSystem(0);
|
||||
gEM.registerSystem!ChangeTestSystem(0);
|
||||
gEM.registerSystem!Sys1(10);
|
||||
gEM.registerSystem!Sys2(-100);
|
||||
gEM.registerSystem!Sys3(-2);
|
||||
//gEM.registerSystem!TestSystemWithHighPriority(100);
|
||||
//gEM.registerSystem!TestSystem2(0);
|
||||
gEM.endRegister();
|
||||
|
|
@ -429,6 +483,10 @@ int main()
|
|||
{
|
||||
entity = gEM.addEntity(tmpl);
|
||||
writeEntityComponents(gEM.getEntity(entity.id));
|
||||
EntityManager.EntitiesBlock* block = EntityManager.instance.getMetaData(gEM.getEntity(entity.id));
|
||||
EntityManager.EntityInfo* info = block.type_info;
|
||||
writeln(info.add_listeners);
|
||||
//if(info)assert(0);
|
||||
}
|
||||
|
||||
time = MonoTime.currTime;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue