|
|
|
package logic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"dcg/game/logic/game_status"
|
|
|
|
"dcg/game/logic/room"
|
|
|
|
"dcg/game/logic/user"
|
|
|
|
"dcg/game/logic/zhg/rank"
|
|
|
|
"dcg/game/logic/zhg/statistics"
|
|
|
|
"dcg/game/svc"
|
|
|
|
"git.noahlan.cn/northlan/ngs/component"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
var GameLogic *Logics
|
|
|
|
|
|
|
|
type Logics struct {
|
|
|
|
Services *component.Components
|
|
|
|
|
|
|
|
RoomLogic *room.Logic
|
|
|
|
StatisticsPvP *statistics.PvP
|
|
|
|
Rank *rank.Rank
|
|
|
|
UserIntegral *user.UserLogic
|
|
|
|
}
|
|
|
|
|
|
|
|
func Init(svcCtx *svc.ServiceContext) {
|
|
|
|
services := &component.Components{}
|
|
|
|
|
|
|
|
roomManager := room.NewRoomLogic()
|
|
|
|
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)
|
|
|
|
}))
|
|
|
|
|
|
|
|
userIntegral := user.NewUserIntegral(svcCtx)
|
|
|
|
services.Register(userIntegral,
|
|
|
|
component.WithName(userIntegral.CMD()),
|
|
|
|
component.WithNameFunc(func(s string) string {
|
|
|
|
return userIntegral.Prefix() + "." + strings.ToLower(s)
|
|
|
|
}))
|
|
|
|
|
|
|
|
gameStatus := game_status.NewGameStatus(svcCtx)
|
|
|
|
services.Register(gameStatus,
|
|
|
|
component.WithName(gameStatus.CMD()),
|
|
|
|
component.WithNameFunc(func(s string) string {
|
|
|
|
return strings.ToLower(s)
|
|
|
|
}))
|
|
|
|
|
|
|
|
GameLogic = &Logics{
|
|
|
|
Services: services,
|
|
|
|
RoomLogic: roomManager,
|
|
|
|
StatisticsPvP: statisticsPvP,
|
|
|
|
Rank: rk,
|
|
|
|
UserIntegral: userIntegral,
|
|
|
|
}
|
|
|
|
}
|