diff --git a/config.yml b/config.yml index 7b990e6..667a319 100644 --- a/config.yml +++ b/config.yml @@ -2,7 +2,7 @@ Server: Debug: false Listen: 0.0.0.0:8888 Command: - Keys: [ "j", "加入", "加入游戏", "s", "w", "c1", "c2", "c3", "c4", "r1", "r2", "r3", "m1", "m2", "m3" ] + Keys: [ "j", "加入", "加入游戏", "s", "w", "我在哪", "c1", "c2", "c3", "c4", "r1", "r2", "r3", "m1", "m2", "m3" ] UserCenterRpc: Etcd: Hosts: diff --git a/game/command/manager.go b/game/command/manager.go index 8c964e9..7d1c50b 100644 --- a/game/command/manager.go +++ b/game/command/manager.go @@ -23,7 +23,7 @@ func (m *Manager) Register(h HandlerFunc, cmd string, alias ...string) { m.handlers[cmd] = h // alias for _, s := range alias { - if _, ok := m.handlers[cmd]; ok { + if _, ok := m.handlers[s]; ok { continue } m.handlers[s] = h diff --git a/game/msg_transfer/danmaku/cmd_parser_test.go b/game/msg_transfer/danmaku/cmd_parser_test.go index 105ec02..915794c 100644 --- a/game/msg_transfer/danmaku/cmd_parser_test.go +++ b/game/msg_transfer/danmaku/cmd_parser_test.go @@ -23,6 +23,9 @@ func TestParse(t *testing.T) { "不服你咬我啊?", "红方前排速度m2b2", "c1c2c3c4c1c2c3c4", + "m2", + "b2", + "c2", } p := NewCMDParser([]string{"j", "c1", "c2", "c3", "c4", "b1", "b2", "b3", "s", "b2", "b3", "w", "m1", "m2", "m3", "加入", "加入游戏"}) diff --git a/game/msg_transfer/danmaku/msg_to_push.go b/game/msg_transfer/danmaku/msg_to_push.go index 8deda8b..2742dd4 100644 --- a/game/msg_transfer/danmaku/msg_to_push.go +++ b/game/msg_transfer/danmaku/msg_to_push.go @@ -38,7 +38,7 @@ func (h *MsgToPushHandler) Init(svc *svc.ServiceContext) { h.commandManager = command.NewManager() h.commandManager.Register(h.handleJoinGame, "j", "加入", "加入游戏") h.commandManager.Register(h.handleOutbreak, "s") - h.commandManager.Register(h.handleWai, "w") + h.commandManager.Register(h.handleWai, "w", "我在哪") h.commandManager.Register(h.handleCreateUnit, "c1", "c2", "c3", "c4") h.commandManager.Register(h.handleMove, "m1", "m2", "m3") h.commandManager.Register(h.handleMode, "r1", "r2", "r3") @@ -119,6 +119,7 @@ func (h *MsgToPushHandler) handleDanmaku(data []byte, msgKey string) { PUid: strconv.FormatInt(msgFromMq.Uid, 10), }) if err == nil { + pbUser.UId = rpcUser.User.Id pbUser.Avatar = rpcUser.User.PAvatar } else { logger.SLog.Info("rpc获取用户信息失败") diff --git a/game/msg_transfer/gift/msg_to_push.go b/game/msg_transfer/gift/msg_to_push.go index ff4818f..7e2ace7 100644 --- a/game/msg_transfer/gift/msg_to_push.go +++ b/game/msg_transfer/gift/msg_to_push.go @@ -59,6 +59,7 @@ func (h *MsgToPushHandler) handleGift(data []byte, msgKey string) { PUid: strconv.FormatInt(msgFromMq.Uid, 10), }) if err == nil { + pbUser.UId = rpcUser.User.Id pbUser.Avatar = rpcUser.User.PAvatar } else { logger.SLog.Error("rpc获取用户信息失败", err)