拆分战斗服务器

This commit is contained in:
huangxiaolei
2022-12-19 22:11:55 +08:00
parent cf4804c444
commit 0dc45708d6
21 changed files with 793 additions and 349 deletions

View File

@@ -9,15 +9,14 @@ import (
"time"
"hk4e/common/config"
"hk4e/common/mq"
"hk4e/gdconf"
gdc "hk4e/gs/config"
"hk4e/gs/constant"
"hk4e/gs/dao"
"hk4e/gs/game"
"hk4e/gs/mq"
"hk4e/gs/service"
"hk4e/pkg/logger"
"hk4e/protocol/cmd"
"github.com/nats-io/nats.go"
)
@@ -46,14 +45,10 @@ func Run(ctx context.Context, configFile string) error {
}
defer db.CloseDao()
netMsgInput := make(chan *cmd.NetMsg, 10000)
netMsgOutput := make(chan *cmd.NetMsg, 10000)
messageQueue := mq.NewMessageQueue(conn, netMsgInput, netMsgOutput)
messageQueue.Start()
messageQueue := mq.NewMessageQueue(mq.GS, "1")
defer messageQueue.Close()
gameManager := game.NewGameManager(db, netMsgInput, netMsgOutput)
gameManager := game.NewGameManager(db, messageQueue)
gameManager.Start()
defer gameManager.Stop()