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.
31 lines
573 B
Go
31 lines
573 B
Go
package game
|
|
|
|
import (
|
|
"dcg/game/room"
|
|
"git.noahlan.cn/northlan/ngs"
|
|
"git.noahlan.cn/northlan/ngs/component"
|
|
"git.noahlan.cn/northlan/ngs/serialize/protobuf"
|
|
"strings"
|
|
)
|
|
|
|
var (
|
|
Services = &component.Components{}
|
|
|
|
roomManager = room.NewRoomManager()
|
|
)
|
|
|
|
func init() {
|
|
Services.Register(roomManager,
|
|
component.WithName("room"),
|
|
component.WithNameFunc(func(s string) string {
|
|
return strings.ToLower(s)
|
|
}))
|
|
}
|
|
|
|
func Run(listen string) {
|
|
ngs.Listen(listen,
|
|
ngs.WithComponents(Services),
|
|
ngs.WithSerializer(protobuf.NewSerializer()),
|
|
ngs.WithDebugMode())
|
|
}
|