refactor: 重构,兼容单客户端多直播间,多客户端多直播间等模式。

添加用户佩戴粉丝牌
添加用户舰长信息(加入游戏)
优化配置文件,区分游戏,放置于svcCtx内
规范命名
main
NorthLan 3 years ago
parent 0a7c9af217
commit e0016ab71f

@ -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" ]
@ -30,6 +31,15 @@ Kafka:
Game:
# 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
@ -100,6 +110,20 @@ Game:
SuperSkill:
# 干杯 超级技能
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

@ -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 MustLoad(filepath string, opts ...Option) *Config {
var cfg Config
f = file.Provider(filepath)
mustLoadAndUnmarshal(f, &cfg)
func Init(filepath string) {
f := file.Provider(filepath)
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)
err = loadAndUnmarshal(f, cfg)
if err != nil {
fmt.Printf("配置文件热重载失败: %v\n", err)
return
}
fmt.Printf("重载配置文件: %+v\n", Config)
fmt.Printf("重载配置文件: %+v\n", cfg)
})
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)
}
}

@ -0,0 +1,7 @@
package config
type Kafka struct {
Addr []string
Topic string
ConsumerGroup string
}

@ -0,0 +1,10 @@
package config
// Zhg 指挥官PvP模式
type Zhg struct {
CoinFoodRatio float32 // 硬币到粮草的转换系数(乘)
OutbreakCount int64 // 默认暴兵指令每次暴兵数量
OutbreakMaxCount int64 // 单次暴兵数量最大限制
OutbreakBaseCost int64 // 默认每次暴兵消耗(不限兵种)
OutbreakCostDict map[int]float64 // 暴兵消耗表(单个兵)
}

@ -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
}

@ -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列表
}
}
}

@ -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,

@ -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 // 贵族购买处理
}
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)
liveLogic struct {
gameType string // 游戏类型
cmdParser *cmd.Parser // 命令解析
cmdHandlerMapper map[string]CMDHandlerFunc // 具体命令处理(同类型)
giftHandlers []GiftHandler // 礼物处理
nobilityHandler NobilityHandlerFunc // 贵族购买处理
}
)
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)
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 *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: dm.Msg,
Content: msg,
})
}
}
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) HandleGift(liveRoom *LiveRoom, user *pbCommon.PbUser, gift *pbMq.MqGift) {
if len(l.giftHandlers) == 0 {
return
}
wrapped := l.wrapGiftHandler(nil, l.giftHandlers)
wrapped(liveRoom, user, gift)
}
func (l *LiveGameLogic) HandleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) {
if l.GiftHandler == nil {
return
// 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)
}
l.GiftHandler(roomId, user, gift)
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)
}

@ -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)
// gameLogic
LiveManager.RegisterLogic(NewZhgLiveGameLogic(svcCtx))
LiveManager.RegisterLogic(NewZhghzLiveGameLogic().LiveGameLogic)
LiveManager.RegisterLogic(NewZhgzdLiveGameLogic(svcCtx))
LiveManager.RegisterLogic(NewTestLiveGameLogic(svcCtx))
LiveManager = &Manager{
gameLogics: make(map[string]LiveLogic),
}
// gameLogic
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)
}

@ -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...)
}
}

@ -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
}

@ -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) {}

@ -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 - ?
1call -
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),
})
}

@ -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)
}
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) 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, "结算")
}
}
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 暂时没有特殊礼物需求,留空
//}

@ -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),
// })
// },
// }
// }
// }
//}

@ -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{
}
}
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,
}, 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)
}
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)

@ -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,
})
}

@ -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,
})
}

@ -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 {

@ -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(),

@ -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
}

@ -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
}

@ -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 {
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,
})
}
return &gameManager{
svcCtx: svcCtx,
RoomManager: NewRoomManager(),
DataManager: NewDataManager(),
RoomManager: newRoomManager(WithDefaultRoom(roomMetas)),
}
}
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)
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 data.LiveRoomId() == liveRoomId {
exists = s
for _, liveRoom := range data.LiveRooms {
if liveRoom.ID == liveRoomId && liveRoom.Platform == platform {
resp = room
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)
}
}
// SessionByDataFilter 通过 session数据过滤器 获取session,data
func (m *gameManager) SessionByDataFilter(filter DataFilter) (room *Room, sess *session.Session, data *Data, err error) {
m.RoomManager.PeekAllSession(func(r *Room, session *session.Session) bool {
data, err = m.DataManager.SessionData(session)
if err != nil {
return true
}
if filter(session, data) {
room = r
sess = session
return false
}
return true
})
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
}

