|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}))
|
|
|
|
|
|
|
|
userCoin := user.NewUserCoin(svcCtx)
|
|
|
|
services.Register(userCoin,
|
|
|
|
component.WithName(userCoin.CMD()),
|
|
|
|
component.WithNameFunc(func(s string) string {
|
|
|
|
return userCoin.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,
|
|
|
|
}
|
|
|
|
}
|