You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
537 B
Go
29 lines
537 B
Go
package svc
|
|
|
|
import (
|
|
"dcg/game/room"
|
|
"git.noahlan.cn/northlan/ngs/component"
|
|
"strings"
|
|
)
|
|
|
|
type ServiceContext struct {
|
|
Services *component.Components
|
|
RoomManager *room.Manager
|
|
}
|
|
|
|
func NewServiceContext() *ServiceContext {
|
|
services := &component.Components{}
|
|
|
|
roomManager := room.NewRoomManager()
|
|
services.Register(roomManager,
|
|
component.WithName("room"),
|
|
component.WithNameFunc(func(s string) string {
|
|
return strings.ToLower(s)
|
|
}))
|
|
|
|
return &ServiceContext{
|
|
Services: services,
|
|
RoomManager: roomManager,
|
|
}
|
|
}
|