按钮
This commit is contained in:
parent
899deff8b0
commit
7891fe2ded
@ -24,11 +24,11 @@ var (
|
||||
)
|
||||
|
||||
type ButtonSystem struct {
|
||||
query *ecs.Query
|
||||
selfRestQuery *ecs.Query
|
||||
}
|
||||
|
||||
func NewButtonSystem() *ButtonSystem {
|
||||
return &ButtonSystem{query: ecs.NewQuery(filter.Contains(ButtonStateComponent))}
|
||||
return &ButtonSystem{selfRestQuery: ecs.NewQuery(filter.Contains(ButtonStateComponent, ButtonSelfRestTag))}
|
||||
}
|
||||
func NewButtonState() *ButtonState {
|
||||
return &ButtonState{Ckd: false}
|
||||
@ -36,11 +36,9 @@ func NewButtonState() *ButtonState {
|
||||
|
||||
// Update world 执行
|
||||
func (me *ButtonSystem) Update(w ecs.World) {
|
||||
me.query.Each(w, func(e *ecs.Entry) {
|
||||
if e.HasComponent(ButtonSelfRestTag) {
|
||||
state := ButtonStateComponent.Get(e)
|
||||
me.calculateSelfRest(w, e, state)
|
||||
}
|
||||
me.selfRestQuery.Each(w, func(e *ecs.Entry) {
|
||||
state := ButtonStateComponent.Get(e)
|
||||
me.calculateSelfRest(w, e, state)
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user