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.

53 lines
1.1 KiB
Go

package logic
import (
"dcg/game/logic/rank"
"dcg/game/logic/room"
"dcg/game/logic/statistics"
"dcg/game/svc"
"git.noahlan.cn/northlan/ngs/component"
"strings"
)
var GameLogic *Logics
type Logics struct {
Services *component.Components
RoomManager *room.Manager
StatisticsPvP *statistics.PvP
Rank *rank.Rank
}
func Init(svcCtx *svc.ServiceContext) {
services := &component.Components{}
roomManager := room.NewRoomManager()
services.Register(roomManager,
component.WithName(roomManager.CMD()),
component.WithNameFunc(func(s string) string {
return strings.ToLower(s)
}))
statisticsPvP := statistics.NewStatisticsPvP(svcCtx)
services.Register(statisticsPvP,
component.WithName(statisticsPvP.CMD()),
component.WithNameFunc(func(s string) string {
return statisticsPvP.Prefix() + "." + strings.ToLower(s)
}))
rk := rank.NewRank(svcCtx)
services.Register(rk,
component.WithName(rk.CMD()),
component.WithNameFunc(func(s string) string {
return strings.ToLower(s)
}))
GameLogic = &Logics{
Services: services,
RoomManager: roomManager,
StatisticsPvP: statisticsPvP,
Rank: rk,
}
}