@ -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)
}
}
}

@ -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)
}
}

@ -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)
}

@ -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) {
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()
for _, room := range m.rooms {
room.PeekMembers(func(sId int64, s *session.Session) bool {
return fn(room, s)
})
if room == nil {
return errors.New("没有房间可供加入")
}
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
}

@ -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)
}

@ -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
}
)

@ -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,

@ -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,
@ -65,6 +63,10 @@ func (h *MsgToPushHandler) handleDanmaku(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]", pbUser.Username, msgFromMq.Msg)

@ -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 }

@ -1,4 +1,4 @@
package msg_transfer
package mq
import (
"dcg/game/svc"
@ -8,7 +8,6 @@ var (
danmakuMsgToPush MsgToPushHandler
giftMsgToPush GiftToPushHandler
nobilityTransfer NobilityTransferHandler
//rewardTransfer RewardTransferHandler
coinTransfer CoinTransferHandler
)
@ -16,7 +15,6 @@ 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)
}

@ -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 }

@ -1,3 +1,3 @@
package msg_transfer
package mq
type kafkaMsgHandlerFunc func(data []byte, msgKey string)

@ -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
//}

@ -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 {
}
}
/// <summary>Field number for the "platform" field.</summary>
public const int PlatformFieldNumber = 4;
private string platform_ = "";
/// <summary>
/// 平台
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Platform {
get { return platform_; }
set {
platform_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "fansMedalWearingStatus" field.</summary>
public const int FansMedalWearingStatusFieldNumber = 5;
private bool fansMedalWearingStatus_;
/// <summary>
/// 牌子佩戴状态
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool FansMedalWearingStatus {
get { return fansMedalWearingStatus_; }
set {
fansMedalWearingStatus_ = value;
}
}
/// <summary>Field number for the "fansMedalName" field.</summary>
public const int FansMedalNameFieldNumber = 6;
private string fansMedalName_ = "";
/// <summary>
/// 粉丝牌子名
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string FansMedalName {
get { return fansMedalName_; }
set {
fansMedalName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "fansMedalLevel" field.</summary>
public const int FansMedalLevelFieldNumber = 7;
private long fansMedalLevel_;
/// <summary>
/// 粉丝牌子等级
/// </summary>
[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;
}
}
}
}

@ -30,6 +30,10 @@ type PbUser struct {
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 (

@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -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
}

@ -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
./vars/*.proto ./mq/*.proto ./common/*.proto ./room/*.proto ./game/zhg/*.proto ./game/zhghz/*.proto ./game/zhgzd/*.proto ./game/zhgww2/*.proto

@ -5,3 +5,4 @@ protoc --csharp_out=./room --proto_path=. --proto_path=./room --proto_path=./var
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
protoc --csharp_out=./game/zhgww2 --proto_path=. --proto_path=./vars --proto_path=./game/zhgww2 ./game/zhgww2/*.proto

@ -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 {
@ -358,20 +355,22 @@ type MqGift struct {
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"` // 粉丝牌子等级
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 {
if x != nil {
return x.MsgId
}
return ""
}
func (x *MqGift) GetTimestamp() int64 {
func (x *MqGift) GetType() MqGift_Type {
if x != nil {
return x.Timestamp
return x.Type
}
return 0
return MqGift_NORMAL
}
func (x *MqGift) GetNobilityLevel() int64 {
func (x *MqGift) GetPackGift() *MqGift_PackGift {
if x != nil {
return x.NobilityLevel
return x.PackGift
}
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 {
func (x *MqGift_PackGift) GetGiftName() string {
if x != nil {
return x.Username
}
return ""
}
func (x *MqUserCoinChanged) GetAvatar() 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:

@ -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; //
string msgId = 3; // ID
int64 timestamp = 4; //
int64 uid = 5;
string uname = 6;
string avatar = 7; //
int64 nobilityLevel = 8; //
int64 giftId = 6;
string giftName = 7;
int64 giftNum = 8;
int64 price = 9;
bool isPaid = 10;
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; //
}
//

@ -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 {
/// </summary>
[pbr::OriginalName("ZHGZD")] Zhgzd = 3,
/// <summary>
/// 指挥官-二战
/// </summary>
[pbr::OriginalName("ZHGWW2")] Zhgww2 = 4,
/// <summary>
/// 测试
/// </summary>
[pbr::OriginalName("TEST")] Test = 10,
@ -72,6 +79,198 @@ namespace Pb.Room {
#endregion
#region Messages
public sealed partial class CreateRoomReq : pb::IMessage<CreateRoomReq>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CreateRoomReq> _parser = new pb::MessageParser<CreateRoomReq>(() => new CreateRoomReq());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<CreateRoomReq> 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.RoomReflection.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 CreateRoomReq() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
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 CreateRoomReq Clone() {
return new CreateRoomReq(this);
}
/// <summary>Field number for the "GameType" field.</summary>
public const int GameTypeFieldNumber = 1;
private global::Pb.Room.GameType gameType_ = global::Pb.Room.GameType.Zhg;
/// <summary>
/// 游戏类型(游戏类型)
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Pb.Room.GameType GameType {
get { return gameType_; }
set {
gameType_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as CreateRoomReq);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(CreateRoomReq other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (GameType != other.GameType) 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 (GameType != global::Pb.Room.GameType.Zhg) hash ^= GameType.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 (GameType != global::Pb.Room.GameType.Zhg) {
output.WriteRawTag(8);
output.WriteEnum((int) GameType);
}
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 (GameType != global::Pb.Room.GameType.Zhg) {
output.WriteRawTag(8);
output.WriteEnum((int) GameType);
}
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 (GameType != global::Pb.Room.GameType.Zhg) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) GameType);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(CreateRoomReq other) {
if (other == null) {
return;
}
if (other.GameType != global::Pb.Room.GameType.Zhg) {
GameType = other.GameType;
}
_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: {
GameType = (global::Pb.Room.GameType) input.ReadEnum();
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: {
GameType = (global::Pb.Room.GameType) input.ReadEnum();
break;
}
}
}
}
#endif
}
public sealed partial class JoinRoomReq : pb::IMessage<JoinRoomReq>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
@ -86,7 +285,7 @@ namespace Pb.Room {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Pb.Room.RoomReflection.Descriptor.MessageTypes[0]; }
get { return global::Pb.Room.RoomReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -106,8 +305,9 @@ namespace Pb.Room {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public JoinRoomReq(JoinRoomReq other) : this() {
liveRoomId_ = other.liveRoomId_;
liveRooms_ = other.liveRooms_.Clone();
gameType_ = other.gameType_;
roomId_ = other.roomId_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@ -117,19 +317,18 @@ namespace Pb.Room {
return new JoinRoomReq(this);
}
/// <summary>Field number for the "LiveRoomId" field.</summary>
public const int LiveRoomIdFieldNumber = 1;
private long liveRoomId_;
/// <summary>Field number for the "liveRooms" field.</summary>
public const int LiveRoomsFieldNumber = 1;
private static readonly pb::FieldCodec<global::Pb.Room.JoinRoomReq.Types.LiveRoom> _repeated_liveRooms_codec
= pb::FieldCodec.ForMessage(10, global::Pb.Room.JoinRoomReq.Types.LiveRoom.Parser);
private readonly pbc::RepeatedField<global::Pb.Room.JoinRoomReq.Types.LiveRoom> liveRooms_ = new pbc::RepeatedField<global::Pb.Room.JoinRoomReq.Types.LiveRoom>();
/// <summary>
/// 直播间ID
/// 客户端对应直播间列表
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long LiveRoomId {
get { return liveRoomId_; }
set {
liveRoomId_ = value;
}
public pbc::RepeatedField<global::Pb.Room.JoinRoomReq.Types.LiveRoom> LiveRooms {
get { return liveRooms_; }
}
/// <summary>Field number for the "GameType" field.</summary>
@ -147,6 +346,21 @@ namespace Pb.Room {
}
}
/// <summary>Field number for the "roomId" field.</summary>
public const int RoomIdFieldNumber = 3;
private long roomId_;
/// <summary>
/// 现有游戏房间ID 0表示加入默认房间 否则将直接加入对应ID房间
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long RoomId {
get { return roomId_; }
set {
roomId_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
@ -162,8 +376,9 @@ namespace Pb.Room {
if (ReferenceEquals(other, this)) {
return true;
}
if (LiveRoomId != other.LiveRoomId) 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);
}
@ -171,8 +386,9 @@ namespace Pb.Room {
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (LiveRoomId != 0L) hash ^= LiveRoomId.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();
}
@ -191,14 +407,15 @@ namespace Pb.Room {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (LiveRoomId != 0L) {
output.WriteRawTag(8);
output.WriteInt64(LiveRoomId);
}
liveRooms_.WriteTo(output, _repeated_liveRooms_codec);
if (GameType != global::Pb.Room.GameType.Zhg) {
output.WriteRawTag(16);
output.WriteEnum((int) GameType);
}
if (RoomId != 0L) {
output.WriteRawTag(24);
output.WriteInt64(RoomId);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
@ -209,14 +426,15 @@ 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);
}
liveRooms_.WriteTo(ref output, _repeated_liveRooms_codec);
if (GameType != global::Pb.Room.GameType.Zhg) {
output.WriteRawTag(16);
output.WriteEnum((int) GameType);
}
if (RoomId != 0L) {
output.WriteRawTag(24);
output.WriteInt64(RoomId);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
@ -227,12 +445,13 @@ 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);
}
size += liveRooms_.CalculateSize(_repeated_liveRooms_codec);
if (GameType != global::Pb.Room.GameType.Zhg) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) GameType);
}
if (RoomId != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoomId);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
@ -245,12 +464,13 @@ namespace Pb.Room {
if (other == null) {
return;
}
if (other.LiveRoomId != 0L) {
LiveRoomId = other.LiveRoomId;
}
liveRooms_.Add(other.liveRooms_);
if (other.GameType != global::Pb.Room.GameType.Zhg) {
GameType = other.GameType;
}
if (other.RoomId != 0L) {
RoomId = other.RoomId;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@ -266,14 +486,18 @@ namespace Pb.Room {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
LiveRoomId = input.ReadInt64();
case 10: {
liveRooms_.AddEntriesFrom(input, _repeated_liveRooms_codec);
break;
}
case 16: {
GameType = (global::Pb.Room.GameType) input.ReadEnum();
break;
}
case 24: {
RoomId = input.ReadInt64();
break;
}
}
}
#endif
@ -289,36 +513,43 @@ namespace Pb.Room {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
LiveRoomId = input.ReadInt64();
case 10: {
liveRooms_.AddEntriesFrom(ref input, _repeated_liveRooms_codec);
break;
}
case 16: {
GameType = (global::Pb.Room.GameType) input.ReadEnum();
break;
}
case 24: {
RoomId = input.ReadInt64();
break;
}
}
}
#endif
}
#endif
public sealed partial class JoinRoomResp : pb::IMessage<JoinRoomResp>
#region Nested types
/// <summary>Container for nested types declared in the JoinRoomReq message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
public sealed partial class LiveRoom : pb::IMessage<LiveRoom>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<JoinRoomResp> _parser = new pb::MessageParser<JoinRoomResp>(() => new JoinRoomResp());
private static readonly pb::MessageParser<LiveRoom> _parser = new pb::MessageParser<LiveRoom>(() => new LiveRoom());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<JoinRoomResp> Parser { get { return _parser; } }
public static pb::MessageParser<LiveRoom> 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.RoomReflection.Descriptor.MessageTypes[1]; }
get { return global::Pb.Room.JoinRoomReq.Descriptor.NestedTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -329,7 +560,7 @@ namespace Pb.Room {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public JoinRoomResp() {
public LiveRoom() {
OnConstruction();
}
@ -337,59 +568,65 @@ 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 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 JoinRoomResp Clone() {
return new JoinRoomResp(this);
public LiveRoom Clone() {
return new LiveRoom(this);
}
/// <summary>Field number for the "Code" field.</summary>
public const int CodeFieldNumber = 1;
private long code_;
/// <summary>Field number for the "liveRoomId" field.</summary>
public const int LiveRoomIdFieldNumber = 1;
private long liveRoomId_;
/// <summary>
/// 直播间ID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long Code {
get { return code_; }
public long LiveRoomId {
get { return liveRoomId_; }
set {
code_ = value;
liveRoomId_ = value;
}
}
/// <summary>Field number for the "Result" field.</summary>
public const int ResultFieldNumber = 2;
private string result_ = "";
/// <summary>Field number for the "platform" field.</summary>
public const int PlatformFieldNumber = 2;
private string platform_ = "";
/// <summary>
/// 直播间对应平台
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Result {
get { return result_; }
public string Platform {
get { return platform_; }
set {
result_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
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 JoinRoomResp);
return Equals(other as LiveRoom);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(JoinRoomResp other) {
public bool Equals(LiveRoom 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 (LiveRoomId != other.LiveRoomId) return false;
if (Platform != other.Platform) return false;
return Equals(_unknownFields, other._unknownFields);
}
@ -397,8 +634,8 @@ 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();
if (LiveRoomId != 0L) hash ^= LiveRoomId.GetHashCode();
if (Platform.Length != 0) hash ^= Platform.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
@ -417,13 +654,13 @@ namespace Pb.Room {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Code != 0L) {
if (LiveRoomId != 0L) {
output.WriteRawTag(8);
output.WriteInt64(Code);
output.WriteInt64(LiveRoomId);
}
if (Result.Length != 0) {
if (Platform.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Result);
output.WriteString(Platform);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
@ -435,13 +672,13 @@ 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) {
if (LiveRoomId != 0L) {
output.WriteRawTag(8);
output.WriteInt64(Code);
output.WriteInt64(LiveRoomId);
}
if (Result.Length != 0) {
if (Platform.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Result);
output.WriteString(Platform);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
@ -453,11 +690,11 @@ 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);
if (LiveRoomId != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(LiveRoomId);
}
if (Result.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Result);
if (Platform.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Platform);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
@ -467,15 +704,15 @@ namespace Pb.Room {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(JoinRoomResp other) {
public void MergeFrom(LiveRoom other) {
if (other == null) {
return;
}
if (other.Code != 0L) {
Code = other.Code;
if (other.LiveRoomId != 0L) {
LiveRoomId = other.LiveRoomId;
}
if (other.Result.Length != 0) {
Result = other.Result;
if (other.Platform.Length != 0) {
Platform = other.Platform;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@ -493,11 +730,11 @@ namespace Pb.Room {
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Code = input.ReadInt64();
LiveRoomId = input.ReadInt64();
break;
}
case 18: {
Result = input.ReadString();
Platform = input.ReadString();
break;
}
}
@ -516,11 +753,11 @@ namespace Pb.Room {
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
Code = input.ReadInt64();
LiveRoomId = input.ReadInt64();
break;
}
case 18: {
Result = input.ReadString();
Platform = input.ReadString();
break;
}
}
@ -530,16 +767,21 @@ namespace Pb.Room {
}
public sealed partial class Client : pb::IMessage<Client>
}
#endregion
}
public sealed partial class JoinRoomResp : pb::IMessage<JoinRoomResp>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Client> _parser = new pb::MessageParser<Client>(() => new Client());
private static readonly pb::MessageParser<JoinRoomResp> _parser = new pb::MessageParser<JoinRoomResp>(() => new JoinRoomResp());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<Client> Parser { get { return _parser; } }
public static pb::MessageParser<JoinRoomResp> 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);
}
/// <summary>Field number for the "Id" field.</summary>
public const int IdFieldNumber = 1;
private long id_;
/// <summary>
/// 客户端ID(直播间ID)
/// </summary>
/// <summary>Field number for the "Code" field.</summary>
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;
}
}
/// <summary>Field number for the "GameType" field.</summary>
public const int GameTypeFieldNumber = 2;
private global::Pb.Room.GameType gameType_ = global::Pb.Room.GameType.Zhg;
/// <summary>
/// 游戏类型(游戏类型)
/// </summary>
/// <summary>Field number for the "Result" field.</summary>
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;
}
}

@ -28,6 +28,7 @@ const (
GameType_ZHGHZ GameType = 1 // 指挥官-海战
GameType_ZHGFB GameType = 2 // 指挥官-副本
GameType_ZHGZD GameType = 3 // 指挥官-阵地
GameType_ZHGWW2 GameType = 4 // 指挥官-二战
GameType_TEST GameType = 10 // 测试
)
@ -38,6 +39,7 @@ var (
1: "ZHGHZ",
2: "ZHGFB",
3: "ZHGZD",
4: "ZHGWW2",
10: "TEST",
}
GameType_value = map[string]int32{
@ -45,6 +47,7 @@ var (
"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
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
(*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,
},

@ -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; // ()
}

@ -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"
)

@ -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 {
/// <summary>
/// B站
/// </summary>
[pbr::OriginalName("Bilibili")] Bilibili = 0,
/// <summary>
/// 虎牙
/// </summary>
[pbr::OriginalName("Huya")] Huya = 1,
/// <summary>
/// 斗鱼
/// </summary>
[pbr::OriginalName("Douyu")] Douyu = 2,
/// <summary>
/// 抖音
/// </summary>
[pbr::OriginalName("Tiktok")] Tiktok = 3,
}
public enum UserCoinChangedReason {
/// <summary>
////// 消费

@ -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,

@ -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; //

@ -9,14 +9,17 @@ import (
type ServiceContext struct {
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
}

@ -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...)
}

@ -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学习开关
}
Loading…
Cancel
Save