道岔ZDJ9电路系统
This commit is contained in:
parent
4a69767c4d
commit
83c53f27f6
@ -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)
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8ffea356da60f2811eed5735c5733c0a24b0fbea
|
||||
Subproject commit c3b9d965c607a2f29e0bdc586aba6851d4f29f13
|
@ -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) {
|
||||
|
||||
}
|
5
system/switch_zdj9_system.go
Normal file
5
system/switch_zdj9_system.go
Normal file
@ -0,0 +1,5 @@
|
||||
package system
|
||||
|
||||
// ZDJ9道岔系统
|
||||
type SwitchZdj9System struct {
|
||||
}
|
Loading…
Reference in New Issue
Block a user