//构造二进制数据
gameKindResponse := &platform.GameKindResponse{
GameKind: []platform.GameKind{platform.GameKind_GAME_KIND_TEEPATTI}, //游戏类型
//游戏房间明细
TeepattiLevels: []*platform.TeepattiLevelDesc{ //结构数组
{
GameLevel: &platform.GameLevelDesc{ //结构
LevelId: 5,
CurrencyKind: platform.CurrencyKind_CK_Money, //枚举
CurrencyLimit: 100,
LevelName: "Level I",
UserCount: 2626,
TaxPermillage: 0,
GameId: 4,
},
Blind: 10,
SingleMaxBet: 1280,
TableMaxBet: 10240,
TimesFeeRatio: 10,
Fantasytime: 0,
},
},
}
//protobuf编码
data, _ := proto.Marshal(gameKindResponse)
fmt.Println(data)
type GameKindResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
GameKind []GameKind `protobuf:"varint,1,rep,packed,name=game_kind,json=gameKind,proto3,enum=com.cw.chess.platform.GameKind" json:"game_kind,omitempty"` // 游戏类型的通用描叙
RummyLevels []*RummyLevelDesc `protobuf:"bytes,2,rep,name=rummy_levels,json=rummyLevels,proto3" json:"rummy_levels,omitempty"` // rummy的级别描叙
TeepattiLevels []*TeepattiLevelDesc `protobuf:"bytes,3,rep,name=teepatti_levels,json=teepattiLevels,proto3" json:"teepatti_levels,omitempty"` // teepatii的级别描叙
AbLevels []*ABLevelDesc `protobuf:"bytes,4,rep,name=ab_levels,json=abLevels,proto3" json:"ab_levels,omitempty"` // AB的级别描叙
SevenupdownLevels []*SevenUpdownLevelDesc `protobuf:"bytes,5,rep,name=sevenupdown_levels,json=sevenupdownLevels,proto3" json:"sevenupdown_levels,omitempty"` // SevenUpDown
RapidteenpattiLevels []*RapidTeenpattiLevelDesc `protobuf:"bytes,6,rep,name=rapidteenpatti_levels,json=rapidteenpattiLevels,proto3" json:"rapidteenpatti_levels,omitempty"` // rapid teenpatti的级别描叙
DragontigerLevels []*DragonTigerLevelDesc `protobuf:"bytes,7,rep,name=dragontiger_levels,json=dragontigerLevels,proto3" json:"dragontiger_levels,omitempty"` // 龙虎级别描叙
BlackredLevels []*BlackredLevelDesc `protobuf:"bytes,8,rep,name=blackred_levels,json=blackredLevels,proto3" json:"blackred_levels,omitempty"` // 红黑的级别描叙
HorseracingLevels []*HorseracingDesc `protobuf:"bytes,9,rep,name=horseracing_levels,json=horseracingLevels,proto3" json:"horseracing_levels,omitempty"` // 赛马的级别描叙
JmLevels []*JMLevelDesc `protobuf:"bytes,10,rep,name=jm_levels,json=jmLevels,proto3" json:"jm_levels,omitempty"` // Jhandi Munda的级别描述
BaccaratLevels []*BaccaratLevelDesc `protobuf:"bytes,11,rep,name=baccarat_levels,json=baccaratLevels,proto3" json:"baccarat_levels,omitempty"` // baccarat级别描叙
}
// 游戏支持的种类
type GameKind int32
const (
GameKind_INVALID GameKind = 0
GameKind_GAME_KIND_Rummy GameKind = 1 // rummy
GameKind_GAME_KIND_Rummy_pool GameKind = 2 // rummy_pool
GameKind_GAME_KIND_Rummy_10 GameKind = 3 // rummy_10
GameKind_GAME_KIND_TEEPATTI GameKind = 4 // teepatti
GameKind_GAME_KIND_AB GameKind = 5 // Andar Bahar
GameKind_GAME_KIND_SevenUD GameKind = 6 // seven up down
GameKind_GAME_KIND_RapidTeenaptti GameKind = 7 // rapid teenpatti
GameKind_GAME_KIND_DragonTiger GameKind = 8 // DragonTiger
GameKind_GAME_KIND_BlackRed GameKind = 9 // Black Red
GameKind_GAME_KIND_HorseRacing GameKind = 10 // 赛马
GameKind_GAME_KIND_JM GameKind = 11 // Jhandi Munda
GameKind_GAME_KIND_BACCARAT GameKind = 12 // baccarat
GameKind_GAME_KIND_FT GameKind = 20 // fantasy time
)
// teepatti每一个级别的数据描叙
type TeepattiLevelDesc struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
GameLevel *GameLevelDesc `protobuf:"bytes,1,opt,name=game_level,json=gameLevel,proto3" json:"game_level,omitempty"` // 游戏通用描叙
Blind uint32 `protobuf:"varint,2,opt,name=blind,proto3" json:"blind,omitempty"` // teepatti是按照盲注的倍数来计算分数
SingleMaxBet uint32 `protobuf:"varint,3,opt,name=single_max_bet,json=singleMaxBet,proto3" json:"single_max_bet,omitempty"` // 单个用户最大封顶值
TableMaxBet uint32 `protobuf:"varint,4,opt,name=table_max_bet,json=tableMaxBet,proto3" json:"table_max_bet,omitempty"` // 桌子最大封顶值
TimesFeeRatio uint32 `protobuf:"varint,5,opt,name=times_fee_ratio,json=timesFeeRatio,proto3" json:"times_fee_ratio,omitempty"` // teenpatti的台费系数
Fantasytime uint32 `protobuf:"varint,6,opt,name=fantasytime,proto3" json:"fantasytime,omitempty"` // 是否支持ft,0:不支持,1:支持
}
// 游戏级别的基础定义
type GameLevelDesc struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
LevelId uint32 `protobuf:"varint,1,opt,name=level_id,json=levelId,proto3" json:"level_id,omitempty"` // 级别ID
CurrencyKind CurrencyKind `protobuf:"varint,2,opt,name=currency_kind,json=currencyKind,proto3,enum=com.cw.chess.platform.CurrencyKind" json:"currency_kind,omitempty"` // 真金还是训练(这个逻辑客户端要判定)
CurrencyLimit uint32 `protobuf:"varint,3,opt,name=currency_limit,json=currencyLimit,proto3" json:"currency_limit,omitempty"` // 进入限制(这个逻辑客户端不需要判定,只显示,服务器会下发,免得以后要修改逻辑)
LevelName string `protobuf:"bytes,4,opt,name=level_name,json=levelName,proto3" json:"level_name,omitempty"` // 级别名字,例如(中级房)
UserCount uint32 `protobuf:"varint,5,opt,name=user_count,json=userCount,proto3" json:"user_count,omitempty"` // 这个级别有多少个用户在玩
TaxPermillage uint32 `protobuf:"varint,6,opt,name=tax_permillage,json=taxPermillage,proto3" json:"tax_permillage,omitempty"` // 抽水比率(千分比)
GameId uint32 `protobuf:"varint,7,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"`
}