diff --git a/examples/basic/main.go b/examples/basic/main.go index f06fee3..bccb893 100644 --- a/examples/basic/main.go +++ b/examples/basic/main.go @@ -4,6 +4,7 @@ import ( "fmt" "time" + "github.com/yohamta/donburi/features/events" "joylink.club/ecs" system "joylink.club/ecs/examples/rtss/sys" ) @@ -15,4 +16,5 @@ func main() { w.StartUp() time.Sleep(5 * time.Second) + events.ProcessAllEvents(nil) } diff --git a/jl-ecs-go b/jl-ecs-go index 8ffea35..c3b9d96 160000 --- a/jl-ecs-go +++ b/jl-ecs-go @@ -1 +1 @@ -Subproject commit 8ffea356da60f2811eed5735c5733c0a24b0fbea +Subproject commit c3b9d965c607a2f29e0bdc586aba6851d4f29f13 diff --git a/system/signal_relay_system.go b/system/signal_relay_system.go deleted file mode 100644 index a7afd91..0000000 --- a/system/signal_relay_system.go +++ /dev/null @@ -1,45 +0,0 @@ -package system - -import ( - "github.com/yohamta/donburi/filter" - "joylink.club/ecs" - "joylink.club/rtsssimulation/components" - "joylink.club/rtsssimulation/umi" -) - -// 信号机继电器系统 -type SignalRelaySystem struct { - //继电器系统基类 - relaySystem - //信号机查询 - query *ecs.Query -} - -func NewSignalReplaySystem() *SignalRelaySystem { - return &SignalRelaySystem{ - relaySystem: relaySystem{relayQuery: make(map[string]*ecs.Query)}, - query: ecs.NewQuery(filter.Contains(components.SignalStateComponent)), - } -} - -// world 执行 -func (me *SignalRelaySystem) Update(world ecs.World) { - //迭代所有信号机 - me.query.Each(world, func(signalEntry *ecs.Entry) { - //key-继电器作用名,value-继电器实体 - usageRelayMapper := make(map[string]*ecs.Entry) - //迭代一个信号机关联的所有继电器 - me.getDeviceRelayQuery(signalEntry).Each(world, func(signalRelayEntry *ecs.Entry) { - relayId := components.DeviceIdentityComponent.Get(signalRelayEntry).Id - relayModel := (WorldModelStorage(world).FindById(relayId)).(umi.IRelayModel) - usageRelayMapper[relayModel.UsageName()] = signalRelayEntry - }) - //根据具体业务逻辑处理继电器 - me.dealWithRelays(world, signalEntry, usageRelayMapper) - }) -} - -// 根据具体业务逻辑处理继电器 -func (me *SignalRelaySystem) dealWithRelays(world ecs.World, signalEntry *ecs.Entry, relays map[string]*ecs.Entry) { - -} diff --git a/system/switch_zdj9_system.go b/system/switch_zdj9_system.go new file mode 100644 index 0000000..f03e33f --- /dev/null +++ b/system/switch_zdj9_system.go @@ -0,0 +1,5 @@ +package system + +// ZDJ9道岔系统 +type SwitchZdj9System struct { +}