From e0016ab71fdb605bd55f0bb4b9aa8a15f85e6378 Mon Sep 17 00:00:00 2001 From: NorthLan <6995syu@163.com> Date: Mon, 11 Jul 2022 02:04:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=EF=BC=8C?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=8D=95=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=A4=9A?= =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=EF=BC=8C=E5=A4=9A=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E5=A4=9A=E7=9B=B4=E6=92=AD=E9=97=B4=E7=AD=89=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加用户佩戴粉丝牌 添加用户舰长信息(加入游戏) 优化配置文件,区分游戏,放置于svcCtx内 规范命名 --- config-dev.yml | 28 +- config/config.go | 128 +- config/kafka_conf.go | 7 + config/zhg_config.go | 10 + config/zhgww2_config.go | 52 + config/zhgzd_config.go | 45 + game/live_logic/common_handler.go | 61 +- game/live_logic/logic.go | 146 +- game/live_logic/manager.go | 108 +- game/live_logic/option.go | 37 + game/live_logic/test_handler.go | 19 - game/live_logic/types.go | 42 + game/live_logic/ww2_handler.go | 377 +++ game/live_logic/zhg_handler.go | 151 +- game/live_logic/zhghz_handler.go | 305 +- game/live_logic/zhgzd_handler.go | 151 +- game/logic/game/game.go | 82 + game/logic/game_status/game_status.go | 51 - game/logic/init.go | 4 +- game/logic/room/manager.go | 42 +- game/manager/data.go | 52 - game/manager/data_manager.go | 34 - game/manager/manager.go | 105 +- game/manager/option.go | 11 + game/manager/room.go | 35 +- game/manager/room_data.go | 57 + game/manager/room_manager.go | 153 +- game/manager/session_data.go | 39 + game/manager/types.go | 36 + game/{msg_transfer => mq}/coin_transfer.go | 6 +- .../msg_to_push.go => mq/dm_to_push.go} | 18 +- game/{msg_transfer => mq}/gift_to_push.go | 12 +- game/{msg_transfer => mq}/init.go | 7 +- .../{msg_transfer => mq}/nobility_transfer.go | 8 +- game/{msg_transfer => mq}/types.go | 2 +- game/msg_transfer/reward_transfer.go | 76 - game/pb/common/Common.cs | 218 +- game/pb/common/common.pb.go | 232 +- game/pb/common/common.proto | 5 + game/pb/game/zhgww2/Command.cs | 2940 +++++++++++++++++ game/pb/game/zhgww2/command.pb.go | 1011 ++++++ game/pb/game/zhgww2/command.proto | 84 + game/pb/gen.bat | 2 +- game/pb/genCSharp.bat | 3 +- game/pb/mq/mq.pb.go | 391 +-- game/pb/mq/mq.proto | 58 +- game/pb/room/Room.cs | 590 +++- game/pb/room/room.pb.go | 233 +- game/pb/room/room.proto | 17 +- game/pb/routes.go | 14 + game/pb/vars/Vars.cs | 45 +- game/pb/vars/vars.pb.go | 145 +- game/pb/vars/vars.proto | 7 + game/svc/service_context.go | 11 +- main.go | 25 +- pkg/radar/engine.go | 18 - 56 files changed, 6911 insertions(+), 1635 deletions(-) create mode 100644 config/kafka_conf.go create mode 100644 config/zhg_config.go create mode 100644 config/zhgww2_config.go create mode 100644 config/zhgzd_config.go create mode 100644 game/live_logic/option.go delete mode 100644 game/live_logic/test_handler.go create mode 100644 game/live_logic/types.go create mode 100644 game/live_logic/ww2_handler.go create mode 100644 game/logic/game/game.go delete mode 100644 game/logic/game_status/game_status.go delete mode 100644 game/manager/data.go delete mode 100644 game/manager/data_manager.go create mode 100644 game/manager/option.go create mode 100644 game/manager/room_data.go create mode 100644 game/manager/session_data.go create mode 100644 game/manager/types.go rename game/{msg_transfer => mq}/coin_transfer.go (95%) rename game/{msg_transfer/msg_to_push.go => mq/dm_to_push.go} (82%) rename game/{msg_transfer => mq}/gift_to_push.go (89%) rename game/{msg_transfer => mq}/init.go (75%) rename game/{msg_transfer => mq}/nobility_transfer.go (94%) rename game/{msg_transfer => mq}/types.go (73%) delete mode 100644 game/msg_transfer/reward_transfer.go create mode 100644 game/pb/game/zhgww2/Command.cs create mode 100644 game/pb/game/zhgww2/command.pb.go create mode 100644 game/pb/game/zhgww2/command.proto delete mode 100644 pkg/radar/engine.go diff --git a/config-dev.yml b/config-dev.yml index f000b63..d0b58de 100644 --- a/config-dev.yml +++ b/config-dev.yml @@ -6,6 +6,7 @@ UserCenterRpc: Hosts: - 127.0.0.1:2379 Key: usercenter.rpc.dev + NonBlock: true Kafka: Danmaku: Addr: [ "127.0.0.1:9093" ] @@ -29,7 +30,16 @@ Kafka: ConsumerGroup: "notifyUserCoinConsumerG-dev" Game: # 30213831837876229 地球 - AdminUserId: [30096265903603717, 30213831837876229] + AdminUserId: [ 30096265903603717, 30213831837876229 ] + DefaultRooms: + - ID: 1 + GameType: ZHG + - ID: 2 + GameType: ZHGZD + - ID: 3 + GameType: ZHGWW2 + - ID: 4 + GameType: TEST Zhg: # 1元=10 Coin (1元40个步兵) CoinFoodRatio: 4 @@ -99,7 +109,21 @@ Game: SkillIds: [ "S0002" ] SuperSkill: # 干杯 超级技能 - GiftIds: [30606, 31049, 31251, 31116] + GiftIds: [ 30606, 31049, 31251, 31116 ] + Zhgww2: + GiftEffect: + # 辣条 + FreeRestoreHealth: [ 1 ] + # 小花花 + RestoreHealth: [ 31036, 31476 ] + SupportSkill: [ ] + # 告白气球,这个好诶 + Paratroops: [ 31702, 31639, 30758, 30971, 31213, 31478 ] + # 打call + Reborn: [ 31485, 31641, 31212, 31037, 31278 ] + TankRatio: 0.1 + TankMulThreshold: 40000 + TankMulRatio: 0.2 Log: Console: Level: debug diff --git a/config/config.go b/config/config.go index 48808e9..7eeda65 100644 --- a/config/config.go +++ b/config/config.go @@ -9,16 +9,8 @@ import ( "github.com/zeromicro/go-zero/zrpc" ) -var Config config - type ( - Kafka struct { - Addr []string - Topic string - ConsumerGroup string - } - - config struct { + Config struct { // Log 日志配置 Log struct { File logger.FileConfig @@ -37,111 +29,83 @@ type ( UserCoin Kafka // 用户金币变动消息 } Game struct { - AdminUserId []int64 // 管理员ID - // Zhg 指挥官PvP模式 - Zhg struct { - CoinFoodRatio float32 // 硬币到粮草的转换系数(乘) - OutbreakCount int64 // 默认暴兵指令每次暴兵数量 - OutbreakMaxCount int64 // 单次暴兵数量最大限制 - OutbreakBaseCost int64 // 默认每次暴兵消耗(不限兵种) - OutbreakCostDict map[int]float64 // 暴兵消耗表(单个兵) + // DefaultRooms 默认房间 + DefaultRooms []struct { + ID int64 // ID + GameType string // 类型 } + AdminUserId []int64 // 管理员ID + Zhg Zhg // 指挥官 // Zhghz 指挥官海战模式 Zhghz struct { } // Zhgfb 指挥官副本模式 Zhgfb struct { } - // Zhgzd 指挥官阵地模式 - Zhgzd struct { - MaxStrategicPoints int32 // 最大战略点数 - StrategicRecoverSpeed int32 // 每秒回复战略点数 - - // CommandUnitDict 命令单位ID字典 - CommandUnitDict map[string]string - - // CommandCostDict 命令战略点消耗 - CommandCostDict map[string]struct { - Common int32 // 通用消耗 - Units map[string]int32 // 单位消耗 - } - - // 战略暴兵数量(兵种相关) - DispatchCountDict map[string]int32 - - // 礼物效果配置 - GiftEffect struct { - // StrategicMaximal 战略点上限配置 - StrategicMaximal struct { - GiftIds []int64 // 对应礼物ID列表 - Addon int32 // 增加上限值 - Limit int32 // 次数限制 - } - // StrategicRecover 战略点回复速度 - StrategicRecover struct { - GiftIds []int64 // 对应礼物ID - Addon int32 // 增加速度值 x每秒 - Duration int32 // 持续时间 秒 - Limit int32 // 次数限制 - } - // SupportSkill - SupportSkill []struct { - GiftIds []int64 // 对应礼物ID列表 (每次匹配一个) - SkillIds []string // 技能ID列表 - } - // SuperSkill - SuperSkill struct { - GiftIds []int64 // 对应礼物ID列表 - } - } - } + Zhgzd Zhgzd // Zhgzd 指挥官-阵地 + Zhgww2 Zhgww2 // Zhgww2 指挥官-二战 } // RPC UserCenterRpc zrpc.RpcClientConf } + + Option func(cfg *Config) ) var k = koanf.New(".") +var f *file.File -func Init(filepath string) { - f := file.Provider(filepath) - err := f.Watch(func(event interface{}, err error) { - if err != nil { - fmt.Printf("配置文件热重载失败: %v\n", err) - return - } - k = koanf.New(".") - err = loadAndUnmarshal(f) +func MustLoad(filepath string, opts ...Option) *Config { + var cfg Config + f = file.Provider(filepath) + mustLoadAndUnmarshal(f, &cfg) + + for _, opt := range opts { + opt(&cfg) + } + + fmt.Printf("%+v\n", cfg) + + return &cfg +} +func WithHotReload() Option { + return func(cfg *Config) { + err := f.Watch(func(event interface{}, err error) { + if err != nil { + fmt.Printf("配置文件热重载失败: %v\n", err) + return + } + k = koanf.New(".") + err = loadAndUnmarshal(f, cfg) + + if err != nil { + fmt.Printf("配置文件热重载失败: %v\n", err) + return + } + fmt.Printf("重载配置文件: %+v\n", cfg) + }) if err != nil { - fmt.Printf("配置文件热重载失败: %v\n", err) - return + panic(err) } - fmt.Printf("重载配置文件: %+v\n", Config) - }) - if err != nil { - panic(err) } - mustLoadAndUnmarshal(f) - - fmt.Printf("%+v\n", Config) } -func loadAndUnmarshal(f *file.File) (err error) { +func loadAndUnmarshal(f *file.File, cfg *Config) (err error) { err = k.Load(f, yaml.Parser()) if err != nil { return } - err = k.UnmarshalWithConf("", &Config, koanf.UnmarshalConf{Tag: "c"}) + err = k.UnmarshalWithConf("", cfg, koanf.UnmarshalConf{Tag: "c"}) if err != nil { return } return } -func mustLoadAndUnmarshal(f *file.File) { - if err := loadAndUnmarshal(f); err != nil { +func mustLoadAndUnmarshal(f *file.File, cfg *Config) { + if err := loadAndUnmarshal(f, cfg); err != nil { panic(err) } } diff --git a/config/kafka_conf.go b/config/kafka_conf.go new file mode 100644 index 0000000..2ed48b5 --- /dev/null +++ b/config/kafka_conf.go @@ -0,0 +1,7 @@ +package config + +type Kafka struct { + Addr []string + Topic string + ConsumerGroup string +} diff --git a/config/zhg_config.go b/config/zhg_config.go new file mode 100644 index 0000000..e7d969a --- /dev/null +++ b/config/zhg_config.go @@ -0,0 +1,10 @@ +package config + +// Zhg 指挥官PvP模式 +type Zhg struct { + CoinFoodRatio float32 // 硬币到粮草的转换系数(乘) + OutbreakCount int64 // 默认暴兵指令每次暴兵数量 + OutbreakMaxCount int64 // 单次暴兵数量最大限制 + OutbreakBaseCost int64 // 默认每次暴兵消耗(不限兵种) + OutbreakCostDict map[int]float64 // 暴兵消耗表(单个兵) +} diff --git a/config/zhgww2_config.go b/config/zhgww2_config.go new file mode 100644 index 0000000..fddf22c --- /dev/null +++ b/config/zhgww2_config.go @@ -0,0 +1,52 @@ +package config + +// Zhgww2 指挥官-二战 +type ( + Zhgww2 struct { + GiftEffect struct { + FreeRestoreHealth []int64 // 免费回血 + RestoreHealth []int64 // 恢复生命值 + SupportSkill []int64 // 技能 + Paratroops []int64 // 空降小队 + Reborn []int64 // 复活 + } + TankMulThreshold int64 // 坦克血量比例阈值 + TankMulRatio float32 // 坦克血量阈值内对于金瓜子比例 + TankRatio float32 // 坦克血量对于金瓜子比例 + } + GiftType int32 +) + +const ( + GiftTypeUnknown GiftType = iota + GiftFreeRestoreHealth + GiftRestoreHealth + GiftSupportSkill + GiftReborn + GiftTank + GiftSpecial +) + +func (z Zhgww2) ParseGiftType(id int64) GiftType { + if z.isContains(id, z.GiftEffect.FreeRestoreHealth) { + return GiftFreeRestoreHealth + } else if z.isContains(id, z.GiftEffect.RestoreHealth) { + return GiftRestoreHealth + } else if z.isContains(id, z.GiftEffect.SupportSkill) { + return GiftSupportSkill + } else if z.isContains(id, z.GiftEffect.Reborn) { + return GiftReborn + } else if z.isContains(id, z.GiftEffect.Paratroops) { + return GiftSpecial + } + return GiftTypeUnknown +} + +func (z Zhgww2) isContains(id int64, arr []int64) bool { + for _, s := range arr { + if s == id { + return true + } + } + return false +} diff --git a/config/zhgzd_config.go b/config/zhgzd_config.go new file mode 100644 index 0000000..dde1ea8 --- /dev/null +++ b/config/zhgzd_config.go @@ -0,0 +1,45 @@ +package config + +// Zhgzd 指挥官阵地模式 +type Zhgzd struct { + MaxStrategicPoints int32 // 最大战略点数 + StrategicRecoverSpeed int32 // 每秒回复战略点数 + + // CommandUnitDict 命令单位ID字典 + CommandUnitDict map[string]string + + // CommandCostDict 命令战略点消耗 + CommandCostDict map[string]struct { + Common int32 // 通用消耗 + Units map[string]int32 // 单位消耗 + } + + // 战略暴兵数量(兵种相关) + DispatchCountDict map[string]int32 + + // 礼物效果配置 + GiftEffect struct { + // StrategicMaximal 战略点上限配置 + StrategicMaximal struct { + GiftIds []int64 // 对应礼物ID列表 + Addon int32 // 增加上限值 + Limit int32 // 次数限制 + } + // StrategicRecover 战略点回复速度 + StrategicRecover struct { + GiftIds []int64 // 对应礼物ID + Addon int32 // 增加速度值 x每秒 + Duration int32 // 持续时间 秒 + Limit int32 // 次数限制 + } + // SupportSkill + SupportSkill []struct { + GiftIds []int64 // 对应礼物ID列表 (每次匹配一个) + SkillIds []string // 技能ID列表 + } + // SuperSkill + SuperSkill struct { + GiftIds []int64 // 对应礼物ID列表 + } + } +} diff --git a/game/live_logic/common_handler.go b/game/live_logic/common_handler.go index dd1c7d5..f5c54c7 100644 --- a/game/live_logic/common_handler.go +++ b/game/live_logic/common_handler.go @@ -13,30 +13,43 @@ import ( "strconv" ) -type commonGameLogic struct { +type CommonGameLogic struct { svcCtx *svc.ServiceContext - *LiveGameLogic } -func NewCommonLiveGameLogic(svcCtx *svc.ServiceContext) *LiveGameLogic { - resp := &commonGameLogic{ +func NewCommonLiveGameLogic(svcCtx *svc.ServiceContext) *CommonGameLogic { + return &CommonGameLogic{ svcCtx: svcCtx, - LiveGameLogic: NewLiveGameLogic(-1, cmd.NewCMDParser(cmd.Pattern{ + } +} + +func (h *CommonGameLogic) CmdParserPatterns() []cmd.Pattern { + return []cmd.Pattern{ + { Prefix: "打卡", Alias: []string{"签到"}, ContentMaxLen: 0, - })), + }, + } +} + +func (h *CommonGameLogic) WithCmdHandler() LogicOption { + return func(logic LiveLogic) { + logic.RegisterCMDHandler(h.handleCheckIn, "打卡") + } +} + +func (h *CommonGameLogic) GiftHandler() GiftHandler { + return func(next GiftHandlerFunc) GiftHandlerFunc { + return func(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) { + h.handleGift(liveRoom, user, gift) + next(liveRoom, user, gift) + } } - // 通用指令处理器 - resp.RegisterCMDHandler(resp.handleCheckIn, "打卡") - // 通用礼物处理器 - resp.RegisterGiftHandler(resp.handleGift) - resp.RegisterNobilityHandler(resp.handleNobility) - return resp.LiveGameLogic } -func (h *commonGameLogic) handleCheckIn(roomId int64, _ string, _ []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *CommonGameLogic) handleCheckIn(liveRoom *LiveRoom, _ string, _ []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -54,8 +67,8 @@ func (h *commonGameLogic) handleCheckIn(roomId int64, _ string, _ []rune, user * room.Broadcast(pb.PushCheckIn, respMsg) } -func (h *commonGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *CommonGameLogic) handleGift(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -73,23 +86,23 @@ func (h *commonGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift * Platform: gift.Platform, UserId: user.UserId, PUid: strconv.FormatInt(gift.Uid, 10), - RoomId: strconv.FormatInt(roomId, 10), + RoomId: strconv.FormatInt(liveRoom.RoomId, 10), GiftId: gift.GiftId, GiftName: gift.GiftName, Num: gift.GiftNum, Price: gift.Price, IsPaid: gift.IsPaid, - BattleId: manager.GameManager.BattleIdByLiveRoomId(roomId), + BattleId: manager.GameManager.BattleIdByLiveRoom(liveRoom.RoomId, liveRoom.Platform), } _, err = h.svcCtx.UserCenterRpc.UserSendGift(h.svcCtx.Ctx, req) if err != nil { - logger.SLog.Info("rpc 用户送礼记录失败,积分变动不通知了...") + logger.SLog.Info("rpc 用户送礼记录失败,金币变动不通知了...") return } } -func (h *commonGameLogic) handleNobility(roomId int64, user *pbCommon.PbUser, msg *pbMq.MqNobilityBuy) { - //room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *CommonGameLogic) handleNobility(liveRoom *LiveRoom, user *pbCommon.PbUser, msg *pbMq.MqNobilityBuy) { + //room, err := manager.GameManager.RoomByLiveRoom(roomId) //if err != nil { // return //} @@ -102,12 +115,12 @@ func (h *commonGameLogic) handleNobility(roomId int64, user *pbCommon.PbUser, ms // Price: msg.Price, // IsPaid: true, //}) - // 2. rpc - //_, err := h.svcCtx.UserCenterRpc.UserBuyNobility(h.svcCtx.Ctx, &usercenter.UserBuyNobilityReq{ + //// 2. rpc + //_, err = h.svcCtx.UserCenterRpc.UserBuyNobility(h.svcCtx.Ctx, &usercenter.UserBuyNobilityReq{ // Platform: msg.Platform, // UserId: user.UserId, // PUid: strconv.FormatInt(msg.Uid, 10), - // BattleId: manager.GameManager.BattleIdByLiveRoomId(roomId), + // BattleId: manager.GameManager.BattleIdByLiveRoom(roomId), // RoomId: strconv.FormatInt(roomId, 10), // GiftId: msg.GiftId, // GiftName: msg.GiftName, diff --git a/game/live_logic/logic.go b/game/live_logic/logic.go index 2b3a924..924fa20 100644 --- a/game/live_logic/logic.go +++ b/game/live_logic/logic.go @@ -5,113 +5,129 @@ import ( "dcg/game/pb" pbCommon "dcg/game/pb/common" pbMq "dcg/game/pb/mq" - pbRoom "dcg/game/pb/room" "dcg/pkg/cmd" ) type ( - // LiveGameLogic 直播游戏逻辑 + // liveLogic 直播游戏逻辑 // 处理指令 // 处理礼物 - LiveGameLogic struct { - GameType pbRoom.GameType // 游戏类型 - CmdParser *cmd.Parser // 命令解析 - CmdHandlerMapper map[string]CMDHandlerFunc // 具体命令处理(同类型) - GiftHandler GiftHandlerFunc // 礼物处理 - NobilityHandler NobilityHandlerFunc // 贵族购买处理 + liveLogic struct { + gameType string // 游戏类型 + cmdParser *cmd.Parser // 命令解析 + cmdHandlerMapper map[string]CMDHandlerFunc // 具体命令处理(同类型) + giftHandlers []GiftHandler // 礼物处理 + nobilityHandler NobilityHandlerFunc // 贵族购买处理 } - CMDHandlerFunc func(roomId int64, msgId string, content []rune, user *pbCommon.PbUser) - GiftHandlerFunc func(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) - NobilityHandlerFunc func(roomId int64, user *pbCommon.PbUser, nobility *pbMq.MqNobilityBuy) - - // 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 { - return &LiveGameLogic{ - GameType: gameType, - CmdParser: cmdParser, - CmdHandlerMapper: make(map[string]CMDHandlerFunc), - GiftHandler: nil, +func NewLiveGameLogic(opts ...LogicOption) LiveLogic { + resp := &liveLogic{ + cmdHandlerMapper: make(map[string]CMDHandlerFunc), + giftHandlers: make([]GiftHandler, 0), + } + + for _, opt := range opts { + opt(resp) } + + return resp +} + +func (l *liveLogic) SetGameType(gameType string) { + l.gameType = gameType +} + +func (l *liveLogic) SetCmdParser(parser *cmd.Parser) { + l.cmdParser = parser +} + +func (l *liveLogic) GameType() string { + return l.gameType } -func (l *LiveGameLogic) RegisterCMDHandler(h CMDHandlerFunc, cmd string, alias ...string) { - if _, ok := l.CmdHandlerMapper[cmd]; ok { +func (l *liveLogic) RegisterCMDHandler(h CMDHandlerFunc, cmd string, alias ...string) { + if _, ok := l.cmdHandlerMapper[cmd]; ok { return } - l.CmdHandlerMapper[cmd] = h + l.cmdHandlerMapper[cmd] = h // alias for _, s := range alias { - if _, ok := l.CmdHandlerMapper[s]; ok { + if _, ok := l.cmdHandlerMapper[s]; ok { continue } - l.CmdHandlerMapper[s] = h + l.cmdHandlerMapper[s] = h } } -func (l *LiveGameLogic) RegisterGiftHandler(h GiftHandlerFunc) { - l.GiftHandler = h +func (l *liveLogic) RegisterGiftHandler(h GiftHandler) { + l.giftHandlers = append(l.giftHandlers, h) } -func (l *LiveGameLogic) RegisterNobilityHandler(h NobilityHandlerFunc) { - l.NobilityHandler = h +func (l *liveLogic) RegisterNobilityHandler(h NobilityHandlerFunc) { + l.nobilityHandler = h } // HandleDanmaku 弹幕数据处理 // pushCommonMsg 非弹幕数据是否转发 -func (l *LiveGameLogic) HandleDanmaku(pushCommonMsg bool, user *pbCommon.PbUser, dm *pbMq.MqDanmaku) { - if l.CmdParser != nil { - cmdStruct := l.CmdParser.Parse(dm.Msg) +func (l *liveLogic) HandleDanmaku(liveRoom *LiveRoom, user *pbCommon.PbUser, dm *pbMq.MqDanmaku) { + if l.cmdParser != nil { + cmdStruct := l.cmdParser.Parse(dm.Msg) if cmdStruct.IsCMD { for _, m := range cmdStruct.Matches { - l.handleCMD(dm.LiveRoomId, dm.MsgId, m.Prefix, m.Content, user) + l.handleCMD(liveRoom, m.Prefix, m.Content, user) } - } else if pushCommonMsg { - room, err := manager.GameManager.RoomByLiveRoomId(dm.LiveRoomId) - if err != nil { - return - } - // 发送正常的非命令弹幕消息 - room.Broadcast(pb.PushDanmaku, &pbCommon.DanmakuMsg{ - User: user, - Content: dm.Msg, - }) + } else { + l.pushDanmaku(liveRoom, user, dm.Msg) } } else { - room, err := manager.GameManager.RoomByLiveRoomId(dm.LiveRoomId) - if err != nil { - return - } - // 发送正常的非命令弹幕消息 - room.Broadcast(pb.PushDanmaku, &pbCommon.DanmakuMsg{ - User: user, - Content: dm.Msg, - }) + l.pushDanmaku(liveRoom, user, dm.Msg) + } +} + +func (l *liveLogic) handleCMD(liveRoom *LiveRoom, prefix string, content []rune, user *pbCommon.PbUser) { + if h, ok := l.cmdHandlerMapper[prefix]; ok { + h(liveRoom, prefix, content, user) } } -func (l *LiveGameLogic) handleCMD(roomId int64, msgId string, prefix string, content []rune, user *pbCommon.PbUser) { - if h, ok := l.CmdHandlerMapper[prefix]; ok { - h(roomId, msgId, content, user) +func (l *liveLogic) pushDanmaku(liveRoom *LiveRoom, user *pbCommon.PbUser, msg string) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) + if err != nil { + return } + room.Broadcast(pb.PushDanmaku, &pbCommon.DanmakuMsg{ + User: user, + Content: msg, + }) } -func (l *LiveGameLogic) HandleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { - if l.GiftHandler == nil { +func (l *liveLogic) HandleGift(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) { + if len(l.giftHandlers) == 0 { return } - l.GiftHandler(roomId, user, gift) + wrapped := l.wrapGiftHandler(nil, l.giftHandlers) + wrapped(liveRoom, user, gift) +} + +// wrapGiftHandler wraps handler and middlewares into a right order call stack. +// like: +// var wrapped GiftHandlerFunc = m1(m2(m3(handle))) +func (l *liveLogic) wrapGiftHandler(handler GiftHandlerFunc, middles []GiftHandler) (wrapped GiftHandlerFunc) { + if handler == nil { + handler = EmptyGiftHandlerFunc + } + wrapped = handler + for i := len(middles) - 1; i >= 0; i-- { + m := middles[i] + wrapped = m(wrapped) + } + return } -func (l *LiveGameLogic) HandleNobility(roomId int64, user *pbCommon.PbUser, msg *pbMq.MqNobilityBuy) { - if l.NobilityHandler == nil { +func (l *liveLogic) HandleNobility(liveRoom *LiveRoom, user *pbCommon.PbUser, msg *pbMq.MqNobilityBuy) { + if l.nobilityHandler == nil { return } - l.NobilityHandler(roomId, user, msg) + l.nobilityHandler(liveRoom, user, msg) } diff --git a/game/live_logic/manager.go b/game/live_logic/manager.go index e56a2cd..a7f1533 100644 --- a/game/live_logic/manager.go +++ b/game/live_logic/manager.go @@ -4,7 +4,6 @@ import ( "dcg/game/manager" pbCommon "dcg/game/pb/common" pbMq "dcg/game/pb/mq" - pbRoom "dcg/game/pb/room" "dcg/game/svc" "errors" "git.noahlan.cn/northlan/ntools-go/logger" @@ -14,74 +13,111 @@ var LiveManager *Manager type ( Manager struct { - // commonLogic 通用游戏逻辑处理器,类型无关 - commonLogic *LiveGameLogic // gameLogics 游戏逻辑处理器 游戏类型相关 - gameLogics map[pbRoom.GameType]*LiveGameLogic + gameLogics map[string]LiveLogic } ) func InitLiveManager(svcCtx *svc.ServiceContext) { - LiveManager = newManager() - // commonLogic - LiveManager.commonLogic = NewCommonLiveGameLogic(svcCtx) + LiveManager = &Manager{ + gameLogics: make(map[string]LiveLogic), + } // gameLogic - LiveManager.RegisterLogic(NewZhgLiveGameLogic(svcCtx)) - LiveManager.RegisterLogic(NewZhghzLiveGameLogic().LiveGameLogic) - LiveManager.RegisterLogic(NewZhgzdLiveGameLogic(svcCtx)) - LiveManager.RegisterLogic(NewTestLiveGameLogic(svcCtx)) -} + commonLogic := NewCommonLiveGameLogic(svcCtx) -func newManager() *Manager { - return &Manager{ - gameLogics: make(map[pbRoom.GameType]*LiveGameLogic), - } + opts := make([]LogicOption, 0) + + // plain logic + opts = append(opts, WithGiftHandler(commonLogic.GiftHandler())) + opts = append(opts, WithGameType("")) + LiveManager.registerLogic(NewLiveGameLogic(opts...)) + + // zhg logic + opts = opts[:1] + zhgLogic := NewZhgLiveGameLogic(svcCtx) + opts = append(opts, WithGiftHandler(commonLogic.GiftHandler()), commonLogic.WithCmdHandler()) + opts = append(opts, + zhgLogic.WithGameType(), + zhgLogic.WithCmdHandlers(), + zhgLogic.WithCmdParserLogic(commonLogic.CmdParserPatterns()), + ) + LiveManager.registerLogic(NewLiveGameLogic(opts...)) + + opts = opts[:1] + zhgzdLogic := NewZhgzdLiveGameLogic(svcCtx) + opts = append(opts, WithGiftHandler(commonLogic.GiftHandler()), commonLogic.WithCmdHandler()) + opts = append(opts, + zhgzdLogic.WithGameType(), + zhgzdLogic.WithCmdHandlers(), + zhgzdLogic.WithCmdParserLogic(commonLogic.CmdParserPatterns()), + zhgzdLogic.WithGiftHandler(), + ) + LiveManager.registerLogic(NewLiveGameLogic(opts...)) + + //LiveManager.registerLogic(NewZhghzLiveGameLogic().liveLogic) + + opts = opts[:1] + zhgww2Logic := NewWW2LiveGameLogic(svcCtx) + opts = append(opts, WithGiftHandler(commonLogic.GiftHandler())) + opts = append(opts, + zhgww2Logic.WithGameType(), + zhgww2Logic.WithCmdHandlers(), + zhgww2Logic.WithCmdParserLogic(commonLogic.CmdParserPatterns()), + zhgww2Logic.WithGiftHandler(), + ) + LiveManager.registerLogic(NewLiveGameLogic(opts...)) } -func (m *Manager) RegisterLogic(h *LiveGameLogic) { - m.gameLogics[h.GameType] = h +func (m *Manager) registerLogic(h LiveLogic) { + m.gameLogics[h.GameType()] = h } -func (m *Manager) logicByLiveRoomId(roomId int64) (*LiveGameLogic, error) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (m *Manager) logicByLiveRoom(liveRoom *LiveRoom) (LiveLogic, error) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { - return nil, errors.New("当前直播间未加入游戏房间") + return nil, errors.New("弹幕对应直播间未加入游戏房间") } - if l, ok := m.gameLogics[room.GameType()]; ok { + if l, ok := m.gameLogics[room.GameType]; ok { return l, nil } return nil, errors.New("未找到当前直播间支持的游戏逻辑") } func (m *Manager) HandleDanmaku(user *pbCommon.PbUser, dm *pbMq.MqDanmaku) { - m.commonLogic.HandleDanmaku(false, user, dm) - - l, err := m.logicByLiveRoomId(dm.LiveRoomId) + liveRoom := &LiveRoom{ + RoomId: dm.LiveRoomId, + Platform: dm.Platform, + } + l, err := m.logicByLiveRoom(liveRoom) if err != nil { logger.SLog.Errorf("获取游戏逻辑失败, err:%+v", err) return } - l.HandleDanmaku(true, user, dm) + l.HandleDanmaku(liveRoom, user, dm) } -func (m *Manager) HandleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { - m.commonLogic.HandleGift(roomId, user, gift) - - l, err := m.logicByLiveRoomId(roomId) +func (m *Manager) HandleGift(user *pbCommon.PbUser, gift *pbMq.MqGift) { + liveRoom := &LiveRoom{ + RoomId: gift.LiveRoomId, + Platform: gift.Platform, + } + l, err := m.logicByLiveRoom(liveRoom) if err != nil { logger.SLog.Errorf("获取游戏逻辑失败, err:%+v", err) return } - l.HandleGift(roomId, user, gift) + l.HandleGift(liveRoom, user, gift) } -func (m *Manager) HandleNobility(roomId int64, user *pbCommon.PbUser, msg *pbMq.MqNobilityBuy) { - m.commonLogic.HandleNobility(roomId, user, msg) - - l, err := m.logicByLiveRoomId(roomId) +func (m *Manager) HandleNobility(user *pbCommon.PbUser, msg *pbMq.MqNobilityBuy) { + liveRoom := &LiveRoom{ + RoomId: msg.LiveRoomId, + Platform: msg.Platform, + } + l, err := m.logicByLiveRoom(liveRoom) if err != nil { logger.SLog.Errorf("获取游戏逻辑失败, err:%+v", err) return } - l.HandleNobility(roomId, user, msg) + l.HandleNobility(liveRoom, user, msg) } diff --git a/game/live_logic/option.go b/game/live_logic/option.go new file mode 100644 index 0000000..e81c03f --- /dev/null +++ b/game/live_logic/option.go @@ -0,0 +1,37 @@ +package live_logic + +import "dcg/pkg/cmd" + +type ( + LogicOption func(logic LiveLogic) +) + +func WithGameType(gameType string) LogicOption { + return func(logic LiveLogic) { + logic.SetGameType(gameType) + } +} + +func WithCmdParser(parser *cmd.Parser) LogicOption { + return func(logic LiveLogic) { + logic.SetCmdParser(parser) + } +} + +func WithGiftHandler(handler GiftHandler) LogicOption { + return func(logic LiveLogic) { + logic.RegisterGiftHandler(handler) + } +} + +func WithNobilityHandler(handler NobilityHandlerFunc) LogicOption { + return func(logic LiveLogic) { + logic.RegisterNobilityHandler(handler) + } +} + +func WithCmdHandler(handler CMDHandlerFunc, prefix string, alias ...string) LogicOption { + return func(logic LiveLogic) { + logic.RegisterCMDHandler(handler, prefix, alias...) + } +} diff --git a/game/live_logic/test_handler.go b/game/live_logic/test_handler.go deleted file mode 100644 index bee09ce..0000000 --- a/game/live_logic/test_handler.go +++ /dev/null @@ -1,19 +0,0 @@ -package live_logic - -import ( - pbRoom "dcg/game/pb/room" - "dcg/game/svc" -) - -type TestGameLogic struct { - svcCtx *svc.ServiceContext - *LiveGameLogic -} - -func NewTestLiveGameLogic(svcCtx *svc.ServiceContext) *LiveGameLogic { - resp := &TestGameLogic{ - svcCtx: svcCtx, - LiveGameLogic: NewLiveGameLogic(pbRoom.GameType_TEST, nil), - } - return resp.LiveGameLogic -} diff --git a/game/live_logic/types.go b/game/live_logic/types.go new file mode 100644 index 0000000..e2b5bed --- /dev/null +++ b/game/live_logic/types.go @@ -0,0 +1,42 @@ +package live_logic + +import ( + pbCommon "dcg/game/pb/common" + pbMq "dcg/game/pb/mq" + "dcg/pkg/cmd" +) + +type ( + LiveLogic interface { + SetGameType(gameType string) + GameType() string + + SetCmdParser(parser *cmd.Parser) + RegisterCMDHandler(h CMDHandlerFunc, cmd string, alias ...string) + RegisterGiftHandler(h GiftHandler) + RegisterNobilityHandler(h NobilityHandlerFunc) + + HandleDanmaku(liveRoom *LiveRoom, user *pbCommon.PbUser, dm *pbMq.MqDanmaku) + HandleGift(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) + HandleNobility(liveRoom *LiveRoom, user *pbCommon.PbUser, msg *pbMq.MqNobilityBuy) + } + // LiveRoom 直播间定位 + LiveRoom struct { + RoomId int64 + Platform string + } + + CMDHandlerFunc func(liveRoom *LiveRoom, prefix string, content []rune, user *pbCommon.PbUser) + GiftHandlerFunc func(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) + GiftHandler func(next GiftHandlerFunc) GiftHandlerFunc + + NobilityHandlerFunc func(liveRoom *LiveRoom, user *pbCommon.PbUser, nobility *pbMq.MqNobilityBuy) + // GiftLogic LiveLogic内部礼物逻辑处理 + GiftLogic struct { + GiftIds []int64 + Fn GiftLogicFunc + } + GiftLogicFunc func(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) +) + +var EmptyGiftHandlerFunc GiftHandlerFunc = func(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) {} diff --git a/game/live_logic/ww2_handler.go b/game/live_logic/ww2_handler.go new file mode 100644 index 0000000..88126f8 --- /dev/null +++ b/game/live_logic/ww2_handler.go @@ -0,0 +1,377 @@ +package live_logic + +import ( + "dcg/app/user_center/usercenter" + "dcg/config" + "dcg/game/manager" + "dcg/game/pb" + pbCommon "dcg/game/pb/common" + pbGameZhgWW2 "dcg/game/pb/game/zhgww2" + pbMq "dcg/game/pb/mq" + pbRoom "dcg/game/pb/room" + "dcg/game/svc" + "dcg/pkg/cmd" + "git.noahlan.cn/northlan/ntools-go/logger" + "github.com/shopspring/decimal" + "strconv" + "strings" +) + +type WW2GameLogic struct { + svcCtx *svc.ServiceContext +} + +func NewWW2LiveGameLogic(svcCtx *svc.ServiceContext) *WW2GameLogic { + return &WW2GameLogic{ + svcCtx: svcCtx, + } +} + +func (h *WW2GameLogic) WithGameType() LogicOption { + return WithGameType(pbRoom.GameType_name[int32(pbRoom.GameType_ZHGWW2)]) +} + +func (h *WW2GameLogic) WithCmdParserLogic(p []cmd.Pattern) LogicOption { + pattern := []cmd.Pattern{ + { + Prefix: "j", + Alias: []string{"加入", "加入游戏"}, + ContentMaxLen: 1, + }, { + Prefix: "红", + ContentMaxLen: 0, + }, { + Prefix: "蓝", + ContentMaxLen: 0, + }, { + Prefix: "c", + Alias: []string{"换兵"}, + ContentMaxLen: 1, + }, { + Prefix: "w", + Alias: []string{"我在哪"}, + ContentMaxLen: 0, + }, { + Prefix: "a", + ContentMaxLen: 2, + }, { + Prefix: "n", + ContentMaxLen: 8, + }, + } + pattern = append(pattern, p...) + cmdParser := cmd.NewCMDParser(pattern...) + cmdParser.SetDistinct(true) + + return WithCmdParser(cmdParser) +} + +func (h *WW2GameLogic) WithCmdHandlers() LogicOption { + return func(logic LiveLogic) { + logic.RegisterCMDHandler(h.handleJoinGame, "j", "红", "蓝") + logic.RegisterCMDHandler(h.handleChangeUnit, "c") + logic.RegisterCMDHandler(h.handleAttack, "a") + logic.RegisterCMDHandler(h.handleMockGift, "n") + } +} + +func (h *WW2GameLogic) WithGiftHandler() LogicOption { + return WithGiftHandler(func(next GiftHandlerFunc) GiftHandlerFunc { + return func(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) { + h.handleGift(liveRoom, user, gift) + next(liveRoom, user, gift) + } + }) +} + +func (h *WW2GameLogic) handleJoinGame(liveRoom *LiveRoom, prefix string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) + if err != nil { + return + } + + details, err := h.svcCtx.UserCenterRpc.GetUserDetails(h.svcCtx.Ctx, &usercenter.UserIdReq{ + UserId: user.UserId, + }) + if err != nil { + return + } + var team int32 + if len(content) > 0 { + t, err := strconv.ParseInt(string(content[0]), 10, 32) + if err == nil { + team = int32(t) + } + } + if prefix == "红" { + team = 1 + } else if prefix == "蓝" { + team = 2 + } + + resp := &pbGameZhgWW2.JoinGame{ + User: user, + NobilityLevel: details.NobilityLevel, + Team: team, + } + + logger.SLog.Debugf("用户 [%s] 加入 [%d]", user.Username, team) + room.Broadcast(pb.PushZhgww2JoinGame, resp) +} + +func (h *WW2GameLogic) handleChangeUnit(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) + if err != nil { + return + } + + if len(content) < 1 { + return + } + + var unit int32 + if len(content) > 0 { + t, err := strconv.ParseInt(string(content[0]), 10, 32) + if err == nil { + unit = int32(t) + } + } + if unit > 5 { + return + } + + logger.SLog.Debugf("用户 [%s] 切换单位 [%d]", user.Username, unit) + room.Broadcast(pb.PushZhgww2ChangeUnit, &pbGameZhgWW2.ChangeUnit{ + User: user, + Unit: unit, + }) +} + +func (h *WW2GameLogic) handleAttack(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) + if err != nil { + return + } + + if len(content) < 1 { + return + } + + var area int32 + if len(content) > 0 { + t, err := strconv.ParseInt(string(content), 10, 32) + if err == nil { + area = int32(t) + } + } + + logger.SLog.Debugf("用户 [%s] 进攻区域 [%d]", user.Username, area) + room.Broadcast(pb.PushZhgww2Attack, &pbGameZhgWW2.Attack{ + User: user, + Area: area, + }) +} + +func (h *WW2GameLogic) handleMockGift(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + var err error + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) + if err != nil { + return + } + + var isAdminUser bool + for _, i := range h.svcCtx.Config.Game.AdminUserId { + if user.UserId == i { + isAdminUser = true + break + } + } + if !isAdminUser { + return + } + + if len(content) < 1 { + return + } + contentStr := string(content) + spaceIdx := strings.Index(contentStr, " ") + if spaceIdx < 0 { + return + } + giftType := contentStr[:spaceIdx] + var count int64 = 1 + if count, err = strconv.ParseInt(contentStr[spaceIdx+1:], 10, 32); err != nil { + return + } + if count <= 0 { + count = 1 + } + + logger.SLog.Debugf("用户 [%s] gift [%s] count [%d]", user.Username, giftType, count) + // 禁止 c w a n j + switch giftType { + case "kt": + // count 110 210 310 + // 1 -> 1-9 2-> 10-49 3-> >50 11 + cStr := strconv.Itoa(int(count)) + + level, _ := strconv.ParseInt(cStr[:1], 10, 32) + var price int64 + switch level { + case 1: + price = 9 + case 2: + price = 11 + case 3: + price = 51 + default: + price = 9 + } + + num, _ := strconv.ParseInt(cStr[1:], 10, 32) + for i := 0; i < int(num); i++ { + h.airdrop(room, user, price*100) + } + case "hp": + h.restoreHealth(room, user, count) + case "fh": + h.reborn(room, user, 1) + case "hz": + h.supportSpecialBomber(room, user, count*100) + case "p": + for i := 0; i < int(count); i++ { + h.supportSpecialParatroops(room, user) + } + case "tk": + h.chargeTank(room, user, count*100) + } +} + +/* + 1辣条 - 小队持续回血5秒,可累计,阵亡后暂停复活后继续 + 1小花花 - 小队持续回血20秒 + 1牛哇牛哇 - 阵营随机支援技能? 不管 + 1打call - 立刻复活 + + 白银宝箱与紫金宝箱礼物召唤坦克一辆血量由开出礼物1块钱*100,玩家同时只能有一辆,炸了再出第二辆 + + B坷拉-3发火箭弹?不管 + + 红包 - 白头鹰支援 + 最低档 - 空降10人队到敌方任意占领区域,不会离开此区域 + 二档及以上 - 美军飞机轰炸任意敌方单位(轰炸次数红包价值换算2电池一发)对建筑无效 + + + 无需指令的效果 + 观众投递礼物发放空投箱(多平台模式空投箱掉落平台对应阵营占领区) + 空投箱打爆随机效果加成(按价值分档) + - (10电池以内)小队回血,小队手雷数量+2,小队防弹衣(百分比血量的护盾) + - (10电池-50电池)阵营回血,阵营手雷数量+1,阵营防弹衣(百分比血量的护盾) + -(50电池以上)阵营所有阵亡成员立即复活, 一辆装甲车 -- 待定 + + 空投箱不需电池默认60秒也会自动触发一次 +*/ +func (h *WW2GameLogic) handleGift(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) + if err != nil { + return + } + + var userInGame bool + _, userInGame = room.GetUser(user.UserId) + + cfg := h.svcCtx.Config.Game.Zhgww2 + if userInGame { + switch gift.Type { + case pbMq.MqGift_NORMAL: + switch cfg.ParseGiftType(gift.GiftId) { + case config.GiftTypeUnknown: + // 空投 + h.airdrop(room, user, gift.Price*gift.GiftNum) + case config.GiftFreeRestoreHealth: + h.restoreHealth(room, user, 5*gift.GiftNum) + case config.GiftRestoreHealth: + h.restoreHealth(room, user, 20*gift.GiftNum) + case config.GiftSupportSkill: + // TODO 技能 + case config.GiftSpecial: + h.supportSpecialParatroops(room, user) + case config.GiftReborn: + h.reborn(room, user, gift.GiftNum) + } + case pbMq.MqGift_PACK: + // 宝箱 + h.chargeTank(room, user, gift.Price*gift.GiftNum) + case pbMq.MqGift_RED_PACK: + // 红包 + h.supportSpecialBomber(room, user, gift.Price*gift.GiftNum) + } + } else { + // 所有礼物-空投 + h.airdrop(room, user, gift.Price*gift.GiftNum) + } +} + +func (h *WW2GameLogic) airdrop(room *manager.Room, user *pbCommon.PbUser, price int64) { + // 1000 -> 10 + battery := price / 100 + var level int32 = 1 + if battery < 10 { + level = 1 + } else if battery < 50 { + level = 2 + } else { + level = 3 + } + room.Broadcast(pb.PushZhgww2SupportAirdrop, &pbGameZhgWW2.SupportAirdrop{ + User: user, + Level: level, + }) +} + +func (h *WW2GameLogic) restoreHealth(room *manager.Room, user *pbCommon.PbUser, duration int64) { + room.Broadcast(pb.PushZhgww2RestoreHealth, &pbGameZhgWW2.RestoreHealth{ + User: user, + Duration: int32(duration), + }) +} + +func (h *WW2GameLogic) reborn(room *manager.Room, user *pbCommon.PbUser, num int64) { + for i := 0; i < int(num); i++ { + room.Broadcast(pb.PushZhgww2Reborn, &pbGameZhgWW2.Reborn{ + User: user, + }) + } +} + +func (h *WW2GameLogic) chargeTank(room *manager.Room, user *pbCommon.PbUser, price int64) { + // 0.1元 = 1电池 = 100金瓜子 = 10HP + cfg := h.svcCtx.Config.Game.Zhgww2 + var hp int64 + if price < cfg.TankMulThreshold { + hp = decimal.NewFromInt(price).Mul(decimal.NewFromFloat32(cfg.TankMulRatio)).Round(0).IntPart() + } else { + hp = decimal.NewFromInt(price).Mul(decimal.NewFromFloat32(cfg.TankRatio)).Round(0).IntPart() + } + room.Broadcast(pb.PushZhgww2ChargeTank, &pbGameZhgWW2.ChargeTank{ + User: user, + Value: float32(hp), + }) +} + +func (h *WW2GameLogic) supportSpecialParatroops(room *manager.Room, user *pbCommon.PbUser) { + room.Broadcast(pb.PushZhgww2SupportSpecial, &pbGameZhgWW2.SupportSpecial{ + User: user, + Type: pbGameZhgWW2.SupportSpecial_PARATROOPS, + Count: 10, + }) +} + +func (h *WW2GameLogic) supportSpecialBomber(room *manager.Room, user *pbCommon.PbUser, price int64) { + battery := price / 100 + room.Broadcast(pb.PushZhgww2SupportSpecial, &pbGameZhgWW2.SupportSpecial{ + User: user, + Type: pbGameZhgWW2.SupportSpecial_BOMBER, + Count: int32(battery / 2), + }) +} diff --git a/game/live_logic/zhg_handler.go b/game/live_logic/zhg_handler.go index d0e0856..474988d 100644 --- a/game/live_logic/zhg_handler.go +++ b/game/live_logic/zhg_handler.go @@ -3,12 +3,10 @@ package live_logic import ( "database/sql" "dcg/app/user_center/usercenter" - "dcg/config" "dcg/game/manager" "dcg/game/pb" pbCommon "dcg/game/pb/common" pbGameZhg "dcg/game/pb/game/zhg" - pbMq "dcg/game/pb/mq" pbRoom "dcg/game/pb/room" pbVars "dcg/game/pb/vars" "dcg/game/svc" @@ -22,89 +20,100 @@ import ( type ZhgGameLogic struct { svcCtx *svc.ServiceContext - *LiveGameLogic tmpOutbreakCountMap map[string]int64 } -func NewZhgLiveGameLogic(svcCtx *svc.ServiceContext) *LiveGameLogic { - cmdParser := cmd.NewCMDParser( - cmd.Pattern{ +func NewZhgLiveGameLogic(svcCtx *svc.ServiceContext) *ZhgGameLogic { + return &ZhgGameLogic{ + svcCtx: svcCtx, + tmpOutbreakCountMap: make(map[string]int64), + } +} + +func (h *ZhgGameLogic) WithCmdParserLogic(p []cmd.Pattern) LogicOption { + pattern := []cmd.Pattern{ + { Prefix: "q", Alias: []string{"查询"}, ContentMaxLen: 0, }, - cmd.Pattern{ + { Prefix: "j", Alias: []string{"加入", "加入游戏"}, ContentMaxLen: 0, - }, cmd.Pattern{ + }, { Prefix: "c", Alias: []string{"换兵"}, ContentMaxLen: 1, - }, cmd.Pattern{ + }, { Prefix: "w", Alias: []string{"我在哪"}, ContentMaxLen: 0, - }, cmd.Pattern{ + }, { Prefix: "s", ContentMaxLen: 4, Distinct: sql.NullBool{Bool: false, Valid: true}, - }, cmd.Pattern{ + }, { Prefix: "m", ContentMaxLen: 1, - }, cmd.Pattern{ + }, { Prefix: "r", ContentMaxLen: 1, - }, cmd.Pattern{ + }, { Prefix: "bq", Alias: []string{"购买粮草", "买粮草"}, ContentMaxLen: 2, - }, cmd.Pattern{ + }, { Prefix: "bw", Alias: []string{"购买精英", "买精英"}, ContentMaxLen: 2, - }, cmd.Pattern{ + }, { Prefix: "zw", Alias: []string{"装备精英"}, ContentMaxLen: 2, - }, cmd.Pattern{ + }, { Prefix: "zz", Alias: []string{"使用称号"}, ContentMaxLen: 2, - }, cmd.Pattern{ + }, { Prefix: "结算", Alias: nil, ContentMaxLen: 2, }, - ) + } + pattern = append(pattern, p...) + cmdParser := cmd.NewCMDParser(pattern...) cmdParser.SetDistinct(true) - resp := &ZhgGameLogic{ - svcCtx: svcCtx, - LiveGameLogic: NewLiveGameLogic(pbRoom.GameType_ZHG, cmdParser), - tmpOutbreakCountMap: make(map[string]int64), + + return WithCmdParser(cmdParser) +} + +func (h *ZhgGameLogic) WithGameType() LogicOption { + return WithGameType(pbRoom.GameType_name[int32(pbRoom.GameType_ZHG)]) +} + +func (h *ZhgGameLogic) WithCmdHandlers() LogicOption { + return func(logic LiveLogic) { + logic.RegisterCMDHandler(h.handleQuery, "q") + logic.RegisterCMDHandler(h.handleJoinGame, "j") + logic.RegisterCMDHandler(h.handleCreateUnit, "c") + logic.RegisterCMDHandler(h.handleWai, "w") + logic.RegisterCMDHandler(h.handleOutbreak, "s") + logic.RegisterCMDHandler(h.handleMove, "r") + logic.RegisterCMDHandler(h.handleMode, "m") + + logic.RegisterCMDHandler(h.handleBuyFood, "bq") + logic.RegisterCMDHandler(h.handleBuyElite, "bw") + logic.RegisterCMDHandler(h.handleChangeElite, "zw") + logic.RegisterCMDHandler(h.handleChangeTitle, "zz") + + logic.RegisterCMDHandler(h.handleRankSubmit, "结算") } - resp.RegisterCMDHandler(resp.handleQuery, "q") - resp.RegisterCMDHandler(resp.handleJoinGame, "j") - resp.RegisterCMDHandler(resp.handleCreateUnit, "c") - resp.RegisterCMDHandler(resp.handleWai, "w") - resp.RegisterCMDHandler(resp.handleOutbreak, "s") - resp.RegisterCMDHandler(resp.handleMove, "m") - resp.RegisterCMDHandler(resp.handleMode, "r") - // - resp.RegisterCMDHandler(resp.handleBuyFood, "bq") - resp.RegisterCMDHandler(resp.handleBuyElite, "bw") - resp.RegisterCMDHandler(resp.handleChangeElite, "zw") - resp.RegisterCMDHandler(resp.handleChangeTitle, "zz") - // - resp.RegisterCMDHandler(resp.handleRankSubmit, "结算") - // gift - resp.RegisterGiftHandler(resp.handleGift) - return resp.LiveGameLogic } -func (h *ZhgGameLogic) handleQuery(roomId int64, _ string, _ []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleQuery(liveRoom *LiveRoom, _ string, _ []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -180,8 +189,8 @@ func (h *ZhgGameLogic) handleQuery(roomId int64, _ string, _ []rune, user *pbCom room.Broadcast(pb.PushUserQuery, resp) } -func (h *ZhgGameLogic) handleJoinGame(roomId int64, _ string, _ []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleJoinGame(liveRoom *LiveRoom, _ string, _ []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -230,8 +239,8 @@ func (h *ZhgGameLogic) handleJoinGame(roomId int64, _ string, _ []rune, user *pb room.Broadcast(pb.PushZhgJoinGame, resp) } -func (h *ZhgGameLogic) handleOutbreak(roomId int64, msgId string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleOutbreak(liveRoom *LiveRoom, prefix string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -240,16 +249,16 @@ func (h *ZhgGameLogic) handleOutbreak(roomId int64, msgId string, content []rune logger.SLog.Debugf("用户 [%s] 普通暴兵", user.Username) room.Broadcast(pb.PushZhgOutbreak, &pbGameZhg.Outbreak{User: user}) } else { - h.handleOutbreakFood(room, msgId, content, user) + h.handleOutbreakFood(room, prefix, content, user) } } -func (h *ZhgGameLogic) handleOutbreakFood(room *manager.Room, msgId string, content []rune, user *pbCommon.PbUser) { +func (h *ZhgGameLogic) handleOutbreakFood(room *manager.Room, prefix string, content []rune, user *pbCommon.PbUser) { if len(content) < 1 { return } - zhgCfg := config.Config.Game.Zhg + zhgCfg := h.svcCtx.Config.Game.Zhg // s1,10s2,10s3,10s4,10 11,0 111, contentStr := string(content) @@ -307,8 +316,8 @@ func (h *ZhgGameLogic) handleOutbreakFood(room *manager.Room, msgId string, cont }) } -func (h *ZhgGameLogic) handleCreateUnit(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleCreateUnit(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -324,8 +333,8 @@ func (h *ZhgGameLogic) handleCreateUnit(roomId int64, _ string, content []rune, }) } -func (h *ZhgGameLogic) handleMove(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleMove(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -341,8 +350,8 @@ func (h *ZhgGameLogic) handleMove(roomId int64, _ string, content []rune, user * }) } -func (h *ZhgGameLogic) handleWai(roomId int64, _ string, _ []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleWai(liveRoom *LiveRoom, _ string, _ []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -352,8 +361,8 @@ func (h *ZhgGameLogic) handleWai(roomId int64, _ string, _ []rune, user *pbCommo room.Broadcast(pb.PushZhgWhere, &pbGameZhg.Wai{User: user}) } -func (h *ZhgGameLogic) handleMode(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleMode(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -370,8 +379,8 @@ func (h *ZhgGameLogic) handleMode(roomId int64, _ string, content []rune, user * }) } -func (h *ZhgGameLogic) handleBuyFood(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleBuyFood(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -383,7 +392,7 @@ func (h *ZhgGameLogic) handleBuyFood(roomId int64, _ string, content []rune, use if err != nil { return } - zhgCfg := config.Config.Game.Zhg + zhgCfg := h.svcCtx.Config.Game.Zhg food := decimal.NewFromInt(cost).Mul(decimal.NewFromFloat32(zhgCfg.CoinFoodRatio)).Round(0).IntPart() logger.SLog.Debugf("用户 [%s] 买粮草 花费[%d] 买到[%d]", user.Username, cost, food) @@ -394,8 +403,8 @@ func (h *ZhgGameLogic) handleBuyFood(roomId int64, _ string, content []rune, use }) } -func (h *ZhgGameLogic) handleBuyElite(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleBuyElite(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -432,8 +441,8 @@ func (h *ZhgGameLogic) handleBuyElite(roomId int64, _ string, content []rune, us room.Broadcast(pb.PushBuyGoods, resp) } -func (h *ZhgGameLogic) handleChangeElite(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleChangeElite(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -465,8 +474,8 @@ func (h *ZhgGameLogic) handleChangeElite(roomId int64, _ string, content []rune, room.Broadcast(pb.PushZhgChangeElite, resp) } -func (h *ZhgGameLogic) handleChangeTitle(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleChangeTitle(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -498,8 +507,8 @@ func (h *ZhgGameLogic) handleChangeTitle(roomId int64, _ string, content []rune, room.Broadcast(pb.PushZhgChangeTitle, resp) } -func (h *ZhgGameLogic) handleRankSubmit(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgGameLogic) handleRankSubmit(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -507,7 +516,7 @@ func (h *ZhgGameLogic) handleRankSubmit(roomId int64, _ string, content []rune, return } var isAdminUser bool - for _, i := range config.Config.Game.AdminUserId { + for _, i := range h.svcCtx.Config.Game.AdminUserId { if user.UserId == i { isAdminUser = true break @@ -556,6 +565,6 @@ func (h *ZhgGameLogic) handleRankSubmit(roomId int64, _ string, content []rune, room.Broadcast(pb.PushZhgRankSubmit, resp) } -func (h *ZhgGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { - // TODO 暂时没有特殊礼物需求,留空 -} +//func (h *ZhgGameLogic) handleGift(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) { +// // TODO 暂时没有特殊礼物需求,留空 +//} diff --git a/game/live_logic/zhghz_handler.go b/game/live_logic/zhghz_handler.go index 8df9b7c..bef6ac0 100644 --- a/game/live_logic/zhghz_handler.go +++ b/game/live_logic/zhghz_handler.go @@ -1,160 +1,149 @@ package live_logic -import ( - "dcg/game/manager" - pbCommon "dcg/game/pb/common" - pbGameZhghz "dcg/game/pb/game/zhghz" - pbMq "dcg/game/pb/mq" - pbRoom "dcg/game/pb/room" - "dcg/pkg/cmd" - "fmt" - "strconv" -) - -type ( - ZhghzGameLogic struct { - *LiveGameLogic - - // giftLogics 礼物处理 platform-cmd:logic - giftLogics map[string]GiftLogic - } -) - -func NewZhghzLiveGameLogic() *ZhghzGameLogic { - resp := &ZhghzGameLogic{ - giftLogics: make(map[string]GiftLogic), - LiveGameLogic: NewLiveGameLogic(pbRoom.GameType_ZHGHZ, cmd.NewCMDParser(cmd.Pattern{ - Prefix: "j", - Alias: nil, - ContentMaxLen: 0, - }, cmd.Pattern{ - Prefix: "t", - Alias: nil, - ContentMaxLen: 1, - }, cmd.Pattern{ - Prefix: "m", - Alias: nil, - ContentMaxLen: 1, - }, cmd.Pattern{ - Prefix: "f", - Alias: nil, - ContentMaxLen: 0, - }, cmd.Pattern{ - Prefix: "w", - Alias: []string{"我在哪"}, - ContentMaxLen: 0, - })), - } - resp.RegisterCMDHandler(resp.handleJoinGame, "j") - resp.RegisterCMDHandler(resp.handleJoinGame, "t") - resp.RegisterCMDHandler(resp.handleMove, "m") - resp.RegisterCMDHandler(resp.handleShoot, "f") - resp.RegisterCMDHandler(resp.handleWai, "w") - // gift | game.chargeShield | game.giftShoot - resp.RegisterGiftHandler(resp.handleGift) - return resp -} - -func (h *ZhghzGameLogic) handleJoinGame(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) - if err != nil { - return - } - - var team int32 - if len(content) > 0 { - v, _ := strconv.Atoi(string(content[0])) - team = int32(v) - } - room.Broadcast("game.join", &pbGameZhghz.JoinGame{ - User: user, - Team: team, - }) -} - -func (h *ZhghzGameLogic) handleMove(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) - if err != nil { - return - } - - if len(content) < 1 { - return - } - v, _ := strconv.Atoi(string(content[0])) - - room.Broadcast("game.move", &pbGameZhghz.Move{ - User: user, - Direction: int32(v), - }) -} - -func (h *ZhghzGameLogic) handleShoot(roomId int64, _ string, _ []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) - if err != nil { - return - } - room.Broadcast("game.shoot", &pbGameZhghz.Shoot{ - User: user, - }) -} - -func (h *ZhghzGameLogic) handleWai(roomId int64, _ string, _ []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) - if err != nil { - return - } - 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 { - if gift.GiftId == id { - gl.Fn(roomId, user, gift) - return true - } - } - return true - } else { - return false - } -} - -func (h *ZhghzGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) - if err != nil { - return - } - - // bilibili - { - 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.Broadcast("game.chargeShield", &pbGameZhghz.ChargeShield{ - User: user, - Points: int32(gift.GiftNum * 1), - }) - }, - } - } - - 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.Broadcast("game.giftShoot", &pbGameZhghz.ChargeShield{ - User: user, - Points: int32(gift.GiftNum * 1), - }) - }, - } - } - } -} +//type ( +// ZhghzGameLogic struct { +// *liveLogic +// +// // giftLogics 礼物处理 platform-cmd:logic +// giftLogics map[string]GiftLogic +// } +//) +// +//func NewZhghzLiveGameLogic() *ZhghzGameLogic { +// resp := &ZhghzGameLogic{ +// giftLogics: make(map[string]GiftLogic), +// liveLogic: NewLiveGameLogic(pbRoom.GameType_ZHGHZ, cmd.NewCMDParser(cmd.Pattern{ +// Prefix: "j", +// Alias: nil, +// ContentMaxLen: 0, +// }, cmd.Pattern{ +// Prefix: "t", +// Alias: nil, +// ContentMaxLen: 1, +// }, cmd.Pattern{ +// Prefix: "m", +// Alias: nil, +// ContentMaxLen: 1, +// }, cmd.Pattern{ +// Prefix: "f", +// Alias: nil, +// ContentMaxLen: 0, +// }, cmd.Pattern{ +// Prefix: "w", +// Alias: []string{"我在哪"}, +// ContentMaxLen: 0, +// })), +// } +// resp.RegisterCMDHandler(resp.handleJoinGame, "j") +// resp.RegisterCMDHandler(resp.handleJoinGame, "t") +// resp.RegisterCMDHandler(resp.handleMove, "m") +// resp.RegisterCMDHandler(resp.handleShoot, "f") +// resp.RegisterCMDHandler(resp.handleWai, "w") +// // gift | game.chargeShield | game.giftShoot +// resp.RegisterGiftHandler(resp.handleGift) +// return resp +//} +// +//func (h *ZhghzGameLogic) handleJoinGame(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { +// room, err := manager.GameManager.RoomByLiveRoom(roomId) +// if err != nil { +// return +// } +// +// var team int32 +// if len(content) > 0 { +// v, _ := strconv.Atoi(string(content[0])) +// team = int32(v) +// } +// room.Broadcast("game.join", &pbGameZhghz.JoinGame{ +// User: user, +// Team: team, +// }) +//} +// +//func (h *ZhghzGameLogic) handleMove(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { +// room, err := manager.GameManager.RoomByLiveRoom(roomId) +// if err != nil { +// return +// } +// +// if len(content) < 1 { +// return +// } +// v, _ := strconv.Atoi(string(content[0])) +// +// room.Broadcast("game.move", &pbGameZhghz.Move{ +// User: user, +// Direction: int32(v), +// }) +//} +// +//func (h *ZhghzGameLogic) handleShoot(roomId int64, _ string, _ []rune, user *pbCommon.PbUser) { +// room, err := manager.GameManager.RoomByLiveRoom(roomId) +// if err != nil { +// return +// } +// room.Broadcast("game.shoot", &pbGameZhghz.Shoot{ +// User: user, +// }) +//} +// +//func (h *ZhghzGameLogic) handleWai(roomId int64, _ string, _ []rune, user *pbCommon.PbUser) { +// room, err := manager.GameManager.RoomByLiveRoom(roomId) +// if err != nil { +// return +// } +// 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 { +// if gift.GiftId == id { +// gl.Fn(roomId, user, gift) +// return true +// } +// } +// return true +// } else { +// return false +// } +//} +// +//func (h *ZhghzGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { +// room, err := manager.GameManager.RoomByLiveRoom(roomId) +// if err != nil { +// return +// } +// +// // bilibili +// { +// 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.Broadcast("game.chargeShield", &pbGameZhghz.ChargeShield{ +// User: user, +// Points: int32(gift.GiftNum * 1), +// }) +// }, +// } +// } +// +// 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.Broadcast("game.giftShoot", &pbGameZhghz.ChargeShield{ +// User: user, +// Points: int32(gift.GiftNum * 1), +// }) +// }, +// } +// } +// } +//} diff --git a/game/live_logic/zhgzd_handler.go b/game/live_logic/zhgzd_handler.go index 34b4309..f6bd0aa 100644 --- a/game/live_logic/zhgzd_handler.go +++ b/game/live_logic/zhgzd_handler.go @@ -1,7 +1,6 @@ package live_logic import ( - "dcg/config" "dcg/game/manager" "dcg/game/pb" pbCommon "dcg/game/pb/common" @@ -17,52 +16,74 @@ import ( type ZhgzdGameLogic struct { svcCtx *svc.ServiceContext - *LiveGameLogic } -func NewZhgzdLiveGameLogic(svcCtx *svc.ServiceContext) *LiveGameLogic { - resp := &ZhgzdGameLogic{ +func NewZhgzdLiveGameLogic(svcCtx *svc.ServiceContext) *ZhgzdGameLogic { + return &ZhgzdGameLogic{ svcCtx: svcCtx, - LiveGameLogic: NewLiveGameLogic(pbRoom.GameType_ZHGZD, cmd.NewCMDParser( - cmd.Pattern{ - Prefix: "j", - Alias: []string{"加入", "加入游戏"}, - ContentMaxLen: 0, - }, cmd.Pattern{ - Prefix: "c", - Alias: []string{"换兵"}, - ContentMaxLen: 1, - }, cmd.Pattern{ - Prefix: "w", - Alias: []string{"我在哪"}, - ContentMaxLen: 0, - }, cmd.Pattern{ - Prefix: "s", - ContentMaxLen: 1, - }, cmd.Pattern{ - Prefix: "m", - ContentMaxLen: 1, - }, cmd.Pattern{ - Prefix: "r", - ContentMaxLen: 1, - }, - )), } - resp.RegisterCMDHandler(resp.handleJoinGame, "j") - resp.RegisterCMDHandler(resp.handleDispatch, "s") - resp.RegisterCMDHandler(resp.handleOutbreak, "s") - resp.RegisterCMDHandler(resp.handleChangeUnit, "c") - resp.RegisterCMDHandler(resp.handlePosition, "p") - resp.RegisterCMDHandler(resp.handleMove, "m") - resp.RegisterCMDHandler(resp.handleWhere, "w") - resp.RegisterCMDHandler(resp.handleMode, "r") - // gift - resp.RegisterGiftHandler(resp.handleGift) - return resp.LiveGameLogic } -func (h *ZhgzdGameLogic) handleJoinGame(roomId int64, _ string, _ []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgzdGameLogic) WithGameType() LogicOption { + return WithGameType(pbRoom.GameType_name[int32(pbRoom.GameType_ZHGZD)]) +} + +func (h *ZhgzdGameLogic) WithCmdParserLogic(p []cmd.Pattern) LogicOption { + pattern := []cmd.Pattern{ + { + Prefix: "j", + Alias: []string{"加入", "加入游戏"}, + ContentMaxLen: 0, + }, { + Prefix: "c", + Alias: []string{"换兵"}, + ContentMaxLen: 1, + }, { + Prefix: "w", + Alias: []string{"我在哪"}, + ContentMaxLen: 0, + }, { + Prefix: "s", + ContentMaxLen: 1, + }, { + Prefix: "m", + ContentMaxLen: 1, + }, { + Prefix: "r", + ContentMaxLen: 1, + }, + } + pattern = append(pattern, p...) + cmdParser := cmd.NewCMDParser(pattern...) + cmdParser.SetDistinct(true) + + return WithCmdParser(cmdParser) +} + +func (h *ZhgzdGameLogic) WithCmdHandlers() LogicOption { + return func(logic LiveLogic) { + logic.RegisterCMDHandler(h.handleJoinGame, "j") + logic.RegisterCMDHandler(h.handleDispatch, "s") + logic.RegisterCMDHandler(h.handleOutbreak, "s") + logic.RegisterCMDHandler(h.handleChangeUnit, "c") + logic.RegisterCMDHandler(h.handlePosition, "p") + logic.RegisterCMDHandler(h.handleMove, "m") + logic.RegisterCMDHandler(h.handleWhere, "w") + logic.RegisterCMDHandler(h.handleMode, "r") + } +} + +func (h *ZhgzdGameLogic) WithGiftHandler() LogicOption { + return WithGiftHandler(func(next GiftHandlerFunc) GiftHandlerFunc { + return func(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) { + h.handleGift(liveRoom, user, gift) + next(liveRoom, user, gift) + } + }) +} + +func (h *ZhgzdGameLogic) handleJoinGame(liveRoom *LiveRoom, _ string, _ []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -71,19 +92,19 @@ func (h *ZhgzdGameLogic) handleJoinGame(roomId int64, _ string, _ []rune, user * room.Broadcast(pb.PushZhgzdJoinGame, &pbGameZhgzd.JoinGame{User: user}) } -func (h *ZhgzdGameLogic) handleDispatch(roomId int64, msgId string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgzdGameLogic) handleDispatch(liveRoom *LiveRoom, msgId string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } if len(content) == 0 { - h.handleOutbreak(roomId, msgId, content, user) + h.handleOutbreak(liveRoom, msgId, content, user) } else { const cmdType = "s" unitType := string(content[0]) - cfg := config.Config.Game.Zhgzd + cfg := h.svcCtx.Config.Game.Zhgzd unitId := cfg.CommandUnitDict[unitType] count := cfg.DispatchCountDict[unitId] var costSp int32 @@ -102,8 +123,8 @@ func (h *ZhgzdGameLogic) handleDispatch(roomId int64, msgId string, content []ru } } -func (h *ZhgzdGameLogic) handleOutbreak(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgzdGameLogic) handleOutbreak(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -112,7 +133,7 @@ func (h *ZhgzdGameLogic) handleOutbreak(roomId int64, _ string, content []rune, } const cmdType = "s" - cfg := config.Config.Game.Zhgzd + cfg := h.svcCtx.Config.Game.Zhgzd var costSp int32 if costCfg, ok := cfg.CommandCostDict[cmdType]; ok { costSp = costCfg.Common @@ -126,8 +147,8 @@ func (h *ZhgzdGameLogic) handleOutbreak(roomId int64, _ string, content []rune, }) } -func (h *ZhgzdGameLogic) handleChangeUnit(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgzdGameLogic) handleChangeUnit(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -137,7 +158,7 @@ func (h *ZhgzdGameLogic) handleChangeUnit(roomId int64, _ string, content []rune const cmdType = "c" unitType := string(content[0]) - cfg := config.Config.Game.Zhgzd + cfg := h.svcCtx.Config.Game.Zhgzd unitId := cfg.CommandUnitDict[unitType] var costSp int32 if costCfg, ok := cfg.CommandCostDict[cmdType]; ok { @@ -153,8 +174,8 @@ func (h *ZhgzdGameLogic) handleChangeUnit(roomId int64, _ string, content []rune }) } -func (h *ZhgzdGameLogic) handlePosition(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgzdGameLogic) handlePosition(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -164,7 +185,7 @@ func (h *ZhgzdGameLogic) handlePosition(roomId int64, _ string, content []rune, } const cmdType = "p" - cfg := config.Config.Game.Zhgzd + cfg := h.svcCtx.Config.Game.Zhgzd var costSp int32 if costCfg, ok := cfg.CommandCostDict[cmdType]; ok { costSp = costCfg.Common @@ -181,8 +202,8 @@ func (h *ZhgzdGameLogic) handlePosition(roomId int64, _ string, content []rune, }) } -func (h *ZhgzdGameLogic) handleMove(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgzdGameLogic) handleMove(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -192,7 +213,7 @@ func (h *ZhgzdGameLogic) handleMove(roomId int64, _ string, content []rune, user } const cmdType = "m" - cfg := config.Config.Game.Zhgzd + cfg := h.svcCtx.Config.Game.Zhgzd var costSp int32 if costCfg, ok := cfg.CommandCostDict[cmdType]; ok { costSp = costCfg.Common @@ -209,8 +230,8 @@ func (h *ZhgzdGameLogic) handleMove(roomId int64, _ string, content []rune, user }) } -func (h *ZhgzdGameLogic) handleWhere(roomId int64, _ string, _ []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgzdGameLogic) handleWhere(liveRoom *LiveRoom, _ string, _ []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -220,8 +241,8 @@ func (h *ZhgzdGameLogic) handleWhere(roomId int64, _ string, _ []rune, user *pbC room.Broadcast(pb.PushZhgzdWhere, &pbGameZhgzd.Where{User: user}) } -func (h *ZhgzdGameLogic) handleMode(roomId int64, _ string, content []rune, user *pbCommon.PbUser) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgzdGameLogic) handleMode(liveRoom *LiveRoom, _ string, content []rune, user *pbCommon.PbUser) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } @@ -230,7 +251,7 @@ func (h *ZhgzdGameLogic) handleMode(roomId int64, _ string, content []rune, user } const cmdType = "r" - cfg := config.Config.Game.Zhgzd + cfg := h.svcCtx.Config.Game.Zhgzd var costSp int32 if costCfg, ok := cfg.CommandCostDict[cmdType]; ok { costSp = costCfg.Common @@ -247,12 +268,12 @@ func (h *ZhgzdGameLogic) handleMode(roomId int64, _ string, content []rune, user }) } -func (h *ZhgzdGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) { - room, err := manager.GameManager.RoomByLiveRoomId(roomId) +func (h *ZhgzdGameLogic) handleGift(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) { + room, err := manager.GameManager.RoomByLiveRoom(liveRoom.RoomId, liveRoom.Platform) if err != nil { return } - cfg := config.Config.Game.Zhgzd.GiftEffect + cfg := h.svcCtx.Config.Game.Zhgzd.GiftEffect logger.SLog.Debugf("用户 [%s] 赠送礼物 %s x %d", user.Username, gift.GiftName, gift.GiftNum) diff --git a/game/logic/game/game.go b/game/logic/game/game.go new file mode 100644 index 0000000..b34184d --- /dev/null +++ b/game/logic/game/game.go @@ -0,0 +1,82 @@ +package game + +import ( + "dcg/game/manager" + pbCommon "dcg/game/pb/common" + pbGameZhgWW2 "dcg/game/pb/game/zhgww2" + "dcg/game/svc" + "git.noahlan.cn/northlan/ngs/component" + "git.noahlan.cn/northlan/ngs/session" + "git.noahlan.cn/northlan/ntools-go/logger" +) + +type GameLogic struct { + component.Base + svcCtx *svc.ServiceContext +} + +func NewGameLogic(svcCtx *svc.ServiceContext) *GameLogic { + return &GameLogic{ + svcCtx: svcCtx, + } +} + +func (p *GameLogic) Init() { +} + +func (p *GameLogic) Shutdown() { +} + +func (p *GameLogic) CMD() string { + return "game" +} + +func (p *GameLogic) Prefix() string { + return "" +} + +// Status 游戏房间状态变更 +func (p *GameLogic) Status(s *session.Session, msg *pbCommon.GameStatusReq) error { + room, err := manager.GameManager.RoomBySession(s) + if err != nil { + return s.Response(&pbCommon.GameStatusResp{ + Success: false, + }) + } + room.SetStatus(manager.GameStatus(msg.Status)) + + return s.Response(&pbCommon.GameStatusResp{ + Success: true, + BattleId: room.BattleId, + Timestamp: msg.Timestamp, + }) +} + +// Join 玩家加入游戏 +func (p *GameLogic) Join(s *session.Session, msg *pbGameZhgWW2.JoinGameReq) error { + logger.SLog.Infof("玩家 [%s] 加入游戏-客户端请求", msg.User.Username) + + room, err := manager.GameManager.RoomBySession(s) + if err != nil { + return s.Response(&pbGameZhgWW2.JoinGameResp{ + User: msg.User, + BattleId: msg.BattleId, + Team: msg.Team, + Success: false, + Message: "未找到游戏房间", + }) + } + room.UserJoin(manager.User{ + ID: msg.User.UserId, + Username: msg.User.Username, + Platform: msg.User.Platform, + Avatar: msg.User.Avatar, + Team: msg.Team, + }) + + return s.Response(&pbGameZhgWW2.JoinGameResp{ + User: msg.User, + BattleId: msg.BattleId, + Team: msg.Team, + }) +} diff --git a/game/logic/game_status/game_status.go b/game/logic/game_status/game_status.go deleted file mode 100644 index ed3575b..0000000 --- a/game/logic/game_status/game_status.go +++ /dev/null @@ -1,51 +0,0 @@ -package game_status - -import ( - "dcg/game/manager" - pbCommon "dcg/game/pb/common" - "dcg/game/svc" - "git.noahlan.cn/northlan/ngs/component" - "git.noahlan.cn/northlan/ngs/session" -) - -type GameStatus struct { - component.Base - svcCtx *svc.ServiceContext -} - -func NewGameStatus(svcCtx *svc.ServiceContext) *GameStatus { - return &GameStatus{ - svcCtx: svcCtx, - } -} - -func (p *GameStatus) Init() { -} - -func (p *GameStatus) Shutdown() { -} - -func (p *GameStatus) CMD() string { - return "game" -} - -func (p *GameStatus) Prefix() string { - return "" -} - -// Status 游戏房间状态变更 -func (p *GameStatus) Status(s *session.Session, msg *pbCommon.GameStatusReq) error { - manager.GameManager.SessionGameStatus(s, manager.GameStatus(msg.Status)) - - data, err := manager.GameManager.SessionData(s) - if err != nil { - return s.Response(&pbCommon.GameStatusResp{ - Success: false, - }) - } - return s.Response(&pbCommon.GameStatusResp{ - Success: true, - BattleId: data.BattleId(), - Timestamp: msg.Timestamp, - }) -} diff --git a/game/logic/init.go b/game/logic/init.go index dcbf92d..974a158 100644 --- a/game/logic/init.go +++ b/game/logic/init.go @@ -1,7 +1,7 @@ package logic import ( - "dcg/game/logic/game_status" + "dcg/game/logic/game" "dcg/game/logic/room" "dcg/game/logic/user" "dcg/game/logic/zhg/rank" @@ -48,7 +48,7 @@ func Init(svcCtx *svc.ServiceContext) { return userCoin.Prefix() + "." + strings.ToLower(s) })) - gameStatus := game_status.NewGameStatus(svcCtx) + gameStatus := game.NewGameLogic(svcCtx) services.Register(gameStatus, component.WithName(gameStatus.CMD()), component.WithNameFunc(func(s string) string { diff --git a/game/logic/room/manager.go b/game/logic/room/manager.go index 16edb7e..6bf3b3d 100644 --- a/game/logic/room/manager.go +++ b/game/logic/room/manager.go @@ -5,6 +5,7 @@ import ( pbRoom "dcg/game/pb/room" "git.noahlan.cn/northlan/ngs/component" "git.noahlan.cn/northlan/ngs/session" + "git.noahlan.cn/northlan/ntools-go/uuid" ) type ( @@ -26,24 +27,55 @@ func (m *Logic) Init() { func (m *Logic) AfterInit() { session.Lifetime.OnClosed(func(s *session.Session) { - manager.GameManager.RoomManager.LeaveRoom(s) + manager.GameManager.LeaveRoom(s) }) } func (m *Logic) Shutdown() { - manager.GameManager.RoomManager.Clean() + manager.GameManager.Clean() } func (m *Logic) Join(s *session.Session, msg *pbRoom.JoinRoomReq) error { // uid - liveRoomId - err := s.Bind(msg.LiveRoomId) + err := s.Bind(uuid.NextId()) if err != nil { return err } - manager.GameManager.DataManager.SetSessionData(s, manager.NewGameData(msg.LiveRoomId)) + gameTypeStr := pbRoom.GameType_name[int32(msg.GameType)] - if err = manager.GameManager.JoinRoom(s, msg.GameType, msg.LiveRoomId); err != nil { + sd := manager.NewSessionData(gameTypeStr) + for _, room := range msg.LiveRooms { + sd.AddLiveRoom(manager.LiveRoom{ + ID: room.LiveRoomId, + Platform: room.Platform, + }) + } + sd.WithSession(s) + + var duplicated bool + manager.GameManager.PeekAllSession(func(room *manager.Room, s *session.Session) bool { + if data, err := manager.GetSessionData(s); err == nil { + for _, liveRoom := range data.LiveRooms { + for _, req_liveRoom := range msg.LiveRooms { + if liveRoom.ID == req_liveRoom.LiveRoomId && liveRoom.Platform == req_liveRoom.Platform { + // 重复 + duplicated = true + return false + } + } + } + } + return true + }) + if duplicated { + return s.Response(&pbRoom.JoinRoomResp{ + Code: 500, + Result: "当前客户端定义的直播间ID已经加入过游戏房间,请检查配置.", + }) + } + + if err = manager.GameManager.JoinRoom(s, gameTypeStr, msg.RoomId); err != nil { return s.Response(&pbRoom.JoinRoomResp{ Code: 500, Result: err.Error(), diff --git a/game/manager/data.go b/game/manager/data.go deleted file mode 100644 index 002762a..0000000 --- a/game/manager/data.go +++ /dev/null @@ -1,52 +0,0 @@ -package manager - -import ( - "git.noahlan.cn/northlan/ngs/session" - "git.noahlan.cn/northlan/ntools-go/uuid" -) - -type GameStatus int32 - -const ( - GameStarted GameStatus = iota + 1 // 游戏已经开始 - GameEnded // 游戏已结束 -) - -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(liveRoomId int64) *Data { - return &Data{ - liveRoomId: liveRoomId, - currentStatus: GameEnded, - } -} - -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.currentStatus -} diff --git a/game/manager/data_manager.go b/game/manager/data_manager.go deleted file mode 100644 index 4816411..0000000 --- a/game/manager/data_manager.go +++ /dev/null @@ -1,34 +0,0 @@ -package manager - -import ( - "errors" - "git.noahlan.cn/northlan/ngs/session" -) - -const ( - DataKey = "DATA" -) - -type DataManager struct { -} - -func NewDataManager() *DataManager { - return &DataManager{} -} - -func (m *DataManager) SessionGameStatus(session *session.Session, status GameStatus) { - if data, err := m.SessionData(session); err == nil { - data.SetStatus(status) - } -} - -func (m *DataManager) SetSessionData(s *session.Session, data *Data) { - s.Set(DataKey, data) -} - -func (m *DataManager) SessionData(session *session.Session) (*Data, error) { - if !session.HasKey(DataKey) { - return nil, errors.New("session中无data数据") - } - return session.Value(DataKey).(*Data), nil -} diff --git a/game/manager/manager.go b/game/manager/manager.go index 96a1536..d6046fd 100644 --- a/game/manager/manager.go +++ b/game/manager/manager.go @@ -1,7 +1,6 @@ package manager import ( - pbRoom "dcg/game/pb/room" "dcg/game/svc" "errors" "fmt" @@ -15,7 +14,6 @@ type ( svcCtx *svc.ServiceContext // svcCtx *RoomManager // 房间管理器 - *DataManager // 数据管理器(Session) } ) @@ -24,100 +22,47 @@ func Init(svcCtx *svc.ServiceContext) { } func newGameManager(svcCtx *svc.ServiceContext) *gameManager { - return &gameManager{ - svcCtx: svcCtx, - RoomManager: NewRoomManager(), - DataManager: NewDataManager(), + gameCfg := svcCtx.Config.Game.DefaultRooms + roomMetas := make([]RoomMeta, 0, len(gameCfg)) + for _, s := range gameCfg { + roomMetas = append(roomMetas, RoomMeta{ + ID: s.ID, + GameType: s.GameType, + IsDefault: true, + }) } -} - -func (m *gameManager) JoinRoom(s *session.Session, gameType pbRoom.GameType, liveRoomId int64) error { - room := m.RoomManager.RetrieveRoomByType(gameType) - - var exists *session.Session - room.PeekMembers(func(_ int64, s *session.Session) bool { - data, err := m.DataManager.SessionData(s) - if err != nil { - return true - } - if data.LiveRoomId() == liveRoomId { - exists = s - return false - } - return true - }) - if exists != nil { - // 将原有session从房间移除 - err := room.Leave(exists) - if err == nil { - exists = nil - } - } - if exists != nil { - return errors.New(fmt.Sprintf("session [%v] 已在房间 [%d] 中,不能再次加入", s, room.ID())) - } else { - return room.Add(s) + return &gameManager{ + svcCtx: svcCtx, + RoomManager: newRoomManager(WithDefaultRoom(roomMetas)), } } -// 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) +func (m *gameManager) RoomByLiveRoom(liveRoomId int64, platform string) (*Room, error) { + var resp *Room + m.PeekAllSession(func(room *Room, s *session.Session) bool { + data, err := GetSessionData(s) if err != nil { return true } - if filter(session, data) { - room = r - sess = session - return false + for _, liveRoom := range data.LiveRooms { + if liveRoom.ID == liveRoomId && liveRoom.Platform == platform { + resp = room + return false + } } return true }) - if err == nil && room == nil { - err = errors.New("未找到相关客户端实例") - return - } - 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 { + if resp == nil { return nil, errors.New(fmt.Sprintf("未找到直播间 [%d] 对应游戏房间", liveRoomId)) } - return room, nil -} - -func (m *gameManager) BattleIdByLiveRoomId(liveRoomId int64) int64 { - _, _, d, err := m.SessionByDataFilter(func(_ *session.Session, data *Data) bool { - return data.LiveRoomId() == liveRoomId - }) - if err != nil { - return 0 - } - return d.BattleId() + return resp, nil } -func (m *gameManager) BattleIdBySession(s *session.Session) int64 { - _, _, d, err := m.SessionByDataFilter(func(sess *session.Session, _ *Data) bool { - return sess.ID() == s.ID() - }) +func (m *gameManager) BattleIdByLiveRoom(liveRoomId int64, platform string) int64 { + room, err := m.RoomByLiveRoom(liveRoomId, platform) if err != nil { return 0 } - return d.BattleId() -} - -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 room, nil + return room.BattleId } diff --git a/game/manager/option.go b/game/manager/option.go new file mode 100644 index 0000000..2e0e880 --- /dev/null +++ b/game/manager/option.go @@ -0,0 +1,11 @@ +package manager + +type RoomManagerOption func(manager *RoomManager) + +func WithDefaultRoom(metas []RoomMeta) RoomManagerOption { + return func(manager *RoomManager) { + for _, meta := range metas { + manager.CreateRoom(meta.ID, meta.GameType, meta.IsDefault) + } + } +} diff --git a/game/manager/room.go b/game/manager/room.go index 42ecfaf..6a71613 100644 --- a/game/manager/room.go +++ b/game/manager/room.go @@ -1,45 +1,42 @@ package manager import ( - pbRoom "dcg/game/pb/room" "fmt" "git.noahlan.cn/northlan/ngs" "git.noahlan.cn/northlan/ntools-go/logger" ) type ( + // Room 游戏房间 - // 一种游戏类型一个房间 - // 一个房间多个客户端(此客户端可能来自于同一个直播间,没办法区分) + // 游戏类型:游戏房间 = 1:n -> 适用于同一个游戏多局游戏同时直播的情况 + // 游戏房间:客户端 = 1:n -> 适用于同一个游戏多个客户端实例(状态同步、帧同步?) + // 客户端:直播间 = 1:n -> 适用于同一个游戏客户端,覆盖多个游戏直播间的情况(如果允许) Room struct { - id int64 // 房间ID - gameType pbRoom.GameType // 游戏类型 + *RoomMeta + *RoomData *ngs.Group // 分组 } ) -func newRoom(id int64, gameType pbRoom.GameType) *Room { +func newRoom(id int64, gameType string, isDefault bool) *Room { return &Room{ - id: id, - gameType: gameType, - Group: ngs.NewGroup(fmt.Sprintf("Room-%s", pbRoom.GameType_name[int32(gameType)])), + RoomMeta: &RoomMeta{ + ID: id, + GameType: gameType, + IsDefault: isDefault, + }, + RoomData: newRoomData(), + Group: ngs.NewGroup(fmt.Sprintf("Room-%s-%d", gameType, id)), } } -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) + logger.SLog.Errorf("推送消息到 房间[%d:%s] 失败, err:%v", r.ID, r.GameType, err) } } @@ -47,6 +44,6 @@ func (r *Room) Broadcast(route string, v interface{}) { 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) + logger.SLog.Errorf("推送消息到 房间[%d:%s] 失败, err:%v", r.ID, r.GameType, err) } } diff --git a/game/manager/room_data.go b/game/manager/room_data.go new file mode 100644 index 0000000..2c08ab5 --- /dev/null +++ b/game/manager/room_data.go @@ -0,0 +1,57 @@ +package manager + +import "git.noahlan.cn/northlan/ntools-go/uuid" + +func newRoomData() *RoomData { + return &RoomData{ + BattleId: 0, + CurrentStatus: GameInit, + UserMap: make(map[int32]map[int64]User), + } +} + +func (m *RoomData) SetStatus(status GameStatus) { + if status == GameStarted { + m.startGame() + } else if status == GameEnded { + m.endGame() + } + + m.CurrentStatus = status +} + +func (m *RoomData) UserJoin(user User) { + tm, ok := m.UserMap[user.Team] + if !ok { + tm = make(map[int64]User) + m.UserMap[user.Team] = tm + } + tm[user.ID] = user +} + +func (m *RoomData) UserLeave(userId int64) { + for _, tm := range m.UserMap { + if _, ok := tm[userId]; ok { + delete(tm, userId) + } + } +} + +func (m *RoomData) GetUser(userId int64) (*User, bool) { + for _, tm := range m.UserMap { + if u, ok := tm[userId]; ok { + return &u, true + } + } + return nil, false +} + +func (m *RoomData) startGame() { + m.BattleId = uuid.NextId() + m.UserMap = make(map[int32]map[int64]User) +} + +func (m *RoomData) endGame() { + m.BattleId = 0 + m.UserMap = make(map[int32]map[int64]User) +} diff --git a/game/manager/room_manager.go b/game/manager/room_manager.go index fcb9392..2b0da7f 100644 --- a/game/manager/room_manager.go +++ b/game/manager/room_manager.go @@ -1,11 +1,9 @@ package manager import ( - pbRoom "dcg/game/pb/room" "errors" "fmt" "git.noahlan.cn/northlan/ngs/session" - "git.noahlan.cn/northlan/ntools-go/uuid" "google.golang.org/protobuf/proto" "sync" ) @@ -17,53 +15,62 @@ const ( type ( // RoomManager 房间管理器 RoomManager struct { - rooms map[pbRoom.GameType]*Room + rooms []*Room // 房间列表 - mutex sync.RWMutex + mu sync.RWMutex } ) -func NewRoomManager() *RoomManager { - return &RoomManager{ - rooms: make(map[pbRoom.GameType]*Room), +func newRoomManager(opts ...RoomManagerOption) *RoomManager { + resp := &RoomManager{ + rooms: make([]*Room, 0), } -} - -func (m *RoomManager) Members() []*session.Session { - m.mutex.RLock() - defer m.mutex.RUnlock() - resp := make([]*session.Session, 0) - for _, room := range m.rooms { - resp = append(resp, room.Members()...) + for _, opt := range opts { + opt(resp) } + return resp } -func (m *RoomManager) PeekRoom(fn func(gameType pbRoom.GameType, room *Room) bool) { - m.mutex.RLock() - defer m.mutex.RUnlock() +func (m *RoomManager) CreateRoom(id int64, gameType string, isDefault bool) *Room { + m.mu.Lock() + defer m.mu.Unlock() - for gameType, room := range m.rooms { - if !fn(gameType, room) { - break + resp := newRoom(id, gameType, isDefault) + m.rooms = append(m.rooms, resp) + + return resp +} + +// JoinRoom 加入房间 +// id 房间ID 零值表示加入默认房间 +func (m *RoomManager) JoinRoom(s *session.Session, gameType string, roomId int64) error { + var room *Room + for _, tmp := range m.rooms { + if roomId == 0 { + if tmp.IsDefault && tmp.GameType == gameType { + room = tmp + break + } + } else { + if tmp.ID == roomId { + room = tmp + break + } } } -} -func (m *RoomManager) PeekAllSession(fn func(*Room, *session.Session) bool) { - m.mutex.RLock() - defer m.mutex.RUnlock() + if room == nil { + return errors.New("没有房间可供加入") + } - for _, room := range m.rooms { - room.PeekMembers(func(sId int64, s *session.Session) bool { - return fn(room, s) - }) + if r, err := m.RoomBySession(s); err == nil { + // 强制离开原房间 + s.Remove(RoomKey) + _ = r.Leave(s) } -} -func (m *RoomManager) JoinRoom(s *session.Session, gameType pbRoom.GameType) error { - room := m.RetrieveRoomByType(gameType) s.Set(RoomKey, room) return room.Add(s) } @@ -73,47 +80,87 @@ func (m *RoomManager) LeaveRoom(s *session.Session) { if err != nil { return } + s.Remove(RoomKey) _ = room.Leave(s) } +func (m *RoomManager) Clean() { + m.mu.Lock() + defer m.mu.Unlock() + + for _, room := range m.rooms { + for _, s := range room.Members() { + s.Remove(RoomKey) + } + _ = room.LeaveAll() + } + m.rooms = m.rooms[:1] +} + +func (m *RoomManager) BattleIdBySession(s *session.Session) int64 { + room, err := m.RoomBySession(s) + if err != nil { + return 0 + } + return room.BattleId +} + +func (m *RoomManager) RoomByBattleId(battleId int64) (*Room, error) { + var resp *Room + m.PeekRoom(func(room *Room) bool { + if room.BattleId == battleId { + resp = room + return false + } + return true + }) + if resp == nil { + return nil, errors.New(fmt.Sprintf("未找到战局 [%d] 对应的游戏房间", battleId)) + } + return resp, nil +} + +// RoomBySession 获取session所在的游戏房间 func (m *RoomManager) RoomBySession(s *session.Session) (*Room, error) { if !s.HasKey(RoomKey) { - return nil, errors.New(fmt.Sprintf("session [%d] 未加入房间", s.ID())) + return nil, errors.New(fmt.Sprintf("客户端 [%d] 未加入房间", s.ID())) } room := s.Value(RoomKey).(*Room) return room, nil } -func (m *RoomManager) Clean() { - m.mutex.Lock() - defer m.mutex.Unlock() +// PeekRoom 遍历所有房间 +// fn filter方法,返回true表示循环继续,false表示循环结束 +func (m *RoomManager) PeekRoom(fn func(room *Room) bool) { + m.mu.RLock() + defer m.mu.RUnlock() for _, room := range m.rooms { - _ = room.LeaveAll() + if !fn(room) { + break + } } - m.rooms = make(map[pbRoom.GameType]*Room) } -// Broadcast 消息全局分发,即所有房间分发 -func (m *RoomManager) Broadcast(route string, msg proto.Message) { - m.mutex.RLock() - defer m.mutex.RUnlock() +// PeekAllSession 遍历所有session +// fn: returns true继续遍历 false结束 +func (m *RoomManager) PeekAllSession(fn func(*Room, *session.Session) bool) { + m.mu.RLock() + defer m.mu.RUnlock() for _, room := range m.rooms { - room.Broadcast(route, msg) + room.PeekMembers(func(sId int64, s *session.Session) bool { + return fn(room, s) + }) } } -// RetrieveRoomByType 通过游戏类型获取游戏房间 -// 若房间不存在,则创建 -func (m *RoomManager) RetrieveRoomByType(gameType pbRoom.GameType) *Room { - m.mutex.Lock() - defer m.mutex.Unlock() +// Broadcast 消息全局分发,即所有房间分发 +func (m *RoomManager) Broadcast(route string, msg proto.Message) { + m.mu.RLock() + defer m.mu.RUnlock() - room, found := m.rooms[gameType] - if !found { - room = newRoom(uuid.NextId(), gameType) - m.rooms[gameType] = room + for _, room := range m.rooms { + room.Broadcast(route, msg) } - return room } diff --git a/game/manager/session_data.go b/game/manager/session_data.go new file mode 100644 index 0000000..d152729 --- /dev/null +++ b/game/manager/session_data.go @@ -0,0 +1,39 @@ +package manager + +import ( + "errors" + "git.noahlan.cn/northlan/ngs/session" +) + +const dataKey = "DATA" + +type ( + SessionData struct { + LiveRooms []LiveRoom // Session 对应 直播间ID列表 + GameType string // 客户端游戏类型 + } + + DataFilter func(session *session.Session, data *SessionData) bool +) + +func NewSessionData(gameType string) *SessionData { + return &SessionData{ + LiveRooms: make([]LiveRoom, 0), + GameType: gameType, + } +} + +func GetSessionData(s *session.Session) (*SessionData, error) { + if !s.HasKey(dataKey) { + return nil, errors.New("session中无data数据") + } + return s.Value(dataKey).(*SessionData), nil +} + +func (m *SessionData) AddLiveRoom(room ...LiveRoom) { + m.LiveRooms = append(m.LiveRooms, room...) +} + +func (m *SessionData) WithSession(s *session.Session) { + s.Set(dataKey, m) +} diff --git a/game/manager/types.go b/game/manager/types.go new file mode 100644 index 0000000..46bfe03 --- /dev/null +++ b/game/manager/types.go @@ -0,0 +1,36 @@ +package manager + +type GameStatus int32 + +const ( + GameInit GameStatus = iota + 1 // 游戏已经初始化 + GameStarted // 游戏已经开始 + GameEnded // 游戏已结束 +) + +type ( + RoomMeta struct { + ID int64 // ID + GameType string // 类型 + IsDefault bool // 是否默认 + } + + RoomData struct { + BattleId int64 // 战局ID + CurrentStatus GameStatus // 当前战局状态 + UserMap map[int32]map[int64]User // 当前房间加入游戏的玩家 (team) + } + + User struct { + ID int64 // uid + Platform string // 平台 + Username string // 用户名 + Avatar string // 头像 + Team int32 // 队伍 + } + + LiveRoom struct { + ID int64 + Platform string + } +) diff --git a/game/msg_transfer/coin_transfer.go b/game/mq/coin_transfer.go similarity index 95% rename from game/msg_transfer/coin_transfer.go rename to game/mq/coin_transfer.go index 528e848..bf51bd9 100644 --- a/game/msg_transfer/coin_transfer.go +++ b/game/mq/coin_transfer.go @@ -1,7 +1,6 @@ -package msg_transfer +package mq import ( - "dcg/config" "dcg/game/manager" "dcg/game/pb" pbCommon "dcg/game/pb/common" @@ -22,7 +21,7 @@ type CoinTransferHandler struct { func (h *CoinTransferHandler) Init(svcCtx *svc.ServiceContext) { h.svcCtx = svcCtx - cfg := config.Config.Kafka.UserCoin + cfg := svcCtx.Config.Kafka.UserCoin h.msgHandle = make(map[string]kafkaMsgHandlerFunc) h.msgHandle[cfg.Topic] = h.handleTopic @@ -52,6 +51,7 @@ func (h *CoinTransferHandler) handleTopic(data []byte, _ string) { UserId: msgFromMq.UserId, Username: msgFromMq.Username, Avatar: msgFromMq.Avatar, + Platform: "bilibili", // TODO 平台 }, Reason: msgFromMq.Reason, Change: msgFromMq.Change, diff --git a/game/msg_transfer/msg_to_push.go b/game/mq/dm_to_push.go similarity index 82% rename from game/msg_transfer/msg_to_push.go rename to game/mq/dm_to_push.go index 73cdeec..f572031 100644 --- a/game/msg_transfer/msg_to_push.go +++ b/game/mq/dm_to_push.go @@ -1,9 +1,7 @@ -package msg_transfer +package mq import ( - "context" "dcg/app/user_center/usercenter" - "dcg/config" "dcg/game/live_logic" pbCommon "dcg/game/pb/common" pbMq "dcg/game/pb/mq" @@ -26,7 +24,7 @@ type MsgToPushHandler struct { func (h *MsgToPushHandler) Init(svcCtx *svc.ServiceContext) { h.svcCtx = svcCtx - cfg := config.Config.Kafka.Danmaku + cfg := svcCtx.Config.Kafka.Danmaku h.msgHandle = make(map[string]kafkaMsgHandlerFunc) h.msgHandle[cfg.Topic] = h.handleDanmaku @@ -51,7 +49,7 @@ func (h *MsgToPushHandler) handleDanmaku(data []byte, _ string) { return } // rpc创建或获取用户数据 - rpcUser, err := h.svcCtx.UserCenterRpc.RetrievePlatformUser(context.Background(), &usercenter.PlatformUserReq{ + rpcUser, err := h.svcCtx.UserCenterRpc.RetrievePlatformUser(h.svcCtx.Ctx, &usercenter.PlatformUserReq{ Platform: msgFromMq.Platform, PUid: strconv.FormatInt(msgFromMq.Uid, 10), PUname: msgFromMq.Uname, @@ -62,9 +60,13 @@ func (h *MsgToPushHandler) handleDanmaku(data []byte, _ string) { return } pbUser := &pbCommon.PbUser{ - UserId: rpcUser.Id, - Username: rpcUser.PUname, - Avatar: rpcUser.PAvatar, + UserId: rpcUser.Id, + Username: rpcUser.PUname, + Avatar: rpcUser.PAvatar, + Platform: rpcUser.Platform, + FansMedalWearingStatus: msgFromMq.FansMedalWearingStatus, + FansMedalName: msgFromMq.FansMedalName, + FansMedalLevel: msgFromMq.FansMedalLevel, } logger.SLog.Debugf("用户 [%s] 发送弹幕 [%s]", pbUser.Username, msgFromMq.Msg) diff --git a/game/msg_transfer/gift_to_push.go b/game/mq/gift_to_push.go similarity index 89% rename from game/msg_transfer/gift_to_push.go rename to game/mq/gift_to_push.go index c93a04e..a0e8903 100644 --- a/game/msg_transfer/gift_to_push.go +++ b/game/mq/gift_to_push.go @@ -1,8 +1,7 @@ -package msg_transfer +package mq import ( "dcg/app/user_center/usercenter" - "dcg/config" "dcg/game/live_logic" pbCommon "dcg/game/pb/common" pbMq "dcg/game/pb/mq" @@ -23,7 +22,7 @@ type GiftToPushHandler struct { func (h *GiftToPushHandler) Init(svcCtx *svc.ServiceContext) { h.svcCtx = svcCtx - cfg := config.Config.Kafka.Gift + cfg := svcCtx.Config.Kafka.Gift h.msgHandle = make(map[string]kafkaMsgHandlerFunc) h.msgHandle[cfg.Topic] = h.handleGift @@ -63,11 +62,16 @@ func (h *GiftToPushHandler) handleGift(data []byte, _ string) { UserId: rpcUser.Id, Username: rpcUser.PUname, Avatar: rpcUser.PAvatar, + Platform: rpcUser.Platform, + + FansMedalWearingStatus: msgFromMq.FansMedalWearingStatus, + FansMedalName: msgFromMq.FansMedalName, + FansMedalLevel: msgFromMq.FansMedalLevel, } logger.SLog.Debugf("队列礼物消息: %s 投喂 %s 价值 %d", msgFromMq.Uname, msgFromMq.GiftName, msgFromMq.Price*msgFromMq.GiftNum) // 游戏逻辑处理 - live_logic.LiveManager.HandleGift(msgFromMq.LiveRoomId, pbUser, &msgFromMq) + live_logic.LiveManager.HandleGift(pbUser, &msgFromMq) } func (GiftToPushHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil } diff --git a/game/msg_transfer/init.go b/game/mq/init.go similarity index 75% rename from game/msg_transfer/init.go rename to game/mq/init.go index ed13684..2f40f01 100644 --- a/game/msg_transfer/init.go +++ b/game/mq/init.go @@ -1,4 +1,4 @@ -package msg_transfer +package mq import ( "dcg/game/svc" @@ -8,15 +8,13 @@ var ( danmakuMsgToPush MsgToPushHandler giftMsgToPush GiftToPushHandler nobilityTransfer NobilityTransferHandler - //rewardTransfer RewardTransferHandler - coinTransfer CoinTransferHandler + coinTransfer CoinTransferHandler ) func Init(svc *svc.ServiceContext) { danmakuMsgToPush.Init(svc) giftMsgToPush.Init(svc) nobilityTransfer.Init(svc) - //rewardTransfer.Init(svc) coinTransfer.Init(svc) run() @@ -26,6 +24,5 @@ func run() { go danmakuMsgToPush.ConsumerGroup.RegisterHandlerAndConsumer(&danmakuMsgToPush) go giftMsgToPush.ConsumerGroup.RegisterHandlerAndConsumer(&giftMsgToPush) go nobilityTransfer.ConsumerGroup.RegisterHandlerAndConsumer(&nobilityTransfer) - //go rewardTransfer.ConsumerGroup.RegisterHandlerAndConsumer(&rewardTransfer) go coinTransfer.ConsumerGroup.RegisterHandlerAndConsumer(&coinTransfer) } diff --git a/game/msg_transfer/nobility_transfer.go b/game/mq/nobility_transfer.go similarity index 94% rename from game/msg_transfer/nobility_transfer.go rename to game/mq/nobility_transfer.go index f52aef7..6918d2f 100644 --- a/game/msg_transfer/nobility_transfer.go +++ b/game/mq/nobility_transfer.go @@ -1,8 +1,7 @@ -package msg_transfer +package mq import ( "dcg/app/user_center/usercenter" - "dcg/config" "dcg/game/live_logic" pbCommon "dcg/game/pb/common" pbMq "dcg/game/pb/mq" @@ -23,7 +22,7 @@ type NobilityTransferHandler struct { func (h *NobilityTransferHandler) Init(svcCtx *svc.ServiceContext) { h.svcCtx = svcCtx - cfg := config.Config.Kafka.GuardBuy + cfg := svcCtx.Config.Kafka.GuardBuy h.msgHandle = make(map[string]kafkaMsgHandlerFunc) h.msgHandle[cfg.Topic] = h.handleTopic @@ -63,11 +62,12 @@ func (h *NobilityTransferHandler) handleTopic(data []byte, _ string) { UserId: rpcUser.Id, Username: rpcUser.PUname, Avatar: rpcUser.PAvatar, + Platform: rpcUser.Platform, } logger.SLog.Debugf("队列舰长消息: %s 送出 舰长|总督|提督", msgFromMq.Uname) // 游戏逻辑处理 - live_logic.LiveManager.HandleNobility(msgFromMq.LiveRoomId, pbUser, &msgFromMq) + live_logic.LiveManager.HandleNobility(pbUser, &msgFromMq) } func (NobilityTransferHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil } diff --git a/game/msg_transfer/types.go b/game/mq/types.go similarity index 73% rename from game/msg_transfer/types.go rename to game/mq/types.go index 94f5abc..aa063e3 100644 --- a/game/msg_transfer/types.go +++ b/game/mq/types.go @@ -1,3 +1,3 @@ -package msg_transfer +package mq type kafkaMsgHandlerFunc func(data []byte, msgKey string) diff --git a/game/msg_transfer/reward_transfer.go b/game/msg_transfer/reward_transfer.go deleted file mode 100644 index e9028ec..0000000 --- a/game/msg_transfer/reward_transfer.go +++ /dev/null @@ -1,76 +0,0 @@ -package msg_transfer - -// -//import ( -// "dcg/config" -// "dcg/game/manager" -// pbCommon "dcg/game/pb/common" -// pbMq "dcg/game/pb/mq" -// "dcg/game/svc" -// kfk "dcg/pkg/kafka" -// "git.noahlan.cn/northlan/ntools-go/kafka" -// "git.noahlan.cn/northlan/ntools-go/logger" -// "github.com/Shopify/sarama" -// "google.golang.org/protobuf/proto" -//) -// -//type RewardTransferHandler struct { -// svcCtx *svc.ServiceContext -// msgHandle map[string]kafkaMsgHandlerFunc -// ConsumerGroup *kafka.ConsumerGroup -//} -// -//func (h *RewardTransferHandler) Init(svcCtx *svc.ServiceContext) { -// h.svcCtx = svcCtx -// cfg := config.Config.Kafka.RewardPool -// h.msgHandle = make(map[string]kafkaMsgHandlerFunc) -// h.msgHandle[cfg.Topic] = h.handleTopic -// -// var err error -// h.ConsumerGroup, err = kafka.NewConsumerGroup(&kafka.ConsumerGroupConfig{ -// KafkaVersion: sarama.V3_1_0_0, -// OffsetsInitial: sarama.OffsetNewest, -// IsReturnErr: false, -// UnMarshaler: kfk.ProtobufMarshaler, -// }, cfg.Addr, []string{cfg.Topic}, cfg.ConsumerGroup) -// -// if err != nil { -// logger.SLog.Error(err) -// } -//} -// -//func (h *RewardTransferHandler) handleTopic(data []byte, _ string) { -// // msg proto -// var msgFromMq pbMq.MqRewardPool -// err := proto.Unmarshal(data, &msgFromMq) -// if err != nil { -// logger.SLog.Error("unmarshal msg err", err) -// return -// } -// room, err := manager.GameManager.RoomByBattleId(msgFromMq.BattleId) -// if err != nil { -// return -// } -// room.Broadcast("game.rewardPool", &pbCommon.RewardPoolMsg{ -// WelfarePool: msgFromMq.WelfarePool, -// BattleId: msgFromMq.BattleId, -// InitReward: msgFromMq.InitReward, -// GiftReward: msgFromMq.GiftReward, -// BattleReward: msgFromMq.BattleReward, -// OtherReward: msgFromMq.OtherReward, -// AllRewards: msgFromMq.AllRewards, -// }) -//} -// -//func (RewardTransferHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil } -//func (RewardTransferHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil } -//func (h *RewardTransferHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { -// for msg := range claim.Messages() { -// //logger.SLog.Infow("kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value)) -// if hFunc, ok := h.msgHandle[msg.Topic]; ok { -// hFunc(msg.Value, string(msg.Key)) -// } -// sess.MarkMessage(msg, "") -// } -// return nil -//} diff --git a/game/pb/common/Common.cs b/game/pb/common/Common.cs index dea0899..e0952fc 100644 --- a/game/pb/common/Common.cs +++ b/game/pb/common/Common.cs @@ -25,37 +25,39 @@ namespace Pb.Common { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChNjb21tb24vY29tbW9uLnByb3RvEglwYi5jb21tb24aD3ZhcnMvdmFycy5w", - "cm90byI6CgZQYlVzZXISDgoGdXNlcklkGAEgASgDEhAKCHVzZXJuYW1lGAIg", - "ASgJEg4KBmF2YXRhchgDIAEoCSIyCg1HYW1lU3RhdHVzUmVxEg4KBnN0YXR1", - "cxgBIAEoBRIRCgl0aW1lc3RhbXAYAiABKAMiRgoOR2FtZVN0YXR1c1Jlc3AS", - "DwoHc3VjY2VzcxgBIAEoCBIQCghiYXR0bGVJZBgCIAEoAxIRCgl0aW1lc3Rh", - "bXAYAyABKAMihgEKElVzZXJDb2luQ2hhbmdlZE1zZxIfCgR1c2VyGAEgASgL", - "MhEucGIuY29tbW9uLlBiVXNlchIuCgZyZWFzb24YAiABKA4yHi5wYi52YXJz", - "LlVzZXJDb2luQ2hhbmdlZFJlYXNvbhIOCgZjaGFuZ2UYCiABKAMSDwoHY3Vy", - "cmVudBgLIAEoAyJjChFDaGFuZ2VVc2VyQ29pblJlcRIOCgZ1c2VySWQYASAB", - "KAMSDgoGY2hhbmdlGAIgASgDEi4KBnJlYXNvbhgDIAEoDjIeLnBiLnZhcnMu", - "VXNlckNvaW5DaGFuZ2VkUmVhc29uIk8KEkNoYW5nZVVzZXJDb2luUmVzcBIM", - "CgRjb2RlGAEgASgFEgsKA21zZxgCIAEoCRIOCgZ1c2VySWQYAyABKAMSDgoG", - "Y2hhbmdlGAQgASgDIoUBCgpDaGVja0luTXNnEgwKBGNvZGUYASABKAUSCwoD", - "bXNnGAIgASgJEh8KBHVzZXIYAyABKAsyES5wYi5jb21tb24uUGJVc2VyEhIK", - "CmNvaW5DaGFuZ2UYBCABKAMSEwoLY3VycmVudENvaW4YBSABKAMSEgoKaXND", - "cml0aWNhbBgKIAEoCCJXCgtHaWZ0UGFja01zZxIMCgRjb2RlGAEgASgFEgsK", - "A21zZxgCIAEoCRIfCgR1c2VyGAMgASgLMhEucGIuY29tbW9uLlBiVXNlchIM", - "CgRjb2luGAQgASgDIp8BCg9Vc2VyQnV5R29vZHNNc2cSDAoEY29kZRgBIAEo", - "BRIfCgR1c2VyGAMgASgLMhEucGIuY29tbW9uLlBiVXNlchIdCgVnb29kcxgE", - "IAEoDjIOLnBiLnZhcnMuR29vZHMSDwoHZ29vZHNJZBgFIAEoAxINCgVjb3Vu", - "dBgGIAEoBRIMCgRjb3N0GAcgASgDEhAKCGR1cmF0aW9uGAggASgFIkMKCVRp", - "dGxlSXRlbRIKCgJpZBgBIAEoAxIMCgRuYW1lGAIgASgJEgwKBHNvcnQYAyAB", - "KAUSDgoGcmVtYWluGAQgASgFIj4KCkRhbm1ha3VNc2cSHwoEdXNlchgBIAEo", - "CzIRLnBiLmNvbW1vbi5QYlVzZXISDwoHY29udGVudBgCIAEoCSJ4CgdHaWZ0", - "TXNnEh8KBHVzZXIYASABKAsyES5wYi5jb21tb24uUGJVc2VyEg4KBmdpZnRJ", - "ZBgCIAEoAxILCgNudW0YAyABKAMSEAoIZ2lmdE5hbWUYBCABKAkSDQoFcHJp", - "Y2UYBSABKAMSDgoGaXNQYWlkGAYgASgIQh1aG2RjZy9nYW1lL3BiL2NvbW1v", - "bjtwYkNvbW1vbmIGcHJvdG8z")); + "cm90byKbAQoGUGJVc2VyEg4KBnVzZXJJZBgBIAEoAxIQCgh1c2VybmFtZRgC", + "IAEoCRIOCgZhdmF0YXIYAyABKAkSEAoIcGxhdGZvcm0YBCABKAkSHgoWZmFu", + "c01lZGFsV2VhcmluZ1N0YXR1cxgFIAEoCBIVCg1mYW5zTWVkYWxOYW1lGAYg", + "ASgJEhYKDmZhbnNNZWRhbExldmVsGAcgASgDIjIKDUdhbWVTdGF0dXNSZXES", + "DgoGc3RhdHVzGAEgASgFEhEKCXRpbWVzdGFtcBgCIAEoAyJGCg5HYW1lU3Rh", + "dHVzUmVzcBIPCgdzdWNjZXNzGAEgASgIEhAKCGJhdHRsZUlkGAIgASgDEhEK", + "CXRpbWVzdGFtcBgDIAEoAyKGAQoSVXNlckNvaW5DaGFuZ2VkTXNnEh8KBHVz", + "ZXIYASABKAsyES5wYi5jb21tb24uUGJVc2VyEi4KBnJlYXNvbhgCIAEoDjIe", + "LnBiLnZhcnMuVXNlckNvaW5DaGFuZ2VkUmVhc29uEg4KBmNoYW5nZRgKIAEo", + "AxIPCgdjdXJyZW50GAsgASgDImMKEUNoYW5nZVVzZXJDb2luUmVxEg4KBnVz", + "ZXJJZBgBIAEoAxIOCgZjaGFuZ2UYAiABKAMSLgoGcmVhc29uGAMgASgOMh4u", + "cGIudmFycy5Vc2VyQ29pbkNoYW5nZWRSZWFzb24iTwoSQ2hhbmdlVXNlckNv", + "aW5SZXNwEgwKBGNvZGUYASABKAUSCwoDbXNnGAIgASgJEg4KBnVzZXJJZBgD", + "IAEoAxIOCgZjaGFuZ2UYBCABKAMihQEKCkNoZWNrSW5Nc2cSDAoEY29kZRgB", + "IAEoBRILCgNtc2cYAiABKAkSHwoEdXNlchgDIAEoCzIRLnBiLmNvbW1vbi5Q", + "YlVzZXISEgoKY29pbkNoYW5nZRgEIAEoAxITCgtjdXJyZW50Q29pbhgFIAEo", + "AxISCgppc0NyaXRpY2FsGAogASgIIlcKC0dpZnRQYWNrTXNnEgwKBGNvZGUY", + "ASABKAUSCwoDbXNnGAIgASgJEh8KBHVzZXIYAyABKAsyES5wYi5jb21tb24u", + "UGJVc2VyEgwKBGNvaW4YBCABKAMinwEKD1VzZXJCdXlHb29kc01zZxIMCgRj", + "b2RlGAEgASgFEh8KBHVzZXIYAyABKAsyES5wYi5jb21tb24uUGJVc2VyEh0K", + "BWdvb2RzGAQgASgOMg4ucGIudmFycy5Hb29kcxIPCgdnb29kc0lkGAUgASgD", + "Eg0KBWNvdW50GAYgASgFEgwKBGNvc3QYByABKAMSEAoIZHVyYXRpb24YCCAB", + "KAUiQwoJVGl0bGVJdGVtEgoKAmlkGAEgASgDEgwKBG5hbWUYAiABKAkSDAoE", + "c29ydBgDIAEoBRIOCgZyZW1haW4YBCABKAUiPgoKRGFubWFrdU1zZxIfCgR1", + "c2VyGAEgASgLMhEucGIuY29tbW9uLlBiVXNlchIPCgdjb250ZW50GAIgASgJ", + "IngKB0dpZnRNc2cSHwoEdXNlchgBIAEoCzIRLnBiLmNvbW1vbi5QYlVzZXIS", + "DgoGZ2lmdElkGAIgASgDEgsKA251bRgDIAEoAxIQCghnaWZ0TmFtZRgEIAEo", + "CRINCgVwcmljZRgFIAEoAxIOCgZpc1BhaWQYBiABKAhCHVobZGNnL2dhbWUv", + "cGIvY29tbW9uO3BiQ29tbW9uYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Pb.Vars.VarsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.PbUser), global::Pb.Common.PbUser.Parser, new[]{ "UserId", "Username", "Avatar" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.PbUser), global::Pb.Common.PbUser.Parser, new[]{ "UserId", "Username", "Avatar", "Platform", "FansMedalWearingStatus", "FansMedalName", "FansMedalLevel" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.GameStatusReq), global::Pb.Common.GameStatusReq.Parser, new[]{ "Status", "Timestamp" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.GameStatusResp), global::Pb.Common.GameStatusResp.Parser, new[]{ "Success", "BattleId", "Timestamp" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Common.UserCoinChangedMsg), global::Pb.Common.UserCoinChangedMsg.Parser, new[]{ "User", "Reason", "Change", "Current" }, null, null, null, null), @@ -113,6 +115,10 @@ namespace Pb.Common { userId_ = other.userId_; username_ = other.username_; avatar_ = other.avatar_; + platform_ = other.platform_; + fansMedalWearingStatus_ = other.fansMedalWearingStatus_; + fansMedalName_ = other.fansMedalName_; + fansMedalLevel_ = other.fansMedalLevel_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -167,6 +173,66 @@ namespace Pb.Common { } } + /// Field number for the "platform" field. + public const int PlatformFieldNumber = 4; + private string platform_ = ""; + /// + /// 平台 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Platform { + get { return platform_; } + set { + platform_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "fansMedalWearingStatus" field. + public const int FansMedalWearingStatusFieldNumber = 5; + private bool fansMedalWearingStatus_; + /// + /// 牌子佩戴状态 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool FansMedalWearingStatus { + get { return fansMedalWearingStatus_; } + set { + fansMedalWearingStatus_ = value; + } + } + + /// Field number for the "fansMedalName" field. + public const int FansMedalNameFieldNumber = 6; + private string fansMedalName_ = ""; + /// + /// 粉丝牌子名 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string FansMedalName { + get { return fansMedalName_; } + set { + fansMedalName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "fansMedalLevel" field. + public const int FansMedalLevelFieldNumber = 7; + private long fansMedalLevel_; + /// + /// 粉丝牌子等级 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long FansMedalLevel { + get { return fansMedalLevel_; } + set { + fansMedalLevel_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -185,6 +251,10 @@ namespace Pb.Common { if (UserId != other.UserId) return false; if (Username != other.Username) return false; if (Avatar != other.Avatar) return false; + if (Platform != other.Platform) return false; + if (FansMedalWearingStatus != other.FansMedalWearingStatus) return false; + if (FansMedalName != other.FansMedalName) return false; + if (FansMedalLevel != other.FansMedalLevel) return false; return Equals(_unknownFields, other._unknownFields); } @@ -195,6 +265,10 @@ namespace Pb.Common { if (UserId != 0L) hash ^= UserId.GetHashCode(); if (Username.Length != 0) hash ^= Username.GetHashCode(); if (Avatar.Length != 0) hash ^= Avatar.GetHashCode(); + if (Platform.Length != 0) hash ^= Platform.GetHashCode(); + if (FansMedalWearingStatus != false) hash ^= FansMedalWearingStatus.GetHashCode(); + if (FansMedalName.Length != 0) hash ^= FansMedalName.GetHashCode(); + if (FansMedalLevel != 0L) hash ^= FansMedalLevel.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -225,6 +299,22 @@ namespace Pb.Common { output.WriteRawTag(26); output.WriteString(Avatar); } + if (Platform.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Platform); + } + if (FansMedalWearingStatus != false) { + output.WriteRawTag(40); + output.WriteBool(FansMedalWearingStatus); + } + if (FansMedalName.Length != 0) { + output.WriteRawTag(50); + output.WriteString(FansMedalName); + } + if (FansMedalLevel != 0L) { + output.WriteRawTag(56); + output.WriteInt64(FansMedalLevel); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -247,6 +337,22 @@ namespace Pb.Common { output.WriteRawTag(26); output.WriteString(Avatar); } + if (Platform.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Platform); + } + if (FansMedalWearingStatus != false) { + output.WriteRawTag(40); + output.WriteBool(FansMedalWearingStatus); + } + if (FansMedalName.Length != 0) { + output.WriteRawTag(50); + output.WriteString(FansMedalName); + } + if (FansMedalLevel != 0L) { + output.WriteRawTag(56); + output.WriteInt64(FansMedalLevel); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -266,6 +372,18 @@ namespace Pb.Common { if (Avatar.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Avatar); } + if (Platform.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Platform); + } + if (FansMedalWearingStatus != false) { + size += 1 + 1; + } + if (FansMedalName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FansMedalName); + } + if (FansMedalLevel != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(FansMedalLevel); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -287,6 +405,18 @@ namespace Pb.Common { if (other.Avatar.Length != 0) { Avatar = other.Avatar; } + if (other.Platform.Length != 0) { + Platform = other.Platform; + } + if (other.FansMedalWearingStatus != false) { + FansMedalWearingStatus = other.FansMedalWearingStatus; + } + if (other.FansMedalName.Length != 0) { + FansMedalName = other.FansMedalName; + } + if (other.FansMedalLevel != 0L) { + FansMedalLevel = other.FansMedalLevel; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -314,6 +444,22 @@ namespace Pb.Common { Avatar = input.ReadString(); break; } + case 34: { + Platform = input.ReadString(); + break; + } + case 40: { + FansMedalWearingStatus = input.ReadBool(); + break; + } + case 50: { + FansMedalName = input.ReadString(); + break; + } + case 56: { + FansMedalLevel = input.ReadInt64(); + break; + } } } #endif @@ -341,6 +487,22 @@ namespace Pb.Common { Avatar = input.ReadString(); break; } + case 34: { + Platform = input.ReadString(); + break; + } + case 40: { + FansMedalWearingStatus = input.ReadBool(); + break; + } + case 50: { + FansMedalName = input.ReadString(); + break; + } + case 56: { + FansMedalLevel = input.ReadInt64(); + break; + } } } } diff --git a/game/pb/common/common.pb.go b/game/pb/common/common.pb.go index 0de24ae..2c492f4 100644 --- a/game/pb/common/common.pb.go +++ b/game/pb/common/common.pb.go @@ -27,9 +27,13 @@ type PbUser struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` // 用户id - Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // 用户名 - Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像 + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` // 用户id + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // 用户名 + Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像 + Platform string `protobuf:"bytes,4,opt,name=platform,proto3" json:"platform,omitempty"` // 平台 + FansMedalWearingStatus bool `protobuf:"varint,5,opt,name=fansMedalWearingStatus,proto3" json:"fansMedalWearingStatus,omitempty"` // 牌子佩戴状态 + FansMedalName string `protobuf:"bytes,6,opt,name=fansMedalName,proto3" json:"fansMedalName,omitempty"` // 粉丝牌子名 + FansMedalLevel int64 `protobuf:"varint,7,opt,name=fansMedalLevel,proto3" json:"fansMedalLevel,omitempty"` // 粉丝牌子等级 } func (x *PbUser) Reset() { @@ -85,6 +89,34 @@ func (x *PbUser) GetAvatar() string { return "" } +func (x *PbUser) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *PbUser) GetFansMedalWearingStatus() bool { + if x != nil { + return x.FansMedalWearingStatus + } + return false +} + +func (x *PbUser) GetFansMedalName() string { + if x != nil { + return x.FansMedalName + } + return "" +} + +func (x *PbUser) GetFansMedalLevel() int64 { + if x != nil { + return x.FansMedalLevel + } + return 0 +} + // GameStatusReq 游戏状态控制 game.status type GameStatusReq struct { state protoimpl.MessageState @@ -893,104 +925,114 @@ var file_common_common_proto_rawDesc = []byte{ 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x1a, 0x0f, 0x76, 0x61, 0x72, 0x73, 0x2f, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x54, 0x0a, 0x06, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 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, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x22, 0x45, 0x0a, 0x0d, 0x47, 0x61, 0x6d, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x64, - 0x0a, 0x0e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 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, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x22, 0xa5, 0x01, 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, 0x36, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x55, 0x73, 0x65, - 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x52, 0x65, 0x61, 0x73, - 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x68, - 0x61, 0x6e, 0x67, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x68, 0x61, 0x6e, - 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x7b, 0x0a, 0x11, + 0x6f, 0x22, 0xf6, 0x01, 0x0a, 0x06, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 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, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, + 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, + 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x36, 0x0a, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, + 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x57, + 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x24, 0x0a, 0x0d, + 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, + 0x65, 0x76, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x66, 0x61, 0x6e, 0x73, + 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x45, 0x0a, 0x0d, 0x47, 0x61, + 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x22, 0x64, 0x0a, 0x0e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 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, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xa5, 0x01, 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, 0x36, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x52, + 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x16, 0x0a, + 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x22, + 0x7b, 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, 0x12, 0x36, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x52, 0x65, + 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x6a, 0x0a, 0x12, 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, 0x12, 0x36, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, - 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x6a, 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, 0x22, 0xbb, 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, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, - 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x69, 0x6e, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x43, - 0x6f, 0x69, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, - 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x43, 0x72, 0x69, 0x74, 0x69, - 0x63, 0x61, 0x6c, 0x22, 0x6e, 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, + 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, 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, - 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, - 0x6f, 0x69, 0x6e, 0x22, 0xd2, 0x01, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x42, 0x75, 0x79, 0x47, - 0x6f, 0x6f, 0x64, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x75, + 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, 0x22, 0xbb, 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, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x6f, 0x69, 0x6e, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x43, + 0x6f, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65, + 0x6e, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x43, 0x72, 0x69, 0x74, + 0x69, 0x63, 0x61, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x43, 0x72, + 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x22, 0x6e, 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, 0x24, 0x0a, 0x05, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x47, 0x6f, 0x6f, 0x64, - 0x73, 0x52, 0x05, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x6f, 0x6f, 0x64, - 0x73, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x6f, 0x6f, 0x64, 0x73, - 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x73, 0x74, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, - 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, - 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5b, 0x0a, 0x09, 0x54, 0x69, 0x74, 0x6c, - 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6f, 0x72, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x72, - 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0x4d, 0x0a, 0x0a, 0x44, 0x61, 0x6e, 0x6d, 0x61, 0x6b, 0x75, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x63, 0x6f, 0x69, 0x6e, 0x22, 0xd2, 0x01, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x42, + 0x75, 0x79, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 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, 0x24, 0x0a, 0x05, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x47, + 0x6f, 0x6f, 0x64, 0x73, 0x52, 0x05, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x67, + 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x6f, + 0x6f, 0x64, 0x73, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, + 0x6f, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x12, + 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5b, 0x0a, 0x09, 0x54, + 0x69, 0x74, 0x6c, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x73, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x6f, 0x72, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 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, 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, 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, + 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, 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 ( diff --git a/game/pb/common/common.proto b/game/pb/common/common.proto index 1a7220f..5c15e44 100644 --- a/game/pb/common/common.proto +++ b/game/pb/common/common.proto @@ -11,6 +11,11 @@ message PbUser { int64 userId = 1; // 用户id string username = 2; // 用户名 string avatar = 3; // 头像 + string platform = 4; // 平台 + + bool fansMedalWearingStatus = 5; // 牌子佩戴状态 + string fansMedalName = 6; // 粉丝牌子名 + int64 fansMedalLevel = 7; // 粉丝牌子等级 } // GameStatusReq 游戏状态控制 game.status diff --git a/game/pb/game/zhgww2/Command.cs b/game/pb/game/zhgww2/Command.cs new file mode 100644 index 0000000..2b00c2f --- /dev/null +++ b/game/pb/game/zhgww2/Command.cs @@ -0,0 +1,2940 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: game/zhgww2/command.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Pb.Game.Zhgww2 { + + /// Holder for reflection information generated from game/zhgww2/command.proto + public static partial class CommandReflection { + + #region Descriptor + /// File descriptor for game/zhgww2/command.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CommandReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChlnYW1lL3poZ3d3Mi9jb21tYW5kLnByb3RvEg5wYi5nYW1lLnpoZ3d3MhoT", + "Y29tbW9uL2NvbW1vbi5wcm90byJQCghKb2luR2FtZRIfCgR1c2VyGAEgASgL", + "MhEucGIuY29tbW9uLlBiVXNlchIVCg1ub2JpbGl0eUxldmVsGAIgASgFEgwK", + "BHRlYW0YAyABKAUiTgoLSm9pbkdhbWVSZXESHwoEdXNlchgBIAEoCzIRLnBi", + "LmNvbW1vbi5QYlVzZXISEAoIYmF0dGxlSWQYAiABKAMSDAoEdGVhbRgDIAEo", + "BSJxCgxKb2luR2FtZVJlc3ASHwoEdXNlchgBIAEoCzIRLnBiLmNvbW1vbi5Q", + "YlVzZXISEAoIYmF0dGxlSWQYAiABKAMSDAoEdGVhbRgDIAEoBRIPCgdzdWNj", + "ZXNzGAQgASgIEg8KB21lc3NhZ2UYBSABKAkiOwoKQ2hhbmdlVW5pdBIfCgR1", + "c2VyGAEgASgLMhEucGIuY29tbW9uLlBiVXNlchIMCgR1bml0GAIgASgFIjcK", + "BkF0dGFjaxIfCgR1c2VyGAEgASgLMhEucGIuY29tbW9uLlBiVXNlchIMCgRh", + "cmVhGAIgASgFIkIKDVJlc3RvcmVIZWFsdGgSHwoEdXNlchgBIAEoCzIRLnBi", + "LmNvbW1vbi5QYlVzZXISEAoIZHVyYXRpb24YAiABKAUiKQoGUmVib3JuEh8K", + "BHVzZXIYASABKAsyES5wYi5jb21tb24uUGJVc2VyIj4KDFN1cHBvcnRTa2ls", + "bBIfCgR1c2VyGAEgASgLMhEucGIuY29tbW9uLlBiVXNlchINCgVza2lsbBgC", + "IAEoCSI8CgpDaGFyZ2VUYW5rEh8KBHVzZXIYASABKAsyES5wYi5jb21tb24u", + "UGJVc2VyEg0KBXZhbHVlGAIgASgCIpcBCg5TdXBwb3J0U3BlY2lhbBIfCgR1", + "c2VyGAEgASgLMhEucGIuY29tbW9uLlBiVXNlchIxCgR0eXBlGAIgASgOMiMu", + "cGIuZ2FtZS56aGd3dzIuU3VwcG9ydFNwZWNpYWwuVHlwZRINCgVjb3VudBgD", + "IAEoBSIiCgRUeXBlEg4KClBBUkFUUk9PUFMQABIKCgZCT01CRVIQASJACg5T", + "dXBwb3J0QWlyZHJvcBIfCgR1c2VyGAEgASgLMhEucGIuY29tbW9uLlBiVXNl", + "chINCgVsZXZlbBgCIAEoBUImWiRkY2cvZ2FtZS9wYi9nYW1lL3poZ3d3Mjtw", + "YkdhbWVaaGdXVzJiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Pb.Common.CommonReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.JoinGame), global::Pb.Game.Zhgww2.JoinGame.Parser, new[]{ "User", "NobilityLevel", "Team" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.JoinGameReq), global::Pb.Game.Zhgww2.JoinGameReq.Parser, new[]{ "User", "BattleId", "Team" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.JoinGameResp), global::Pb.Game.Zhgww2.JoinGameResp.Parser, new[]{ "User", "BattleId", "Team", "Success", "Message" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.ChangeUnit), global::Pb.Game.Zhgww2.ChangeUnit.Parser, new[]{ "User", "Unit" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.Attack), global::Pb.Game.Zhgww2.Attack.Parser, new[]{ "User", "Area" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.RestoreHealth), global::Pb.Game.Zhgww2.RestoreHealth.Parser, new[]{ "User", "Duration" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.Reborn), global::Pb.Game.Zhgww2.Reborn.Parser, new[]{ "User" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.SupportSkill), global::Pb.Game.Zhgww2.SupportSkill.Parser, new[]{ "User", "Skill" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.ChargeTank), global::Pb.Game.Zhgww2.ChargeTank.Parser, new[]{ "User", "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.SupportSpecial), global::Pb.Game.Zhgww2.SupportSpecial.Parser, new[]{ "User", "Type", "Count" }, null, new[]{ typeof(global::Pb.Game.Zhgww2.SupportSpecial.Types.Type) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.SupportAirdrop), global::Pb.Game.Zhgww2.SupportAirdrop.Parser, new[]{ "User", "Level" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// 玩家加入游戏 push -> game.join + /// + public sealed partial class JoinGame : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JoinGame()); + 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.Game.Zhgww2.CommandReflection.Descriptor.MessageTypes[0]; } + } + + [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 JoinGame() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public JoinGame(JoinGame other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + nobilityLevel_ = other.nobilityLevel_; + team_ = other.team_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public JoinGame Clone() { + return new JoinGame(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 "nobilityLevel" field. + public const int NobilityLevelFieldNumber = 2; + private int nobilityLevel_; + /// + /// 贵族等级 3舰长 0总督? + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NobilityLevel { + get { return nobilityLevel_; } + set { + nobilityLevel_ = value; + } + } + + /// Field number for the "team" field. + public const int TeamFieldNumber = 3; + private int team_; + /// + /// 加入的队伍 0表示加入人少的一方 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Team { + get { return team_; } + set { + team_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as JoinGame); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(JoinGame other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (NobilityLevel != other.NobilityLevel) return false; + if (Team != other.Team) 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 (NobilityLevel != 0) hash ^= NobilityLevel.GetHashCode(); + if (Team != 0) hash ^= Team.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 (NobilityLevel != 0) { + output.WriteRawTag(16); + output.WriteInt32(NobilityLevel); + } + if (Team != 0) { + output.WriteRawTag(24); + output.WriteInt32(Team); + } + 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 (NobilityLevel != 0) { + output.WriteRawTag(16); + output.WriteInt32(NobilityLevel); + } + if (Team != 0) { + output.WriteRawTag(24); + output.WriteInt32(Team); + } + 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 (NobilityLevel != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NobilityLevel); + } + if (Team != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Team); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(JoinGame other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.NobilityLevel != 0) { + NobilityLevel = other.NobilityLevel; + } + if (other.Team != 0) { + Team = other.Team; + } + _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: { + NobilityLevel = input.ReadInt32(); + break; + } + case 24: { + Team = input.ReadInt32(); + 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: { + NobilityLevel = input.ReadInt32(); + break; + } + case 24: { + Team = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// 玩家加入游戏 request -> game.join + /// + public sealed partial class JoinGameReq : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JoinGameReq()); + 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.Game.Zhgww2.CommandReflection.Descriptor.MessageTypes[1]; } + } + + [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 JoinGameReq() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public JoinGameReq(JoinGameReq other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + battleId_ = other.battleId_; + team_ = other.team_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public JoinGameReq Clone() { + return new JoinGameReq(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 "battleId" field. + public const int BattleIdFieldNumber = 2; + private long battleId_; + /// + /// 战局ID + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long BattleId { + get { return battleId_; } + set { + battleId_ = value; + } + } + + /// Field number for the "team" field. + public const int TeamFieldNumber = 3; + private int team_; + /// + /// 加入的队伍 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Team { + get { return team_; } + set { + team_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as JoinGameReq); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(JoinGameReq other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (BattleId != other.BattleId) return false; + if (Team != other.Team) 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 (BattleId != 0L) hash ^= BattleId.GetHashCode(); + if (Team != 0) hash ^= Team.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 (BattleId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(BattleId); + } + if (Team != 0) { + output.WriteRawTag(24); + output.WriteInt32(Team); + } + 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 (BattleId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(BattleId); + } + if (Team != 0) { + output.WriteRawTag(24); + output.WriteInt32(Team); + } + 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 (BattleId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(BattleId); + } + if (Team != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Team); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(JoinGameReq other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.BattleId != 0L) { + BattleId = other.BattleId; + } + if (other.Team != 0) { + Team = other.Team; + } + _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: { + BattleId = input.ReadInt64(); + break; + } + case 24: { + Team = input.ReadInt32(); + 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: { + BattleId = input.ReadInt64(); + break; + } + case 24: { + Team = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// 玩家加入游戏回复 response -> game.join + /// + public sealed partial class JoinGameResp : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JoinGameResp()); + 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.Game.Zhgww2.CommandReflection.Descriptor.MessageTypes[2]; } + } + + [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 JoinGameResp() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public JoinGameResp(JoinGameResp other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + battleId_ = other.battleId_; + team_ = other.team_; + success_ = other.success_; + message_ = other.message_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public JoinGameResp Clone() { + return new JoinGameResp(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 "battleId" field. + public const int BattleIdFieldNumber = 2; + private long battleId_; + /// + /// 战局ID + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long BattleId { + get { return battleId_; } + set { + battleId_ = value; + } + } + + /// Field number for the "team" field. + public const int TeamFieldNumber = 3; + private int team_; + /// + /// 加入的队伍 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Team { + get { return team_; } + set { + team_ = value; + } + } + + /// Field number for the "success" field. + public const int SuccessFieldNumber = 4; + private bool success_; + /// + /// 是否成功,不成功重发消息 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Success { + get { return success_; } + set { + success_ = value; + } + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 5; + private string message_ = ""; + /// + /// 失败时将有message提示 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as JoinGameResp); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(JoinGameResp other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (BattleId != other.BattleId) return false; + if (Team != other.Team) return false; + if (Success != other.Success) return false; + if (Message != other.Message) 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 (BattleId != 0L) hash ^= BattleId.GetHashCode(); + if (Team != 0) hash ^= Team.GetHashCode(); + if (Success != false) hash ^= Success.GetHashCode(); + if (Message.Length != 0) hash ^= Message.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 (BattleId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(BattleId); + } + if (Team != 0) { + output.WriteRawTag(24); + output.WriteInt32(Team); + } + if (Success != false) { + output.WriteRawTag(32); + output.WriteBool(Success); + } + if (Message.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Message); + } + 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 (BattleId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(BattleId); + } + if (Team != 0) { + output.WriteRawTag(24); + output.WriteInt32(Team); + } + if (Success != false) { + output.WriteRawTag(32); + output.WriteBool(Success); + } + if (Message.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Message); + } + 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 (BattleId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(BattleId); + } + if (Team != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Team); + } + if (Success != false) { + size += 1 + 1; + } + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(JoinGameResp other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.BattleId != 0L) { + BattleId = other.BattleId; + } + if (other.Team != 0) { + Team = other.Team; + } + if (other.Success != false) { + Success = other.Success; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + _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: { + BattleId = input.ReadInt64(); + break; + } + case 24: { + Team = input.ReadInt32(); + break; + } + case 32: { + Success = input.ReadBool(); + break; + } + case 42: { + Message = input.ReadString(); + 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: { + BattleId = input.ReadInt64(); + break; + } + case 24: { + Team = input.ReadInt32(); + break; + } + case 32: { + Success = input.ReadBool(); + break; + } + case 42: { + Message = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// 切换生产单位种类 push -> game.unit.change + /// + public sealed partial class ChangeUnit : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ChangeUnit()); + 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.Game.Zhgww2.CommandReflection.Descriptor.MessageTypes[3]; } + } + + [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 ChangeUnit() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChangeUnit(ChangeUnit other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + unit_ = other.unit_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChangeUnit Clone() { + return new ChangeUnit(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 "unit" field. + public const int UnitFieldNumber = 2; + private int unit_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Unit { + get { return unit_; } + set { + unit_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ChangeUnit); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ChangeUnit other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (Unit != other.Unit) 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 (Unit != 0) hash ^= Unit.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 (Unit != 0) { + output.WriteRawTag(16); + output.WriteInt32(Unit); + } + 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 (Unit != 0) { + output.WriteRawTag(16); + output.WriteInt32(Unit); + } + 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 (Unit != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Unit); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ChangeUnit other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.Unit != 0) { + Unit = other.Unit; + } + _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: { + Unit = input.ReadInt32(); + 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: { + Unit = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// 进攻区域 push -> game.attack + /// + public sealed partial class Attack : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Attack()); + 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.Game.Zhgww2.CommandReflection.Descriptor.MessageTypes[4]; } + } + + [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 Attack() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Attack(Attack other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + area_ = other.area_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Attack Clone() { + return new Attack(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 "area" field. + public const int AreaFieldNumber = 2; + private int area_; + /// + /// 地图上的位置 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Area { + get { return area_; } + set { + area_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Attack); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Attack other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (Area != other.Area) 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 (Area != 0) hash ^= Area.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 (Area != 0) { + output.WriteRawTag(16); + output.WriteInt32(Area); + } + 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 (Area != 0) { + output.WriteRawTag(16); + output.WriteInt32(Area); + } + 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 (Area != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Area); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Attack other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.Area != 0) { + Area = other.Area; + } + _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: { + Area = input.ReadInt32(); + 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: { + Area = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// 持续回复生命值 push -> game.restoreHealth + /// + public sealed partial class RestoreHealth : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RestoreHealth()); + 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.Game.Zhgww2.CommandReflection.Descriptor.MessageTypes[5]; } + } + + [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 RestoreHealth() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RestoreHealth(RestoreHealth other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + duration_ = other.duration_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RestoreHealth Clone() { + return new RestoreHealth(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 "duration" field. + public const int DurationFieldNumber = 2; + private int duration_; + /// + /// 持续时间,单位:秒s + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Duration { + get { return duration_; } + set { + duration_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as RestoreHealth); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(RestoreHealth other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (Duration != other.Duration) 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 (Duration != 0) hash ^= Duration.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 (Duration != 0) { + output.WriteRawTag(16); + output.WriteInt32(Duration); + } + 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 (Duration != 0) { + output.WriteRawTag(16); + output.WriteInt32(Duration); + } + 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 (Duration != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Duration); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(RestoreHealth other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.Duration != 0) { + Duration = other.Duration; + } + _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: { + Duration = input.ReadInt32(); + 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: { + Duration = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// 复活 push -> game.reborn + /// + public sealed partial class Reborn : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Reborn()); + 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.Game.Zhgww2.CommandReflection.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 Reborn() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Reborn(Reborn other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Reborn Clone() { + return new Reborn(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; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Reborn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Reborn other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) 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 (_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 (_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 (_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 (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Reborn other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + _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; + } + } + } + #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; + } + } + } + } + #endif + + } + + /// + /// 阵营支援技能 push -> game.support.skill + /// + public sealed partial class SupportSkill : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SupportSkill()); + 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.Game.Zhgww2.CommandReflection.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 SupportSkill() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SupportSkill(SupportSkill other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + skill_ = other.skill_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SupportSkill Clone() { + return new SupportSkill(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 "skill" field. + public const int SkillFieldNumber = 2; + private string skill_ = ""; + /// + /// 技能ID, 空字符串表示随机 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Skill { + get { return skill_; } + set { + skill_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as SupportSkill); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(SupportSkill other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (Skill != other.Skill) 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 (Skill.Length != 0) hash ^= Skill.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 (Skill.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Skill); + } + 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 (Skill.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Skill); + } + 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 (Skill.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Skill); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(SupportSkill other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.Skill.Length != 0) { + Skill = other.Skill; + } + _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 18: { + Skill = input.ReadString(); + 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 18: { + Skill = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// 充能坦克制造进度 push -> game.chargeTank + /// + public sealed partial class ChargeTank : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ChargeTank()); + 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.Game.Zhgww2.CommandReflection.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 ChargeTank() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChargeTank(ChargeTank other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChargeTank Clone() { + return new ChargeTank(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 "value" field. + public const int ValueFieldNumber = 2; + private float value_; + /// + /// 值 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public float Value { + get { return value_; } + set { + value_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ChargeTank); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ChargeTank other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Value, other.Value)) 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 (Value != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Value); + 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 (Value != 0F) { + output.WriteRawTag(21); + output.WriteFloat(Value); + } + 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 (Value != 0F) { + output.WriteRawTag(21); + output.WriteFloat(Value); + } + 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 (Value != 0F) { + size += 1 + 4; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ChargeTank other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.Value != 0F) { + Value = other.Value; + } + _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 21: { + Value = input.ReadFloat(); + 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 21: { + Value = input.ReadFloat(); + break; + } + } + } + } + #endif + + } + + /// + /// 特殊支援(红包之类的包裹类礼物) push -> game.support.special + /// + public sealed partial class SupportSpecial : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SupportSpecial()); + 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.Game.Zhgww2.CommandReflection.Descriptor.MessageTypes[9]; } + } + + [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 SupportSpecial() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SupportSpecial(SupportSpecial other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + type_ = other.type_; + count_ = other.count_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SupportSpecial Clone() { + return new SupportSpecial(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 "type" field. + public const int TypeFieldNumber = 2; + private global::Pb.Game.Zhgww2.SupportSpecial.Types.Type type_ = global::Pb.Game.Zhgww2.SupportSpecial.Types.Type.Paratroops; + /// + /// 支援类型 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Pb.Game.Zhgww2.SupportSpecial.Types.Type Type { + get { return type_; } + set { + type_ = value; + } + } + + /// Field number for the "count" field. + public const int CountFieldNumber = 3; + private int count_; + /// + /// 数量 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Count { + get { return count_; } + set { + count_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as SupportSpecial); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(SupportSpecial other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (Type != other.Type) return false; + if (Count != other.Count) 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 (Type != global::Pb.Game.Zhgww2.SupportSpecial.Types.Type.Paratroops) hash ^= Type.GetHashCode(); + if (Count != 0) hash ^= Count.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 (Type != global::Pb.Game.Zhgww2.SupportSpecial.Types.Type.Paratroops) { + output.WriteRawTag(16); + output.WriteEnum((int) Type); + } + if (Count != 0) { + output.WriteRawTag(24); + output.WriteInt32(Count); + } + 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 (Type != global::Pb.Game.Zhgww2.SupportSpecial.Types.Type.Paratroops) { + output.WriteRawTag(16); + output.WriteEnum((int) Type); + } + if (Count != 0) { + output.WriteRawTag(24); + output.WriteInt32(Count); + } + 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 (Type != global::Pb.Game.Zhgww2.SupportSpecial.Types.Type.Paratroops) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); + } + if (Count != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Count); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(SupportSpecial other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.Type != global::Pb.Game.Zhgww2.SupportSpecial.Types.Type.Paratroops) { + Type = other.Type; + } + if (other.Count != 0) { + Count = other.Count; + } + _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: { + Type = (global::Pb.Game.Zhgww2.SupportSpecial.Types.Type) input.ReadEnum(); + break; + } + case 24: { + Count = input.ReadInt32(); + 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: { + Type = (global::Pb.Game.Zhgww2.SupportSpecial.Types.Type) input.ReadEnum(); + break; + } + case 24: { + Count = input.ReadInt32(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the SupportSpecial message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public enum Type { + /// + /// 空降兵,num多时重复发送该指令 + /// + [pbr::OriginalName("PARATROOPS")] Paratroops = 0, + /// + /// 轰炸机,num多时计算总次数 + /// + [pbr::OriginalName("BOMBER")] Bomber = 1, + } + + } + #endregion + + } + + /// + /// 空投箱(任意价值礼物,游戏内玩家限定特殊礼物除外) push -> game.support.airdrop + /// + public sealed partial class SupportAirdrop : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SupportAirdrop()); + 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.Game.Zhgww2.CommandReflection.Descriptor.MessageTypes[10]; } + } + + [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 SupportAirdrop() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SupportAirdrop(SupportAirdrop other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + level_ = other.level_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SupportAirdrop Clone() { + return new SupportAirdrop(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 "level" field. + public const int LevelFieldNumber = 2; + private int level_; + /// + /// 档次 1 -> 2 -> 3 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Level { + get { return level_; } + set { + level_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as SupportAirdrop); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(SupportAirdrop other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (Level != other.Level) 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 (Level != 0) hash ^= Level.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 (Level != 0) { + output.WriteRawTag(16); + output.WriteInt32(Level); + } + 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 (Level != 0) { + output.WriteRawTag(16); + output.WriteInt32(Level); + } + 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 (Level != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Level); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(SupportAirdrop other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.Level != 0) { + Level = other.Level; + } + _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: { + Level = input.ReadInt32(); + 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: { + Level = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/game/pb/game/zhgww2/command.pb.go b/game/pb/game/zhgww2/command.pb.go new file mode 100644 index 0000000..8826e7c --- /dev/null +++ b/game/pb/game/zhgww2/command.pb.go @@ -0,0 +1,1011 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.19.4 +// source: game/zhgww2/command.proto + +package pbGameZhgWW2 + +import ( + common "dcg/game/pb/common" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SupportSpecial_Type int32 + +const ( + SupportSpecial_PARATROOPS SupportSpecial_Type = 0 // 空降兵,num多时重复发送该指令 + SupportSpecial_BOMBER SupportSpecial_Type = 1 // 轰炸机,num多时计算总次数 +) + +// Enum value maps for SupportSpecial_Type. +var ( + SupportSpecial_Type_name = map[int32]string{ + 0: "PARATROOPS", + 1: "BOMBER", + } + SupportSpecial_Type_value = map[string]int32{ + "PARATROOPS": 0, + "BOMBER": 1, + } +) + +func (x SupportSpecial_Type) Enum() *SupportSpecial_Type { + p := new(SupportSpecial_Type) + *p = x + return p +} + +func (x SupportSpecial_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SupportSpecial_Type) Descriptor() protoreflect.EnumDescriptor { + return file_game_zhgww2_command_proto_enumTypes[0].Descriptor() +} + +func (SupportSpecial_Type) Type() protoreflect.EnumType { + return &file_game_zhgww2_command_proto_enumTypes[0] +} + +func (x SupportSpecial_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SupportSpecial_Type.Descriptor instead. +func (SupportSpecial_Type) EnumDescriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{9, 0} +} + +// 玩家加入游戏 push -> game.join +type JoinGame struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + NobilityLevel int32 `protobuf:"varint,2,opt,name=nobilityLevel,proto3" json:"nobilityLevel,omitempty"` // 贵族等级 3舰长 0总督? + Team int32 `protobuf:"varint,3,opt,name=team,proto3" json:"team,omitempty"` // 加入的队伍 0表示加入人少的一方 +} + +func (x *JoinGame) Reset() { + *x = JoinGame{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JoinGame) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinGame) ProtoMessage() {} + +func (x *JoinGame) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_proto_msgTypes[0] + 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 JoinGame.ProtoReflect.Descriptor instead. +func (*JoinGame) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{0} +} + +func (x *JoinGame) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *JoinGame) GetNobilityLevel() int32 { + if x != nil { + return x.NobilityLevel + } + return 0 +} + +func (x *JoinGame) GetTeam() int32 { + if x != nil { + return x.Team + } + return 0 +} + +// 玩家加入游戏 request -> game.join +type JoinGameReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + BattleId int64 `protobuf:"varint,2,opt,name=battleId,proto3" json:"battleId,omitempty"` // 战局ID + Team int32 `protobuf:"varint,3,opt,name=team,proto3" json:"team,omitempty"` // 加入的队伍 +} + +func (x *JoinGameReq) Reset() { + *x = JoinGameReq{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JoinGameReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinGameReq) ProtoMessage() {} + +func (x *JoinGameReq) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_proto_msgTypes[1] + 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 JoinGameReq.ProtoReflect.Descriptor instead. +func (*JoinGameReq) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{1} +} + +func (x *JoinGameReq) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *JoinGameReq) GetBattleId() int64 { + if x != nil { + return x.BattleId + } + return 0 +} + +func (x *JoinGameReq) GetTeam() int32 { + if x != nil { + return x.Team + } + return 0 +} + +// 玩家加入游戏回复 response -> game.join +type JoinGameResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + BattleId int64 `protobuf:"varint,2,opt,name=battleId,proto3" json:"battleId,omitempty"` // 战局ID + Team int32 `protobuf:"varint,3,opt,name=team,proto3" json:"team,omitempty"` // 加入的队伍 + Success bool `protobuf:"varint,4,opt,name=success,proto3" json:"success,omitempty"` // 是否成功,不成功重发消息 + Message string `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` // 失败时将有message提示 +} + +func (x *JoinGameResp) Reset() { + *x = JoinGameResp{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JoinGameResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinGameResp) ProtoMessage() {} + +func (x *JoinGameResp) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_proto_msgTypes[2] + 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 JoinGameResp.ProtoReflect.Descriptor instead. +func (*JoinGameResp) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{2} +} + +func (x *JoinGameResp) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *JoinGameResp) GetBattleId() int64 { + if x != nil { + return x.BattleId + } + return 0 +} + +func (x *JoinGameResp) GetTeam() int32 { + if x != nil { + return x.Team + } + return 0 +} + +func (x *JoinGameResp) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *JoinGameResp) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +// 切换生产单位种类 push -> game.unit.change +type ChangeUnit struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Unit int32 `protobuf:"varint,2,opt,name=unit,proto3" json:"unit,omitempty"` +} + +func (x *ChangeUnit) Reset() { + *x = ChangeUnit{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChangeUnit) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChangeUnit) ProtoMessage() {} + +func (x *ChangeUnit) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_proto_msgTypes[3] + 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 ChangeUnit.ProtoReflect.Descriptor instead. +func (*ChangeUnit) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{3} +} + +func (x *ChangeUnit) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *ChangeUnit) GetUnit() int32 { + if x != nil { + return x.Unit + } + return 0 +} + +// 进攻区域 push -> game.attack +type Attack struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Area int32 `protobuf:"varint,2,opt,name=area,proto3" json:"area,omitempty"` // 地图上的位置 +} + +func (x *Attack) Reset() { + *x = Attack{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Attack) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Attack) ProtoMessage() {} + +func (x *Attack) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_proto_msgTypes[4] + 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 Attack.ProtoReflect.Descriptor instead. +func (*Attack) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{4} +} + +func (x *Attack) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *Attack) GetArea() int32 { + if x != nil { + return x.Area + } + return 0 +} + +// 持续回复生命值 push -> game.restoreHealth +type RestoreHealth struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Duration int32 `protobuf:"varint,2,opt,name=duration,proto3" json:"duration,omitempty"` // 持续时间,单位:秒s +} + +func (x *RestoreHealth) Reset() { + *x = RestoreHealth{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RestoreHealth) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RestoreHealth) ProtoMessage() {} + +func (x *RestoreHealth) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_proto_msgTypes[5] + 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 RestoreHealth.ProtoReflect.Descriptor instead. +func (*RestoreHealth) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{5} +} + +func (x *RestoreHealth) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *RestoreHealth) GetDuration() int32 { + if x != nil { + return x.Duration + } + return 0 +} + +// 复活 push -> game.reborn +type Reborn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *Reborn) Reset() { + *x = Reborn{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Reborn) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Reborn) ProtoMessage() {} + +func (x *Reborn) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_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 Reborn.ProtoReflect.Descriptor instead. +func (*Reborn) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{6} +} + +func (x *Reborn) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +// 阵营支援技能 push -> game.support.skill +type SupportSkill struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Skill string `protobuf:"bytes,2,opt,name=skill,proto3" json:"skill,omitempty"` // 技能ID, 空字符串表示随机 +} + +func (x *SupportSkill) Reset() { + *x = SupportSkill{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SupportSkill) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SupportSkill) ProtoMessage() {} + +func (x *SupportSkill) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_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 SupportSkill.ProtoReflect.Descriptor instead. +func (*SupportSkill) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{7} +} + +func (x *SupportSkill) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *SupportSkill) GetSkill() string { + if x != nil { + return x.Skill + } + return "" +} + +// 充能坦克制造进度 push -> game.chargeTank +type ChargeTank struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Value float32 `protobuf:"fixed32,2,opt,name=value,proto3" json:"value,omitempty"` // 值 +} + +func (x *ChargeTank) Reset() { + *x = ChargeTank{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChargeTank) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChargeTank) ProtoMessage() {} + +func (x *ChargeTank) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_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 ChargeTank.ProtoReflect.Descriptor instead. +func (*ChargeTank) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{8} +} + +func (x *ChargeTank) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *ChargeTank) GetValue() float32 { + if x != nil { + return x.Value + } + return 0 +} + +// 特殊支援(红包之类的包裹类礼物) push -> game.support.special +type SupportSpecial struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Type SupportSpecial_Type `protobuf:"varint,2,opt,name=type,proto3,enum=pb.game.zhgww2.SupportSpecial_Type" json:"type,omitempty"` // 支援类型 + Count int32 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"` // 数量 +} + +func (x *SupportSpecial) Reset() { + *x = SupportSpecial{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SupportSpecial) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SupportSpecial) ProtoMessage() {} + +func (x *SupportSpecial) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_proto_msgTypes[9] + 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 SupportSpecial.ProtoReflect.Descriptor instead. +func (*SupportSpecial) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{9} +} + +func (x *SupportSpecial) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *SupportSpecial) GetType() SupportSpecial_Type { + if x != nil { + return x.Type + } + return SupportSpecial_PARATROOPS +} + +func (x *SupportSpecial) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + +// 空投箱(任意价值礼物,游戏内玩家限定特殊礼物除外) push -> game.support.airdrop +type SupportAirdrop struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Level int32 `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"` // 档次 1 -> 2 -> 3 +} + +func (x *SupportAirdrop) Reset() { + *x = SupportAirdrop{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SupportAirdrop) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SupportAirdrop) ProtoMessage() {} + +func (x *SupportAirdrop) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_proto_msgTypes[10] + 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 SupportAirdrop.ProtoReflect.Descriptor instead. +func (*SupportAirdrop) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{10} +} + +func (x *SupportAirdrop) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *SupportAirdrop) GetLevel() int32 { + if x != nil { + return x.Level + } + return 0 +} + +var File_game_zhgww2_command_proto protoreflect.FileDescriptor + +var file_game_zhgww2_command_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x7a, 0x68, 0x67, 0x77, 0x77, 0x32, 0x2f, 0x63, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x62, 0x2e, + 0x67, 0x61, 0x6d, 0x65, 0x2e, 0x7a, 0x68, 0x67, 0x77, 0x77, 0x32, 0x1a, 0x13, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x6b, 0x0a, 0x08, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 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, 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, + 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6e, 0x6f, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, + 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x22, 0x64, 0x0a, + 0x0b, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 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, 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, + 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, + 0x65, 0x61, 0x6d, 0x22, 0x99, 0x01, 0x0a, 0x0c, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, + 0x52, 0x65, 0x73, 0x70, 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, 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, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, + 0x47, 0x0a, 0x0a, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x55, 0x6e, 0x69, 0x74, 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, 0x12, 0x0a, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x22, 0x43, 0x0a, 0x06, 0x41, 0x74, 0x74, 0x61, + 0x63, 0x6b, 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, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x65, + 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x61, 0x72, 0x65, 0x61, 0x22, 0x52, 0x0a, + 0x0d, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 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, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0x2f, 0x0a, 0x06, 0x52, 0x65, 0x62, 0x6f, 0x72, 0x6e, 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, 0x22, 0x4b, 0x0a, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x6b, 0x69, + 0x6c, 0x6c, 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, 0x14, 0x0a, 0x05, 0x73, 0x6b, 0x69, + 0x6c, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x22, + 0x49, 0x0a, 0x0a, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x54, 0x61, 0x6e, 0x6b, 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, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x0e, 0x53, + 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 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, 0x37, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x2e, 0x7a, 0x68, 0x67, + 0x77, 0x77, 0x32, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x70, 0x65, 0x63, 0x69, + 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x22, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x50, + 0x41, 0x52, 0x41, 0x54, 0x52, 0x4f, 0x4f, 0x50, 0x53, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x42, + 0x4f, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x22, 0x4d, 0x0a, 0x0e, 0x53, 0x75, 0x70, 0x70, 0x6f, + 0x72, 0x74, 0x41, 0x69, 0x72, 0x64, 0x72, 0x6f, 0x70, 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, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x42, 0x26, 0x5a, 0x24, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, + 0x6d, 0x65, 0x2f, 0x70, 0x62, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x7a, 0x68, 0x67, 0x77, 0x77, + 0x32, 0x3b, 0x70, 0x62, 0x47, 0x61, 0x6d, 0x65, 0x5a, 0x68, 0x67, 0x57, 0x57, 0x32, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_game_zhgww2_command_proto_rawDescOnce sync.Once + file_game_zhgww2_command_proto_rawDescData = file_game_zhgww2_command_proto_rawDesc +) + +func file_game_zhgww2_command_proto_rawDescGZIP() []byte { + file_game_zhgww2_command_proto_rawDescOnce.Do(func() { + file_game_zhgww2_command_proto_rawDescData = protoimpl.X.CompressGZIP(file_game_zhgww2_command_proto_rawDescData) + }) + return file_game_zhgww2_command_proto_rawDescData +} + +var file_game_zhgww2_command_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_game_zhgww2_command_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_game_zhgww2_command_proto_goTypes = []interface{}{ + (SupportSpecial_Type)(0), // 0: pb.game.zhgww2.SupportSpecial.Type + (*JoinGame)(nil), // 1: pb.game.zhgww2.JoinGame + (*JoinGameReq)(nil), // 2: pb.game.zhgww2.JoinGameReq + (*JoinGameResp)(nil), // 3: pb.game.zhgww2.JoinGameResp + (*ChangeUnit)(nil), // 4: pb.game.zhgww2.ChangeUnit + (*Attack)(nil), // 5: pb.game.zhgww2.Attack + (*RestoreHealth)(nil), // 6: pb.game.zhgww2.RestoreHealth + (*Reborn)(nil), // 7: pb.game.zhgww2.Reborn + (*SupportSkill)(nil), // 8: pb.game.zhgww2.SupportSkill + (*ChargeTank)(nil), // 9: pb.game.zhgww2.ChargeTank + (*SupportSpecial)(nil), // 10: pb.game.zhgww2.SupportSpecial + (*SupportAirdrop)(nil), // 11: pb.game.zhgww2.SupportAirdrop + (*common.PbUser)(nil), // 12: pb.common.PbUser +} +var file_game_zhgww2_command_proto_depIdxs = []int32{ + 12, // 0: pb.game.zhgww2.JoinGame.user:type_name -> pb.common.PbUser + 12, // 1: pb.game.zhgww2.JoinGameReq.user:type_name -> pb.common.PbUser + 12, // 2: pb.game.zhgww2.JoinGameResp.user:type_name -> pb.common.PbUser + 12, // 3: pb.game.zhgww2.ChangeUnit.user:type_name -> pb.common.PbUser + 12, // 4: pb.game.zhgww2.Attack.user:type_name -> pb.common.PbUser + 12, // 5: pb.game.zhgww2.RestoreHealth.user:type_name -> pb.common.PbUser + 12, // 6: pb.game.zhgww2.Reborn.user:type_name -> pb.common.PbUser + 12, // 7: pb.game.zhgww2.SupportSkill.user:type_name -> pb.common.PbUser + 12, // 8: pb.game.zhgww2.ChargeTank.user:type_name -> pb.common.PbUser + 12, // 9: pb.game.zhgww2.SupportSpecial.user:type_name -> pb.common.PbUser + 0, // 10: pb.game.zhgww2.SupportSpecial.type:type_name -> pb.game.zhgww2.SupportSpecial.Type + 12, // 11: pb.game.zhgww2.SupportAirdrop.user:type_name -> pb.common.PbUser + 12, // [12:12] is the sub-list for method output_type + 12, // [12:12] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_game_zhgww2_command_proto_init() } +func file_game_zhgww2_command_proto_init() { + if File_game_zhgww2_command_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_game_zhgww2_command_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JoinGame); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JoinGameReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JoinGameResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChangeUnit); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Attack); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RestoreHealth); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Reborn); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SupportSkill); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChargeTank); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SupportSpecial); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SupportAirdrop); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_game_zhgww2_command_proto_rawDesc, + NumEnums: 1, + NumMessages: 11, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_game_zhgww2_command_proto_goTypes, + DependencyIndexes: file_game_zhgww2_command_proto_depIdxs, + EnumInfos: file_game_zhgww2_command_proto_enumTypes, + MessageInfos: file_game_zhgww2_command_proto_msgTypes, + }.Build() + File_game_zhgww2_command_proto = out.File + file_game_zhgww2_command_proto_rawDesc = nil + file_game_zhgww2_command_proto_goTypes = nil + file_game_zhgww2_command_proto_depIdxs = nil +} diff --git a/game/pb/game/zhgww2/command.proto b/game/pb/game/zhgww2/command.proto new file mode 100644 index 0000000..a310d0e --- /dev/null +++ b/game/pb/game/zhgww2/command.proto @@ -0,0 +1,84 @@ +syntax = "proto3"; + +package pb.game.zhgww2; + +import "common/common.proto"; + +option go_package = "dcg/game/pb/game/zhgww2;pbGameZhgWW2"; + +// 玩家加入游戏 push -> game.join +message JoinGame{ + pb.common.PbUser user = 1; + int32 nobilityLevel = 2; // 贵族等级 3舰长 0总督? + int32 team = 3; // 加入的队伍 0表示加入人少的一方 +} + +// 玩家加入游戏 request -> game.join +message JoinGameReq { + pb.common.PbUser user = 1; + int64 battleId = 2; // 战局ID + int32 team = 3; // 加入的队伍 +} + +// 玩家加入游戏回复 response -> game.join +message JoinGameResp { + pb.common.PbUser user = 1; + int64 battleId = 2; // 战局ID + int32 team = 3; // 加入的队伍 + bool success = 4; // 是否成功,不成功重发消息 + string message = 5; // 失败时将有message提示 +} + +// 切换生产单位种类 push -> game.unit.change +message ChangeUnit{ + pb.common.PbUser user = 1; + int32 unit = 2; +} + +// 进攻区域 push -> game.attack +message Attack{ + pb.common.PbUser user = 1; + int32 area = 2; // 地图上的位置 +} + +////////////// gift + +// 持续回复生命值 push -> game.restoreHealth +message RestoreHealth { + pb.common.PbUser user = 1; + int32 duration = 2; // 持续时间,单位:秒s +} + +// 复活 push -> game.reborn +message Reborn { + pb.common.PbUser user = 1; +} + +// 阵营支援技能 push -> game.support.skill +message SupportSkill { + pb.common.PbUser user = 1; + string skill = 2; // 技能ID, 空字符串表示随机 +} + +// 充能坦克制造进度 push -> game.chargeTank +message ChargeTank { + pb.common.PbUser user = 1; + float value = 2; // 值 +} + +// 特殊支援(红包之类的包裹类礼物) push -> game.support.special +message SupportSpecial { + enum Type { + PARATROOPS = 0; // 空降兵,num多时重复发送该指令 + BOMBER = 1; // 轰炸机,num多时计算总次数 + } + pb.common.PbUser user = 1; + Type type = 2; // 支援类型 + int32 count = 3; // 数量 +} + +// 空投箱(任意价值礼物,游戏内玩家限定特殊礼物除外) push -> game.support.airdrop +message SupportAirdrop { + pb.common.PbUser user = 1; + int32 level = 2; // 档次 1 -> 2 -> 3 +} \ No newline at end of file diff --git a/game/pb/gen.bat b/game/pb/gen.bat index 07d6d71..ec8365e 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=. ^ - ./vars/*.proto ./mq/*.proto ./common/*.proto ./room/*.proto ./game/zhg/*.proto ./game/zhghz/*.proto ./game/zhgzd/*.proto \ No newline at end of file + ./vars/*.proto ./mq/*.proto ./common/*.proto ./room/*.proto ./game/zhg/*.proto ./game/zhghz/*.proto ./game/zhgzd/*.proto ./game/zhgww2/*.proto \ No newline at end of file diff --git a/game/pb/genCSharp.bat b/game/pb/genCSharp.bat index cba79a2..eef0068 100644 --- a/game/pb/genCSharp.bat +++ b/game/pb/genCSharp.bat @@ -4,4 +4,5 @@ protoc --csharp_out=./room --proto_path=. --proto_path=./room --proto_path=./var ::games protoc --csharp_out=./game/zhg --proto_path=. --proto_path=./vars --proto_path=./game/zhg ./game/zhg/*.proto protoc --csharp_out=./game/zhghz --proto_path=. --proto_path=./vars --proto_path=./game/zhghz ./game/zhghz/*.proto -protoc --csharp_out=./game/zhgzd --proto_path=. --proto_path=./vars --proto_path=./game/zhgzd ./game/zhgzd/*.proto \ No newline at end of file +protoc --csharp_out=./game/zhgzd --proto_path=. --proto_path=./vars --proto_path=./game/zhgzd ./game/zhgzd/*.proto +protoc --csharp_out=./game/zhgww2 --proto_path=. --proto_path=./vars --proto_path=./game/zhgww2 ./game/zhgww2/*.proto \ No newline at end of file diff --git a/game/pb/mq/mq.pb.go b/game/pb/mq/mq.pb.go index 06c332f..731d483 100644 --- a/game/pb/mq/mq.pb.go +++ b/game/pb/mq/mq.pb.go @@ -21,56 +21,53 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type Platform int32 +type MqGift_Type int32 const ( - Platform_bilibili Platform = 0 // B站 - Platform_huya Platform = 1 // 虎牙 - Platform_douyu Platform = 2 // 斗鱼 - Platform_douyin Platform = 3 // 抖音 + MqGift_NORMAL MqGift_Type = 0 + MqGift_PACK MqGift_Type = 1 // 包裹类,白银宝箱一类的礼物 + MqGift_RED_PACK MqGift_Type = 2 // 红包类,抽放给观众的礼物 ) -// Enum value maps for Platform. +// Enum value maps for MqGift_Type. var ( - Platform_name = map[int32]string{ - 0: "bilibili", - 1: "huya", - 2: "douyu", - 3: "douyin", - } - Platform_value = map[string]int32{ - "bilibili": 0, - "huya": 1, - "douyu": 2, - "douyin": 3, + MqGift_Type_name = map[int32]string{ + 0: "NORMAL", + 1: "PACK", + 2: "RED_PACK", + } + MqGift_Type_value = map[string]int32{ + "NORMAL": 0, + "PACK": 1, + "RED_PACK": 2, } ) -func (x Platform) Enum() *Platform { - p := new(Platform) +func (x MqGift_Type) Enum() *MqGift_Type { + p := new(MqGift_Type) *p = x return p } -func (x Platform) String() string { +func (x MqGift_Type) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (Platform) Descriptor() protoreflect.EnumDescriptor { +func (MqGift_Type) Descriptor() protoreflect.EnumDescriptor { return file_mq_mq_proto_enumTypes[0].Descriptor() } -func (Platform) Type() protoreflect.EnumType { +func (MqGift_Type) Type() protoreflect.EnumType { return &file_mq_mq_proto_enumTypes[0] } -func (x Platform) Number() protoreflect.EnumNumber { +func (x MqGift_Type) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use Platform.Descriptor instead. -func (Platform) EnumDescriptor() ([]byte, []int) { - return file_mq_mq_proto_rawDescGZIP(), []int{0} +// Deprecated: Use MqGift_Type.Descriptor instead. +func (MqGift_Type) EnumDescriptor() ([]byte, []int) { + return file_mq_mq_proto_rawDescGZIP(), []int{2, 0} } type MqNobilityBuy struct { @@ -356,22 +353,24 @@ type MqGift struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` - LiveRoomId int64 `protobuf:"varint,2,opt,name=liveRoomId,proto3" json:"liveRoomId,omitempty"` - Uid int64 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"` - Uname string `protobuf:"bytes,4,opt,name=uname,proto3" json:"uname,omitempty"` - Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像 - GiftId int64 `protobuf:"varint,6,opt,name=giftId,proto3" json:"giftId,omitempty"` - GiftName string `protobuf:"bytes,7,opt,name=giftName,proto3" json:"giftName,omitempty"` - GiftNum int64 `protobuf:"varint,8,opt,name=giftNum,proto3" json:"giftNum,omitempty"` - Price int64 `protobuf:"varint,9,opt,name=price,proto3" json:"price,omitempty"` - IsPaid bool `protobuf:"varint,10,opt,name=isPaid,proto3" json:"isPaid,omitempty"` - MsgId string `protobuf:"bytes,11,opt,name=msgId,proto3" json:"msgId,omitempty"` // 消息唯一ID - Timestamp int64 `protobuf:"varint,12,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 收礼时间 - NobilityLevel int64 `protobuf:"varint,13,opt,name=nobilityLevel,proto3" json:"nobilityLevel,omitempty"` // 贵族等级 - FansMedalWearingStatus bool `protobuf:"varint,14,opt,name=fansMedalWearingStatus,proto3" json:"fansMedalWearingStatus,omitempty"` // 牌子佩戴状态 - FansMedalName string `protobuf:"bytes,15,opt,name=fansMedalName,proto3" json:"fansMedalName,omitempty"` // 粉丝牌子名 - FansMedalLevel int64 `protobuf:"varint,16,opt,name=fansMedalLevel,proto3" json:"fansMedalLevel,omitempty"` // 粉丝牌子等级 + Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` + LiveRoomId int64 `protobuf:"varint,2,opt,name=liveRoomId,proto3" json:"liveRoomId,omitempty"` + MsgId string `protobuf:"bytes,3,opt,name=msgId,proto3" json:"msgId,omitempty"` // 消息唯一ID + Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 送礼时间 + Uid int64 `protobuf:"varint,5,opt,name=uid,proto3" json:"uid,omitempty"` + Uname string `protobuf:"bytes,6,opt,name=uname,proto3" json:"uname,omitempty"` + Avatar string `protobuf:"bytes,7,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像 + NobilityLevel int64 `protobuf:"varint,8,opt,name=nobilityLevel,proto3" json:"nobilityLevel,omitempty"` // 贵族等级 + GiftId int64 `protobuf:"varint,9,opt,name=giftId,proto3" json:"giftId,omitempty"` // 礼物ID + GiftName string `protobuf:"bytes,10,opt,name=giftName,proto3" json:"giftName,omitempty"` // 礼物名称 + GiftNum int64 `protobuf:"varint,11,opt,name=giftNum,proto3" json:"giftNum,omitempty"` // 单次送礼数量 + Price int64 `protobuf:"varint,12,opt,name=price,proto3" json:"price,omitempty"` // 平台礼物价值(平台货币) + IsPaid bool `protobuf:"varint,13,opt,name=isPaid,proto3" json:"isPaid,omitempty"` // 是否付费 + Type MqGift_Type `protobuf:"varint,14,opt,name=type,proto3,enum=pb.MqGift_Type" json:"type,omitempty"` // 礼物类型 + PackGift *MqGift_PackGift `protobuf:"bytes,15,opt,name=packGift,proto3" json:"packGift,omitempty"` + FansMedalWearingStatus bool `protobuf:"varint,20,opt,name=fansMedalWearingStatus,proto3" json:"fansMedalWearingStatus,omitempty"` // 牌子佩戴状态 + FansMedalName string `protobuf:"bytes,21,opt,name=fansMedalName,proto3" json:"fansMedalName,omitempty"` // 粉丝牌子名 + FansMedalLevel int64 `protobuf:"varint,22,opt,name=fansMedalLevel,proto3" json:"fansMedalLevel,omitempty"` // 粉丝牌子等级 } func (x *MqGift) Reset() { @@ -420,6 +419,20 @@ func (x *MqGift) GetLiveRoomId() int64 { return 0 } +func (x *MqGift) GetMsgId() string { + if x != nil { + return x.MsgId + } + return "" +} + +func (x *MqGift) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + func (x *MqGift) GetUid() int64 { if x != nil { return x.Uid @@ -441,6 +454,13 @@ func (x *MqGift) GetAvatar() string { return "" } +func (x *MqGift) GetNobilityLevel() int64 { + if x != nil { + return x.NobilityLevel + } + return 0 +} + func (x *MqGift) GetGiftId() int64 { if x != nil { return x.GiftId @@ -476,25 +496,18 @@ func (x *MqGift) GetIsPaid() bool { return false } -func (x *MqGift) GetMsgId() string { +func (x *MqGift) GetType() MqGift_Type { if x != nil { - return x.MsgId + return x.Type } - return "" + return MqGift_NORMAL } -func (x *MqGift) GetTimestamp() int64 { +func (x *MqGift) GetPackGift() *MqGift_PackGift { if x != nil { - return x.Timestamp + return x.PackGift } - return 0 -} - -func (x *MqGift) GetNobilityLevel() int64 { - if x != nil { - return x.NobilityLevel - } - return 0 + return nil } func (x *MqGift) GetFansMedalWearingStatus() bool { @@ -518,22 +531,22 @@ func (x *MqGift) GetFansMedalLevel() int64 { return 0 } -type MqRewardPool struct { +// 用户金币变动通知 +type MqUserCoinChanged struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - WelfarePool int64 `protobuf:"varint,1,opt,name=welfarePool,proto3" json:"welfarePool,omitempty"` // 福利池,与战局无关 - BattleId int64 `protobuf:"varint,2,opt,name=battleId,proto3" json:"battleId,omitempty"` // 战局ID - InitReward int64 `protobuf:"varint,3,opt,name=initReward,proto3" json:"initReward,omitempty"` // 初始奖池 - GiftReward int64 `protobuf:"varint,4,opt,name=giftReward,proto3" json:"giftReward,omitempty"` // 礼物奖池 - BattleReward int64 `protobuf:"varint,5,opt,name=battleReward,proto3" json:"battleReward,omitempty"` // 战斗奖池 - OtherReward int64 `protobuf:"varint,6,opt,name=otherReward,proto3" json:"otherReward,omitempty"` // 其它奖池 - AllRewards int64 `protobuf:"varint,10,opt,name=allRewards,proto3" json:"allRewards,omitempty"` // 所有奖池 + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"` + Reason vars.UserCoinChangedReason `protobuf:"varint,4,opt,name=reason,proto3,enum=pb.vars.UserCoinChangedReason" json:"reason,omitempty"` // 变动原因 + Change int64 `protobuf:"varint,10,opt,name=change,proto3" json:"change,omitempty"` // 变动量 + Current int64 `protobuf:"varint,11,opt,name=current,proto3" json:"current,omitempty"` // 当前量 } -func (x *MqRewardPool) Reset() { - *x = MqRewardPool{} +func (x *MqUserCoinChanged) Reset() { + *x = MqUserCoinChanged{} if protoimpl.UnsafeEnabled { mi := &file_mq_mq_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -541,13 +554,13 @@ func (x *MqRewardPool) Reset() { } } -func (x *MqRewardPool) String() string { +func (x *MqUserCoinChanged) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MqRewardPool) ProtoMessage() {} +func (*MqUserCoinChanged) ProtoMessage() {} -func (x *MqRewardPool) ProtoReflect() protoreflect.Message { +func (x *MqUserCoinChanged) ProtoReflect() protoreflect.Message { mi := &file_mq_mq_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -559,76 +572,65 @@ func (x *MqRewardPool) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use MqRewardPool.ProtoReflect.Descriptor instead. -func (*MqRewardPool) Descriptor() ([]byte, []int) { +// Deprecated: Use MqUserCoinChanged.ProtoReflect.Descriptor instead. +func (*MqUserCoinChanged) Descriptor() ([]byte, []int) { return file_mq_mq_proto_rawDescGZIP(), []int{3} } -func (x *MqRewardPool) GetWelfarePool() int64 { - if x != nil { - return x.WelfarePool - } - return 0 -} - -func (x *MqRewardPool) GetBattleId() int64 { +func (x *MqUserCoinChanged) GetUserId() int64 { if x != nil { - return x.BattleId + return x.UserId } return 0 } -func (x *MqRewardPool) GetInitReward() int64 { +func (x *MqUserCoinChanged) GetUsername() string { if x != nil { - return x.InitReward + return x.Username } - return 0 + return "" } -func (x *MqRewardPool) GetGiftReward() int64 { +func (x *MqUserCoinChanged) GetAvatar() string { if x != nil { - return x.GiftReward + return x.Avatar } - return 0 + return "" } -func (x *MqRewardPool) GetBattleReward() int64 { +func (x *MqUserCoinChanged) GetReason() vars.UserCoinChangedReason { if x != nil { - return x.BattleReward + return x.Reason } - return 0 + return vars.UserCoinChangedReason(0) } -func (x *MqRewardPool) GetOtherReward() int64 { +func (x *MqUserCoinChanged) GetChange() int64 { if x != nil { - return x.OtherReward + return x.Change } return 0 } -func (x *MqRewardPool) GetAllRewards() int64 { +func (x *MqUserCoinChanged) GetCurrent() int64 { if x != nil { - return x.AllRewards + return x.Current } return 0 } -// 用户金币变动通知 -type MqUserCoinChanged struct { +// 礼物(包裹) +type MqGift_PackGift struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` - Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` - Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"` - Reason vars.UserCoinChangedReason `protobuf:"varint,4,opt,name=reason,proto3,enum=pb.vars.UserCoinChangedReason" json:"reason,omitempty"` // 变动原因 - Change int64 `protobuf:"varint,10,opt,name=change,proto3" json:"change,omitempty"` // 变动量 - Current int64 `protobuf:"varint,11,opt,name=current,proto3" json:"current,omitempty"` // 当前量 + GiftId int64 `protobuf:"varint,1,opt,name=giftId,proto3" json:"giftId,omitempty"` + GiftName string `protobuf:"bytes,2,opt,name=giftName,proto3" json:"giftName,omitempty"` // 礼物名称 } -func (x *MqUserCoinChanged) Reset() { - *x = MqUserCoinChanged{} +func (x *MqGift_PackGift) Reset() { + *x = MqGift_PackGift{} if protoimpl.UnsafeEnabled { mi := &file_mq_mq_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -636,13 +638,13 @@ func (x *MqUserCoinChanged) Reset() { } } -func (x *MqUserCoinChanged) String() string { +func (x *MqGift_PackGift) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MqUserCoinChanged) ProtoMessage() {} +func (*MqGift_PackGift) ProtoMessage() {} -func (x *MqUserCoinChanged) ProtoReflect() protoreflect.Message { +func (x *MqGift_PackGift) ProtoReflect() protoreflect.Message { mi := &file_mq_mq_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -654,53 +656,25 @@ func (x *MqUserCoinChanged) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use MqUserCoinChanged.ProtoReflect.Descriptor instead. -func (*MqUserCoinChanged) Descriptor() ([]byte, []int) { - return file_mq_mq_proto_rawDescGZIP(), []int{4} +// Deprecated: Use MqGift_PackGift.ProtoReflect.Descriptor instead. +func (*MqGift_PackGift) Descriptor() ([]byte, []int) { + return file_mq_mq_proto_rawDescGZIP(), []int{2, 0} } -func (x *MqUserCoinChanged) GetUserId() int64 { +func (x *MqGift_PackGift) GetGiftId() int64 { if x != nil { - return x.UserId + return x.GiftId } return 0 } -func (x *MqUserCoinChanged) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *MqUserCoinChanged) GetAvatar() string { +func (x *MqGift_PackGift) GetGiftName() string { if x != nil { - return x.Avatar + return x.GiftName } return "" } -func (x *MqUserCoinChanged) GetReason() vars.UserCoinChangedReason { - if x != nil { - return x.Reason - } - return vars.UserCoinChangedReason(0) -} - -func (x *MqUserCoinChanged) GetChange() int64 { - if x != nil { - return x.Change - } - return 0 -} - -func (x *MqUserCoinChanged) GetCurrent() int64 { - if x != nil { - return x.Current - } - return 0 -} - var File_mq_mq_proto protoreflect.FileDescriptor var file_mq_mq_proto_rawDesc = []byte{ @@ -755,70 +729,63 @@ var file_mq_mq_proto_rawDesc = []byte{ 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x66, 0x61, - 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0xe0, 0x03, 0x0a, + 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0xa2, 0x05, 0x0a, 0x06, 0x4d, 0x71, 0x47, 0x69, 0x66, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, - 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, - 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, - 0x74, 0x61, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, - 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, - 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x69, 0x66, 0x74, 0x4e, - 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x75, - 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, - 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x12, - 0x14, 0x0a, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x6d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, - 0x65, 0x76, 0x65, 0x6c, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6e, 0x6f, 0x62, 0x69, - 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x36, 0x0a, 0x16, 0x66, 0x61, 0x6e, - 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, - 0x65, 0x64, 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, - 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, - 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, - 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, - 0xf2, 0x01, 0x0a, 0x0c, 0x4d, 0x71, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x50, 0x6f, 0x6f, 0x6c, - 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, 0x22, 0xc9, 0x01, 0x0a, 0x11, 0x4d, 0x71, 0x55, 0x73, 0x65, 0x72, 0x43, - 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 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, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x36, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, - 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, - 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x16, - 0x0a, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, - 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, - 0x2a, 0x39, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0c, 0x0a, 0x08, - 0x62, 0x69, 0x6c, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x68, 0x75, - 0x79, 0x61, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x64, 0x6f, 0x75, 0x79, 0x75, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x10, 0x03, 0x42, 0x07, 0x5a, 0x05, 0x2f, - 0x70, 0x62, 0x4d, 0x71, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, + 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x16, 0x0a, + 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x67, + 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x07, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x70, + 0x72, 0x69, 0x63, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x71, 0x47, + 0x69, 0x66, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2f, + 0x0a, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x47, 0x69, 0x66, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x71, 0x47, 0x69, 0x66, 0x74, 0x2e, 0x50, 0x61, 0x63, + 0x6b, 0x47, 0x69, 0x66, 0x74, 0x52, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x47, 0x69, 0x66, 0x74, 0x12, + 0x36, 0x0a, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, + 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, + 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, + 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, + 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, + 0x16, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, + 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x1a, 0x3e, 0x0a, 0x08, 0x50, 0x61, 0x63, 0x6b, 0x47, 0x69, 0x66, + 0x74, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, + 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, + 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x2a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, + 0x06, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x41, 0x43, + 0x4b, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x44, 0x5f, 0x50, 0x41, 0x43, 0x4b, 0x10, + 0x02, 0x22, 0xc9, 0x01, 0x0a, 0x11, 0x4d, 0x71, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 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, + 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, + 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, + 0x74, 0x61, 0x72, 0x12, 0x36, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x52, 0x65, 0x61, + 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x63, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x0b, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x07, 0x5a, + 0x05, 0x2f, 0x70, 0x62, 0x4d, 0x71, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -836,21 +803,23 @@ func file_mq_mq_proto_rawDescGZIP() []byte { var file_mq_mq_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_mq_mq_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_mq_mq_proto_goTypes = []interface{}{ - (Platform)(0), // 0: pb.Platform + (MqGift_Type)(0), // 0: pb.MqGift.Type (*MqNobilityBuy)(nil), // 1: pb.MqNobilityBuy (*MqDanmaku)(nil), // 2: pb.MqDanmaku (*MqGift)(nil), // 3: pb.MqGift - (*MqRewardPool)(nil), // 4: pb.MqRewardPool - (*MqUserCoinChanged)(nil), // 5: pb.MqUserCoinChanged + (*MqUserCoinChanged)(nil), // 4: pb.MqUserCoinChanged + (*MqGift_PackGift)(nil), // 5: pb.MqGift.PackGift (vars.UserCoinChangedReason)(0), // 6: pb.vars.UserCoinChangedReason } var file_mq_mq_proto_depIdxs = []int32{ - 6, // 0: pb.MqUserCoinChanged.reason:type_name -> pb.vars.UserCoinChangedReason - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 0, // 0: pb.MqGift.type:type_name -> pb.MqGift.Type + 5, // 1: pb.MqGift.packGift:type_name -> pb.MqGift.PackGift + 6, // 2: pb.MqUserCoinChanged.reason:type_name -> pb.vars.UserCoinChangedReason + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_mq_mq_proto_init() } @@ -896,7 +865,7 @@ func file_mq_mq_proto_init() { } } file_mq_mq_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MqRewardPool); i { + switch v := v.(*MqUserCoinChanged); i { case 0: return &v.state case 1: @@ -908,7 +877,7 @@ func file_mq_mq_proto_init() { } } file_mq_mq_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MqUserCoinChanged); i { + switch v := v.(*MqGift_PackGift); i { case 0: return &v.state case 1: diff --git a/game/pb/mq/mq.proto b/game/pb/mq/mq.proto index 00691f4..96d078d 100644 --- a/game/pb/mq/mq.proto +++ b/game/pb/mq/mq.proto @@ -6,13 +6,6 @@ import "vars/vars.proto"; option go_package = "/pbMq"; -enum Platform { - bilibili = 0; // B站 - huya = 1; // 虎牙 - douyu = 2; // 斗鱼 - douyin = 3; // 抖音 -} - message MqNobilityBuy { string platform = 1; // 平台 int64 liveRoomId = 2; // 直播间ID @@ -40,40 +33,43 @@ message MqDanmaku { string msgId = 7; // 消息唯一ID int64 timestamp = 8; // 发送时间 int64 nobilityLevel = 9; // 贵族等级 + bool fansMedalWearingStatus = 10; // 牌子佩戴状态 string fansMedalName = 11; // 粉丝牌子名 int64 fansMedalLevel = 12; // 粉丝牌子等级 } message MqGift { + enum Type { + NORMAL = 0; + PACK = 1; // 包裹类,白银宝箱一类的礼物 + RED_PACK = 2; // 红包类,抽放给观众的礼物 + } + // 礼物(包裹) + message PackGift { + int64 giftId = 1; + string giftName = 2; // 礼物名称 + } string platform = 1; int64 liveRoomId = 2; - int64 uid = 3; - string uname = 4; - string avatar = 5; // 头像 - - int64 giftId = 6; - string giftName = 7; - int64 giftNum = 8; - int64 price = 9; - bool isPaid = 10; + string msgId = 3; // 消息唯一ID + int64 timestamp = 4; // 送礼时间 + int64 uid = 5; + string uname = 6; + string avatar = 7; // 头像 + int64 nobilityLevel = 8; // 贵族等级 - string msgId = 11; // 消息唯一ID - int64 timestamp = 12; // 收礼时间 - int64 nobilityLevel = 13; // 贵族等级 - bool fansMedalWearingStatus = 14; // 牌子佩戴状态 - string fansMedalName = 15; // 粉丝牌子名 - int64 fansMedalLevel = 16; // 粉丝牌子等级 -} + int64 giftId = 9; // 礼物ID + string giftName = 10; // 礼物名称 + int64 giftNum = 11; // 单次送礼数量 + int64 price = 12; // 平台礼物价值(平台货币) + bool isPaid = 13; // 是否付费 + Type type = 14; // 礼物类型 + PackGift packGift = 15; -message MqRewardPool { - int64 welfarePool = 1; // 福利池,与战局无关 - int64 battleId = 2; // 战局ID - int64 initReward = 3; // 初始奖池 - int64 giftReward = 4; // 礼物奖池 - int64 battleReward = 5; // 战斗奖池 - int64 otherReward = 6; // 其它奖池 - int64 allRewards = 10; // 所有奖池 + bool fansMedalWearingStatus = 20; // 牌子佩戴状态 + string fansMedalName = 21; // 粉丝牌子名 + int64 fansMedalLevel = 22; // 粉丝牌子等级 } // 用户金币变动通知 diff --git a/game/pb/room/Room.cs b/game/pb/room/Room.cs index f48ae02..fdf53d4 100644 --- a/game/pb/room/Room.cs +++ b/game/pb/room/Room.cs @@ -24,19 +24,22 @@ namespace Pb.Room { static RoomReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cg9yb29tL3Jvb20ucHJvdG8SB3BiLnJvb20iRgoLSm9pblJvb21SZXESEgoK", - "TGl2ZVJvb21JZBgBIAEoAxIjCghHYW1lVHlwZRgCIAEoDjIRLnBiLnJvb20u", - "R2FtZVR5cGUiLAoMSm9pblJvb21SZXNwEgwKBENvZGUYASABKAMSDgoGUmVz", - "dWx0GAIgASgJIjkKBkNsaWVudBIKCgJJZBgBIAEoAxIjCghHYW1lVHlwZRgC", - "IAEoDjIRLnBiLnJvb20uR2FtZVR5cGUqPgoIR2FtZVR5cGUSBwoDWkhHEAAS", - "CQoFWkhHSFoQARIJCgVaSEdGQhACEgkKBVpIR1pEEAMSCAoEVEVTVBAKQhla", - "F2RjZy9nYW1lL3BiL3Jvb207cGJSb29tYgZwcm90bzM=")); + "Cg9yb29tL3Jvb20ucHJvdG8SB3BiLnJvb20iNAoNQ3JlYXRlUm9vbVJlcRIj", + "CghHYW1lVHlwZRgBIAEoDjIRLnBiLnJvb20uR2FtZVR5cGUipgEKC0pvaW5S", + "b29tUmVxEjAKCWxpdmVSb29tcxgBIAMoCzIdLnBiLnJvb20uSm9pblJvb21S", + "ZXEuTGl2ZVJvb20SIwoIR2FtZVR5cGUYAiABKA4yES5wYi5yb29tLkdhbWVU", + "eXBlEg4KBnJvb21JZBgDIAEoAxowCghMaXZlUm9vbRISCgpsaXZlUm9vbUlk", + "GAEgASgDEhAKCHBsYXRmb3JtGAIgASgJIiwKDEpvaW5Sb29tUmVzcBIMCgRD", + "b2RlGAEgASgDEg4KBlJlc3VsdBgCIAEoCSpKCghHYW1lVHlwZRIHCgNaSEcQ", + "ABIJCgVaSEdIWhABEgkKBVpIR0ZCEAISCQoFWkhHWkQQAxIKCgZaSEdXVzIQ", + "BBIICgRURVNUEApCGVoXZGNnL2dhbWUvcGIvcm9vbTtwYlJvb21iBnByb3Rv", + "Mw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Pb.Room.GameType), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Room.JoinRoomReq), global::Pb.Room.JoinRoomReq.Parser, new[]{ "LiveRoomId", "GameType" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Room.JoinRoomResp), global::Pb.Room.JoinRoomResp.Parser, new[]{ "Code", "Result" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Room.Client), global::Pb.Room.Client.Parser, new[]{ "Id", "GameType" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Room.CreateRoomReq), global::Pb.Room.CreateRoomReq.Parser, new[]{ "GameType" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Room.JoinRoomReq), global::Pb.Room.JoinRoomReq.Parser, new[]{ "LiveRooms", "GameType", "RoomId" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Room.JoinRoomReq.Types.LiveRoom), global::Pb.Room.JoinRoomReq.Types.LiveRoom.Parser, new[]{ "LiveRoomId", "Platform" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Room.JoinRoomResp), global::Pb.Room.JoinRoomResp.Parser, new[]{ "Code", "Result" }, null, null, null, null) })); } #endregion @@ -64,6 +67,10 @@ namespace Pb.Room { /// [pbr::OriginalName("ZHGZD")] Zhgzd = 3, /// + /// 指挥官-二战 + /// + [pbr::OriginalName("ZHGWW2")] Zhgww2 = 4, + /// /// 测试 /// [pbr::OriginalName("TEST")] Test = 10, @@ -72,16 +79,16 @@ namespace Pb.Room { #endregion #region Messages - public sealed partial class JoinRoomReq : pb::IMessage + public sealed partial class CreateRoomReq : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JoinRoomReq()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRoomReq()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -97,7 +104,7 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public JoinRoomReq() { + public CreateRoomReq() { OnConstruction(); } @@ -105,35 +112,19 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public JoinRoomReq(JoinRoomReq other) : this() { - liveRoomId_ = other.liveRoomId_; + public CreateRoomReq(CreateRoomReq other) : this() { gameType_ = other.gameType_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public JoinRoomReq Clone() { - return new JoinRoomReq(this); - } - - /// Field number for the "LiveRoomId" field. - public const int LiveRoomIdFieldNumber = 1; - private long liveRoomId_; - /// - /// 直播间ID - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long LiveRoomId { - get { return liveRoomId_; } - set { - liveRoomId_ = value; - } + public CreateRoomReq Clone() { + return new CreateRoomReq(this); } /// Field number for the "GameType" field. - public const int GameTypeFieldNumber = 2; + public const int GameTypeFieldNumber = 1; private global::Pb.Room.GameType gameType_ = global::Pb.Room.GameType.Zhg; /// /// 游戏类型(游戏类型) @@ -150,19 +141,18 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { - return Equals(other as JoinRoomReq); + return Equals(other as CreateRoomReq); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(JoinRoomReq other) { + public bool Equals(CreateRoomReq other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (LiveRoomId != other.LiveRoomId) return false; if (GameType != other.GameType) return false; return Equals(_unknownFields, other._unknownFields); } @@ -171,7 +161,6 @@ namespace Pb.Room { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; - if (LiveRoomId != 0L) hash ^= LiveRoomId.GetHashCode(); if (GameType != global::Pb.Room.GameType.Zhg) hash ^= GameType.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -191,12 +180,8 @@ namespace Pb.Room { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (LiveRoomId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(LiveRoomId); - } if (GameType != global::Pb.Room.GameType.Zhg) { - output.WriteRawTag(16); + output.WriteRawTag(8); output.WriteEnum((int) GameType); } if (_unknownFields != null) { @@ -209,12 +194,8 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (LiveRoomId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(LiveRoomId); - } if (GameType != global::Pb.Room.GameType.Zhg) { - output.WriteRawTag(16); + output.WriteRawTag(8); output.WriteEnum((int) GameType); } if (_unknownFields != null) { @@ -227,9 +208,6 @@ namespace Pb.Room { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; - if (LiveRoomId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LiveRoomId); - } if (GameType != global::Pb.Room.GameType.Zhg) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) GameType); } @@ -241,13 +219,10 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(JoinRoomReq other) { + public void MergeFrom(CreateRoomReq other) { if (other == null) { return; } - if (other.LiveRoomId != 0L) { - LiveRoomId = other.LiveRoomId; - } if (other.GameType != global::Pb.Room.GameType.Zhg) { GameType = other.GameType; } @@ -267,10 +242,6 @@ namespace Pb.Room { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { - LiveRoomId = input.ReadInt64(); - break; - } - case 16: { GameType = (global::Pb.Room.GameType) input.ReadEnum(); break; } @@ -290,10 +261,6 @@ namespace Pb.Room { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 8: { - LiveRoomId = input.ReadInt64(); - break; - } - case 16: { GameType = (global::Pb.Room.GameType) input.ReadEnum(); break; } @@ -304,16 +271,16 @@ namespace Pb.Room { } - public sealed partial class JoinRoomResp : pb::IMessage + public sealed partial class JoinRoomReq : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JoinRoomResp()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JoinRoomReq()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -329,7 +296,7 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public JoinRoomResp() { + public JoinRoomReq() { OnConstruction(); } @@ -337,59 +304,81 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public JoinRoomResp(JoinRoomResp other) : this() { - code_ = other.code_; - result_ = other.result_; + public JoinRoomReq(JoinRoomReq other) : this() { + liveRooms_ = other.liveRooms_.Clone(); + gameType_ = other.gameType_; + roomId_ = other.roomId_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public JoinRoomResp Clone() { - return new JoinRoomResp(this); + public JoinRoomReq Clone() { + return new JoinRoomReq(this); } - /// Field number for the "Code" field. - public const int CodeFieldNumber = 1; - private long code_; + /// Field number for the "liveRooms" field. + public const int LiveRoomsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_liveRooms_codec + = pb::FieldCodec.ForMessage(10, global::Pb.Room.JoinRoomReq.Types.LiveRoom.Parser); + private readonly pbc::RepeatedField liveRooms_ = new pbc::RepeatedField(); + /// + /// 客户端对应直播间列表 + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Code { - get { return code_; } + public pbc::RepeatedField LiveRooms { + get { return liveRooms_; } + } + + /// Field number for the "GameType" field. + public const int GameTypeFieldNumber = 2; + private global::Pb.Room.GameType gameType_ = global::Pb.Room.GameType.Zhg; + /// + /// 游戏类型(游戏类型) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Pb.Room.GameType GameType { + get { return gameType_; } set { - code_ = value; + gameType_ = value; } } - /// Field number for the "Result" field. - public const int ResultFieldNumber = 2; - private string result_ = ""; + /// Field number for the "roomId" field. + public const int RoomIdFieldNumber = 3; + private long roomId_; + /// + /// 现有游戏房间ID 0表示加入默认房间 否则将直接加入对应ID房间 + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Result { - get { return result_; } + public long RoomId { + get { return roomId_; } set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + roomId_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { - return Equals(other as JoinRoomResp); + return Equals(other as JoinRoomReq); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(JoinRoomResp other) { + public bool Equals(JoinRoomReq other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Code != other.Code) return false; - if (Result != other.Result) return false; + if(!liveRooms_.Equals(other.liveRooms_)) return false; + if (GameType != other.GameType) return false; + if (RoomId != other.RoomId) return false; return Equals(_unknownFields, other._unknownFields); } @@ -397,8 +386,9 @@ namespace Pb.Room { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; - if (Code != 0L) hash ^= Code.GetHashCode(); - if (Result.Length != 0) hash ^= Result.GetHashCode(); + hash ^= liveRooms_.GetHashCode(); + if (GameType != global::Pb.Room.GameType.Zhg) hash ^= GameType.GetHashCode(); + if (RoomId != 0L) hash ^= RoomId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -417,13 +407,14 @@ namespace Pb.Room { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Code != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Code); + liveRooms_.WriteTo(output, _repeated_liveRooms_codec); + if (GameType != global::Pb.Room.GameType.Zhg) { + output.WriteRawTag(16); + output.WriteEnum((int) GameType); } - if (Result.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Result); + if (RoomId != 0L) { + output.WriteRawTag(24); + output.WriteInt64(RoomId); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -435,13 +426,14 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Code != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Code); + liveRooms_.WriteTo(ref output, _repeated_liveRooms_codec); + if (GameType != global::Pb.Room.GameType.Zhg) { + output.WriteRawTag(16); + output.WriteEnum((int) GameType); } - if (Result.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Result); + if (RoomId != 0L) { + output.WriteRawTag(24); + output.WriteInt64(RoomId); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -453,11 +445,12 @@ namespace Pb.Room { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; - if (Code != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Code); + size += liveRooms_.CalculateSize(_repeated_liveRooms_codec); + if (GameType != global::Pb.Room.GameType.Zhg) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) GameType); } - if (Result.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Result); + if (RoomId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoomId); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -467,15 +460,16 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(JoinRoomResp other) { + public void MergeFrom(JoinRoomReq other) { if (other == null) { return; } - if (other.Code != 0L) { - Code = other.Code; + liveRooms_.Add(other.liveRooms_); + if (other.GameType != global::Pb.Room.GameType.Zhg) { + GameType = other.GameType; } - if (other.Result.Length != 0) { - Result = other.Result; + if (other.RoomId != 0L) { + RoomId = other.RoomId; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -492,12 +486,16 @@ namespace Pb.Room { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; - case 8: { - Code = input.ReadInt64(); + case 10: { + liveRooms_.AddEntriesFrom(input, _repeated_liveRooms_codec); break; } - case 18: { - Result = input.ReadString(); + case 16: { + GameType = (global::Pb.Room.GameType) input.ReadEnum(); + break; + } + case 24: { + RoomId = input.ReadInt64(); break; } } @@ -515,12 +513,16 @@ namespace Pb.Room { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - case 8: { - Code = input.ReadInt64(); + case 10: { + liveRooms_.AddEntriesFrom(ref input, _repeated_liveRooms_codec); break; } - case 18: { - Result = input.ReadString(); + case 16: { + GameType = (global::Pb.Room.GameType) input.ReadEnum(); + break; + } + case 24: { + RoomId = input.ReadInt64(); break; } } @@ -528,18 +530,258 @@ namespace Pb.Room { } #endif + #region Nested types + /// Container for nested types declared in the JoinRoomReq message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public sealed partial class LiveRoom : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LiveRoom()); + 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.Room.JoinRoomReq.Descriptor.NestedTypes[0]; } + } + + [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 LiveRoom() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LiveRoom(LiveRoom other) : this() { + liveRoomId_ = other.liveRoomId_; + platform_ = other.platform_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LiveRoom Clone() { + return new LiveRoom(this); + } + + /// Field number for the "liveRoomId" field. + public const int LiveRoomIdFieldNumber = 1; + private long liveRoomId_; + /// + /// 直播间ID + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long LiveRoomId { + get { return liveRoomId_; } + set { + liveRoomId_ = value; + } + } + + /// Field number for the "platform" field. + public const int PlatformFieldNumber = 2; + private string platform_ = ""; + /// + /// 直播间对应平台 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Platform { + get { return platform_; } + set { + platform_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as LiveRoom); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(LiveRoom other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LiveRoomId != other.LiveRoomId) return false; + if (Platform != other.Platform) 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 (LiveRoomId != 0L) hash ^= LiveRoomId.GetHashCode(); + if (Platform.Length != 0) hash ^= Platform.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 (LiveRoomId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(LiveRoomId); + } + if (Platform.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Platform); + } + 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 (LiveRoomId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(LiveRoomId); + } + if (Platform.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Platform); + } + 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 (LiveRoomId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(LiveRoomId); + } + if (Platform.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Platform); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(LiveRoom other) { + if (other == null) { + return; + } + if (other.LiveRoomId != 0L) { + LiveRoomId = other.LiveRoomId; + } + if (other.Platform.Length != 0) { + Platform = other.Platform; + } + _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: { + LiveRoomId = input.ReadInt64(); + break; + } + case 18: { + Platform = input.ReadString(); + 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: { + LiveRoomId = input.ReadInt64(); + break; + } + case 18: { + Platform = input.ReadString(); + break; + } + } + } + } + #endif + + } + + } + #endregion + } - public sealed partial class Client : pb::IMessage + public sealed partial class JoinRoomResp : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Client()); + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JoinRoomResp()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -555,7 +797,7 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public Client() { + public JoinRoomResp() { OnConstruction(); } @@ -563,65 +805,59 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public Client(Client other) : this() { - id_ = other.id_; - gameType_ = other.gameType_; + public JoinRoomResp(JoinRoomResp other) : this() { + code_ = other.code_; + result_ = other.result_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public Client Clone() { - return new Client(this); + public JoinRoomResp Clone() { + return new JoinRoomResp(this); } - /// Field number for the "Id" field. - public const int IdFieldNumber = 1; - private long id_; - /// - /// 客户端ID(直播间ID) - /// + /// Field number for the "Code" field. + public const int CodeFieldNumber = 1; + private long code_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Id { - get { return id_; } + public long Code { + get { return code_; } set { - id_ = value; + code_ = value; } } - /// Field number for the "GameType" field. - public const int GameTypeFieldNumber = 2; - private global::Pb.Room.GameType gameType_ = global::Pb.Room.GameType.Zhg; - /// - /// 游戏类型(游戏类型) - /// + /// Field number for the "Result" field. + public const int ResultFieldNumber = 2; + private string result_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Pb.Room.GameType GameType { - get { return gameType_; } + public string Result { + get { return result_; } set { - gameType_ = value; + result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { - return Equals(other as Client); + return Equals(other as JoinRoomResp); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(Client other) { + public bool Equals(JoinRoomResp other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } - if (Id != other.Id) return false; - if (GameType != other.GameType) return false; + if (Code != other.Code) return false; + if (Result != other.Result) return false; return Equals(_unknownFields, other._unknownFields); } @@ -629,8 +865,8 @@ namespace Pb.Room { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; - if (Id != 0L) hash ^= Id.GetHashCode(); - if (GameType != global::Pb.Room.GameType.Zhg) hash ^= GameType.GetHashCode(); + if (Code != 0L) hash ^= Code.GetHashCode(); + if (Result.Length != 0) hash ^= Result.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -649,13 +885,13 @@ namespace Pb.Room { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else - if (Id != 0L) { + if (Code != 0L) { output.WriteRawTag(8); - output.WriteInt64(Id); + output.WriteInt64(Code); } - if (GameType != global::Pb.Room.GameType.Zhg) { - output.WriteRawTag(16); - output.WriteEnum((int) GameType); + if (Result.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Result); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -667,13 +903,13 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Id != 0L) { + if (Code != 0L) { output.WriteRawTag(8); - output.WriteInt64(Id); + output.WriteInt64(Code); } - if (GameType != global::Pb.Room.GameType.Zhg) { - output.WriteRawTag(16); - output.WriteEnum((int) GameType); + if (Result.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Result); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); @@ -685,11 +921,11 @@ namespace Pb.Room { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; - if (Id != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); + if (Code != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Code); } - if (GameType != global::Pb.Room.GameType.Zhg) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) GameType); + if (Result.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Result); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -699,15 +935,15 @@ namespace Pb.Room { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(Client other) { + public void MergeFrom(JoinRoomResp other) { if (other == null) { return; } - if (other.Id != 0L) { - Id = other.Id; + if (other.Code != 0L) { + Code = other.Code; } - if (other.GameType != global::Pb.Room.GameType.Zhg) { - GameType = other.GameType; + if (other.Result.Length != 0) { + Result = other.Result; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -725,11 +961,11 @@ namespace Pb.Room { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { - Id = input.ReadInt64(); + Code = input.ReadInt64(); break; } - case 16: { - GameType = (global::Pb.Room.GameType) input.ReadEnum(); + case 18: { + Result = input.ReadString(); break; } } @@ -748,11 +984,11 @@ namespace Pb.Room { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 8: { - Id = input.ReadInt64(); + Code = input.ReadInt64(); break; } - case 16: { - GameType = (global::Pb.Room.GameType) input.ReadEnum(); + case 18: { + Result = input.ReadString(); break; } } diff --git a/game/pb/room/room.pb.go b/game/pb/room/room.pb.go index cce3f2a..e94de08 100644 --- a/game/pb/room/room.pb.go +++ b/game/pb/room/room.pb.go @@ -24,11 +24,12 @@ const ( type GameType int32 const ( - GameType_ZHG GameType = 0 // 指挥官 - GameType_ZHGHZ GameType = 1 // 指挥官-海战 - GameType_ZHGFB GameType = 2 // 指挥官-副本 - GameType_ZHGZD GameType = 3 // 指挥官-阵地 - GameType_TEST GameType = 10 // 测试 + GameType_ZHG GameType = 0 // 指挥官 + GameType_ZHGHZ GameType = 1 // 指挥官-海战 + GameType_ZHGFB GameType = 2 // 指挥官-副本 + GameType_ZHGZD GameType = 3 // 指挥官-阵地 + GameType_ZHGWW2 GameType = 4 // 指挥官-二战 + GameType_TEST GameType = 10 // 测试 ) // Enum value maps for GameType. @@ -38,14 +39,16 @@ var ( 1: "ZHGHZ", 2: "ZHGFB", 3: "ZHGZD", + 4: "ZHGWW2", 10: "TEST", } GameType_value = map[string]int32{ - "ZHG": 0, - "ZHGHZ": 1, - "ZHGFB": 2, - "ZHGZD": 3, - "TEST": 10, + "ZHG": 0, + "ZHGHZ": 1, + "ZHGFB": 2, + "ZHGZD": 3, + "ZHGWW2": 4, + "TEST": 10, } ) @@ -76,19 +79,67 @@ func (GameType) EnumDescriptor() ([]byte, []int) { return file_room_room_proto_rawDescGZIP(), []int{0} } +type CreateRoomReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GameType GameType `protobuf:"varint,1,opt,name=GameType,proto3,enum=pb.room.GameType" json:"GameType,omitempty"` // 游戏类型(游戏类型) +} + +func (x *CreateRoomReq) Reset() { + *x = CreateRoomReq{} + if protoimpl.UnsafeEnabled { + mi := &file_room_room_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateRoomReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRoomReq) ProtoMessage() {} + +func (x *CreateRoomReq) ProtoReflect() protoreflect.Message { + mi := &file_room_room_proto_msgTypes[0] + 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 CreateRoomReq.ProtoReflect.Descriptor instead. +func (*CreateRoomReq) Descriptor() ([]byte, []int) { + return file_room_room_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateRoomReq) GetGameType() GameType { + if x != nil { + return x.GameType + } + return GameType_ZHG +} + type JoinRoomReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - LiveRoomId int64 `protobuf:"varint,1,opt,name=LiveRoomId,proto3" json:"LiveRoomId,omitempty"` // 直播间ID - GameType GameType `protobuf:"varint,2,opt,name=GameType,proto3,enum=pb.room.GameType" json:"GameType,omitempty"` // 游戏类型(游戏类型) + LiveRooms []*JoinRoomReq_LiveRoom `protobuf:"bytes,1,rep,name=liveRooms,proto3" json:"liveRooms,omitempty"` // 客户端对应直播间列表 + GameType GameType `protobuf:"varint,2,opt,name=GameType,proto3,enum=pb.room.GameType" json:"GameType,omitempty"` // 游戏类型(游戏类型) + RoomId int64 `protobuf:"varint,3,opt,name=roomId,proto3" json:"roomId,omitempty"` // 现有游戏房间ID 0表示加入默认房间 否则将直接加入对应ID房间 } func (x *JoinRoomReq) Reset() { *x = JoinRoomReq{} if protoimpl.UnsafeEnabled { - mi := &file_room_room_proto_msgTypes[0] + mi := &file_room_room_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101,7 +152,7 @@ func (x *JoinRoomReq) String() string { func (*JoinRoomReq) ProtoMessage() {} func (x *JoinRoomReq) ProtoReflect() protoreflect.Message { - mi := &file_room_room_proto_msgTypes[0] + mi := &file_room_room_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114,14 +165,14 @@ func (x *JoinRoomReq) ProtoReflect() protoreflect.Message { // Deprecated: Use JoinRoomReq.ProtoReflect.Descriptor instead. func (*JoinRoomReq) Descriptor() ([]byte, []int) { - return file_room_room_proto_rawDescGZIP(), []int{0} + return file_room_room_proto_rawDescGZIP(), []int{1} } -func (x *JoinRoomReq) GetLiveRoomId() int64 { +func (x *JoinRoomReq) GetLiveRooms() []*JoinRoomReq_LiveRoom { if x != nil { - return x.LiveRoomId + return x.LiveRooms } - return 0 + return nil } func (x *JoinRoomReq) GetGameType() GameType { @@ -131,6 +182,13 @@ func (x *JoinRoomReq) GetGameType() GameType { return GameType_ZHG } +func (x *JoinRoomReq) GetRoomId() int64 { + if x != nil { + return x.RoomId + } + return 0 +} + type JoinRoomResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -143,7 +201,7 @@ type JoinRoomResp struct { func (x *JoinRoomResp) Reset() { *x = JoinRoomResp{} if protoimpl.UnsafeEnabled { - mi := &file_room_room_proto_msgTypes[1] + mi := &file_room_room_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -156,7 +214,7 @@ func (x *JoinRoomResp) String() string { func (*JoinRoomResp) ProtoMessage() {} func (x *JoinRoomResp) ProtoReflect() protoreflect.Message { - mi := &file_room_room_proto_msgTypes[1] + mi := &file_room_room_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -169,7 +227,7 @@ func (x *JoinRoomResp) ProtoReflect() protoreflect.Message { // Deprecated: Use JoinRoomResp.ProtoReflect.Descriptor instead. func (*JoinRoomResp) Descriptor() ([]byte, []int) { - return file_room_room_proto_rawDescGZIP(), []int{1} + return file_room_room_proto_rawDescGZIP(), []int{2} } func (x *JoinRoomResp) GetCode() int64 { @@ -186,32 +244,32 @@ func (x *JoinRoomResp) GetResult() string { return "" } -type Client struct { +type JoinRoomReq_LiveRoom struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id int64 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` // 客户端ID(直播间ID) - GameType GameType `protobuf:"varint,2,opt,name=GameType,proto3,enum=pb.room.GameType" json:"GameType,omitempty"` // 游戏类型(游戏类型) + LiveRoomId int64 `protobuf:"varint,1,opt,name=liveRoomId,proto3" json:"liveRoomId,omitempty"` // 直播间ID + Platform string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform,omitempty"` // 直播间对应平台 } -func (x *Client) Reset() { - *x = Client{} +func (x *JoinRoomReq_LiveRoom) Reset() { + *x = JoinRoomReq_LiveRoom{} if protoimpl.UnsafeEnabled { - mi := &file_room_room_proto_msgTypes[2] + mi := &file_room_room_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Client) String() string { +func (x *JoinRoomReq_LiveRoom) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Client) ProtoMessage() {} +func (*JoinRoomReq_LiveRoom) ProtoMessage() {} -func (x *Client) ProtoReflect() protoreflect.Message { - mi := &file_room_room_proto_msgTypes[2] +func (x *JoinRoomReq_LiveRoom) ProtoReflect() protoreflect.Message { + mi := &file_room_room_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -222,50 +280,59 @@ func (x *Client) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Client.ProtoReflect.Descriptor instead. -func (*Client) Descriptor() ([]byte, []int) { - return file_room_room_proto_rawDescGZIP(), []int{2} +// Deprecated: Use JoinRoomReq_LiveRoom.ProtoReflect.Descriptor instead. +func (*JoinRoomReq_LiveRoom) Descriptor() ([]byte, []int) { + return file_room_room_proto_rawDescGZIP(), []int{1, 0} } -func (x *Client) GetId() int64 { +func (x *JoinRoomReq_LiveRoom) GetLiveRoomId() int64 { if x != nil { - return x.Id + return x.LiveRoomId } return 0 } -func (x *Client) GetGameType() GameType { +func (x *JoinRoomReq_LiveRoom) GetPlatform() string { if x != nil { - return x.GameType + return x.Platform } - return GameType_ZHG + return "" } var File_room_room_proto protoreflect.FileDescriptor var file_room_room_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x72, 0x6f, 0x6f, 0x6d, 0x2f, 0x72, 0x6f, 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x07, 0x70, 0x62, 0x2e, 0x72, 0x6f, 0x6f, 0x6d, 0x22, 0x5c, 0x0a, 0x0b, 0x4a, 0x6f, - 0x69, 0x6e, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x4c, 0x69, 0x76, - 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x4c, - 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 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, 0x22, 0x3a, 0x0a, 0x0c, 0x4a, 0x6f, 0x69, 0x6e, - 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x22, 0x47, 0x0a, 0x06, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x0e, - 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, 0x3e, 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, 0x12, 0x09, 0x0a, 0x05, 0x5a, 0x48, 0x47, 0x5a, - 0x44, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x45, 0x53, 0x54, 0x10, 0x0a, 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, + 0x6f, 0x12, 0x07, 0x70, 0x62, 0x2e, 0x72, 0x6f, 0x6f, 0x6d, 0x22, 0x3e, 0x0a, 0x0d, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x2d, 0x0a, 0x08, 0x47, + 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 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, 0x22, 0xd9, 0x01, 0x0a, 0x0b, 0x4a, + 0x6f, 0x69, 0x6e, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x3b, 0x0a, 0x09, 0x6c, 0x69, + 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, + 0x70, 0x62, 0x2e, 0x72, 0x6f, 0x6f, 0x6d, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x6f, 0x6f, 0x6d, + 0x52, 0x65, 0x71, 0x2e, 0x4c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x09, 0x6c, 0x69, + 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x73, 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, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x1a, 0x46, + 0x0a, 0x08, 0x4c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x69, + 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, + 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, + 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, + 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x22, 0x3a, 0x0a, 0x0c, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x6f, + 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x2a, 0x4a, 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, 0x12, 0x09, 0x0a, + 0x05, 0x5a, 0x48, 0x47, 0x5a, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x5a, 0x48, 0x47, 0x57, + 0x57, 0x32, 0x10, 0x04, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x45, 0x53, 0x54, 0x10, 0x0a, 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 ( @@ -281,21 +348,23 @@ func file_room_room_proto_rawDescGZIP() []byte { } var file_room_room_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_room_room_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_room_room_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_room_room_proto_goTypes = []interface{}{ - (GameType)(0), // 0: pb.room.GameType - (*JoinRoomReq)(nil), // 1: pb.room.JoinRoomReq - (*JoinRoomResp)(nil), // 2: pb.room.JoinRoomResp - (*Client)(nil), // 3: pb.room.Client + (GameType)(0), // 0: pb.room.GameType + (*CreateRoomReq)(nil), // 1: pb.room.CreateRoomReq + (*JoinRoomReq)(nil), // 2: pb.room.JoinRoomReq + (*JoinRoomResp)(nil), // 3: pb.room.JoinRoomResp + (*JoinRoomReq_LiveRoom)(nil), // 4: pb.room.JoinRoomReq.LiveRoom } var file_room_room_proto_depIdxs = []int32{ - 0, // 0: pb.room.JoinRoomReq.GameType:type_name -> pb.room.GameType - 0, // 1: pb.room.Client.GameType:type_name -> pb.room.GameType - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 0, // 0: pb.room.CreateRoomReq.GameType:type_name -> pb.room.GameType + 4, // 1: pb.room.JoinRoomReq.liveRooms:type_name -> pb.room.JoinRoomReq.LiveRoom + 0, // 2: pb.room.JoinRoomReq.GameType:type_name -> pb.room.GameType + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_room_room_proto_init() } @@ -305,7 +374,7 @@ func file_room_room_proto_init() { } if !protoimpl.UnsafeEnabled { file_room_room_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*JoinRoomReq); i { + switch v := v.(*CreateRoomReq); i { case 0: return &v.state case 1: @@ -317,7 +386,7 @@ func file_room_room_proto_init() { } } file_room_room_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*JoinRoomResp); i { + switch v := v.(*JoinRoomReq); i { case 0: return &v.state case 1: @@ -329,7 +398,19 @@ func file_room_room_proto_init() { } } file_room_room_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Client); i { + switch v := v.(*JoinRoomResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_room_room_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JoinRoomReq_LiveRoom); i { case 0: return &v.state case 1: @@ -347,7 +428,7 @@ func file_room_room_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_room_room_proto_rawDesc, NumEnums: 1, - NumMessages: 3, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/game/pb/room/room.proto b/game/pb/room/room.proto index 76a14f5..81b64d9 100644 --- a/game/pb/room/room.proto +++ b/game/pb/room/room.proto @@ -10,20 +10,25 @@ enum GameType { ZHGHZ = 1; // 指挥官-海战 ZHGFB = 2; // 指挥官-副本 ZHGZD = 3; // 指挥官-阵地 + ZHGWW2 = 4; // 指挥官-二战 TEST = 10; // 测试 } +message CreateRoomReq { + GameType GameType = 1; // 游戏类型(游戏类型) +} + message JoinRoomReq { - int64 LiveRoomId = 1; // 直播间ID + message LiveRoom { + int64 liveRoomId = 1; // 直播间ID + string platform = 2; // 直播间对应平台 + } + repeated LiveRoom liveRooms = 1; // 客户端对应直播间列表 GameType GameType = 2; // 游戏类型(游戏类型) + int64 roomId = 3; // 现有游戏房间ID 0表示加入默认房间 否则将直接加入对应ID房间 } message JoinRoomResp { int64 Code = 1; string Result = 2; -} - -message Client { - int64 Id = 1; // 客户端ID(直播间ID) - GameType GameType = 2; // 游戏类型(游戏类型) } \ No newline at end of file diff --git a/game/pb/routes.go b/game/pb/routes.go index d347db5..de39f2c 100644 --- a/game/pb/routes.go +++ b/game/pb/routes.go @@ -40,3 +40,17 @@ const ( PushZhgzdWhere = "game.where" PushZhgzdMode = "game.mode" ) + +// zhgww2 +const ( + PushZhgww2JoinGame = "game.join" + PushZhgww2ChangeUnit = "game.unit.change" + PushZhgww2Attack = "game.attack" + + PushZhgww2RestoreHealth = "game.restoreHealth" + PushZhgww2SupportSkill = "game.support.skill" + PushZhgww2ChargeTank = "game.chargeTank" + PushZhgww2SupportSpecial = "game.support.special" + PushZhgww2SupportAirdrop = "game.support.airdrop" + PushZhgww2Reborn = "game.reborn" +) diff --git a/game/pb/vars/Vars.cs b/game/pb/vars/Vars.cs index 882b65c..3e94a91 100644 --- a/game/pb/vars/Vars.cs +++ b/game/pb/vars/Vars.cs @@ -24,25 +24,46 @@ namespace Pb.Vars { static VarsReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cg92YXJzL3ZhcnMucHJvdG8SB3BiLnZhcnMqyAEKFVVzZXJDb2luQ2hhbmdl", - "ZFJlYXNvbhIHCgNQYXkQABIRCg1CdXlCYXR0bGVGb29kEAESEAoMQnV5RWxp", - "dGVVbml0EAISDAoIQnV5VGl0bGUQAxIMCghTZW5kR2lmdBAEEg8KC0J1eU5v", - "YmlsaXR5EAUSEAoMRHJhd0dpZnRQYWNrEAoSCwoHQ2hlY2tJbhALEhMKD0V2", - "ZW50UmFua1N1Ym1pdBAUEhIKDkV2ZW50QmF0dGxlRW5kEBUSDAoIVHJhbnNm", - "ZXIQHiodCgVHb29kcxIJCgVUaXRsZRAAEgkKBUVsaXRlEAEqwgEKCFJhbmtU", - "eXBlEgsKB1Vua25vd24QABIKCgZEYW1hZ2UQARIMCghEZURhbWFnZRACEgsK", - "B0dlbmVyYWwQAxINCglEZUdlbmVyYWwQBBIMCghLaWxsVW5pdBAFEg4KCkRl", - "S2lsbFVuaXQQBhIOCgpLaWxsUGxheWVyEAcSEAoMRGVLaWxsUGxheWVyEAgS", - "BwoDV2luEAkSCAoETG9zdBAKEg4KCkZpcnN0Qmxvb2QQCxIQCgxEZUZpcnN0", - "Qmxvb2QQDEIZWhdkY2cvZ2FtZS9wYi92YXJzO3BiVmFyc2IGcHJvdG8z")); + "Cg92YXJzL3ZhcnMucHJvdG8SB3BiLnZhcnMqOQoIUGxhdGZvcm0SDAoIQmls", + "aWJpbGkQABIICgRIdXlhEAESCQoFRG91eXUQAhIKCgZUaWt0b2sQAyrIAQoV", + "VXNlckNvaW5DaGFuZ2VkUmVhc29uEgcKA1BheRAAEhEKDUJ1eUJhdHRsZUZv", + "b2QQARIQCgxCdXlFbGl0ZVVuaXQQAhIMCghCdXlUaXRsZRADEgwKCFNlbmRH", + "aWZ0EAQSDwoLQnV5Tm9iaWxpdHkQBRIQCgxEcmF3R2lmdFBhY2sQChILCgdD", + "aGVja0luEAsSEwoPRXZlbnRSYW5rU3VibWl0EBQSEgoORXZlbnRCYXR0bGVF", + "bmQQFRIMCghUcmFuc2ZlchAeKh0KBUdvb2RzEgkKBVRpdGxlEAASCQoFRWxp", + "dGUQASrCAQoIUmFua1R5cGUSCwoHVW5rbm93bhAAEgoKBkRhbWFnZRABEgwK", + "CERlRGFtYWdlEAISCwoHR2VuZXJhbBADEg0KCURlR2VuZXJhbBAEEgwKCEtp", + "bGxVbml0EAUSDgoKRGVLaWxsVW5pdBAGEg4KCktpbGxQbGF5ZXIQBxIQCgxE", + "ZUtpbGxQbGF5ZXIQCBIHCgNXaW4QCRIICgRMb3N0EAoSDgoKRmlyc3RCbG9v", + "ZBALEhAKDERlRmlyc3RCbG9vZBAMQhlaF2RjZy9nYW1lL3BiL3ZhcnM7cGJW", + "YXJzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Pb.Vars.UserCoinChangedReason), typeof(global::Pb.Vars.Goods), typeof(global::Pb.Vars.RankType), }, null, null)); + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Pb.Vars.Platform), typeof(global::Pb.Vars.UserCoinChangedReason), typeof(global::Pb.Vars.Goods), typeof(global::Pb.Vars.RankType), }, null, null)); } #endregion } #region Enums + public enum Platform { + /// + /// B站 + /// + [pbr::OriginalName("Bilibili")] Bilibili = 0, + /// + /// 虎牙 + /// + [pbr::OriginalName("Huya")] Huya = 1, + /// + /// 斗鱼 + /// + [pbr::OriginalName("Douyu")] Douyu = 2, + /// + /// 抖音 + /// + [pbr::OriginalName("Tiktok")] Tiktok = 3, + } + public enum UserCoinChangedReason { /// ////// 消费 diff --git a/game/pb/vars/vars.pb.go b/game/pb/vars/vars.pb.go index 34bf457..49b2f76 100644 --- a/game/pb/vars/vars.pb.go +++ b/game/pb/vars/vars.pb.go @@ -20,6 +20,58 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type Platform int32 + +const ( + Platform_Bilibili Platform = 0 // B站 + Platform_Huya Platform = 1 // 虎牙 + Platform_Douyu Platform = 2 // 斗鱼 + Platform_Tiktok Platform = 3 // 抖音 +) + +// Enum value maps for Platform. +var ( + Platform_name = map[int32]string{ + 0: "Bilibili", + 1: "Huya", + 2: "Douyu", + 3: "Tiktok", + } + Platform_value = map[string]int32{ + "Bilibili": 0, + "Huya": 1, + "Douyu": 2, + "Tiktok": 3, + } +) + +func (x Platform) Enum() *Platform { + p := new(Platform) + *p = x + return p +} + +func (x Platform) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Platform) Descriptor() protoreflect.EnumDescriptor { + return file_vars_vars_proto_enumTypes[0].Descriptor() +} + +func (Platform) Type() protoreflect.EnumType { + return &file_vars_vars_proto_enumTypes[0] +} + +func (x Platform) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Platform.Descriptor instead. +func (Platform) EnumDescriptor() ([]byte, []int) { + return file_vars_vars_proto_rawDescGZIP(), []int{0} +} + type UserCoinChangedReason int32 const ( @@ -82,11 +134,11 @@ func (x UserCoinChangedReason) String() string { } func (UserCoinChangedReason) Descriptor() protoreflect.EnumDescriptor { - return file_vars_vars_proto_enumTypes[0].Descriptor() + return file_vars_vars_proto_enumTypes[1].Descriptor() } func (UserCoinChangedReason) Type() protoreflect.EnumType { - return &file_vars_vars_proto_enumTypes[0] + return &file_vars_vars_proto_enumTypes[1] } func (x UserCoinChangedReason) Number() protoreflect.EnumNumber { @@ -95,7 +147,7 @@ func (x UserCoinChangedReason) Number() protoreflect.EnumNumber { // Deprecated: Use UserCoinChangedReason.Descriptor instead. func (UserCoinChangedReason) EnumDescriptor() ([]byte, []int) { - return file_vars_vars_proto_rawDescGZIP(), []int{0} + return file_vars_vars_proto_rawDescGZIP(), []int{1} } type Goods int32 @@ -128,11 +180,11 @@ func (x Goods) String() string { } func (Goods) Descriptor() protoreflect.EnumDescriptor { - return file_vars_vars_proto_enumTypes[1].Descriptor() + return file_vars_vars_proto_enumTypes[2].Descriptor() } func (Goods) Type() protoreflect.EnumType { - return &file_vars_vars_proto_enumTypes[1] + return &file_vars_vars_proto_enumTypes[2] } func (x Goods) Number() protoreflect.EnumNumber { @@ -141,7 +193,7 @@ func (x Goods) Number() protoreflect.EnumNumber { // Deprecated: Use Goods.Descriptor instead. func (Goods) EnumDescriptor() ([]byte, []int) { - return file_vars_vars_proto_rawDescGZIP(), []int{1} + return file_vars_vars_proto_rawDescGZIP(), []int{2} } type RankType int32 @@ -207,11 +259,11 @@ func (x RankType) String() string { } func (RankType) Descriptor() protoreflect.EnumDescriptor { - return file_vars_vars_proto_enumTypes[2].Descriptor() + return file_vars_vars_proto_enumTypes[3].Descriptor() } func (RankType) Type() protoreflect.EnumType { - return &file_vars_vars_proto_enumTypes[2] + return &file_vars_vars_proto_enumTypes[3] } func (x RankType) Number() protoreflect.EnumNumber { @@ -220,43 +272,47 @@ func (x RankType) Number() protoreflect.EnumNumber { // Deprecated: Use RankType.Descriptor instead. func (RankType) EnumDescriptor() ([]byte, []int) { - return file_vars_vars_proto_rawDescGZIP(), []int{2} + return file_vars_vars_proto_rawDescGZIP(), []int{3} } var File_vars_vars_proto protoreflect.FileDescriptor var file_vars_vars_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x76, 0x61, 0x72, 0x73, 0x2f, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x07, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, 0x2a, 0xc8, 0x01, 0x0a, 0x15, 0x55, - 0x73, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x52, 0x65, - 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x61, 0x79, 0x10, 0x00, 0x12, 0x11, 0x0a, - 0x0d, 0x42, 0x75, 0x79, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x6f, 0x64, 0x10, 0x01, - 0x12, 0x10, 0x0a, 0x0c, 0x42, 0x75, 0x79, 0x45, 0x6c, 0x69, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, - 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x75, 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x10, 0x03, - 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x47, 0x69, 0x66, 0x74, 0x10, 0x04, 0x12, 0x0f, - 0x0a, 0x0b, 0x42, 0x75, 0x79, 0x4e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x10, 0x05, 0x12, - 0x10, 0x0a, 0x0c, 0x44, 0x72, 0x61, 0x77, 0x47, 0x69, 0x66, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x10, - 0x0a, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x10, 0x0b, 0x12, 0x13, - 0x0a, 0x0f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69, - 0x74, 0x10, 0x14, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x74, - 0x6c, 0x65, 0x45, 0x6e, 0x64, 0x10, 0x15, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x66, 0x65, 0x72, 0x10, 0x1e, 0x2a, 0x1d, 0x0a, 0x05, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x12, 0x09, - 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x6c, 0x69, - 0x74, 0x65, 0x10, 0x01, 0x2a, 0xc2, 0x01, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0a, - 0x0a, 0x06, 0x44, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x65, - 0x44, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x47, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x6c, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x6c, 0x10, 0x04, 0x12, 0x0c, 0x0a, 0x08, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, - 0x10, 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, - 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x4b, 0x69, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x10, 0x07, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x10, 0x08, 0x12, 0x07, 0x0a, 0x03, 0x57, 0x69, 0x6e, 0x10, 0x09, 0x12, 0x08, 0x0a, - 0x04, 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x46, 0x69, 0x72, 0x73, 0x74, - 0x42, 0x6c, 0x6f, 0x6f, 0x64, 0x10, 0x0b, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x65, 0x46, 0x69, 0x72, - 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x6f, 0x64, 0x10, 0x0c, 0x42, 0x19, 0x5a, 0x17, 0x64, 0x63, 0x67, - 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x62, 0x2f, 0x76, 0x61, 0x72, 0x73, 0x3b, 0x70, 0x62, - 0x56, 0x61, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x12, 0x07, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, 0x2a, 0x39, 0x0a, 0x08, 0x50, 0x6c, + 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x69, 0x6c, 0x69, 0x62, 0x69, + 0x6c, 0x69, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x75, 0x79, 0x61, 0x10, 0x01, 0x12, 0x09, + 0x0a, 0x05, 0x44, 0x6f, 0x75, 0x79, 0x75, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x54, 0x69, 0x6b, + 0x74, 0x6f, 0x6b, 0x10, 0x03, 0x2a, 0xc8, 0x01, 0x0a, 0x15, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, + 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, + 0x07, 0x0a, 0x03, 0x50, 0x61, 0x79, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x42, 0x75, 0x79, 0x42, + 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x42, + 0x75, 0x79, 0x45, 0x6c, 0x69, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x10, 0x02, 0x12, 0x0c, 0x0a, + 0x08, 0x42, 0x75, 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x53, + 0x65, 0x6e, 0x64, 0x47, 0x69, 0x66, 0x74, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x42, 0x75, 0x79, + 0x4e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x72, + 0x61, 0x77, 0x47, 0x69, 0x66, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x10, 0x0a, 0x12, 0x0b, 0x0a, 0x07, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x10, 0x0b, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x10, 0x14, 0x12, 0x12, + 0x0a, 0x0e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x45, 0x6e, 0x64, + 0x10, 0x15, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x10, 0x1e, + 0x2a, 0x1d, 0x0a, 0x05, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x69, 0x74, + 0x6c, 0x65, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x6c, 0x69, 0x74, 0x65, 0x10, 0x01, 0x2a, + 0xc2, 0x01, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, + 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x61, 0x6d, + 0x61, 0x67, 0x65, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x65, 0x44, 0x61, 0x6d, 0x61, 0x67, + 0x65, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x10, 0x03, + 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x10, 0x04, 0x12, + 0x0c, 0x0a, 0x08, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x10, 0x05, 0x12, 0x0e, 0x0a, + 0x0a, 0x44, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x10, 0x06, 0x12, 0x0e, 0x0a, + 0x0a, 0x4b, 0x69, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x07, 0x12, 0x10, 0x0a, + 0x0c, 0x44, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x08, 0x12, + 0x07, 0x0a, 0x03, 0x57, 0x69, 0x6e, 0x10, 0x09, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x6f, 0x73, 0x74, + 0x10, 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x46, 0x69, 0x72, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x6f, 0x64, + 0x10, 0x0b, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x65, 0x46, 0x69, 0x72, 0x73, 0x74, 0x42, 0x6c, 0x6f, + 0x6f, 0x64, 0x10, 0x0c, 0x42, 0x19, 0x5a, 0x17, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, 0x6d, 0x65, + 0x2f, 0x70, 0x62, 0x2f, 0x76, 0x61, 0x72, 0x73, 0x3b, 0x70, 0x62, 0x56, 0x61, 0x72, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -271,11 +327,12 @@ func file_vars_vars_proto_rawDescGZIP() []byte { return file_vars_vars_proto_rawDescData } -var file_vars_vars_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_vars_vars_proto_enumTypes = make([]protoimpl.EnumInfo, 4) var file_vars_vars_proto_goTypes = []interface{}{ - (UserCoinChangedReason)(0), // 0: pb.vars.UserCoinChangedReason - (Goods)(0), // 1: pb.vars.Goods - (RankType)(0), // 2: pb.vars.RankType + (Platform)(0), // 0: pb.vars.Platform + (UserCoinChangedReason)(0), // 1: pb.vars.UserCoinChangedReason + (Goods)(0), // 2: pb.vars.Goods + (RankType)(0), // 3: pb.vars.RankType } var file_vars_vars_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -295,7 +352,7 @@ func file_vars_vars_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_vars_vars_proto_rawDesc, - NumEnums: 3, + NumEnums: 4, NumMessages: 0, NumExtensions: 0, NumServices: 0, diff --git a/game/pb/vars/vars.proto b/game/pb/vars/vars.proto index a5bd7a4..75eccca 100644 --- a/game/pb/vars/vars.proto +++ b/game/pb/vars/vars.proto @@ -4,6 +4,13 @@ package pb.vars; option go_package = "dcg/game/pb/vars;pbVars"; +enum Platform { + Bilibili = 0; // B站 + Huya = 1; // 虎牙 + Douyu = 2; // 斗鱼 + Tiktok = 3; // 抖音 +} + enum UserCoinChangedReason { ///// 消费 Pay = 0; // 通用消费 diff --git a/game/svc/service_context.go b/game/svc/service_context.go index 58030a1..4a0fc1a 100644 --- a/game/svc/service_context.go +++ b/game/svc/service_context.go @@ -8,15 +8,18 @@ import ( ) type ServiceContext struct { - Ctx context.Context + Ctx context.Context + Config *config.Config + UserCenterRpc usercenter.UserCenter } -func NewServiceContext() *ServiceContext { +func NewServiceContext(ctx context.Context, cfg *config.Config) *ServiceContext { svc := &ServiceContext{ - Ctx: context.Background(), + Ctx: ctx, + Config: cfg, // rpc - UserCenterRpc: usercenter.NewUserCenter(zrpc.MustNewClient(config.Config.UserCenterRpc)), + UserCenterRpc: usercenter.NewUserCenter(zrpc.MustNewClient(cfg.UserCenterRpc)), } return svc } diff --git a/main.go b/main.go index 389642b..17bd428 100644 --- a/main.go +++ b/main.go @@ -1,11 +1,12 @@ package main import ( + "context" "dcg/config" "dcg/game/live_logic" "dcg/game/logic" "dcg/game/manager" - "dcg/game/msg_transfer" + "dcg/game/mq" "dcg/game/svc" "flag" "git.noahlan.cn/northlan/ngs" @@ -18,25 +19,25 @@ var configFile = flag.String("f", "./config.yml", "the config file") func main() { flag.Parse() - config.Init(*configFile) + cfg := config.MustLoad(*configFile, config.WithHotReload()) - _ = logger.InitLogger(&config.Config.Log.File, &config.Config.Log.Console) - defer logger.Sync() + svcCtx := svc.NewServiceContext(context.Background(), cfg) - ctx := svc.NewServiceContext() + _ = logger.InitLogger(&cfg.Log.File, &cfg.Log.Console) + defer logger.Sync() - manager.Init(ctx) - logic.Init(ctx) - live_logic.InitLiveManager(ctx) + manager.Init(svcCtx) + logic.Init(svcCtx) + live_logic.InitLiveManager(svcCtx) - msg_transfer.Init(ctx) + mq.Init(svcCtx) opts := make([]ngs.Option, 0) opts = append(opts, ngs.WithComponents(logic.GameLogic.Services)) opts = append(opts, ngs.WithSerializer(protobuf.NewSerializer())) - if config.Config.Server.Debug { - ngs.WithDebugMode() + if cfg.Server.Debug { + opts = append(opts, ngs.WithDebugMode()) } - ngs.Listen(config.Config.Server.Listen, opts...) + ngs.Listen(cfg.Server.Listen, opts...) } diff --git a/pkg/radar/engine.go b/pkg/radar/engine.go deleted file mode 100644 index d992d0a..0000000 --- a/pkg/radar/engine.go +++ /dev/null @@ -1,18 +0,0 @@ -package radar - -// Engine 简易风控引擎 -type Engine struct { - opt1 byte - opt2 byte - ratio int32 - danmakuChan chan struct{} - userId int64 - username string -} - -type Option struct { - IntervalCheck bool // 间隔检测开关 - Repeat bool // 重复性检测开关 - Violence bool // 暴力检测开关 - RuleStudy bool // 规则AI学习开关 -}