|
|
|
package logic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"dcg/game/logic/zhg/rank"
|
|
|
|
"dcg/game/logic/zhg/statistics"
|
|
|
|
"dcg/game/room"
|
|
|
|
"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,
|
|
|
|
}
|
|
|
|
}
|