mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-17 20:12:26 +08:00
服务器玩家在线信息同步
This commit is contained in:
@@ -25,34 +25,32 @@ func NewHandle(messageQueue *mq.MessageQueue) (r *Handle) {
|
||||
}
|
||||
|
||||
func (h *Handle) run() {
|
||||
for i := 0; i < 1; i++ {
|
||||
go func() {
|
||||
for {
|
||||
netMsg := <-h.messageQueue.GetNetMsg()
|
||||
if netMsg.MsgType != mq.MsgTypeGame {
|
||||
continue
|
||||
}
|
||||
if netMsg.EventId != mq.NormalMsg {
|
||||
continue
|
||||
}
|
||||
if netMsg.OriginServerType != api.GATE {
|
||||
continue
|
||||
}
|
||||
gameMsg := netMsg.GameMsg
|
||||
switch gameMsg.CmdId {
|
||||
case cmd.QueryPathReq:
|
||||
h.QueryPath(gameMsg.UserId, netMsg.OriginServerAppId, gameMsg.PayloadMessage)
|
||||
case cmd.ObstacleModifyNotify:
|
||||
h.ObstacleModifyNotify(gameMsg.UserId, netMsg.OriginServerAppId, gameMsg.PayloadMessage)
|
||||
}
|
||||
go func() {
|
||||
for {
|
||||
netMsg := <-h.messageQueue.GetNetMsg()
|
||||
if netMsg.MsgType != mq.MsgTypeGame {
|
||||
continue
|
||||
}
|
||||
}()
|
||||
}
|
||||
if netMsg.EventId != mq.NormalMsg {
|
||||
continue
|
||||
}
|
||||
if netMsg.OriginServerType != api.GATE {
|
||||
continue
|
||||
}
|
||||
gameMsg := netMsg.GameMsg
|
||||
switch gameMsg.CmdId {
|
||||
case cmd.QueryPathReq:
|
||||
h.QueryPath(gameMsg.UserId, netMsg.OriginServerAppId, gameMsg.PayloadMessage)
|
||||
case cmd.ObstacleModifyNotify:
|
||||
h.ObstacleModifyNotify(gameMsg.UserId, netMsg.OriginServerAppId, gameMsg.PayloadMessage)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// SendMsg 发送消息给客户端
|
||||
func (h *Handle) SendMsg(cmdId uint16, userId uint32, gateAppId string, payloadMsg pb.Message) {
|
||||
if userId < 100000000 || payloadMsg == nil {
|
||||
if payloadMsg == nil {
|
||||
return
|
||||
}
|
||||
gameMsg := new(mq.GameMsg)
|
||||
|
||||
Reference in New Issue
Block a user