From 0621d663e01c02d920ee95101a09641a17eb5720 Mon Sep 17 00:00:00 2001 From: NorthLan <6995syu@163.com> Date: Sat, 28 May 2022 01:05:18 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B8=B8=E6=88=8F=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=99=A8=EF=BC=8C=E6=88=BF=E9=97=B4=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=99=A8=EF=BC=8C=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86=E5=99=A8?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config-dev.yml | 51 ++ game/common.go | 34 - game/live_logic/common_handler.go | 20 +- game/live_logic/logic.go | 11 +- game/live_logic/manager.go | 7 +- game/live_logic/zhg_handler.go | 29 +- game/live_logic/zhghz_handler.go | 47 +- game/logic/game_status/game_status.go | 5 +- game/logic/init.go | 11 +- game/logic/room/manager.go | 14 +- game/logic/user/user_integral.go | 2 +- game/manager/data.go | 52 +- game/manager/data_manager.go | 28 +- game/manager/manager.go | 104 ++- game/manager/room.go | 52 ++ game/manager/room_manager.go | 167 ++--- game/manager/vars.go | 7 - game/msg_transfer/gift_to_push.go | 2 +- game/msg_transfer/msg_to_push.go | 2 +- game/msg_transfer/nobility_transfer.go | 2 +- game/msg_transfer/reward_transfer.go | 7 +- game/pb/common/Common.cs | 927 ++++++++++++++++++++++++- game/pb/common/common.pb.go | 472 ++++++++++--- game/pb/common/common.proto | 27 + game/pb/gen.bat | 2 +- game/pb/room/Room.cs | 10 +- game/pb/room/room.pb.go | 12 +- game/pb/room/room.proto | 1 + go.mod | 12 +- go.sum | 24 +- main.go | 2 + pkg/cmd/cmd_parser.go | 1 - 32 files changed, 1704 insertions(+), 440 deletions(-) delete mode 100644 game/common.go create mode 100644 game/manager/room.go delete mode 100644 game/manager/vars.go diff --git a/config-dev.yml b/config-dev.yml index ddb2e80..e381cf0 100644 --- a/config-dev.yml +++ b/config-dev.yml @@ -43,6 +43,57 @@ Game: Commands: [ "j", "加入", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "w", "我在哪", "m1", "m2", "m3", "m4", "f", "开炮" ] Zhgfb: Commands: [ ] + Zhgzd: + Commands: [ "j", "加入", "加入游戏", "w", "我在哪", "s", "s1", "s2", "s3", "s4", "c1", "c2", "c3", "c4", "r1", "r2", "r3", "r4", "p0", "p1", "p2", "p3", "p4", "p5" ] + CommandUnitDict: + 1: "001" + 2: "003" + 3: "004" + 4: "006" + CommandCostDict: + s: + Common: 1 + Units: + "001": 2 + "003": 3 + "004": 3 + "006": 2 + c: + Common: 1 + r: + Common: 1 + p: + Common: 1 + DispatchCountDict: + "001": 5 + "003": 5 + "004": 3 + "006": 3 + GiftEffect: + StrategicMaximal: + # 这个好诶 10电池 1元 + GiftIds: [ 30758,30971,31213,31478] + Addon: 2 + Limit: 5 + StrategicRecover: + # 打call 5电池 0.5元 + GiftIds: [ 31278,31037,31212,31485 ] + Addon: 1 + Duration: 5 + Limit: 10 + SupportSkill: + # 辣条随机 免费 + - GiftIds: [1] + SkillIds: ["S0001", "S0002", "S0003", "S0005"] + # 小花花 - 火墙 1电池 0.1元 + - GiftIds: [31036, 31476] + SkillIds: ["S0001"] + # 牛哇牛哇 - 雷击 1电池 0.1元 + - GiftIds: [31225, 31214, 31039, 31202, 31477] + SkillIds: ["S0003"] + # i了i了 - 箭雨 1电池 0.1元 + - GiftIds: [ 31060, 31216 ] + SkillIds: [ "S0002" ] Log: Console: Level: debug diff --git a/game/common.go b/game/common.go deleted file mode 100644 index 380fce9..0000000 --- a/game/common.go +++ /dev/null @@ -1,34 +0,0 @@ -package game - -import ( - "dcg/config" - pbRoom "dcg/game/pb/room" - "errors" -) - -// LivePair 直播间ID 与 游戏类型 映射关系 -var ( - LivePair map[int64]pbRoom.GameType - defaultGameType = pbRoom.GameType_ZHG -) - -func init() { - LivePair = make(map[int64]pbRoom.GameType) -} - -func CacheGameType(roomId int64, gameType pbRoom.GameType) { - LivePair[roomId] = gameType -} - -//goland:noinspection GoNameStartsWithPackageName -func GameTypeByLiveRoomId(roomId int64) (pbRoom.GameType, error) { - if gameType, ok := LivePair[roomId]; ok { - return gameType, nil - } else { - modeCfg := config.Config.Game.ModeDict - if gtInt, ok := modeCfg[roomId]; ok { - return pbRoom.GameType(gtInt), nil - } - } - return defaultGameType, errors.New("该直播间未加入游戏房间") -} diff --git a/game/live_logic/common_handler.go b/game/live_logic/common_handler.go index 2f88a0e..1a25b66 100644 --- a/game/live_logic/common_handler.go +++ b/game/live_logic/common_handler.go @@ -32,7 +32,7 @@ func NewCommonLiveGameLogic(svcCtx *svc.ServiceContext) *LiveGameLogic { } func (h *commonGameLogic) handleCheckIn(roomId int64, _ string, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } @@ -48,11 +48,11 @@ func (h *commonGameLogic) handleCheckIn(roomId int64, _ string, user *pbCommon.P respMsg.IntegralChange = resp.IntegralChange respMsg.IsCritical = resp.IsCritical } - room.PushToLiveRoom(roomId, "user.checkIn", respMsg) + room.Broadcast("user.checkIn", respMsg) } func (h *commonGameLogic) handleQuery(roomId int64, _ string, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } @@ -70,7 +70,7 @@ func (h *commonGameLogic) handleQuery(roomId int64, _ string, user *pbCommon.PbU }) } } - room.PushToLiveRoom(roomId, "user.query", &pbCommon.UserQueryMsg{ + room.Broadcast("user.query", &pbCommon.UserQueryMsg{ User: user, Rank: rank, TitleIds: []int64{}, @@ -78,12 +78,12 @@ func (h *commonGameLogic) handleQuery(roomId int64, _ string, user *pbCommon.PbU } func (h *commonGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } // 1. 发送通用礼物消息 - room.PushToLiveRoom(roomId, "live.gift.common", &pbCommon.GiftMsg{ + room.Broadcast("live.gift.common", &pbCommon.GiftMsg{ User: user, GiftId: gift.GiftId, Num: gift.Num, @@ -110,7 +110,7 @@ func (h *commonGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift * return } user.Integral = giftResp.Integral.Integral // 更新最新积分 - room.PushToLiveRoom(roomId, "user.integral.change", &pbCommon.UserIntegralChanged{ + room.Broadcast("user.integral.change", &pbCommon.UserIntegralChanged{ User: user, Change: giftResp.Integral.Change, Integral: giftResp.Integral.Integral, @@ -118,12 +118,12 @@ func (h *commonGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift * } func (h *commonGameLogic) handleNobility(roomId int64, user *pbCommon.PbUser, msg *pbMq.MqGuardBuy) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } // 1. 发送通用礼物消息 - room.PushToLiveRoom(roomId, "live.gift.nobility", &pbCommon.GiftMsg{ + room.Broadcast("live.gift.nobility", &pbCommon.GiftMsg{ User: user, GiftId: msg.GiftId, Num: int64(msg.Num), @@ -151,7 +151,7 @@ func (h *commonGameLogic) handleNobility(roomId int64, user *pbCommon.PbUser, ms return } user.Integral = nobilityResp.Integral.Integral // 更新最新积分 - room.PushToLiveRoom(roomId, "user.integral.change", &pbCommon.UserIntegralChanged{ + room.Broadcast("user.integral.change", &pbCommon.UserIntegralChanged{ User: user, Change: nobilityResp.Integral.Change, Integral: nobilityResp.Integral.Integral, diff --git a/game/live_logic/logic.go b/game/live_logic/logic.go index 3da30a3..2c46d8a 100644 --- a/game/live_logic/logic.go +++ b/game/live_logic/logic.go @@ -22,6 +22,13 @@ type ( CMDHandlerFunc func(roomId int64, cmd string, user *pbCommon.PbUser) GiftHandlerFunc func(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) NobilityHandlerFunc func(roomId int64, user *pbCommon.PbUser, nobility *pbMq.MqGuardBuy) + + // GiftLogic LiveGameLogic内部礼物逻辑处理 + GiftLogic struct { + GiftIds []int64 + Fn GiftLogicFunc + } + GiftLogicFunc func(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) ) func NewLiveGameLogic(gameType pbRoom.GameType, cmdParser *cmd.Parser) *LiveGameLogic { @@ -64,12 +71,12 @@ func (l *LiveGameLogic) HandleDanmaku(pushCommonMsg bool, user *pbCommon.PbUser, l.handleCMD(dm.LiveRoomId, c, user) } } else if pushCommonMsg { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(dm.LiveRoomId) + room, err := manager.GameManager.RoomByLiveRoomId(dm.LiveRoomId) if err != nil { return } // 发送正常的非命令弹幕消息 - room.PushToLiveRoom(dm.LiveRoomId, "live.danmaku", &pbCommon.DanmakuMsg{ + room.Broadcast("live.danmaku", &pbCommon.DanmakuMsg{ User: user, Content: dm.Content, }) diff --git a/game/live_logic/manager.go b/game/live_logic/manager.go index eae8c34..89b6fda 100644 --- a/game/live_logic/manager.go +++ b/game/live_logic/manager.go @@ -1,7 +1,7 @@ package live_logic import ( - "dcg/game" + "dcg/game/manager" pbCommon "dcg/game/pb/common" pbMq "dcg/game/pb/mq" pbRoom "dcg/game/pb/room" @@ -28,6 +28,7 @@ func InitLiveManager(svcCtx *svc.ServiceContext) { // gameLogic LiveManager.RegisterLogic(NewZhgLiveGameLogic(svcCtx)) LiveManager.RegisterLogic(NewZhghzLiveGameLogic().LiveGameLogic) + LiveManager.RegisterLogic(NewZhgzdLiveGameLogic(svcCtx)) } func newManager() *Manager { @@ -41,11 +42,11 @@ func (m *Manager) RegisterLogic(h *LiveGameLogic) { } func (m *Manager) logicByLiveRoomId(roomId int64) (*LiveGameLogic, error) { - gameType, err := game.GameTypeByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return nil, errors.New("当前直播间未加入游戏房间") } - if l, ok := m.gameLogics[gameType]; ok { + if l, ok := m.gameLogics[room.GameType()]; ok { return l, nil } return nil, errors.New("未找到当前直播间支持的游戏逻辑") diff --git a/game/live_logic/zhg_handler.go b/game/live_logic/zhg_handler.go index 05c2cd9..8aa9e47 100644 --- a/game/live_logic/zhg_handler.go +++ b/game/live_logic/zhg_handler.go @@ -35,23 +35,24 @@ func NewZhgLiveGameLogic(svcCtx *svc.ServiceContext) *LiveGameLogic { } func (h *ZhgGameLogic) handleJoinGame(roomId int64, _ string, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } - room.PushToLiveRoom(roomId, "game.join", &pbGameZhg.JoinGame{User: user}) + + room.Broadcast("game.join", &pbGameZhg.JoinGame{User: user}) } func (h *ZhgGameLogic) handleOutbreak(roomId int64, _ string, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } - room.PushToLiveRoom(roomId, "game.outbreak", &pbGameZhg.Outbreak{User: user}) + room.Broadcast("game.outbreak", &pbGameZhg.Outbreak{User: user}) } func (h *ZhgGameLogic) handleOutbreakIntegral(roomId int64, cmd string, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } @@ -70,7 +71,7 @@ func (h *ZhgGameLogic) handleOutbreakIntegral(roomId int64, cmd string, user *pb costIntegral = zhgCfg.OutbreakBaseCost } - room.PushToLiveRoom(roomId, "game.outbreak.integral", &pbGameZhg.OutbreakIntegral{ + room.Broadcast("game.outbreak.integral", &pbGameZhg.OutbreakIntegral{ User: user, UnitType: string(cmdRune[1]), Count: int32(zhgCfg.OutbreakCount), @@ -84,12 +85,12 @@ func (h *ZhgGameLogic) handleCreateUnit(roomId int64, cmd string, user *pbCommon } unit := cmd[1] - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } - room.PushToLiveRoom(roomId, "game.createUnit", &pbGameZhg.CreateUnit{ + room.Broadcast("game.createUnit", &pbGameZhg.CreateUnit{ User: user, Unit: string(unit), }) @@ -101,22 +102,22 @@ func (h *ZhgGameLogic) handleMove(roomId int64, cmd string, user *pbCommon.PbUse } line := cmd[1] - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } - room.PushToLiveRoom(roomId, "game.move", &pbGameZhg.Move{ + room.Broadcast("game.move", &pbGameZhg.Move{ User: user, Line: string(line), }) } func (h *ZhgGameLogic) handleWai(roomId int64, _ string, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } - room.PushToLiveRoom(roomId, "game.wai", &pbGameZhg.Wai{User: user}) + room.Broadcast("game.wai", &pbGameZhg.Wai{User: user}) } func (h *ZhgGameLogic) handleMode(roomId int64, cmd string, user *pbCommon.PbUser) { @@ -124,11 +125,11 @@ func (h *ZhgGameLogic) handleMode(roomId int64, cmd string, user *pbCommon.PbUse return } line := cmd[1] - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } - room.PushToLiveRoom(roomId, "game.mode", &pbGameZhg.BuildingMode{ + room.Broadcast("game.mode", &pbGameZhg.BuildingMode{ User: user, Mode: string(line), }) diff --git a/game/live_logic/zhghz_handler.go b/game/live_logic/zhghz_handler.go index 7132f9d..64bdc23 100644 --- a/game/live_logic/zhghz_handler.go +++ b/game/live_logic/zhghz_handler.go @@ -17,19 +17,14 @@ type ( *LiveGameLogic // giftLogics 礼物处理 platform-cmd:logic - giftLogics map[string]giftLogic + giftLogics map[string]GiftLogic } - giftLogic struct { - giftIds []int64 - fn giftLogicFunc - } - giftLogicFunc func(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) ) func NewZhghzLiveGameLogic() *ZhghzGameLogic { resp := &ZhghzGameLogic{ LiveGameLogic: NewLiveGameLogic(pbRoom.GameType_ZHGHZ, cmd.NewCMDParser(false, config.Config.Game.Zhghz.Commands...)), - giftLogics: make(map[string]giftLogic), + giftLogics: make(map[string]GiftLogic), } resp.RegisterCMDHandler(resp.handleJoinGame, "j", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8") resp.RegisterCMDHandler(resp.handleMove, "m1", "m2", "m3", "m4") @@ -41,7 +36,7 @@ func NewZhghzLiveGameLogic() *ZhghzGameLogic { } func (h *ZhghzGameLogic) handleJoinGame(roomId int64, cmd string, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } @@ -51,14 +46,14 @@ func (h *ZhghzGameLogic) handleJoinGame(roomId int64, cmd string, user *pbCommon v, _ := strconv.Atoi(string(cmd[1])) team = int32(v) } - room.PushToLiveRoom(roomId, "game.join", &pbGameZhghz.JoinGame{ + room.Broadcast("game.join", &pbGameZhghz.JoinGame{ User: user, Team: team, }) } func (h *ZhghzGameLogic) handleMove(roomId int64, cmd string, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } @@ -68,35 +63,35 @@ func (h *ZhghzGameLogic) handleMove(roomId int64, cmd string, user *pbCommon.PbU } v, _ := strconv.Atoi(string(cmd[1])) - room.PushToLiveRoom(roomId, "game.move", &pbGameZhghz.Move{ + room.Broadcast("game.move", &pbGameZhghz.Move{ User: user, Direction: int32(v), }) } func (h *ZhghzGameLogic) handleShoot(roomId int64, _ string, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } - room.PushToLiveRoom(roomId, "game.shoot", &pbGameZhghz.Shoot{ + room.Broadcast("game.shoot", &pbGameZhghz.Shoot{ User: user, }) } func (h *ZhghzGameLogic) handleWai(roomId int64, _ string, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } - room.PushToLiveRoom(roomId, "game.wai", &pbGameZhghz.Where{User: user}) + room.Broadcast("game.wai", &pbGameZhghz.Where{User: user}) } func (h *ZhghzGameLogic) handleGiftLogic(cmd string, roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) bool { if gl, ok := h.giftLogics[cmd]; ok { - for _, id := range gl.giftIds { + for _, id := range gl.GiftIds { if gift.GiftId == id { - gl.fn(roomId, user, gift) + gl.Fn(roomId, user, gift) return true } } @@ -107,7 +102,7 @@ func (h *ZhghzGameLogic) handleGiftLogic(cmd string, roomId int64, user *pbCommo } func (h *ZhghzGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByLiveRoomId(roomId) if err != nil { return } @@ -117,10 +112,10 @@ func (h *ZhghzGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *p logicKey := fmt.Sprintf("%s-game.chargeShield", gift.Platform) if ok := h.handleGiftLogic(logicKey, roomId, user, gift); !ok { // 1 辣条 | 30607 小心心 > 魔法护盾 - h.giftLogics[logicKey] = giftLogic{ - giftIds: []int64{1, 30607}, - fn: func(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { - room.PushToLiveRoom(roomId, "game.chargeShield", &pbGameZhghz.ChargeShield{ + h.giftLogics[logicKey] = GiftLogic{ + GiftIds: []int64{1, 30607}, + Fn: func(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { + room.Broadcast("game.chargeShield", &pbGameZhghz.ChargeShield{ User: user, Points: int32(gift.Num * 1), }) @@ -131,10 +126,10 @@ func (h *ZhghzGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *p logicKey = fmt.Sprintf("%s-game.giftShoot", gift.Platform) if ok := h.handleGiftLogic(logicKey, roomId, user, gift); !ok { // 31036 小花花 | 31039 牛哇牛哇 > 魔法飞弹 - h.giftLogics[logicKey] = giftLogic{ - giftIds: []int64{31036, 31039}, - fn: func(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { - room.PushToLiveRoom(roomId, "game.giftShoot", &pbGameZhghz.ChargeShield{ + h.giftLogics[logicKey] = GiftLogic{ + GiftIds: []int64{31036, 31039}, + Fn: func(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { + room.Broadcast("game.giftShoot", &pbGameZhghz.ChargeShield{ User: user, Points: int32(gift.Num * 1), }) diff --git a/game/logic/game_status/game_status.go b/game/logic/game_status/game_status.go index 0f50d10..ed3575b 100644 --- a/game/logic/game_status/game_status.go +++ b/game/logic/game_status/game_status.go @@ -35,8 +35,9 @@ func (p *GameStatus) Prefix() string { // Status 游戏房间状态变更 func (p *GameStatus) Status(s *session.Session, msg *pbCommon.GameStatusReq) error { - manager.GameManager.DataManager.SessionGameStatus(s, manager.GameStatus(msg.Status)) - data, err := manager.GameManager.DataManager.SessionData(s) + manager.GameManager.SessionGameStatus(s, manager.GameStatus(msg.Status)) + + data, err := manager.GameManager.SessionData(s) if err != nil { return s.Response(&pbCommon.GameStatusResp{ Success: false, diff --git a/game/logic/init.go b/game/logic/init.go index ccd8462..f7f19c5 100644 --- a/game/logic/init.go +++ b/game/logic/init.go @@ -15,11 +15,6 @@ 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) { @@ -61,10 +56,6 @@ func Init(svcCtx *svc.ServiceContext) { })) GameLogic = &Logics{ - Services: services, - RoomLogic: roomManager, - StatisticsPvP: statisticsPvP, - Rank: rk, - UserIntegral: userIntegral, + Services: services, } } diff --git a/game/logic/room/manager.go b/game/logic/room/manager.go index e9c2a9b..16edb7e 100644 --- a/game/logic/room/manager.go +++ b/game/logic/room/manager.go @@ -26,7 +26,7 @@ func (m *Logic) Init() { func (m *Logic) AfterInit() { session.Lifetime.OnClosed(func(s *session.Session) { - manager.GameManager.RoomManager.SessionLeaveRoom(s) + manager.GameManager.RoomManager.LeaveRoom(s) }) } @@ -35,10 +35,18 @@ func (m *Logic) Shutdown() { } func (m *Logic) Join(s *session.Session, msg *pbRoom.JoinRoomReq) error { - if err := manager.GameManager.RoomManager.SessionJoinRoom(s, msg.GameType, msg.LiveRoomId); err != nil { + // uid - liveRoomId + err := s.Bind(msg.LiveRoomId) + if err != nil { + return err + } + + manager.GameManager.DataManager.SetSessionData(s, manager.NewGameData(msg.LiveRoomId)) + + if err = manager.GameManager.JoinRoom(s, msg.GameType, msg.LiveRoomId); err != nil { return s.Response(&pbRoom.JoinRoomResp{ Code: 500, - Result: "加入房间失败", + Result: err.Error(), }) } return s.Response(&pbRoom.JoinRoomResp{ diff --git a/game/logic/user/user_integral.go b/game/logic/user/user_integral.go index 3d04bca..61677cf 100644 --- a/game/logic/user/user_integral.go +++ b/game/logic/user/user_integral.go @@ -41,7 +41,7 @@ func (p *UserLogic) Prefix() string { func (p *UserLogic) Change(s *session.Session, msg *pbCommon.ChangeUserIntegralReq) error { integral, err := p.svcCtx.UserCenterRpc.ChangeIntegral(p.svcCtx.Ctx, &usercenter.ChangeIntegralReq{ UserId: msg.UserId, - BattleId: manager.GameManager.DataManager.BattleIdBySession(s), + BattleId: manager.GameManager.BattleIdBySession(s), Change: msg.Change, IntegralType: pb.IntegralType_Battle, }) diff --git a/game/manager/data.go b/game/manager/data.go index 3008392..002762a 100644 --- a/game/manager/data.go +++ b/game/manager/data.go @@ -1,8 +1,8 @@ package manager import ( + "git.noahlan.cn/northlan/ngs/session" "git.noahlan.cn/northlan/ntools-go/uuid" - "sync" ) type GameStatus int32 @@ -12,39 +12,41 @@ const ( GameEnded // 游戏已结束 ) -type GameData struct { - battleId int64 // 战局ID - current GameStatus // 当前战局状态 - mutex sync.RWMutex // 锁 +type DataFilter func(session *session.Session, data *Data) bool + +// Data is Session data +type Data struct { + liveRoomId int64 // Session 对应 直播间ID + battleId int64 // 战局ID + currentStatus GameStatus // 当前战局状态 } -func NewGameData() *GameData { - return &GameData{ - current: GameEnded, +func NewGameData(liveRoomId int64) *Data { + return &Data{ + liveRoomId: liveRoomId, + currentStatus: GameEnded, } } -func (m *GameData) SetStatus(status GameStatus) GameStatus { - m.mutex.Lock() - defer m.mutex.Unlock() - m.current = status +func (m *Data) LiveRoomId() int64 { + return m.liveRoomId +} + +func (m *Data) BattleId() int64 { + return m.battleId +} + +func (m *Data) CurrentStatus() GameStatus { + return m.currentStatus +} + +func (m *Data) SetStatus(status GameStatus) GameStatus { + m.currentStatus = status if status == GameStarted { m.battleId = uuid.NextId() } else if status == GameEnded { m.battleId = 0 } - return m.current -} - -func (m *GameData) Status() GameStatus { - m.mutex.RLock() - defer m.mutex.RUnlock() - return m.current -} - -func (m *GameData) BattleId() int64 { - m.mutex.RLock() - defer m.mutex.RUnlock() - return m.battleId + return m.currentStatus } diff --git a/game/manager/data_manager.go b/game/manager/data_manager.go index ae794ed..4816411 100644 --- a/game/manager/data_manager.go +++ b/game/manager/data_manager.go @@ -5,6 +5,10 @@ import ( "git.noahlan.cn/northlan/ngs/session" ) +const ( + DataKey = "DATA" +) + type DataManager struct { } @@ -12,25 +16,19 @@ func NewDataManager() *DataManager { return &DataManager{} } -func (m *DataManager) SessionGameStatus(session *session.Session, status GameStatus) GameStatus { - if data, err := m.SessionData(session); err != nil { - return GameEnded - } else { - return data.SetStatus(status) +func (m *DataManager) SessionGameStatus(session *session.Session, status GameStatus) { + if data, err := m.SessionData(session); err == nil { + data.SetStatus(status) } } -func (m *DataManager) SessionData(session *session.Session) (*GameData, error) { - if !session.HasKey(DataKey) { - return nil, errors.New("session中无data数据") - } - return session.Value(DataKey).(*GameData), nil +func (m *DataManager) SetSessionData(s *session.Session, data *Data) { + s.Set(DataKey, data) } -func (m *DataManager) BattleIdBySession(session *session.Session) int64 { - data, err := m.SessionData(session) - if err != nil { - return 0 +func (m *DataManager) SessionData(session *session.Session) (*Data, error) { + if !session.HasKey(DataKey) { + return nil, errors.New("session中无data数据") } - return data.BattleId() + return session.Value(DataKey).(*Data), nil } diff --git a/game/manager/manager.go b/game/manager/manager.go index 441f36f..33039aa 100644 --- a/game/manager/manager.go +++ b/game/manager/manager.go @@ -1,48 +1,110 @@ package manager +import ( + pbRoom "dcg/game/pb/room" + "dcg/game/svc" + "errors" + "fmt" + "git.noahlan.cn/northlan/ngs/session" +) + var GameManager *gameManager type ( gameManager struct { - RoomManager *RoomManager // 房间管理器 - DataManager *DataManager // 数据管理器(Session) + svcCtx *svc.ServiceContext // svcCtx + + *RoomManager // 房间管理器 + *DataManager // 数据管理器(Session) } ) -func init() { - GameManager = newGameManager() +func Init(svcCtx *svc.ServiceContext) { + GameManager = newGameManager(svcCtx) } -func newGameManager() *gameManager { +func newGameManager(svcCtx *svc.ServiceContext) *gameManager { return &gameManager{ + svcCtx: svcCtx, RoomManager: NewRoomManager(), + DataManager: NewDataManager(), } } +func (m *gameManager) JoinRoom(s *session.Session, gameType pbRoom.GameType, liveRoomId int64) error { + room := m.RoomManager.RetrieveRoomByType(gameType) + + var exists bool + room.PeekMembers(func(_ int64, s *session.Session) bool { + data, err := m.DataManager.SessionData(s) + if err != nil { + return true + } + if data.LiveRoomId() == liveRoomId { + exists = true + return false + } + return true + }) + if !exists { + return room.Add(s) + } + return errors.New(fmt.Sprintf("session [%v] 已在房间 [%d] 中,不能再次加入", s, room.ID())) +} + +// SessionByDataFilter 通过 session数据过滤器 获取session,data +func (m *gameManager) SessionByDataFilter(filter DataFilter) (room *Room, sess *session.Session, data *Data, err error) { + m.RoomManager.PeekAllSession(func(r *Room, session *session.Session) bool { + data, err = m.DataManager.SessionData(session) + if err != nil { + return true + } + if filter(session, data) { + room = r + sess = session + return false + } + return true + }) + return +} + +func (m *gameManager) RoomByLiveRoomId(liveRoomId int64) (*Room, error) { + room, _, _, err := m.SessionByDataFilter(func(session *session.Session, data *Data) bool { + return data.LiveRoomId() == liveRoomId + }) + if err != nil { + return nil, errors.New(fmt.Sprintf("未找到直播间 [%s] 对应游戏房间", liveRoomId)) + } + return room, nil +} + func (m *gameManager) BattleIdByLiveRoomId(liveRoomId int64) int64 { - sess, err := m.RoomManager.SessionByLiveRoomId(liveRoomId) + _, _, d, err := m.SessionByDataFilter(func(_ *session.Session, data *Data) bool { + return data.LiveRoomId() == liveRoomId + }) if err != nil { return 0 } - data, err := m.DataManager.SessionData(sess) + return d.BattleId() +} + +func (m *gameManager) BattleIdBySession(s *session.Session) int64 { + _, _, d, err := m.SessionByDataFilter(func(sess *session.Session, _ *Data) bool { + return sess.ID() == s.ID() + }) if err != nil { return 0 } - return data.BattleId() + return d.BattleId() } -func (m *gameManager) LiveRoomIdByBattleId(battleId int64) int64 { - for _, session := range m.RoomManager.Sessions() { - data, err := m.DataManager.SessionData(session) - if err != nil { - continue - } - if data.BattleId() == battleId { - if !session.HasKey(LiveRoomIdKey) { - continue - } - return session.Int64(LiveRoomIdKey) - } +func (m *gameManager) RoomByBattleId(battleId int64) (*Room, error) { + room, _, _, err := m.SessionByDataFilter(func(_ *session.Session, data *Data) bool { + return data.BattleId() == battleId + }) + if err != nil { + return nil, errors.New(fmt.Sprintf("未找到战局 [%d] 对应的游戏房间", battleId)) } - return 0 + return room, nil } diff --git a/game/manager/room.go b/game/manager/room.go new file mode 100644 index 0000000..42ecfaf --- /dev/null +++ b/game/manager/room.go @@ -0,0 +1,52 @@ +package manager + +import ( + pbRoom "dcg/game/pb/room" + "fmt" + "git.noahlan.cn/northlan/ngs" + "git.noahlan.cn/northlan/ntools-go/logger" +) + +type ( + // Room 游戏房间 + // 一种游戏类型一个房间 + // 一个房间多个客户端(此客户端可能来自于同一个直播间,没办法区分) + Room struct { + id int64 // 房间ID + gameType pbRoom.GameType // 游戏类型 + + *ngs.Group // 分组 + } +) + +func newRoom(id int64, gameType pbRoom.GameType) *Room { + return &Room{ + id: id, + gameType: gameType, + Group: ngs.NewGroup(fmt.Sprintf("Room-%s", pbRoom.GameType_name[int32(gameType)])), + } +} + +func (r *Room) ID() int64 { + return r.id +} + +func (r *Room) GameType() pbRoom.GameType { + return r.gameType +} + +// Broadcast 广播消息到该房间内所有客户端session +func (r *Room) Broadcast(route string, v interface{}) { + err := r.Group.Broadcast(route, v) + if err != nil { + logger.SLog.Errorf("推送消息到 房间[%d:%s] 失败, err:%v", r.id, pbRoom.GameType_name[int32(r.gameType)], err) + } +} + +// Multicast 根据filter条件推送消息 +func (r *Room) Multicast(route string, v interface{}, filter ngs.SessionFilter) { + err := r.Group.Multicast(route, v, filter) + if err != nil { + logger.SLog.Errorf("推送消息到 房间[%d:%s] 失败, err:%v", r.id, pbRoom.GameType_name[int32(r.gameType)], err) + } +} diff --git a/game/manager/room_manager.go b/game/manager/room_manager.go index 8b04872..fcb9392 100644 --- a/game/manager/room_manager.go +++ b/game/manager/room_manager.go @@ -1,30 +1,25 @@ package manager import ( - "dcg/game" pbRoom "dcg/game/pb/room" "errors" "fmt" - "git.noahlan.cn/northlan/ngs" "git.noahlan.cn/northlan/ngs/session" - "git.noahlan.cn/northlan/ntools-go/logger" "git.noahlan.cn/northlan/ntools-go/uuid" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" + "sync" ) -type ( - // Room 游戏房间 - // 一种游戏类型一个房间(后期有需要再进行修改) - // 一个房间可加入多个直播间客户端 - Room struct { - Id int64 // 房间ID - GameType pbRoom.GameType // 游戏类型 - - group *ngs.Group // 分组 - } +const ( + RoomKey = "ROOM" +) +type ( + // RoomManager 房间管理器 RoomManager struct { rooms map[pbRoom.GameType]*Room + + mutex sync.RWMutex } ) @@ -34,135 +29,91 @@ func NewRoomManager() *RoomManager { } } -func (m *RoomManager) Rooms() []*Room { - resp := make([]*Room, 0, len(m.rooms)) - for _, room := range m.rooms { - resp = append(resp, room) - } - return resp -} +func (m *RoomManager) Members() []*session.Session { + m.mutex.RLock() + defer m.mutex.RUnlock() -func (m *RoomManager) Sessions() []*session.Session { resp := make([]*session.Session, 0) for _, room := range m.rooms { - for _, sid := range room.group.Members() { - member, err := room.group.Member(sid) - if err != nil { - return resp - } - resp = append(resp, member) - } + resp = append(resp, room.Members()...) } return resp } -// RoomByGameType 通过游戏类型获取游戏房间 -// 若房间不存在,则创建之 -func (m *RoomManager) RoomByGameType(gameType pbRoom.GameType) *Room { - room, found := m.rooms[gameType] - if !found { - room = &Room{ - Id: uuid.NextId(), - GameType: gameType, - group: ngs.NewGroup(fmt.Sprintf("Room-%s", pbRoom.GameType_name[int32(gameType)])), +func (m *RoomManager) PeekRoom(fn func(gameType pbRoom.GameType, room *Room) bool) { + m.mutex.RLock() + defer m.mutex.RUnlock() + + for gameType, room := range m.rooms { + if !fn(gameType, room) { + break } - m.rooms[gameType] = room } - return room } -func (m *RoomManager) RoomByLiveRoomId(liveRoomId int64) (*Room, error) { - gameType, err := game.GameTypeByLiveRoomId(liveRoomId) - if err != nil { - return nil, err - } - return m.RoomByGameType(gameType), nil -} +func (m *RoomManager) PeekAllSession(fn func(*Room, *session.Session) bool) { + m.mutex.RLock() + defer m.mutex.RUnlock() -func (m *RoomManager) SessionByLiveRoomId(liveRoomId int64) (*session.Session, error) { - room, err := m.RoomByLiveRoomId(liveRoomId) - if err != nil { - return nil, err + for _, room := range m.rooms { + room.PeekMembers(func(sId int64, s *session.Session) bool { + return fn(room, s) + }) } - return room.SessionByLiveRoomId(liveRoomId) } -func (m *RoomManager) SessionJoinRoom(s *session.Session, gameType pbRoom.GameType, liveRoomId int64) error { - room := m.RoomByGameType(gameType) - game.CacheGameType(liveRoomId, gameType) +func (m *RoomManager) JoinRoom(s *session.Session, gameType pbRoom.GameType) error { + room := m.RetrieveRoomByType(gameType) + s.Set(RoomKey, room) + return room.Add(s) +} - // uid - uuid - err := s.Bind(uuid.NextId()) +func (m *RoomManager) LeaveRoom(s *session.Session) { + room, err := m.RoomBySession(s) if err != nil { - return err + return } - - s.Set(RoomKey, room) - s.Set(LiveRoomIdKey, liveRoomId) - s.Set(DataKey, NewGameData()) - - return room.group.Add(s) + _ = room.Leave(s) } -func (m *RoomManager) SessionLeaveRoom(s *session.Session) { +func (m *RoomManager) RoomBySession(s *session.Session) (*Room, error) { if !s.HasKey(RoomKey) { - return + return nil, errors.New(fmt.Sprintf("session [%d] 未加入房间", s.ID())) } room := s.Value(RoomKey).(*Room) - _ = room.group.Leave(s) + return room, nil } func (m *RoomManager) Clean() { + m.mutex.Lock() + defer m.mutex.Unlock() + for _, room := range m.rooms { - _ = room.group.LeaveAll() + _ = room.LeaveAll() } + m.rooms = make(map[pbRoom.GameType]*Room) } -// Broadcast 消息全局分发 +// Broadcast 消息全局分发,即所有房间分发 func (m *RoomManager) Broadcast(route string, msg proto.Message) { - for _, room := range m.rooms { - err := room.group.Broadcast(route, msg) - if err != nil { - logger.SLog.Errorf("broadcast message to room %d err:%+v", room.Id, err) - } - } -} + m.mutex.RLock() + defer m.mutex.RUnlock() -// PushToLiveRoom 消息Push到直播间ID指定客户端 -func (r *Room) PushToLiveRoom(liveRoomId int64, route string, msg proto.Message) { - sess, err := r.SessionByLiveRoomId(liveRoomId) - if err != nil { - return - } - err = sess.Push(route, msg) - if err != nil { - logger.SLog.Errorf("推送消息到 直播间[%d]客户端 失败, err:%+v", liveRoomId, err) + for _, room := range m.rooms { + room.Broadcast(route, msg) } } -func (r *Room) SessionByLiveRoomId(liveRoomId int64) (*session.Session, error) { - for _, sid := range r.group.Members() { - member, err := r.group.Member(sid) - if err != nil { - continue - } - if !member.HasKey(LiveRoomIdKey) { - continue - } - lRId := member.Value(LiveRoomIdKey).(int64) - if lRId == liveRoomId { - return member, nil - } - } - logger.SLog.Errorf("未找到直播间 [%d] 的客户端实例", liveRoomId) - return nil, errors.New("未找到客户端实例") -} +// RetrieveRoomByType 通过游戏类型获取游戏房间 +// 若房间不存在,则创建 +func (m *RoomManager) RetrieveRoomByType(gameType pbRoom.GameType) *Room { + m.mutex.Lock() + defer m.mutex.Unlock() -// Broadcast 房间内分发消息 -func (r *Room) Broadcast(route string, msg proto.Message) { - err := r.group.Broadcast(route, msg) - if err != nil { - logger.SLog.Errorf("推送消息到 房间[%d:%s] 失败, err:%+v", r.Id, pbRoom.GameType_name[int32(r.GameType)], err) - return + room, found := m.rooms[gameType] + if !found { + room = newRoom(uuid.NextId(), gameType) + m.rooms[gameType] = room } + return room } diff --git a/game/manager/vars.go b/game/manager/vars.go deleted file mode 100644 index b0ae295..0000000 --- a/game/manager/vars.go +++ /dev/null @@ -1,7 +0,0 @@ -package manager - -const ( - RoomKey = "ROOM" - LiveRoomIdKey = "LIVE_ROOM_ID" - DataKey = "DATA" -) diff --git a/game/msg_transfer/gift_to_push.go b/game/msg_transfer/gift_to_push.go index 8269cca..3d722b7 100644 --- a/game/msg_transfer/gift_to_push.go +++ b/game/msg_transfer/gift_to_push.go @@ -11,7 +11,7 @@ import ( "git.noahlan.cn/northlan/ntools-go/kafka" "git.noahlan.cn/northlan/ntools-go/logger" "github.com/Shopify/sarama" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "strconv" ) diff --git a/game/msg_transfer/msg_to_push.go b/game/msg_transfer/msg_to_push.go index a7ef5ad..c417c26 100644 --- a/game/msg_transfer/msg_to_push.go +++ b/game/msg_transfer/msg_to_push.go @@ -12,7 +12,7 @@ import ( "git.noahlan.cn/northlan/ntools-go/kafka" "git.noahlan.cn/northlan/ntools-go/logger" "github.com/Shopify/sarama" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "strconv" ) diff --git a/game/msg_transfer/nobility_transfer.go b/game/msg_transfer/nobility_transfer.go index c7cc53f..5f26ea9 100644 --- a/game/msg_transfer/nobility_transfer.go +++ b/game/msg_transfer/nobility_transfer.go @@ -11,7 +11,7 @@ import ( "git.noahlan.cn/northlan/ntools-go/kafka" "git.noahlan.cn/northlan/ntools-go/logger" "github.com/Shopify/sarama" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "strconv" ) diff --git a/game/msg_transfer/reward_transfer.go b/game/msg_transfer/reward_transfer.go index 936f494..b016a90 100644 --- a/game/msg_transfer/reward_transfer.go +++ b/game/msg_transfer/reward_transfer.go @@ -10,7 +10,7 @@ import ( "git.noahlan.cn/northlan/ntools-go/kafka" "git.noahlan.cn/northlan/ntools-go/logger" "github.com/Shopify/sarama" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" ) type RewardTransferHandler struct { @@ -46,12 +46,11 @@ func (h *RewardTransferHandler) handleTopic(data []byte, _ string) { logger.SLog.Error("unmarshal msg err", err) return } - roomId := manager.GameManager.LiveRoomIdByBattleId(msgFromMq.BattleId) - room, err := manager.GameManager.RoomManager.RoomByLiveRoomId(roomId) + room, err := manager.GameManager.RoomByBattleId(msgFromMq.BattleId) if err != nil { return } - room.PushToLiveRoom(roomId, "game.rewardPool", &pbCommon.RewardPoolMsg{ + room.Broadcast("game.rewardPool", &pbCommon.RewardPoolMsg{ WelfarePool: msgFromMq.WelfarePool, BattleId: msgFromMq.BattleId, InitReward: msgFromMq.InitReward, diff --git a/game/pb/common/Common.cs b/game/pb/common/Common.cs index 66cd6f5..1ef47d2 100644 --- a/game/pb/common/Common.cs +++ b/game/pb/common/Common.cs @@ -35,24 +35,29 @@ namespace Pb.Common { "DgoGdXNlcklkGAEgASgDEg4KBmNoYW5nZRgCIAEoAyJlChZDaGFuZ2VVc2Vy", "SW50ZWdyYWxSZXNwEgwKBGNvZGUYASABKAUSCwoDbXNnGAIgASgJEg4KBnVz", "ZXJJZBgDIAEoAxIOCgZjaGFuZ2UYBCABKAMSEAoIaW50ZWdyYWwYBSABKAMi", - "dAoKQ2hlY2tJbk1zZxIMCgRjb2RlGAEgASgFEgsKA21zZxgCIAEoCRIfCgR1", - "c2VyGAMgASgLMhEucGIuY29tbW9uLlBiVXNlchIWCg5pbnRlZ3JhbENoYW5n", - "ZRgEIAEoAxISCgppc0NyaXRpY2FsGAUgASgIImEKC0dpZnRQYWNrTXNnEgwK", - "BGNvZGUYASABKAUSCwoDbXNnGAIgASgJEh8KBHVzZXIYAyABKAsyES5wYi5j", - "b21tb24uUGJVc2VyEhYKDmludGVncmFsQ2hhbmdlGAQgASgDIqwBCgxVc2Vy", - "UXVlcnlNc2cSHwoEdXNlchgBIAEoCzIRLnBiLmNvbW1vbi5QYlVzZXISLgoE", - "cmFuaxgCIAMoCzIgLnBiLmNvbW1vbi5Vc2VyUXVlcnlNc2cuUmFua0l0ZW0S", - "EAoIdGl0bGVJZHMYAyADKAMaOQoIUmFua0l0ZW0SEAoIcmFua1R5cGUYASAB", - "KAUSDQoFc2NvcmUYAiABKAMSDAoEcmFuaxgDIAEoBSI+CgpEYW5tYWt1TXNn", - "Eh8KBHVzZXIYASABKAsyES5wYi5jb21tb24uUGJVc2VyEg8KB2NvbnRlbnQY", - "AiABKAkieAoHR2lmdE1zZxIfCgR1c2VyGAEgASgLMhEucGIuY29tbW9uLlBi", - "VXNlchIOCgZnaWZ0SWQYAiABKAMSCwoDbnVtGAMgASgDEhAKCGdpZnROYW1l", - "GAQgASgJEg0KBXByaWNlGAUgASgDEg4KBmlzUGFpZBgGIAEoCCKdAQoNUmV3", - "YXJkUG9vbE1zZxITCgt3ZWxmYXJlUG9vbBgBIAEoAxIQCghiYXR0bGVJZBgC", - "IAEoAxISCgppbml0UmV3YXJkGAMgASgDEhIKCmdpZnRSZXdhcmQYBCABKAMS", - "FAoMYmF0dGxlUmV3YXJkGAUgASgDEhMKC290aGVyUmV3YXJkGAYgASgDEhIK", - "CmFsbFJld2FyZHMYCiABKANCHVobZGNnL2dhbWUvcGIvY29tbW9uO3BiQ29t", - "bW9uYgZwcm90bzM=")); + "VgoSVXNlckNvaW5DaGFuZ2VkTXNnEh8KBHVzZXIYASABKAsyES5wYi5jb21t", + "b24uUGJVc2VyEg4KBmNoYW5nZRgCIAEoAxIPCgdjdXJyZW50GAMgASgDIjMK", + "EUNoYW5nZVVzZXJDb2luUmVxEg4KBnVzZXJJZBgBIAEoAxIOCgZjaGFuZ2UY", + "AiABKAMiYAoSQ2hhbmdlVXNlckNvaW5SZXNwEgwKBGNvZGUYASABKAUSCwoD", + "bXNnGAIgASgJEg4KBnVzZXJJZBgDIAEoAxIOCgZjaGFuZ2UYBCABKAMSDwoH", + "Y3VycmVudBgFIAEoAyJ0CgpDaGVja0luTXNnEgwKBGNvZGUYASABKAUSCwoD", + "bXNnGAIgASgJEh8KBHVzZXIYAyABKAsyES5wYi5jb21tb24uUGJVc2VyEhYK", + "DmludGVncmFsQ2hhbmdlGAQgASgDEhIKCmlzQ3JpdGljYWwYBSABKAgiYQoL", + "R2lmdFBhY2tNc2cSDAoEY29kZRgBIAEoBRILCgNtc2cYAiABKAkSHwoEdXNl", + "chgDIAEoCzIRLnBiLmNvbW1vbi5QYlVzZXISFgoOaW50ZWdyYWxDaGFuZ2UY", + "BCABKAMirAEKDFVzZXJRdWVyeU1zZxIfCgR1c2VyGAEgASgLMhEucGIuY29t", + "bW9uLlBiVXNlchIuCgRyYW5rGAIgAygLMiAucGIuY29tbW9uLlVzZXJRdWVy", + "eU1zZy5SYW5rSXRlbRIQCgh0aXRsZUlkcxgDIAMoAxo5CghSYW5rSXRlbRIQ", + "CghyYW5rVHlwZRgBIAEoBRINCgVzY29yZRgCIAEoAxIMCgRyYW5rGAMgASgF", + "Ij4KCkRhbm1ha3VNc2cSHwoEdXNlchgBIAEoCzIRLnBiLmNvbW1vbi5QYlVz", + "ZXISDwoHY29udGVudBgCIAEoCSJ4CgdHaWZ0TXNnEh8KBHVzZXIYASABKAsy", + "ES5wYi5jb21tb24uUGJVc2VyEg4KBmdpZnRJZBgCIAEoAxILCgNudW0YAyAB", + "KAMSEAoIZ2lmdE5hbWUYBCABKAkSDQoFcHJpY2UYBSABKAMSDgoGaXNQYWlk", + "GAYgASgIIp0BCg1SZXdhcmRQb29sTXNnEhMKC3dlbGZhcmVQb29sGAEgASgD", + "EhAKCGJhdHRsZUlkGAIgASgDEhIKCmluaXRSZXdhcmQYAyABKAMSEgoKZ2lm", + "dFJld2FyZBgEIAEoAxIUCgxiYXR0bGVSZXdhcmQYBSABKAMSEwoLb3RoZXJS", + "ZXdhcmQYBiABKAMSEgoKYWxsUmV3YXJkcxgKIAEoA0IdWhtkY2cvZ2FtZS9w", + "Yi9jb21tb247cGJDb21tb25iBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { @@ -62,6 +67,9 @@ namespace Pb.Common { new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.UserIntegralChanged), global::Pb.Common.UserIntegralChanged.Parser, new[]{ "User", "Change", "Integral" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.ChangeUserIntegralReq), global::Pb.Common.ChangeUserIntegralReq.Parser, new[]{ "UserId", "Change" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.ChangeUserIntegralResp), global::Pb.Common.ChangeUserIntegralResp.Parser, new[]{ "Code", "Msg", "UserId", "Change", "Integral" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.UserCoinChangedMsg), global::Pb.Common.UserCoinChangedMsg.Parser, new[]{ "User", "Change", "Current" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.ChangeUserCoinReq), global::Pb.Common.ChangeUserCoinReq.Parser, new[]{ "UserId", "Change" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.ChangeUserCoinResp), global::Pb.Common.ChangeUserCoinResp.Parser, new[]{ "Code", "Msg", "UserId", "Change", "Current" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.CheckInMsg), global::Pb.Common.CheckInMsg.Parser, new[]{ "Code", "Msg", "User", "IntegralChange", "IsCritical" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.GiftPackMsg), global::Pb.Common.GiftPackMsg.Parser, new[]{ "Code", "Msg", "User", "IntegralChange" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.UserQueryMsg), global::Pb.Common.UserQueryMsg.Parser, new[]{ "User", "Rank", "TitleIds" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.UserQueryMsg.Types.RankItem), global::Pb.Common.UserQueryMsg.Types.RankItem.Parser, new[]{ "RankType", "Score", "Rank" }, null, null, null, null)}), @@ -1807,6 +1815,877 @@ namespace Pb.Common { } + /// + /// UserIntegralChanged 用户金币变更通知 push -> user.coin.change + /// + public sealed partial class UserCoinChangedMsg : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UserCoinChangedMsg()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UserCoinChangedMsg() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UserCoinChangedMsg(UserCoinChangedMsg other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + change_ = other.change_; + current_ = other.current_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UserCoinChangedMsg Clone() { + return new UserCoinChangedMsg(this); + } + + /// Field number for the "user" field. + public const int UserFieldNumber = 1; + private global::Pb.Common.PbUser user_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Pb.Common.PbUser User { + get { return user_; } + set { + user_ = value; + } + } + + /// Field number for the "change" field. + public const int ChangeFieldNumber = 2; + private long change_; + /// + /// 变更量 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Change { + get { return change_; } + set { + change_ = value; + } + } + + /// Field number for the "current" field. + public const int CurrentFieldNumber = 3; + private long current_; + /// + /// 现有量 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Current { + get { return current_; } + set { + current_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as UserCoinChangedMsg); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(UserCoinChangedMsg other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (Change != other.Change) return false; + if (Current != other.Current) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (user_ != null) hash ^= User.GetHashCode(); + if (Change != 0L) hash ^= Change.GetHashCode(); + if (Current != 0L) hash ^= Current.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (user_ != null) { + output.WriteRawTag(10); + output.WriteMessage(User); + } + if (Change != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Change); + } + if (Current != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Current); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (user_ != null) { + output.WriteRawTag(10); + output.WriteMessage(User); + } + if (Change != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Change); + } + if (Current != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Current); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (user_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(User); + } + if (Change != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Change); + } + if (Current != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Current); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(UserCoinChangedMsg other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.Change != 0L) { + Change = other.Change; + } + if (other.Current != 0L) { + Current = other.Current; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + input.ReadMessage(User); + break; + } + case 16: { + Change = input.ReadInt64(); + break; + } + case 24: { + Current = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + input.ReadMessage(User); + break; + } + case 16: { + Change = input.ReadInt64(); + break; + } + case 24: { + Current = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + /// + /// ChangeUserIntegral 更新用户金币 request -> user.coin.change + /// + public sealed partial class ChangeUserCoinReq : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ChangeUserCoinReq()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChangeUserCoinReq() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChangeUserCoinReq(ChangeUserCoinReq other) : this() { + userId_ = other.userId_; + change_ = other.change_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChangeUserCoinReq Clone() { + return new ChangeUserCoinReq(this); + } + + /// Field number for the "userId" field. + public const int UserIdFieldNumber = 1; + private long userId_; + /// + /// 用户ID + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long UserId { + get { return userId_; } + set { + userId_ = value; + } + } + + /// Field number for the "change" field. + public const int ChangeFieldNumber = 2; + private long change_; + /// + /// 更新量,负数为消耗,正数为增加 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Change { + get { return change_; } + set { + change_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ChangeUserCoinReq); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ChangeUserCoinReq other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (UserId != other.UserId) return false; + if (Change != other.Change) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (UserId != 0L) hash ^= UserId.GetHashCode(); + if (Change != 0L) hash ^= Change.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (UserId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(UserId); + } + if (Change != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Change); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (UserId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(UserId); + } + if (Change != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Change); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (UserId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(UserId); + } + if (Change != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Change); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ChangeUserCoinReq other) { + if (other == null) { + return; + } + if (other.UserId != 0L) { + UserId = other.UserId; + } + if (other.Change != 0L) { + Change = other.Change; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + UserId = input.ReadInt64(); + break; + } + case 16: { + Change = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + UserId = input.ReadInt64(); + break; + } + case 16: { + Change = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + /// + /// ChangeUserIntegralResp 用户金币更新返回 + /// + public sealed partial class ChangeUserCoinResp : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ChangeUserCoinResp()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChangeUserCoinResp() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChangeUserCoinResp(ChangeUserCoinResp other) : this() { + code_ = other.code_; + msg_ = other.msg_; + userId_ = other.userId_; + change_ = other.change_; + current_ = other.current_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChangeUserCoinResp Clone() { + return new ChangeUserCoinResp(this); + } + + /// Field number for the "code" field. + public const int CodeFieldNumber = 1; + private int code_; + /// + /// code, 200表示成功,其余根据对照表 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Code { + get { return code_; } + set { + code_ = value; + } + } + + /// Field number for the "msg" field. + public const int MsgFieldNumber = 2; + private string msg_ = ""; + /// + /// 消息 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Msg { + get { return msg_; } + set { + msg_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "userId" field. + public const int UserIdFieldNumber = 3; + private long userId_; + /// + /// 用户ID + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long UserId { + get { return userId_; } + set { + userId_ = value; + } + } + + /// Field number for the "change" field. + public const int ChangeFieldNumber = 4; + private long change_; + /// + /// 变更量 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Change { + get { return change_; } + set { + change_ = value; + } + } + + /// Field number for the "current" field. + public const int CurrentFieldNumber = 5; + private long current_; + /// + /// 现有量 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Current { + get { return current_; } + set { + current_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ChangeUserCoinResp); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ChangeUserCoinResp other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Code != other.Code) return false; + if (Msg != other.Msg) return false; + if (UserId != other.UserId) return false; + if (Change != other.Change) return false; + if (Current != other.Current) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Code != 0) hash ^= Code.GetHashCode(); + if (Msg.Length != 0) hash ^= Msg.GetHashCode(); + if (UserId != 0L) hash ^= UserId.GetHashCode(); + if (Change != 0L) hash ^= Change.GetHashCode(); + if (Current != 0L) hash ^= Current.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Code != 0) { + output.WriteRawTag(8); + output.WriteInt32(Code); + } + if (Msg.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Msg); + } + if (UserId != 0L) { + output.WriteRawTag(24); + output.WriteInt64(UserId); + } + if (Change != 0L) { + output.WriteRawTag(32); + output.WriteInt64(Change); + } + if (Current != 0L) { + output.WriteRawTag(40); + output.WriteInt64(Current); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Code != 0) { + output.WriteRawTag(8); + output.WriteInt32(Code); + } + if (Msg.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Msg); + } + if (UserId != 0L) { + output.WriteRawTag(24); + output.WriteInt64(UserId); + } + if (Change != 0L) { + output.WriteRawTag(32); + output.WriteInt64(Change); + } + if (Current != 0L) { + output.WriteRawTag(40); + output.WriteInt64(Current); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Code != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + } + if (Msg.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Msg); + } + if (UserId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(UserId); + } + if (Change != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Change); + } + if (Current != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Current); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ChangeUserCoinResp other) { + if (other == null) { + return; + } + if (other.Code != 0) { + Code = other.Code; + } + if (other.Msg.Length != 0) { + Msg = other.Msg; + } + if (other.UserId != 0L) { + UserId = other.UserId; + } + if (other.Change != 0L) { + Change = other.Change; + } + if (other.Current != 0L) { + Current = other.Current; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Code = input.ReadInt32(); + break; + } + case 18: { + Msg = input.ReadString(); + break; + } + case 24: { + UserId = input.ReadInt64(); + break; + } + case 32: { + Change = input.ReadInt64(); + break; + } + case 40: { + Current = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Code = input.ReadInt32(); + break; + } + case 18: { + Msg = input.ReadString(); + break; + } + case 24: { + UserId = input.ReadInt64(); + break; + } + case 32: { + Change = input.ReadInt64(); + break; + } + case 40: { + Current = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + /// /// CheckInMsg 每日打卡 push -> user.checkIn /// @@ -1824,7 +2703,7 @@ namespace Pb.Common { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[6]; } + get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2188,7 +3067,7 @@ namespace Pb.Common { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[7]; } + get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2509,7 +3388,7 @@ namespace Pb.Common { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[8]; } + get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3056,7 +3935,7 @@ namespace Pb.Common { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[9]; } + get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[12]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3294,7 +4173,7 @@ namespace Pb.Common { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[10]; } + get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[13]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3686,7 +4565,7 @@ namespace Pb.Common { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[11]; } + get { return global::Pb.Common.CommonReflection.Descriptor.MessageTypes[14]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/game/pb/common/common.pb.go b/game/pb/common/common.pb.go index aabf0ff..8431588 100644 --- a/game/pb/common/common.pb.go +++ b/game/pb/common/common.pb.go @@ -420,6 +420,206 @@ func (x *ChangeUserIntegralResp) GetIntegral() int64 { return 0 } +// UserIntegralChanged 用户金币变更通知 push -> user.coin.change +type UserCoinChangedMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Change int64 `protobuf:"varint,2,opt,name=change,proto3" json:"change,omitempty"` // 变更量 + Current int64 `protobuf:"varint,3,opt,name=current,proto3" json:"current,omitempty"` // 现有量 +} + +func (x *UserCoinChangedMsg) Reset() { + *x = UserCoinChangedMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_common_common_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserCoinChangedMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserCoinChangedMsg) ProtoMessage() {} + +func (x *UserCoinChangedMsg) ProtoReflect() protoreflect.Message { + mi := &file_common_common_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserCoinChangedMsg.ProtoReflect.Descriptor instead. +func (*UserCoinChangedMsg) Descriptor() ([]byte, []int) { + return file_common_common_proto_rawDescGZIP(), []int{6} +} + +func (x *UserCoinChangedMsg) GetUser() *PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *UserCoinChangedMsg) GetChange() int64 { + if x != nil { + return x.Change + } + return 0 +} + +func (x *UserCoinChangedMsg) GetCurrent() int64 { + if x != nil { + return x.Current + } + return 0 +} + +// ChangeUserIntegral 更新用户金币 request -> user.coin.change +type ChangeUserCoinReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` // 用户ID + Change int64 `protobuf:"varint,2,opt,name=change,proto3" json:"change,omitempty"` // 更新量,负数为消耗,正数为增加 +} + +func (x *ChangeUserCoinReq) Reset() { + *x = ChangeUserCoinReq{} + if protoimpl.UnsafeEnabled { + mi := &file_common_common_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChangeUserCoinReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChangeUserCoinReq) ProtoMessage() {} + +func (x *ChangeUserCoinReq) ProtoReflect() protoreflect.Message { + mi := &file_common_common_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChangeUserCoinReq.ProtoReflect.Descriptor instead. +func (*ChangeUserCoinReq) Descriptor() ([]byte, []int) { + return file_common_common_proto_rawDescGZIP(), []int{7} +} + +func (x *ChangeUserCoinReq) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *ChangeUserCoinReq) GetChange() int64 { + if x != nil { + return x.Change + } + return 0 +} + +// ChangeUserIntegralResp 用户金币更新返回 +type ChangeUserCoinResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // code, 200表示成功,其余根据对照表 + Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` // 消息 + UserId int64 `protobuf:"varint,3,opt,name=userId,proto3" json:"userId,omitempty"` // 用户ID + Change int64 `protobuf:"varint,4,opt,name=change,proto3" json:"change,omitempty"` // 变更量 + Current int64 `protobuf:"varint,5,opt,name=current,proto3" json:"current,omitempty"` // 现有量 +} + +func (x *ChangeUserCoinResp) Reset() { + *x = ChangeUserCoinResp{} + if protoimpl.UnsafeEnabled { + mi := &file_common_common_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChangeUserCoinResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChangeUserCoinResp) ProtoMessage() {} + +func (x *ChangeUserCoinResp) ProtoReflect() protoreflect.Message { + mi := &file_common_common_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChangeUserCoinResp.ProtoReflect.Descriptor instead. +func (*ChangeUserCoinResp) Descriptor() ([]byte, []int) { + return file_common_common_proto_rawDescGZIP(), []int{8} +} + +func (x *ChangeUserCoinResp) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *ChangeUserCoinResp) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *ChangeUserCoinResp) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *ChangeUserCoinResp) GetChange() int64 { + if x != nil { + return x.Change + } + return 0 +} + +func (x *ChangeUserCoinResp) GetCurrent() int64 { + if x != nil { + return x.Current + } + return 0 +} + // CheckInMsg 每日打卡 push -> user.checkIn type CheckInMsg struct { state protoimpl.MessageState @@ -436,7 +636,7 @@ type CheckInMsg struct { func (x *CheckInMsg) Reset() { *x = CheckInMsg{} if protoimpl.UnsafeEnabled { - mi := &file_common_common_proto_msgTypes[6] + mi := &file_common_common_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -449,7 +649,7 @@ func (x *CheckInMsg) String() string { func (*CheckInMsg) ProtoMessage() {} func (x *CheckInMsg) ProtoReflect() protoreflect.Message { - mi := &file_common_common_proto_msgTypes[6] + mi := &file_common_common_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -462,7 +662,7 @@ func (x *CheckInMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckInMsg.ProtoReflect.Descriptor instead. func (*CheckInMsg) Descriptor() ([]byte, []int) { - return file_common_common_proto_rawDescGZIP(), []int{6} + return file_common_common_proto_rawDescGZIP(), []int{9} } func (x *CheckInMsg) GetCode() int32 { @@ -515,7 +715,7 @@ type GiftPackMsg struct { func (x *GiftPackMsg) Reset() { *x = GiftPackMsg{} if protoimpl.UnsafeEnabled { - mi := &file_common_common_proto_msgTypes[7] + mi := &file_common_common_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -528,7 +728,7 @@ func (x *GiftPackMsg) String() string { func (*GiftPackMsg) ProtoMessage() {} func (x *GiftPackMsg) ProtoReflect() protoreflect.Message { - mi := &file_common_common_proto_msgTypes[7] + mi := &file_common_common_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -541,7 +741,7 @@ func (x *GiftPackMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use GiftPackMsg.ProtoReflect.Descriptor instead. func (*GiftPackMsg) Descriptor() ([]byte, []int) { - return file_common_common_proto_rawDescGZIP(), []int{7} + return file_common_common_proto_rawDescGZIP(), []int{10} } func (x *GiftPackMsg) GetCode() int32 { @@ -586,7 +786,7 @@ type UserQueryMsg struct { func (x *UserQueryMsg) Reset() { *x = UserQueryMsg{} if protoimpl.UnsafeEnabled { - mi := &file_common_common_proto_msgTypes[8] + mi := &file_common_common_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -599,7 +799,7 @@ func (x *UserQueryMsg) String() string { func (*UserQueryMsg) ProtoMessage() {} func (x *UserQueryMsg) ProtoReflect() protoreflect.Message { - mi := &file_common_common_proto_msgTypes[8] + mi := &file_common_common_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -612,7 +812,7 @@ func (x *UserQueryMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use UserQueryMsg.ProtoReflect.Descriptor instead. func (*UserQueryMsg) Descriptor() ([]byte, []int) { - return file_common_common_proto_rawDescGZIP(), []int{8} + return file_common_common_proto_rawDescGZIP(), []int{11} } func (x *UserQueryMsg) GetUser() *PbUser { @@ -649,7 +849,7 @@ type DanmakuMsg struct { func (x *DanmakuMsg) Reset() { *x = DanmakuMsg{} if protoimpl.UnsafeEnabled { - mi := &file_common_common_proto_msgTypes[9] + mi := &file_common_common_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -662,7 +862,7 @@ func (x *DanmakuMsg) String() string { func (*DanmakuMsg) ProtoMessage() {} func (x *DanmakuMsg) ProtoReflect() protoreflect.Message { - mi := &file_common_common_proto_msgTypes[9] + mi := &file_common_common_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -675,7 +875,7 @@ func (x *DanmakuMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use DanmakuMsg.ProtoReflect.Descriptor instead. func (*DanmakuMsg) Descriptor() ([]byte, []int) { - return file_common_common_proto_rawDescGZIP(), []int{9} + return file_common_common_proto_rawDescGZIP(), []int{12} } func (x *DanmakuMsg) GetUser() *PbUser { @@ -709,7 +909,7 @@ type GiftMsg struct { func (x *GiftMsg) Reset() { *x = GiftMsg{} if protoimpl.UnsafeEnabled { - mi := &file_common_common_proto_msgTypes[10] + mi := &file_common_common_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -722,7 +922,7 @@ func (x *GiftMsg) String() string { func (*GiftMsg) ProtoMessage() {} func (x *GiftMsg) ProtoReflect() protoreflect.Message { - mi := &file_common_common_proto_msgTypes[10] + mi := &file_common_common_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -735,7 +935,7 @@ func (x *GiftMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use GiftMsg.ProtoReflect.Descriptor instead. func (*GiftMsg) Descriptor() ([]byte, []int) { - return file_common_common_proto_rawDescGZIP(), []int{10} + return file_common_common_proto_rawDescGZIP(), []int{13} } func (x *GiftMsg) GetUser() *PbUser { @@ -798,7 +998,7 @@ type RewardPoolMsg struct { func (x *RewardPoolMsg) Reset() { *x = RewardPoolMsg{} if protoimpl.UnsafeEnabled { - mi := &file_common_common_proto_msgTypes[11] + mi := &file_common_common_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -811,7 +1011,7 @@ func (x *RewardPoolMsg) String() string { func (*RewardPoolMsg) ProtoMessage() {} func (x *RewardPoolMsg) ProtoReflect() protoreflect.Message { - mi := &file_common_common_proto_msgTypes[11] + mi := &file_common_common_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -824,7 +1024,7 @@ func (x *RewardPoolMsg) ProtoReflect() protoreflect.Message { // Deprecated: Use RewardPoolMsg.ProtoReflect.Descriptor instead. func (*RewardPoolMsg) Descriptor() ([]byte, []int) { - return file_common_common_proto_rawDescGZIP(), []int{11} + return file_common_common_proto_rawDescGZIP(), []int{14} } func (x *RewardPoolMsg) GetWelfarePool() int64 { @@ -890,7 +1090,7 @@ type UserQueryMsg_RankItem struct { func (x *UserQueryMsg_RankItem) Reset() { *x = UserQueryMsg_RankItem{} if protoimpl.UnsafeEnabled { - mi := &file_common_common_proto_msgTypes[12] + mi := &file_common_common_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -903,7 +1103,7 @@ func (x *UserQueryMsg_RankItem) String() string { func (*UserQueryMsg_RankItem) ProtoMessage() {} func (x *UserQueryMsg_RankItem) ProtoReflect() protoreflect.Message { - mi := &file_common_common_proto_msgTypes[12] + mi := &file_common_common_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -916,7 +1116,7 @@ func (x *UserQueryMsg_RankItem) ProtoReflect() protoreflect.Message { // Deprecated: Use UserQueryMsg_RankItem.ProtoReflect.Descriptor instead. func (*UserQueryMsg_RankItem) Descriptor() ([]byte, []int) { - return file_common_common_proto_rawDescGZIP(), []int{8, 0} + return file_common_common_proto_rawDescGZIP(), []int{11, 0} } func (x *UserQueryMsg_RankItem) GetRankType() int32 { @@ -985,7 +1185,37 @@ var file_common_common_proto_rawDesc = []byte{ 0x0a, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, - 0x61, 0x6c, 0x22, 0xa1, 0x01, 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x4d, 0x73, + 0x61, 0x6c, 0x22, 0x6d, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, + 0x16, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, + 0x74, 0x22, 0x43, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, + 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x22, 0x84, 0x01, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6d, 0x73, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x63, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x22, 0xa1, 0x01, + 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04, + 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, + 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x6e, 0x74, + 0x65, 0x67, 0x72, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, + 0x6c, 0x22, 0x82, 0x01, 0x0a, 0x0b, 0x47, 0x69, 0x66, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, @@ -993,64 +1223,54 @@ var file_common_common_proto_rawDesc = []byte{ 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, - 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x43, 0x72, 0x69, 0x74, - 0x69, 0x63, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x43, 0x72, - 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x22, 0x82, 0x01, 0x0a, 0x0b, 0x47, 0x69, 0x66, 0x74, 0x50, - 0x61, 0x63, 0x6b, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, - 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, - 0x75, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, - 0x73, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x43, - 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x69, 0x6e, 0x74, - 0x65, 0x67, 0x72, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x22, 0xd9, 0x01, 0x0a, 0x0c, - 0x55, 0x73, 0x65, 0x72, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, - 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, - 0x73, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x73, 0x67, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x49, - 0x74, 0x65, 0x6d, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x49, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x08, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x49, 0x64, 0x73, 0x1a, 0x50, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x74, 0x65, - 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x63, - 0x6f, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x22, 0x4d, 0x0a, 0x0a, 0x44, 0x61, 0x6e, 0x6d, 0x61, - 0x6b, 0x75, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0xa4, 0x01, 0x0a, 0x07, 0x47, 0x69, 0x66, 0x74, 0x4d, - 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, - 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, - 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, - 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, - 0x6e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, - 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x22, 0xf3, 0x01, - 0x0a, 0x0d, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x50, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x12, - 0x20, 0x0a, 0x0b, 0x77, 0x65, 0x6c, 0x66, 0x61, 0x72, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x77, 0x65, 0x6c, 0x66, 0x61, 0x72, 0x65, 0x50, 0x6f, 0x6f, - 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, - 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, - 0x0a, 0x67, 0x69, 0x66, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0a, 0x67, 0x69, 0x66, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x22, 0x0a, - 0x0c, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0c, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, - 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x77, - 0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x77, 0x61, - 0x72, 0x64, 0x73, 0x42, 0x1d, 0x5a, 0x1b, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, - 0x70, 0x62, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x70, 0x62, 0x43, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x22, 0xd9, 0x01, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x34, + 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x4d, 0x73, 0x67, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, + 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x49, 0x64, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x08, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x49, 0x64, 0x73, + 0x1a, 0x50, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1a, 0x0a, 0x08, + 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, + 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x61, + 0x6e, 0x6b, 0x22, 0x4d, 0x0a, 0x0a, 0x44, 0x61, 0x6e, 0x6d, 0x61, 0x6b, 0x75, 0x4d, 0x73, 0x67, + 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x22, 0xa4, 0x01, 0x0a, 0x07, 0x47, 0x69, 0x66, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, + 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, + 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x1a, + 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, + 0x69, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x22, 0xf3, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x77, + 0x61, 0x72, 0x64, 0x50, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x20, 0x0a, 0x0b, 0x77, 0x65, + 0x6c, 0x66, 0x61, 0x72, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0b, 0x77, 0x65, 0x6c, 0x66, 0x61, 0x72, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x1a, 0x0a, 0x08, + 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x69, 0x74, + 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x69, 0x6e, + 0x69, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x69, 0x66, 0x74, + 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x67, 0x69, + 0x66, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x61, 0x74, 0x74, + 0x6c, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, + 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x20, 0x0a, 0x0b, + 0x6f, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0b, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x1e, + 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x42, 0x1d, + 0x5a, 0x1b, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x62, 0x2f, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x70, 0x62, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1065,7 +1285,7 @@ func file_common_common_proto_rawDescGZIP() []byte { return file_common_common_proto_rawDescData } -var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_common_common_proto_goTypes = []interface{}{ (*PbUser)(nil), // 0: pb.common.PbUser (*GameStatusReq)(nil), // 1: pb.common.GameStatusReq @@ -1073,27 +1293,31 @@ var file_common_common_proto_goTypes = []interface{}{ (*UserIntegralChanged)(nil), // 3: pb.common.UserIntegralChanged (*ChangeUserIntegralReq)(nil), // 4: pb.common.ChangeUserIntegralReq (*ChangeUserIntegralResp)(nil), // 5: pb.common.ChangeUserIntegralResp - (*CheckInMsg)(nil), // 6: pb.common.CheckInMsg - (*GiftPackMsg)(nil), // 7: pb.common.GiftPackMsg - (*UserQueryMsg)(nil), // 8: pb.common.UserQueryMsg - (*DanmakuMsg)(nil), // 9: pb.common.DanmakuMsg - (*GiftMsg)(nil), // 10: pb.common.GiftMsg - (*RewardPoolMsg)(nil), // 11: pb.common.RewardPoolMsg - (*UserQueryMsg_RankItem)(nil), // 12: pb.common.UserQueryMsg.RankItem + (*UserCoinChangedMsg)(nil), // 6: pb.common.UserCoinChangedMsg + (*ChangeUserCoinReq)(nil), // 7: pb.common.ChangeUserCoinReq + (*ChangeUserCoinResp)(nil), // 8: pb.common.ChangeUserCoinResp + (*CheckInMsg)(nil), // 9: pb.common.CheckInMsg + (*GiftPackMsg)(nil), // 10: pb.common.GiftPackMsg + (*UserQueryMsg)(nil), // 11: pb.common.UserQueryMsg + (*DanmakuMsg)(nil), // 12: pb.common.DanmakuMsg + (*GiftMsg)(nil), // 13: pb.common.GiftMsg + (*RewardPoolMsg)(nil), // 14: pb.common.RewardPoolMsg + (*UserQueryMsg_RankItem)(nil), // 15: pb.common.UserQueryMsg.RankItem } var file_common_common_proto_depIdxs = []int32{ 0, // 0: pb.common.UserIntegralChanged.user:type_name -> pb.common.PbUser - 0, // 1: pb.common.CheckInMsg.user:type_name -> pb.common.PbUser - 0, // 2: pb.common.GiftPackMsg.user:type_name -> pb.common.PbUser - 0, // 3: pb.common.UserQueryMsg.user:type_name -> pb.common.PbUser - 12, // 4: pb.common.UserQueryMsg.rank:type_name -> pb.common.UserQueryMsg.RankItem - 0, // 5: pb.common.DanmakuMsg.user:type_name -> pb.common.PbUser - 0, // 6: pb.common.GiftMsg.user:type_name -> pb.common.PbUser - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 0, // 1: pb.common.UserCoinChangedMsg.user:type_name -> pb.common.PbUser + 0, // 2: pb.common.CheckInMsg.user:type_name -> pb.common.PbUser + 0, // 3: pb.common.GiftPackMsg.user:type_name -> pb.common.PbUser + 0, // 4: pb.common.UserQueryMsg.user:type_name -> pb.common.PbUser + 15, // 5: pb.common.UserQueryMsg.rank:type_name -> pb.common.UserQueryMsg.RankItem + 0, // 6: pb.common.DanmakuMsg.user:type_name -> pb.common.PbUser + 0, // 7: pb.common.GiftMsg.user:type_name -> pb.common.PbUser + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_common_common_proto_init() } @@ -1175,7 +1399,7 @@ func file_common_common_proto_init() { } } file_common_common_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CheckInMsg); i { + switch v := v.(*UserCoinChangedMsg); i { case 0: return &v.state case 1: @@ -1187,7 +1411,7 @@ func file_common_common_proto_init() { } } file_common_common_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GiftPackMsg); i { + switch v := v.(*ChangeUserCoinReq); i { case 0: return &v.state case 1: @@ -1199,7 +1423,7 @@ func file_common_common_proto_init() { } } file_common_common_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserQueryMsg); i { + switch v := v.(*ChangeUserCoinResp); i { case 0: return &v.state case 1: @@ -1211,7 +1435,7 @@ func file_common_common_proto_init() { } } file_common_common_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DanmakuMsg); i { + switch v := v.(*CheckInMsg); i { case 0: return &v.state case 1: @@ -1223,7 +1447,7 @@ func file_common_common_proto_init() { } } file_common_common_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GiftMsg); i { + switch v := v.(*GiftPackMsg); i { case 0: return &v.state case 1: @@ -1235,7 +1459,7 @@ func file_common_common_proto_init() { } } file_common_common_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RewardPoolMsg); i { + switch v := v.(*UserQueryMsg); i { case 0: return &v.state case 1: @@ -1247,6 +1471,42 @@ func file_common_common_proto_init() { } } file_common_common_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DanmakuMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_common_common_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GiftMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_common_common_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RewardPoolMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_common_common_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserQueryMsg_RankItem); i { case 0: return &v.state @@ -1265,7 +1525,7 @@ func file_common_common_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_common_common_proto_rawDesc, NumEnums: 0, - NumMessages: 13, + NumMessages: 16, NumExtensions: 0, NumServices: 0, }, diff --git a/game/pb/common/common.proto b/game/pb/common/common.proto index 8edfc3a..3651d4e 100644 --- a/game/pb/common/common.proto +++ b/game/pb/common/common.proto @@ -26,6 +26,8 @@ message GameStatusResp { int64 timestamp = 3; // 时间戳 } +///////////////// 用户积分 + // UserIntegralChanged 用户积分变更 push -> user.integral.change message UserIntegralChanged { pb.common.PbUser user = 1; @@ -49,6 +51,31 @@ message ChangeUserIntegralResp { int64 integral = 5; // 当前剩余积分 } +//////////////////// 用户金币 + +// UserIntegralChanged 用户金币变更通知 push -> user.coin.change +message UserCoinChangedMsg { + pb.common.PbUser user = 1; + int64 change = 2; // 变更量 + int64 current = 3; // 现有量 +} + +// ChangeUserIntegral 更新用户金币 request -> user.coin.change +message ChangeUserCoinReq { + int64 userId = 1; // 用户ID + int64 change = 2; // 更新量,负数为消耗,正数为增加 +} + +// ChangeUserIntegralResp 用户金币更新返回 +message ChangeUserCoinResp { + int32 code = 1; // code, 200表示成功,其余根据对照表 + string msg = 2; // 消息 + + int64 userId = 3; // 用户ID + int64 change = 4; // 变更量 + int64 current = 5; // 现有量 +} + // CheckInMsg 每日打卡 push -> user.checkIn message CheckInMsg { int32 code = 1; // code, 200表示成功,其余根据对照表 diff --git a/game/pb/gen.bat b/game/pb/gen.bat index 73f847c..f00f141 100644 --- a/game/pb/gen.bat +++ b/game/pb/gen.bat @@ -2,4 +2,4 @@ protoc --go_opt=paths=source_relative ^ --go-grpc_opt=paths=source_relative ^ --go-grpc_opt=require_unimplemented_servers=false ^ --go_out=. --go-grpc_out=. --proto_path=. ^ - ./mq/*.proto ./common/*.proto ./room/*.proto ./game/zhg/*.proto ./game/zhghz/*.proto \ No newline at end of file + ./mq/*.proto ./common/*.proto ./room/*.proto ./game/zhg/*.proto ./game/zhghz/*.proto ./game/zhgzd/*.proto \ No newline at end of file diff --git a/game/pb/room/Room.cs b/game/pb/room/Room.cs index 84beb61..0056161 100644 --- a/game/pb/room/Room.cs +++ b/game/pb/room/Room.cs @@ -28,9 +28,9 @@ namespace Pb.Room { "b29tSWQYASABKAMSIwoIR2FtZVR5cGUYAiABKA4yES5wYi5yb29tLkdhbWVU", "eXBlIiwKDEpvaW5Sb29tUmVzcBIMCgRDb2RlGAEgASgDEg4KBlJlc3VsdBgC", "IAEoCSI5CgZDbGllbnQSCgoCSWQYASABKAMSIwoIR2FtZVR5cGUYAiABKA4y", - "ES5wYi5yb29tLkdhbWVUeXBlKikKCEdhbWVUeXBlEgcKA1pIRxAAEgkKBVpI", - "R0haEAESCQoFWkhHRkIQAkIZWhdkY2cvZ2FtZS9wYi9yb29tO3BiUm9vbWIG", - "cHJvdG8z")); + "ES5wYi5yb29tLkdhbWVUeXBlKjQKCEdhbWVUeXBlEgcKA1pIRxAAEgkKBVpI", + "R0haEAESCQoFWkhHRkIQAhIJCgVaSEdaRBADQhlaF2RjZy9nYW1lL3BiL3Jv", + "b207cGJSb29tYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Pb.Room.GameType), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -59,6 +59,10 @@ namespace Pb.Room { /// 指挥官-副本 /// [pbr::OriginalName("ZHGFB")] Zhgfb = 2, + /// + /// 指挥官-阵地 + /// + [pbr::OriginalName("ZHGZD")] Zhgzd = 3, } #endregion diff --git a/game/pb/room/room.pb.go b/game/pb/room/room.pb.go index ab9d00a..f25692b 100644 --- a/game/pb/room/room.pb.go +++ b/game/pb/room/room.pb.go @@ -27,6 +27,7 @@ const ( GameType_ZHG GameType = 0 // 指挥官 GameType_ZHGHZ GameType = 1 // 指挥官-海战 GameType_ZHGFB GameType = 2 // 指挥官-副本 + GameType_ZHGZD GameType = 3 // 指挥官-阵地 ) // Enum value maps for GameType. @@ -35,11 +36,13 @@ var ( 0: "ZHG", 1: "ZHGHZ", 2: "ZHGFB", + 3: "ZHGZD", } GameType_value = map[string]int32{ "ZHG": 0, "ZHGHZ": 1, "ZHGFB": 2, + "ZHGZD": 3, } ) @@ -253,12 +256,13 @@ var file_room_room_proto_rawDesc = []byte{ 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x72, 0x6f, 0x6f, 0x6d, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x52, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x2a, 0x29, 0x0a, + 0x79, 0x70, 0x65, 0x52, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x2a, 0x34, 0x0a, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x5a, 0x48, 0x47, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x5a, 0x48, 0x47, 0x48, 0x5a, 0x10, 0x01, 0x12, 0x09, 0x0a, - 0x05, 0x5a, 0x48, 0x47, 0x46, 0x42, 0x10, 0x02, 0x42, 0x19, 0x5a, 0x17, 0x64, 0x63, 0x67, 0x2f, - 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x62, 0x2f, 0x72, 0x6f, 0x6f, 0x6d, 0x3b, 0x70, 0x62, 0x52, - 0x6f, 0x6f, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x05, 0x5a, 0x48, 0x47, 0x46, 0x42, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x5a, 0x48, 0x47, 0x5a, + 0x44, 0x10, 0x03, 0x42, 0x19, 0x5a, 0x17, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, + 0x70, 0x62, 0x2f, 0x72, 0x6f, 0x6f, 0x6d, 0x3b, 0x70, 0x62, 0x52, 0x6f, 0x6f, 0x6d, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/game/pb/room/room.proto b/game/pb/room/room.proto index 30c9090..4d5e36d 100644 --- a/game/pb/room/room.proto +++ b/game/pb/room/room.proto @@ -9,6 +9,7 @@ enum GameType { ZHG = 0; // 指挥官 ZHGHZ = 1; // 指挥官-海战 ZHGFB = 2; // 指挥官-副本 + ZHGZD = 3; // 指挥官-阵地 } message JoinRoomReq { diff --git a/go.mod b/go.mod index 6ba6658..2b9f693 100644 --- a/go.mod +++ b/go.mod @@ -3,17 +3,16 @@ module dcg go 1.18 require ( - git.noahlan.cn/northlan/ngs v0.1.2 + git.noahlan.cn/northlan/ngs v1.0.2 git.noahlan.cn/northlan/ntools-go/kafka v1.0.1 git.noahlan.cn/northlan/ntools-go/logger v1.0.1 git.noahlan.cn/northlan/ntools-go/stringn v1.1.0 git.noahlan.cn/northlan/ntools-go/uuid v1.0.0 github.com/Shopify/sarama v1.32.0 - github.com/golang/protobuf v1.5.2 github.com/gookit/config/v2 v2.1.0 github.com/pkg/errors v0.9.1 github.com/zeromicro/go-zero v1.3.2 - google.golang.org/grpc v1.45.0 + google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 ) @@ -32,6 +31,7 @@ require ( github.com/go-redis/redis/v8 v8.11.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/mock v1.6.0 // indirect + github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/go-cmp v0.5.7 // indirect github.com/google/gofuzz v1.2.0 // indirect @@ -76,14 +76,14 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.21.0 // indirect golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect - golang.org/x/net v0.0.0-20220421235706-1d1ef9303861 // indirect + golang.org/x/net v0.0.0-20220526153639-5463443f8c37 // indirect golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 // indirect + google.golang.org/genproto v0.0.0-20220526192754-51939a95c655 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/api v0.20.12 // indirect diff --git a/go.sum b/go.sum index 99b69dc..42d90cd 100644 --- a/go.sum +++ b/go.sum @@ -33,6 +33,12 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= git.noahlan.cn/northlan/ngs v0.1.2 h1:0+cZIAff14VgGBqkCw5Hur9gVD6HzxTmFIvuoWvFphQ= git.noahlan.cn/northlan/ngs v0.1.2/go.mod h1:dWoj94sHXJPFE1BbCvF8hOLtMRUe0V6v7RGpGs4+iAs= +git.noahlan.cn/northlan/ngs v1.0.0 h1:u2VREPozM/+e4Pqt2+3+g0CVDBuL02UNv2Mq73xkGP0= +git.noahlan.cn/northlan/ngs v1.0.0/go.mod h1:dWoj94sHXJPFE1BbCvF8hOLtMRUe0V6v7RGpGs4+iAs= +git.noahlan.cn/northlan/ngs v1.0.1 h1:Jf0mT7N9pHTt3tgq5IhL7DxvjudJUBaH6iSS5+KB9FI= +git.noahlan.cn/northlan/ngs v1.0.1/go.mod h1:dWoj94sHXJPFE1BbCvF8hOLtMRUe0V6v7RGpGs4+iAs= +git.noahlan.cn/northlan/ngs v1.0.2 h1:ulEnuEQ/RTrsY6xbYJnQtg8Q8conCnF+/bmOFBfle4I= +git.noahlan.cn/northlan/ngs v1.0.2/go.mod h1:dWoj94sHXJPFE1BbCvF8hOLtMRUe0V6v7RGpGs4+iAs= git.noahlan.cn/northlan/ntools-go/kafka v1.0.1 h1:SDUwYRzksZ3Vcu7PTZxk+TEMF2f3gBiQEboKOhi1yfI= git.noahlan.cn/northlan/ntools-go/kafka v1.0.1/go.mod h1:RxX9JSUIr3Gbk+cvUwE5k+i08AgIK3TA9ayDJCMn2n8= git.noahlan.cn/northlan/ntools-go/logger v1.0.1 h1:+08dMbsKGECM1B7H8GqwtRzGqOl5yrNNbJYo9tFoMf0= @@ -101,6 +107,7 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -131,6 +138,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= @@ -596,8 +604,8 @@ golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220421235706-1d1ef9303861 h1:yssD99+7tqHWO5Gwh81phT+67hg+KttniBr6UnEXOY8= -golang.org/x/net v0.0.0-20220421235706-1d1ef9303861/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220526153639-5463443f8c37 h1:lUkvobShwKsOesNfWWlCS5q7fnbG1MEliIzwu886fn8= +golang.org/x/net v0.0.0-20220526153639-5463443f8c37/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -661,6 +669,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -672,8 +681,9 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= @@ -801,8 +811,8 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20220228195345-15d65a4533f7/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 h1:myaecH64R0bIEDjNORIel4iXubqzaHU1K2z8ajBwWcM= -google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220526192754-51939a95c655 h1:56rmjc5LUAanErbiNrY+s/Nd47wDQEJkpqS7i43M1I0= +google.golang.org/genproto v0.0.0-20220526192754-51939a95c655/go.mod h1:yKyY4AMRwFiC8yMMNaMi+RkCnjZJt9LoWuvhXjMs+To= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -820,8 +830,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/main.go b/main.go index 359e0b7..957ffb2 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( "dcg/config" "dcg/game/live_logic" "dcg/game/logic" + "dcg/game/manager" "dcg/game/msg_transfer" "dcg/game/svc" "flag" @@ -24,6 +25,7 @@ func main() { ctx := svc.NewServiceContext() + manager.Init(ctx) logic.Init(ctx) live_logic.InitLiveManager(ctx) diff --git a/pkg/cmd/cmd_parser.go b/pkg/cmd/cmd_parser.go index d11f6dc..dca6fbf 100644 --- a/pkg/cmd/cmd_parser.go +++ b/pkg/cmd/cmd_parser.go @@ -50,7 +50,6 @@ func (p *Parser) SetDistinct(distinct bool) { } // Parse 从弹幕内容解析命令 -// distinct 是否去重 func (p *Parser) Parse(content string) *CMD { // 移除多余空格,小写 tmpContent := strings.ToLower(strings.TrimSpace(content))