package svc import ( "dcg/app/user_center/usercenter" "dcg/config" "dcg/game/room" "git.noahlan.cn/northlan/ngs/component" "github.com/zeromicro/go-zero/zrpc" "strings" ) type ServiceContext struct { Services *component.Components RoomManager *room.Manager UserCenterRpc usercenter.UserCenter } 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, // rpc UserCenterRpc: usercenter.NewUserCenter(zrpc.MustNewClient(config.Config.UserCenterRpc)), } }