rts-sim-module/component/singleton/repo.go
walker c4bc8c640f 重构singleton组件及相关方法接口
调整repo目录结构和命名
初步开始重构仿真实体加载
2023-12-28 16:49:28 +08:00

20 lines
339 B
Go

package singleton
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/modelrepo"
)
var WorldRepoType = ecs.NewComponentType[WorldRepo]()
type WorldRepo struct {
r modelrepo.Repo
}
func loadWorldRepo(w ecs.World, r modelrepo.Repo) {
entry := w.Entry(w.Create(WorldRepoType))
WorldRepoType.Set(entry, &WorldRepo{
r: r,
})
}