Prepare uses Query
This commit is contained in:
parent
052c79c904
commit
472af504e8
1 changed files with 3 additions and 9 deletions
|
@ -221,15 +221,9 @@ func (g *Game) Load(component interface{}, assets fs.FS) error {
|
||||||
func (g *Game) Prepare(component interface{}) error {
|
func (g *Game) Prepare(component interface{}) error {
|
||||||
// Postorder traversal, in case ancestors depend on descendants being
|
// Postorder traversal, in case ancestors depend on descendants being
|
||||||
// ready to answer queries.
|
// ready to answer queries.
|
||||||
if sc, ok := component.(Scanner); ok {
|
return g.Query(component, PrepperType, nil, func(c interface{}) error {
|
||||||
if err := sc.Scan(g.Prepare); err != nil {
|
return c.(Prepper).Prepare(g)
|
||||||
return err
|
})
|
||||||
}
|
|
||||||
}
|
|
||||||
if p, ok := component.(Prepper); ok {
|
|
||||||
return p.Prepare(g)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadAndPrepare first calls Load on all Loaders. Once loading is complete, it
|
// LoadAndPrepare first calls Load on all Loaders. Once loading is complete, it
|
||||||
|
|
Loading…
Reference in a new issue