diff --git a/data/DB_PropExchange.dat b/data/DB_PropExchange.dat index da1a818..12cce5f 100644 Binary files a/data/DB_PropExchange.dat and b/data/DB_PropExchange.dat differ diff --git a/data/DB_Task.dat b/data/DB_Task.dat index f4201d0..f5a92be 100644 Binary files a/data/DB_Task.dat and b/data/DB_Task.dat differ diff --git a/dbproxy/svc/l_jybuser.go b/dbproxy/svc/l_jybuser.go index efa1a00..a8dc343 100644 --- a/dbproxy/svc/l_jybuser.go +++ b/dbproxy/svc/l_jybuser.go @@ -156,10 +156,12 @@ func upJybUser(cjybuse, cjyb *mongo.Collection, snId, codeType int32, plt, useCo if jybuser.JybInfos == nil { jybuser.JybInfos = make(map[string]int32) } else if _, exist := jybuser.JybInfos[jybuseerid]; exist { // 该类型礼包玩家已经领取过 - return model.ErrJYBPlCode + if ret.CodeType != 3 { + return model.ErrJYBPlCode + } } - jybuser.JybInfos[jybuseerid] = 1 + jybuser.JybInfos[jybuseerid]++ err = cjybuse.Update(bson.M{"_id": jybuser.JybUserId}, bson.D{{"$set", bson.D{{"jybinfos", jybuser.JybInfos}}}}) if err != nil { diff --git a/etcd/keyconf.go b/etcd/keyconf.go index 0f1813b..25e3733 100644 --- a/etcd/keyconf.go +++ b/etcd/keyconf.go @@ -39,6 +39,7 @@ const ( ETCDKEY_RANK_TYPE = "/game/RankType" // 排行榜奖励配置 ETCDKEY_AWARD_CONFIG = "/game/awardlog_config" //获奖记录 ETCDKEY_GUIDE = "/game/guide_config" //新手引导配置 + ETCDKEY_MACHINE = "/game/machine_config" //娃娃机配置 ETCDKEY_MatchAudience = "/game/match_audience" //比赛观众 ETCDKEY_Spirit = "/game/spirit" // 小精灵配置 ETCDKEY_RoomType = "/game/room_type" // 房间类型配置 diff --git a/gamerule/clawdoll/constants.go b/gamerule/clawdoll/constants.go index 5f361d0..b1c0813 100644 --- a/gamerule/clawdoll/constants.go +++ b/gamerule/clawdoll/constants.go @@ -8,18 +8,53 @@ const ( ClawDollSceneStateStart //开始倒计时 ClawDollSceneStatePlayGame //游戏中 ClawDollSceneStateBilled //结算 + ClawDollSceneWaitPayCoin //等待下一局投币 ClawDollSceneStateMax ) +// 玩家状态 const ( - ClawDollSceneWaitTimeout = time.Second * 2 //等待倒计时 - ClawDollSceneStartTimeout = time.Second * 6 //开始倒计时 - ClawDollSceneBilledTimeout = time.Second * 2 //结算 + ClawDollPlayerStateWait int32 = iota //等待状态 + ClawDollPlayerStateStart //开始倒计时 + ClawDollPlayerStatePlayGame //游戏中 + ClawDollPlayerStateBilled //结算 + ClawDollPlayerWaitPayCoin //等待下一局投币 + ClawDollPlayerStateMax +) + +const ( + ClawDollSceneWaitTimeout = time.Second * 6 //等待倒计时 + ClawDollSceneStartTimeout = time.Second * 1 //开始倒计时 + ClawDollScenePlayTimeout = time.Second * 30 //娃娃机下抓倒计时 + ClawDollSceneBilledTimeout = time.Second * 2 //结算 + ClawDollSceneWaitPayCoinimeout = time.Second * 10 //等待下一局投币 + ) // 玩家操作 const ( - ClawDollPlayerOpScore = iota + 1 // 上分 - ClawDollPlayerOpGo // 下抓 - ClawDollPlayerOpMove // 移动方向 + ClawDollPlayerOpPayCoin = iota + 1 // 上分 投币 + ClawDollPlayerOpGo // 下抓 + ClawDollPlayerOpMove // 玩家操控动作 // 1-前 2-后 3-左 4-右 + ClawDollPlayerCancelPayCoin // 取消投币 +) + +// 1-前 2-后 3-左 4-右 5-投币 +const ( + ButtonFront = iota + 1 /*前*/ + ButtonBack /*后*/ + ButtonLeft /*左*/ + ButtonRight /*右*/ + ButtonPayCoin /*投币*/ +) + +const ( + MoveStop = 0 /*移动停止*/ + MoveStar = 1 /*移动开始*/ +) + +const ( + ClawWeak = iota + 1 //弱力抓 + ClawStrong //强力抓 + ClawGain //必出抓 ) diff --git a/gamerule/clawdoll/queue.go b/gamerule/clawdoll/queue.go new file mode 100644 index 0000000..c051bae --- /dev/null +++ b/gamerule/clawdoll/queue.go @@ -0,0 +1,221 @@ +package clawdoll + +// queue队列容器包 +// 以动态数组的形式实现 +// 该容器可以在尾部实现线性增加元素,在首部实现线性减少元素 +// 队列的扩容和缩容同vector一样,即数组小采用翻倍扩缩容/折半缩容,数组大时采用固定扩/缩容 +// 该容器满足FIFO的先进先出模式 +// 可接纳不同类型的元素 + +// queue队列结构体 +// 包含泛型切片和该切片的首尾位的下标 +// 当删除节点时仅仅需要后移首位一位即可 +// 当剩余长度较小时采用缩容策略进行缩容以释放空间 +// 当添加节点时若未占满全部已分配空间则尾指针后移一位同时进行覆盖存放 +// 当添加节点时尾指针大于已分配空间长度,则先去掉首部多出来的空间,如果还不足则进行扩容 +// 首节点指针始终不能超过尾节点指针 +type Queue struct { + data []interface{} //泛型切片 + begin uint64 //首节点下标 + end uint64 //尾节点下标 + cap uint64 //容量 +} + +//queue队列容器接口 +//存放了queue容器可使用的函数 +//对应函数介绍见下方 + +type queuer interface { + Size() (size uint64) //返回该队列中元素的使用空间大小 + Clear() //清空该队列 + Empty() (b bool) //判断该队列是否为空 + Push(e interface{}) //将元素e添加到该队列末尾 + Pop() (e interface{}) //将该队列首元素弹出并返回 + Front() (e interface{}) //获取该队列首元素 + Back() (e interface{}) //获取该队列尾元素 +} + +// 新建一个queue队列容器并返回 +// 初始queue的切片数组为空 +// 初始queue的首尾指针均置零 +// +// @receiver nil +// @param nil +// @return q *Queue 新建的queue指针 +func New() (q *Queue) { + return &Queue{ + data: make([]interface{}, 1, 1), + begin: 0, + end: 0, + cap: 1, + } +} + +// 返回该容器当前含有元素的数量 +// 该长度并非实际占用空间数量 +// 若容器为空则返回0 +// +// @receiver q *Queue 接受者queue的指针 +// @param nil +// @return size uint64 容器中实际使用元素所占空间大小 +func (q *Queue) Size() (size uint64) { + if q == nil { + q = New() + } + return q.end - q.begin +} + +// 以queue队列容器做接收者 +// 将该容器中所承载的元素清空 +// 将该容器的首尾指针均置0,容量设为1 +// +// @receiver q *Queue 接受者queue的指针 +// @param nil +// @return nil +func (q *Queue) Clear() { + if q == nil { + q = New() + } + + q.data = make([]interface{}, 1, 1) + q.begin = 0 + q.end = 0 + q.cap = 1 +} + +// 判断该queue队列容器是否含有元素 +// 如果含有元素则不为空,返回false +// 如果不含有元素则说明为空,返回true +// 如果容器不存在,返回true +// 该判断过程通过首尾指针数值进行判断 +// 当尾指针数值等于首指针时说明不含有元素 +// 当尾指针数值大于首指针时说明含有元素 +// +// @receiver q *Queue 接受者queue的指针 +// @param nil +// @return b bool 该容器是空的吗? +func (q *Queue) Empty() (b bool) { + if q == nil { + q = New() + } + return q.Size() <= 0 +} + +// 在容器尾部插入元素 +// 若尾指针小于切片实际使用长度,则对当前指针位置进行覆盖,同时尾下标后移一位 +// 若尾指针等于切片实际使用长度,则对实际使用量和实际占用量进行判断 +// 当首部还有冗余时则删将实际使用整体前移到首部,否则对尾部进行扩容即可 +// +// @receiver q *Queue 接受者queue的指针 +// @param e interface{} 待插入元素 +// @return nil +func (q *Queue) Push(e interface{}) { + if q == nil { + q = New() + } + + if q.end < q.cap { + //不需要扩容 + q.data[q.end] = e + } else { + //需要扩容 + if q.begin > 0 { + //首部有冗余,整体前移 + for i := uint64(0); i < q.end-q.begin; i++ { + q.data[i] = q.data[i+q.begin] + } + q.end -= q.begin + q.begin = 0 + } else { + //冗余不足,需要扩容 + if q.cap <= 65536 { + //容量翻倍 + if q.cap == 0 { + q.cap = 1 + } + q.cap *= 2 + } else { + //容量增加2^16 + q.cap += 2 ^ 16 + } + //复制扩容前的元素 + tmp := make([]interface{}, q.cap, q.cap) + copy(tmp, q.data) + q.data = tmp + } + q.data[q.end] = e + } + q.end++ +} + +// 弹出容器第一个元素,同时首下标后移一位 +// 若容器为空,则不进行弹出 +// 弹出结束后,进行缩容判断,考虑到queue的冗余会存在于前后两个方向 +// 所以需要对前后两方分别做判断, 但由于首部主要是减少,并不会增加,所以不需要太多冗余量,而尾部只做添加,所以需要更多的冗余 +// 所以可以对首部预留2^10的冗余,当超过时直接对首部冗余清除即可,释放首部空间时尾部空间仍然保留不变 +// 当首部冗余不足2^10时,但冗余超过实际使用空间,也会对首部进行缩容,尾部不变 +// 同时返回队首元素 +// +// @receiver q *Queue 接受者queue的指针 +// @param nil +// @return e interface{} 队首元素 +func (q *Queue) Pop() (e interface{}) { + if q == nil { + q = New() + return nil + } + if q.Empty() { + q.Clear() + return nil + } + + e = q.data[q.begin] + q.begin++ + if q.begin >= 1024 || q.begin*2 > q.end { + //首部冗余超过2^10或首部冗余超过实际使用 + q.cap -= q.begin + q.end -= q.begin + tmp := make([]interface{}, q.cap, q.cap) + copy(tmp, q.data[q.begin:]) + q.data = tmp + q.begin = 0 + } + + return e +} + +// 返回该容器的第一个元素 +// 若该容器当前为空,则返回nil +// +// @receiver q *Queue 接受者queue的指针 +// @param nil +// @return e interface{} 容器的第一个元素 +func (q *Queue) Front() (e interface{}) { + if q == nil { + q = New() + return nil + } + if q.Empty() { + q.Clear() + return nil + } + return q.data[q.begin] +} + +// 返回该容器的最后一个元素 +// 若该容器当前为空,则返回nil +// +// @receiver q *Queue 接受者queue的指针 +// @param nil +// @return e interface{} 容器的最后一个元素 +func (q *Queue) Back() (e interface{}) { + if q == nil { + q = New() + return nil + } + if q.Empty() { + q.Clear() + return nil + } + return q.data[q.end-1] +} diff --git a/gamerule/tienlen/constants.go b/gamerule/tienlen/constants.go index 24ff3bc..024f6a2 100644 --- a/gamerule/tienlen/constants.go +++ b/gamerule/tienlen/constants.go @@ -29,6 +29,7 @@ const ( TIenLenTianhuTimeout = time.Second * 2 // 天胡动画时长 TienLenHandNotExceedTimeLimit = time.Second * 3 //玩家没有牌可以接上家的牌,出牌时间上限 TienLenHandAutoStateTimeOut = time.Second * 1 //玩家托管出牌时间上限 + TienLenCustomWaiteStatTimeout = time.Millisecond * 1500 ) // 场景状态 diff --git a/gamesrv/action/action_machine.go b/gamesrv/action/action_machine.go index 92d56e6..c577f4e 100644 --- a/gamesrv/action/action_machine.go +++ b/gamesrv/action/action_machine.go @@ -4,22 +4,77 @@ import ( "mongo.games.com/game/protocol/machine" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" + "sync" ) -var MachineMap = make(map[int]string) +var MachineMap = make(map[int]*DollMachine) +var MachineMapLock = sync.Mutex{} -func MSDollMachineList(session *netlib.Session, packetId int, data interface{}) error { +type DollMachine struct { + Id int + MachineStatus int32 //娃娃机链接状态 0:离线 1:在线 + Status bool //标记是否被占用 + VideoAddr string +} + +func MSDollMachineListHandler(session *netlib.Session, packetId int, data interface{}) error { logger.Logger.Tracef("TestHandler %v", data) - MachineMap = make(map[int]string) + MachineMap = make(map[int]*DollMachine) if msg, ok := data.(*machine.MSDollMachineList); ok { for i, info := range msg.Data { - MachineMap[i+1] = info.VideoAddr + MachineMap[i+1] = &DollMachine{ + Id: i + 1, + Status: false, + VideoAddr: info.VideoAddr, + MachineStatus: 1, + } logger.Logger.Tracef("MachineMap[%v] = %v", i, info.VideoAddr) } } return nil } -func init() { - netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineList) +// 获取空闲娃娃机标识 +func GetFreeDollMachineId() int { + // 获取互斥锁 + MachineMapLock.Lock() + defer MachineMapLock.Unlock() + for i, v := range MachineMap { + if v.Status == false { + v.Status = true + return i + } + } + return 0 +} + +// 获取指定娃娃机链接状态 +func GetDollMachineStatus(id int) int32 { + if MachineMap[id] == nil { + return 0 + } + return MachineMap[id].MachineStatus +} + +func MSUpdateDollMachineStatusHandler(session *netlib.Session, packetId int, data interface{}) error { + logger.Logger.Tracef("MSUpdateDollMachineStatusHandler %v", data) + if msg, ok := data.(*machine.MSUpdateDollMachineStatus); ok { + if MachineMap[int(msg.Id)] == nil { + MachineMap[int(msg.Id)] = &DollMachine{ + Id: int(msg.Id), + Status: false, + VideoAddr: msg.VideoAddr, + MachineStatus: msg.Status, + } + } else { + MachineMap[int(msg.Id)].MachineStatus = msg.Status + } + logger.Logger.Tracef("更新娃娃机连接状态 id = %d,status= %d", msg.Id, msg.GetStatus()) + } + return nil +} +func init() { + netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineListHandler) + //更新娃娃机链接状态 + netlib.Register(int(machine.DollMachinePacketID_PACKET_MSUpdateDollMachineStatus), &machine.MSUpdateDollMachineStatus{}, MSUpdateDollMachineStatusHandler) } diff --git a/gamesrv/base/etcd.go b/gamesrv/base/etcd.go index bce9a3e..5452a21 100644 --- a/gamesrv/base/etcd.go +++ b/gamesrv/base/etcd.go @@ -24,6 +24,8 @@ func init() { etcd.Register(etcd.ETCDKEY_ChannelSwitch, webapi.ChannelSwitchConfig{}, platformConfigEtcd) // 皮肤配置 etcd.Register(etcd.ETCDKEY_SKin, webapi.SkinConfig{}, platformConfigEtcd) + // 娃娃机配置 + etcd.Register(etcd.ETCDKEY_MACHINE, webapi.MachineConfig{}, platformConfigEtcd) } func platformConfigEtcd(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) { @@ -41,6 +43,8 @@ func platformConfigEtcd(ctx context.Context, completeKey string, isInit bool, ev ConfigMgrInst.GetConfig(d.Platform).ChannelSwitch[d.GetTp()] = d case *webapi.SkinConfig: ConfigMgrInst.GetConfig(d.Platform).SkinConfig = d + case *webapi.MachineConfig: + ConfigMgrInst.GetConfig(d.Platform).MachineConfig = d default: logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey) } diff --git a/gamesrv/base/logchannel.go b/gamesrv/base/logchannel.go index 4f77a44..de78540 100644 --- a/gamesrv/base/logchannel.go +++ b/gamesrv/base/logchannel.go @@ -3,6 +3,8 @@ package base import ( "reflect" + "mongo.games.com/goserver/core/logger" + "mongo.games.com/game/model" "mongo.games.com/game/mq" ) @@ -38,6 +40,7 @@ func (c *LogChannel) WriteLog(log interface{}) { if cname == "" { cname = "_null_" } + logger.Logger.Tracef("LogChannel ==> %#v", log) mq.Send(cname, log) } diff --git a/gamesrv/base/scene.go b/gamesrv/base/scene.go index fd3f0f7..5f5b0e3 100644 --- a/gamesrv/base/scene.go +++ b/gamesrv/base/scene.go @@ -117,6 +117,8 @@ func NewScene(args *CreateSceneParam) *Scene { KeyGameDif: args.GetDBGameFree().GetGameDif(), } s.CycleID, _ = model.AutoIncGameLogId() + s.rrVer = ReplayRecorderVer[gameId] + s.RecordReplayStart() s.init() return s } @@ -2551,3 +2553,15 @@ func (this *Scene) TryRelease() { this.Destroy(true) } } +func (this *Scene) GetMachineServerSecret(MachineId int32, platform string) (AppId int64, ServerSecret string) { + config := ConfigMgrInst.GetConfig(platform).MachineConfig + if config == nil { + return 0, "" + } + for _, info := range config.Info { + if info.MachineId == MachineId { + return info.AppId, info.ServerSecret + } + } + return 0, "" +} diff --git a/gamesrv/clawdoll/action_clawdoll.go b/gamesrv/clawdoll/action_clawdoll.go index 591aca8..11fddd2 100644 --- a/gamesrv/clawdoll/action_clawdoll.go +++ b/gamesrv/clawdoll/action_clawdoll.go @@ -2,8 +2,10 @@ package clawdoll import ( "mongo.games.com/game/common" + rule "mongo.games.com/game/gamerule/clawdoll" "mongo.games.com/game/gamesrv/base" "mongo.games.com/game/protocol/clawdoll" + "mongo.games.com/game/protocol/machine" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" ) @@ -48,8 +50,129 @@ func (h *CSPlayerOpHandler) Process(s *netlib.Session, packetid int, data interf } return nil } +func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data interface{}) error { + logger.Logger.Tracef("收到返回上分结果!!!!!!!!!!") + if msg, ok := data.(*machine.MSDollMachineoPerateResult); ok { -func init() { - common.RegisterHandler(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP), &CSPlayerOpHandler{}) - netlib.RegisterFactory(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP), &CSPlayerOpPacketFactory{}) + p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) + if p == nil { + logger.Logger.Warn("CSGetTokenHandler p == nil") + return nil + } + + scene := p.GetScene() + if scene == nil { + return nil + } + sceneEx, ok := scene.ExtraData.(*SceneEx) + if !ok { + return nil + } + + switch msg.TypeId { + case 1: + if msg.Result == 1 { + logger.Logger.Tracef("上分成功!!!!!!!!!!!!snid = ", msg.Snid) + } else { + logger.Logger.Tracef("上分失败!!!!!!!!!!!!snid = ", msg.Snid) + } + case 2: + if msg.Result == 1 { + + } else { + logger.Logger.Tracef("下抓失败!!!!!!!!!!!!snid = ", msg.Snid) + } + + scene.ChangeSceneState(rule.ClawDollSceneStateBilled) + + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled)) + + ClawdollBroadcastRoomState(scene) + ClawdollSendPlayerInfo(scene) + } + } + return nil +} + +type CSGetTokenPacketFactory struct { +} + +type CSGetTokenHandler struct { +} + +func (f *CSGetTokenPacketFactory) CreatePacket() interface{} { + pack := &clawdoll.CSCLAWDOLLGetToken{} + return pack +} + +func (h *CSGetTokenHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error { + //转发到娃娃机主机 + logger.Logger.Tracef("CSGetTokenHandler") + if _, ok := data.(*clawdoll.CSCLAWDOLLGetToken); ok { + p := base.PlayerMgrSington.GetPlayer(sid) + if p == nil { + logger.Logger.Warn("CSGetTokenHandler p == nil") + return nil + } + pack := &machine.SMGetToken{} + pack.Snid = p.SnId + + scene := p.GetScene() + if scene == nil { + return nil + } + sceneEx, ok := scene.ExtraData.(*SceneEx) + if !ok { + return nil + } + + machineId := scene.GetDBGameFree().GetId() % 6080000 + appId, serverSecret := sceneEx.GetMachineServerSecret(machineId, p.Platform) + logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v", appId, serverSecret) + if serverSecret == "" || appId == 0 { + return nil + } + + pack.ServerSecret = serverSecret + pack.AppId = appId + sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMGetToken), pack) + } + return nil +} + +// 娃娃机返回token 通知客户端 +func MSSendTokenHandler(session *netlib.Session, packetId int, data interface{}) error { + logger.Logger.Tracef("MSSendTokenHandler") + if msg, ok := data.(*machine.MSSendToken); ok { + //给客户端返回token + token := msg.Token + p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) + if p == nil { + logger.Logger.Warn("MSSendTokenHandler p == nil") + return nil + } + + scene := p.GetScene() + if scene == nil { + return nil + } + + pack := &clawdoll.SCCLAWDOLLSendToken{ + LogicId: scene.DBGameFree.GetId(), + Appid: msg.Appid, + Token: token, + } + p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_SENDTOKEN), pack) + } + return nil +} +func init() { + common.RegisterHandler(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_PLAYEROP), &CSPlayerOpHandler{}) + netlib.RegisterFactory(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_PLAYEROP), &CSPlayerOpPacketFactory{}) + netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{}, MSDollMachineoCoinResultHandler) + //客户端请求token + common.RegisterHandler(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_GETTOKEN), &CSGetTokenHandler{}) + netlib.RegisterFactory(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_GETTOKEN), &CSGetTokenPacketFactory{}) + //获取token返回 + netlib.Register(int(machine.DollMachinePacketID_PACKET_MSSendToken), &machine.MSSendToken{}, MSSendTokenHandler) } diff --git a/gamesrv/clawdoll/player_clawdoll.go b/gamesrv/clawdoll/player_clawdoll.go index e7559b3..2fb434e 100644 --- a/gamesrv/clawdoll/player_clawdoll.go +++ b/gamesrv/clawdoll/player_clawdoll.go @@ -8,9 +8,13 @@ import ( type PlayerEx struct { *base.Player //玩家信息 - gainCoin int64 // 本局赢的金币 - taxCoin int64 // 本局税收 - odds int32 + clawDollState int32 // 抓娃娃状态 + dollCardsCnt int32 // 娃娃卡数量 + + winDollCardType int32 // 本局赢取娃娃的类型 + gainCoin int64 // 本局赢的金币 + taxCoin int64 // 本局税收 + odds int32 } func (this *PlayerEx) Clear(baseScore int32) { @@ -31,14 +35,37 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool { return true } -func (this *PlayerEx) CanPayCoinByPos() bool { +// 能否投币 +func (this *PlayerEx) CanPayCoin() bool { + return true +} - return false +// 投币消耗 +func (this *PlayerEx) CostPlayCoin() bool { + + return true +} + +// 能否移动 +func (this *PlayerEx) CanMove() bool { + + return true +} + +// 能否下抓 +func (this *PlayerEx) CanGrab() bool { + + return true } // 游戏新一局 设置数据 func (this *PlayerEx) ReStartGame() { this.ReDataStartGame() + + this.UnmarkFlag(base.PlayerState_WaitNext) + this.UnmarkFlag(base.PlayerState_GameBreak) + this.MarkFlag(base.PlayerState_Ready) + this.gainCoin = 0 this.taxCoin = 0 this.odds = 0 @@ -49,7 +76,7 @@ func (this *PlayerEx) InitData(baseScore int32) { } -// 重置下注数据 +// 重置数据 func (this *PlayerEx) ResetData() { } @@ -69,3 +96,13 @@ func (this *PlayerEx) CanLeaveScene(sceneState int) bool { return true } + +// 获取状态 +func (this *PlayerEx) GetClawState() int32 { + return this.clawDollState +} + +// 设置状态 +func (this *PlayerEx) SetClawState(state int32) { + this.clawDollState = state +} diff --git a/gamesrv/clawdoll/scene_clawdoll.go b/gamesrv/clawdoll/scene_clawdoll.go index fd6a518..3347ea6 100644 --- a/gamesrv/clawdoll/scene_clawdoll.go +++ b/gamesrv/clawdoll/scene_clawdoll.go @@ -1,13 +1,16 @@ package clawdoll import ( - "mongo.games.com/game/protocol/clawdoll" - "mongo.games.com/goserver/core/logger" - + "container/list" "mongo.games.com/game/common" rule "mongo.games.com/game/gamerule/clawdoll" "mongo.games.com/game/gamesrv/base" "mongo.games.com/game/proto" + "mongo.games.com/game/protocol/clawdoll" + "mongo.games.com/game/protocol/machine" + "mongo.games.com/goserver/core/logger" + "mongo.games.com/goserver/core/netlib" + "mongo.games.com/goserver/srvlib" ) type PlayerData struct { @@ -41,15 +44,21 @@ type SceneEx struct { PlayerBackup map[int32]*PlayerData // 本局离场玩家数据备份 seats []*PlayerEx // 本局游戏中的玩家状态数据 - RoundId int // 局数,第几局 - robotNum int // 参与游戏的机器人数量 - logid string + waitPlayers *list.List + playingSnid int32 // 正在玩的玩家snid + + RoundId int // 局数,第几局 + robotNum int // 参与游戏的机器人数量 + logid string + machineId int //娃娃机ID + machineConn *netlib.Session //娃娃机链接 + machineStatus int32 //娃娃机链接状态 0:离线 1:在线 } // 游戏是否能开始 func (this *SceneEx) CanStart() bool { //人数>=1自动开始 - if len(this.players) >= 0 && (this.GetRealPlayerNum() >= 0 || this.IsPreCreateScene()) { + if len(this.players) >= 1 && (this.GetRealPlayerNum() >= 1 || this.IsPreCreateScene() || this.IsHasPlaying()) { return true } return false @@ -58,19 +67,41 @@ func (this *SceneEx) CanStart() bool { // 从房间删除玩家 func (this *SceneEx) delPlayer(p *base.Player) { if p, exist := this.players[p.SnId]; exist { - this.seats[p.GetPos()] = nil + //this.seats[p.GetPos()] = nil delete(this.players, p.SnId) + this.RemoveWaitPlayer(p.SnId) } } +// 广播玩家进入 +func (this *SceneEx) BroadcastPlayerEnter(p *base.Player, reason int) { + pack := &clawdoll.SCCLAWDOLLPlayerEnter{} + + pack.Data = &clawdoll.CLAWDOLLPlayerDigestInfo{} + + pack.Data.SnId = p.GetSnId() + pack.Data.Head = p.Head + pack.Data.HeadUrl = p.HeadUrl + pack.Data.Name = p.Name + + proto.SetDefaults(pack) + + this.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PlayerEnter), pack, p.GetSid()) +} + // 广播玩家离开 func (this *SceneEx) BroadcastPlayerLeave(p *base.Player, reason int) { scLeavePack := &clawdoll.SCCLAWDOLLPlayerLeave{ - Pos: proto.Int(p.GetPos()), + SnId: proto.Int32(p.SnId), } proto.SetDefaults(scLeavePack) - this.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerLeave), scLeavePack, p.GetSid()) + this.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PlayerLeave), scLeavePack, p.GetSid()) +} + +// 玩家进入事件 +func (this *SceneEx) OnPlayerEnter(p *base.Player, reason int) { + this.BroadcastPlayerEnter(p, reason) } // 玩家离开事件 @@ -88,7 +119,7 @@ func (e *SceneEx) playerOpPack(snId int32, opcode int, opRetCode clawdoll.OpResu SnId: proto.Int32(snId), OpCode: proto.Int32(int32(opcode)), Params: params, - OpRetCode: clawdoll.OpResultCode_OPRC_Success, + OpRetCode: opRetCode, } proto.SetDefaults(pack) @@ -98,7 +129,7 @@ func (e *SceneEx) playerOpPack(snId int32, opcode int, opRetCode clawdoll.OpResu // OnPlayerSCOp 发送玩家操作情况 func (e *SceneEx) OnPlayerSCOp(p *base.Player, opcode int, opRetCode clawdoll.OpResultCode, params []int64) { pack := e.playerOpPack(p.SnId, opcode, opRetCode, params) - p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PLAYEROP), pack) + p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYEROP), pack) logger.Logger.Tracef("OnPlayerSCOp %s", pack) } @@ -132,7 +163,8 @@ func (this *SceneEx) ClawdollCreateRoomInfoPacket(s *base.Scene, p *base.Player) HeadOutLine: proto.Int32(playerEx.HeadOutLine), VIP: proto.Int32(playerEx.VIP), - WinCoin: proto.Int64(playerEx.gainCoin), + WinCoin: proto.Int64(playerEx.gainCoin), + ClawDollState: proto.Int32(playerEx.clawDollState), } pack.Players = append(pack.Players, pd) @@ -152,8 +184,8 @@ func NewClawdollSceneData(s *base.Scene) *SceneEx { Scene: s, logic: new(rule.Logic), players: make(map[int32]*PlayerEx), - seats: make([]*PlayerEx, s.GetPlayerNum()), PlayerBackup: make(map[int32]*PlayerData), + waitPlayers: list.New(), } return sceneEx @@ -164,9 +196,40 @@ func (this *SceneEx) init() bool { return true } -// 检查上分是否合法 -func (this *SceneEx) CheckPayOp(betVal int64, takeMul int64) bool { //游戏底分 - return true +// 检查上分投币是否合法 +func (this *SceneEx) CheckPayCoinOp(p *PlayerEx) bool { + if p == nil { + return false + } + + if p.SnId == this.playingSnid { + return true + } + return false +} + +// 检查移动是否合法 +func (this *SceneEx) CheckMoveOp(p *PlayerEx) bool { + if p == nil { + return false + } + + if p.SnId == this.playingSnid { + return true + } + return false +} + +// 下抓是否合法 +func (this *SceneEx) CheckGrapOp(p *PlayerEx) bool { + if p == nil { + return false + } + + if p.SnId == this.playingSnid { + return true + } + return false } func (this *SceneEx) Clear() { @@ -174,13 +237,29 @@ func (this *SceneEx) Clear() { this.PlayerBackup = make(map[int32]*PlayerData) this.RoundId = 0 - for i := 0; i < this.GetPlayerNum(); i++ { - if this.seats[i] != nil { - this.seats[i].Clear(this.GetBaseScore()) + for e := this.waitPlayers.Front(); e != nil; e = e.Next() { + if e != nil { + p := e.Value.(*PlayerEx) + p.Clear(0) } } } +// 是否有玩家正在玩 +func (this *SceneEx) IsHasPlaying() bool { + if this.playingSnid == 0 { + return false + } + + return true +} + +// 等待下一个玩家 +func (this *SceneEx) ReStartGame() { + this.playingSnid = 0 + +} + func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) { this.PlayerBackup[p.SnId] = &PlayerData{ SnId: p.SnId, @@ -203,3 +282,107 @@ func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) { BeUnderAgentCode: p.BeUnderAgentCode, } } + +func (this *SceneEx) GetPlayGrabType(player *PlayerEx) int32 { + if player == nil { + return rule.ClawWeak + } + + if this.RoundId%100 == 0 && this.RoundId != 0 { + return rule.ClawStrong + } + + return rule.ClawWeak +} + +func (this *SceneEx) AddWaitPlayer(player *PlayerEx) { + if player == nil { + return + } + + this.waitPlayers.PushBack(player) +} + +func (this *SceneEx) RemoveWaitPlayer(SnId int32) bool { + l := this.waitPlayers + for e := l.Front(); e != nil; e = e.Next() { + if p := e.Value.(*PlayerEx); p.SnId == SnId { + this.waitPlayers.Remove(e) + return true + } + } + + return false +} + +func (this *SceneEx) GetPlayingEx() *PlayerEx { + if this.playingSnid == 0 { + return nil + } + + return this.players[this.playingSnid] +} + +func (this *SceneEx) SetPlayingState(state int32) { + if this.playingSnid == 0 { + return + } + + playerEx := this.players[this.playingSnid] + if playerEx != nil { + oldState := playerEx.GetClawState() + if oldState != state { + if oldState == rule.ClawDollPlayerStateWait && (state >= rule.ClawDollPlayerStateStart && state <= rule.ClawDollPlayerWaitPayCoin) { + ClawdollBroadcastPlayingInfo(this.Scene) + } + + if state == rule.ClawDollPlayerStateWait && (oldState >= rule.ClawDollPlayerStateStart && oldState <= rule.ClawDollPlayerWaitPayCoin) { + ClawdollBroadcastPlayingInfo(this.Scene) + } + } + + playerEx.SetClawState(state) + } +} + +// 时间到 系统开始下抓 +func (this *SceneEx) TimeOutPlayGrab() bool { + + this.OnPlayerSMGrabOp(this.playingSnid, int32(this.machineId), rule.ClawWeak) + + return true +} + +// OnPlayerSMGrabOp 下抓 //1-弱力抓 2 -强力抓 3-必出抓 +func (this *SceneEx) OnPlayerSMGrabOp(SnId, Id, GrabType int32) { + + pack := &machine.SMDollMachineGrab{ + Snid: proto.Int32(SnId), + Id: proto.Int32(Id), + TypeId: proto.Int32(GrabType), + } + + this.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), pack) +} + +// OnPlayerSCOp 发送玩家操作情况 1-前 2-后 3-左 4-右 5-投币 +func (this *SceneEx) OnPlayerSMPerateOp(SnId, Id, Perate int32) { + + pack := &machine.SMDollMachineoPerate{ + Snid: proto.Int32(SnId), + Id: proto.Int32(Id), + Perate: proto.Int32(Perate), + } + + this.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), pack) +} + +// 向娃娃机主机发送消息 +func (this *SceneEx) SendToMachine(pid int, msg interface{}) { + this.machineConn = srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001) + if this.machineConn != nil { + this.machineConn.Send(pid, msg) + } else { + logger.Logger.Error("MachineConn is nil !") + } +} diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 46bc199..713da22 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -1,7 +1,9 @@ package clawdoll import ( + "mongo.games.com/game/gamesrv/action" "mongo.games.com/game/protocol/clawdoll" + "mongo.games.com/game/protocol/machine" "time" "mongo.games.com/goserver/core" @@ -61,6 +63,31 @@ func (this *PolicyClawdoll) OnTick(s *base.Scene) { if s.SceneState != nil { s.SceneState.OnTick(s) } + + sceneEx, ok := s.ExtraData.(*SceneEx) + if ok { + if sceneEx.machineId == 0 { + sceneEx.machineId = action.GetFreeDollMachineId() + } + if sceneEx.machineId != 0 { + machineStatus := action.GetDollMachineStatus(sceneEx.machineId) + if machineStatus == 0 { + //链接状态不可用 踢出所有玩家 + for _, p := range sceneEx.players { + sceneEx.delPlayer(p.Player) + } + sceneEx.machineStatus = 0 + logger.Logger.Trace("娃娃机离线,当前场景暂停服务!") + //通知客户单房间不可用 + } else { + if sceneEx.machineStatus == 0 { + sceneEx.machineStatus = machineStatus + //通知客户端房间可用 + } + } + } + } + } func (this *PolicyClawdoll) OnPlayerEnter(s *base.Scene, p *base.Player) { @@ -69,35 +96,31 @@ func (this *PolicyClawdoll) OnPlayerEnter(s *base.Scene, p *base.Player) { } logger.Logger.Trace("(this *PolicyClawdoll) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.SnId) - if sceneEx, ok := s.ExtraData.(*SceneEx); ok { - pos := -1 - for i := 0; i < sceneEx.GetPlayerNum(); i++ { - if sceneEx.seats[i] == nil { - pos = i - break - } + playerEx := &PlayerEx{Player: p} + sceneEx.players[p.SnId] = playerEx + baseScore := sceneEx.GetBaseScore() + p.ExtraData = playerEx + playerEx.Clear(baseScore) + + if sceneEx.playingSnid == 0 { + //sceneEx.playingSnid = p.GetSnId() } - if pos != -1 { - playerEx := &PlayerEx{Player: p} - sceneEx.seats[pos] = playerEx - sceneEx.players[p.SnId] = playerEx - baseScore := sceneEx.GetBaseScore() + p.MarkFlag(base.PlayerState_WaitNext) + p.UnmarkFlag(base.PlayerState_Ready) - p.Pos = pos - p.ExtraData = playerEx - playerEx.Clear(baseScore) + //给自己发送房间信息 + this.SendRoomInfo(s, p, sceneEx) - if sceneEx.Gaming { - p.MarkFlag(base.PlayerState_WaitNext) - p.UnmarkFlag(base.PlayerState_Ready) - } + ClawdollBroadcastRoomWaitPlayers(s) + ClawdollBroadcastPlayingInfo(s) - //给自己发送房间信息 - this.SendRoomInfo(s, p, sceneEx) - s.FirePlayerEvent(p, base.PlayerEventEnter, nil) - } + // 玩家数据发送 + sceneEx.OnPlayerEnter(p, 0) + + this.SendGetVideoToken(s, p, sceneEx) + s.FirePlayerEvent(p, base.PlayerEventEnter, nil) } } @@ -151,6 +174,10 @@ func (this *PolicyClawdoll) OnPlayerRehold(s *base.Scene, p *base.Player) { p.MarkFlag(base.PlayerState_Ready) } this.SendRoomInfo(s, p, sceneEx) + ClawdollBroadcastRoomWaitPlayers(s) + ClawdollBroadcastPlayingInfo(s) + + this.SendGetVideoToken(s, p, sceneEx) s.FirePlayerEvent(p, base.PlayerEventRehold, nil) } } @@ -168,6 +195,10 @@ func (this *PolicyClawdoll) OnPlayerReturn(s *base.Scene, p *base.Player) { p.MarkFlag(base.PlayerState_Ready) } this.SendRoomInfo(s, p, sceneEx) + ClawdollBroadcastRoomWaitPlayers(s) + ClawdollBroadcastPlayingInfo(s) + + this.SendGetVideoToken(s, p, sceneEx) s.FirePlayerEvent(p, base.PlayerEventReturn, nil) } } @@ -207,9 +238,6 @@ func (this *PolicyClawdoll) IsCompleted(s *base.Scene) bool { } func (this *PolicyClawdoll) IsCanForceStart(s *base.Scene) bool { - if sceneEx, ok := s.ExtraData.(*SceneEx); ok { - return len(s.Players) >= 2 && !sceneEx.Gaming - } return false } @@ -234,8 +262,38 @@ func (this *PolicyClawdoll) CanChangeCoinScene(s *base.Scene, p *base.Player) bo } func (this *PolicyClawdoll) SendRoomInfo(s *base.Scene, p *base.Player, sceneEx *SceneEx) { + if s == nil || p == nil || sceneEx == nil { + return + } + pack := sceneEx.ClawdollCreateRoomInfoPacket(s, p) - p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMINFO), pack) + + p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_ROOMINFO), pack) +} + +func (this *PolicyClawdoll) SendGetVideoToken(s *base.Scene, p *base.Player, sceneEx *SceneEx) { + //转发到娃娃机主机 + if s == nil || p == nil || sceneEx == nil { + return + } + logger.Logger.Tracef("ClawdollGetVideoToken") + if p == nil { + logger.Logger.Warn("ClawdollGetVideoToken p == nil") + return + } + pack := &machine.SMGetToken{} + pack.Snid = p.SnId + + machineId := s.DBGameFree.GetId() % 6080000 + appId, serverSecret := sceneEx.GetMachineServerSecret(machineId, p.Platform) + logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v", appId, serverSecret) + if serverSecret == "" || appId == 0 { + return + } + + pack.ServerSecret = serverSecret + pack.AppId = appId + sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMGetToken), pack) } // 广播房间状态 @@ -244,7 +302,79 @@ func ClawdollBroadcastRoomState(s *base.Scene, params ...float32) { State: proto.Int(s.SceneState.GetState()), Params: params, } - s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMSTATE), pack, 0) + s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_ROOMSTATE), pack, 0) +} + +// 玩家状态信息变化 +func ClawdollSendPlayerInfo(s *base.Scene) { + + if sceneEx, ok := s.ExtraData.(*SceneEx); ok { + playerEx := sceneEx.GetPlayingEx() + if playerEx != nil && playerEx.SnId == sceneEx.playingSnid { + pack := &clawdoll.SCCLAWDOLLPlayerInfo{ + SnId: proto.Int32(playerEx.SnId), + ClawDollState: proto.Int32(playerEx.GetClawState()), + Coin: proto.Int64(playerEx.Coin), + GainCoin: proto.Int64(playerEx.gainCoin), + } + + proto.SetDefaults(pack) + + playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYERINFO), pack) + } + } +} + +// 广播房间里所有等待玩家信息 +func ClawdollBroadcastRoomWaitPlayers(s *base.Scene) { + pack := &clawdoll.CLAWDOLLWaitPlayers{} + + if sceneEx, ok := s.ExtraData.(*SceneEx); ok { + for _, playerEx := range sceneEx.players { + // 玩家信息 + if playerEx.SnId != sceneEx.playingSnid { + pd := &clawdoll.CLAWDOLLPlayerDigestInfo{ + SnId: proto.Int32(playerEx.SnId), + Head: proto.Int32(playerEx.Head), + HeadUrl: proto.String(playerEx.HeadUrl), + Name: proto.String(playerEx.Name), + } + + pack.WaitPlayersInfo = append(pack.WaitPlayersInfo, pd) + } + } + + s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_WAITPLAYERS), pack, 0) + } +} + +// 广播房间正在控制娃娃机的玩家信息 +func ClawdollBroadcastPlayingInfo(s *base.Scene) { + if sceneEx, ok := s.ExtraData.(*SceneEx); ok { + + if !sceneEx.IsHasPlaying() { + pack := &clawdoll.CLAWDOLLPlayerDigestInfo{ + SnId: proto.Int32(0), + Head: proto.Int32(0), + } + + s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYINGINFO), pack, 0) + return + } + + playerEx := sceneEx.GetPlayingEx() + if playerEx != nil && playerEx.SnId == sceneEx.playingSnid { + pack := &clawdoll.CLAWDOLLPlayerDigestInfo{ + SnId: proto.Int32(playerEx.SnId), + Head: proto.Int32(playerEx.Head), + HeadUrl: proto.String(playerEx.HeadUrl), + Name: proto.String(playerEx.Name), + } + + s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYINGINFO), pack, 0) + //playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYERINFO), pack) + } + } } //===================================== @@ -267,14 +397,14 @@ func (this *BaseState) CanChangeTo(s base.SceneState) bool { func (this *BaseState) CanChangeCoinScene(s *base.Scene, p *base.Player) bool { - //playerEx, ok := p.ExtraData.(*PlayerEx) - //if !ok { - // return false - //} - // - //if !playerEx.CanLeaveScene(s.GetSceneState().GetState()) { - // return false - //} + playerEx, ok := p.ExtraData.(*PlayerEx) + if !ok { + return false + } + + if !playerEx.CanLeaveScene(s.GetSceneState().GetState()) { + return false + } return true } @@ -288,6 +418,7 @@ func (this *BaseState) OnEnter(s *base.Scene) { func (this *BaseState) OnLeave(s *base.Scene) {} func (this *BaseState) OnTick(s *base.Scene) { + } func (this *BaseState) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool { @@ -318,23 +449,19 @@ func (this *StateWait) CanChangeTo(s base.SceneState) bool { } func (this *StateWait) GetTimeout(s *base.Scene) int { - return this.BaseState.GetTimeout(s) } func (this *StateWait) OnEnter(s *base.Scene) { this.BaseState.OnEnter(s) - if sceneEx, ok := s.ExtraData.(*SceneEx); ok { + if _, ok := s.ExtraData.(*SceneEx); ok { if s.Gaming { s.NotifySceneRoundPause() } s.Gaming = false - ClawdollBroadcastRoomState(s, float32(0), float32(0)) - - if sceneEx.CanStart() { - s.ChangeSceneState(rule.ClawDollSceneStateStart) - } + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) } } @@ -361,13 +488,51 @@ func (this *StateWait) OnTick(s *base.Scene) { sceneEx.SceneDestroy(true) return } - if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneWaitTimeout { - //切换到准备开局状态 - if sceneEx.CanStart() { - s.ChangeSceneState(rule.ClawDollSceneStateStart) - } + } +} + +func (this *StateWait) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool { + if this.BaseState.OnPlayerOp(s, p, opcode, params) { + return true + } + + sceneEx, ok := s.ExtraData.(*SceneEx) + if !ok { + return false + } + playerEx, ok := p.ExtraData.(*PlayerEx) + if !ok { + return false + } + + switch opcode { + case rule.ClawDollPlayerOpPayCoin: + if sceneEx.IsHasPlaying() { + return false + } + + if !playerEx.CanPayCoin() { + return false + } + + // 1-前 2-后 3-左 4-右 5-投币 + sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonPayCoin) + + if sceneEx.CanStart() { + sceneEx.playingSnid = playerEx.SnId + s.ChangeSceneState(rule.ClawDollSceneStateStart) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart)) + + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) + + ClawdollBroadcastPlayingInfo(s) + + sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params) } } + + return false } //===================================== @@ -386,6 +551,8 @@ func (this *StateStart) CanChangeTo(s base.SceneState) bool { switch s.GetState() { case rule.ClawDollSceneStatePlayGame: return true + case rule.ClawDollSceneStateWait: + return true } return false } @@ -393,11 +560,12 @@ func (this *StateStart) CanChangeTo(s base.SceneState) bool { func (this *StateStart) OnEnter(s *base.Scene) { this.BaseState.OnEnter(s) if sceneEx, ok := s.ExtraData.(*SceneEx); ok { - ClawdollBroadcastRoomState(s, float32(0), float32(0)) + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) + s.Gaming = false sceneEx.GameNowTime = time.Now() sceneEx.NumOfGames++ - } } @@ -406,32 +574,24 @@ func (this *StateStart) OnTick(s *base.Scene) { if sceneEx, ok := s.ExtraData.(*SceneEx); ok { if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneStartTimeout { //切换到等待操作状态 - if sceneEx.CanStart() { - s.ChangeSceneState(rule.ClawDollSceneStatePlayGame) - } else { - s.ChangeSceneState(rule.ClawDollSceneStateWait) - } + s.ChangeSceneState(rule.ClawDollSceneStatePlayGame) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStatePlayGame)) + + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) } } } func (this *StateStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool { - if this.BaseState.OnPlayerOp(s, p, opcode, params) { - return true - } - return false } func (this *StateStart) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) { logger.Logger.Trace("(this *StateStart) OnPlayerEvent, sceneId=", s.GetSceneId(), " player=", p.SnId, " evtcode=", evtcode) this.BaseState.OnPlayerEvent(s, p, evtcode, params) - if sceneEx, ok := s.ExtraData.(*SceneEx); ok { + if _, ok := s.ExtraData.(*SceneEx); ok { switch evtcode { - case base.PlayerEventLeave: - if !sceneEx.CanStart() { - s.ChangeSceneState(rule.ClawDollSceneStateWait) - } case base.PlayerEventEnter: if !p.IsReady() { p.MarkFlag(base.PlayerState_Ready) @@ -467,7 +627,8 @@ func (this *PlayGame) OnEnter(s *base.Scene) { s.Gaming = true - ClawdollBroadcastRoomState(s, float32(0), float32(0)) + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) } @@ -479,11 +640,65 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para return true } + sceneEx, ok := s.ExtraData.(*SceneEx) + if !ok { + return false + } + playerEx, ok := p.ExtraData.(*PlayerEx) + if !ok { + return false + } + + switch opcode { + case rule.ClawDollPlayerOpGo: + + if !sceneEx.CheckGrapOp(playerEx) { + return false + } + + if !playerEx.CanGrab() { + return false + } + + grapType := sceneEx.GetPlayGrabType(playerEx) + + logger.Logger.Trace("StatePlayGame OnPlayerOp-----SnId:", p.SnId, " grapType: ", grapType) + //1-弱力抓 2 -强力抓 + sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), grapType) + + case rule.ClawDollPlayerOpMove: + + if !sceneEx.CheckMoveOp(playerEx) { + return false + } + + if !playerEx.CanMove() { + return false + } + + if params[0] < rule.ButtonFront || params[0] > rule.ButtonRight { + logger.Logger.Trace("StatePlayGame OnPlayerOp-----SnId:", p.SnId, " opcode: ", opcode, " params:", params) + return false + } + // 1-前 2-后 3-左 4-右 5-投币 + sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), int32(params[0])) + } + return false } func (this *PlayGame) OnTick(s *base.Scene) { this.BaseState.OnTick(s) + if sceneEx, ok := s.ExtraData.(*SceneEx); ok { + if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollScenePlayTimeout { + + if sceneEx.TimeOutPlayGrab() { + logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId) + } + + return + } + } } //===================================== @@ -500,7 +715,7 @@ func (this *StateBilled) GetState() int { func (this *StateBilled) CanChangeTo(s base.SceneState) bool { switch s.GetState() { - case rule.ClawDollSceneStateStart: + case rule.ClawDollSceneWaitPayCoin: return true } return false @@ -513,6 +728,26 @@ func (this *StateBilled) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, p func (this *StateBilled) OnEnter(s *base.Scene) { logger.Logger.Trace("(this *StateBilled) OnEnter, sceneid=", s.GetSceneId()) this.BaseState.OnEnter(s) + + sceneEx, ok := s.ExtraData.(*SceneEx) + if !ok { + return + } + + playerEx := sceneEx.GetPlayingEx() + if playerEx != nil { + pack := &clawdoll.SCCLAWDOLLRoundGameBilled{ + RoundId: proto.Int32(int32(sceneEx.RoundId)), + ClowResult: proto.Int32(0), + Award: proto.Int64(playerEx.gainCoin), + Balance: proto.Int64(playerEx.Coin), + } + + // logger.Logger.Trace("SCSmallRocketRoundGameBilled is pack: ", pack) + proto.SetDefaults(pack) + + playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_GAMEBILLED), pack) + } } func (this *StateBilled) OnLeave(s *base.Scene) { @@ -532,11 +767,138 @@ func (this *StateBilled) OnTick(s *base.Scene) { this.BaseState.OnTick(s) if sceneEx, ok := s.ExtraData.(*SceneEx); ok { if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneBilledTimeout { - if sceneEx.CanStart() { - s.ChangeSceneState(rule.ClawDollSceneStateStart) - } else { - s.ChangeSceneState(rule.ClawDollSceneStateWait) + + s.ChangeSceneState(rule.ClawDollSceneWaitPayCoin) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneWaitPayCoin)) + + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) + + return + } + } +} + +//===================================== +// StateWaitPayCoin 等待下一局投币 +//===================================== + +type StateWaitPayCoin struct { + BaseState +} + +func (this *StateWaitPayCoin) GetState() int { + return rule.ClawDollSceneWaitPayCoin +} + +func (this *StateWaitPayCoin) CanChangeTo(s base.SceneState) bool { + switch s.GetState() { + case rule.ClawDollSceneStateStart: + return true + case rule.ClawDollSceneStateWait: + return true + } + return false +} + +func (this *StateWaitPayCoin) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool { + logger.Logger.Trace("StatePlayGame OnPlayerOp-----SnId:", p.SnId, " opcode: ", opcode, " params:", params) + + if this.BaseState.OnPlayerOp(s, p, opcode, params) { + return true + } + + sceneEx, ok := s.ExtraData.(*SceneEx) + if !ok { + return false + } + playerEx, ok := p.ExtraData.(*PlayerEx) + if !ok { + return false + } + + switch opcode { + case rule.ClawDollPlayerOpPayCoin: + + if sceneEx.playingSnid != playerEx.SnId { + logger.Logger.Trace("StateWaitPayCoin OnPlayerOp-----sceneEx.playingSnid:", sceneEx.playingSnid, " playerEx.SnId: ", playerEx.SnId) + return false + } + + // 投币检测 + if !playerEx.CanPayCoin() { + logger.Logger.Trace("StateWaitPayCoin OnPlayerOp-----CanPayCoin: false") + return false + } + + sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonPayCoin) + + playerEx.ReStartGame() + + s.ChangeSceneState(rule.ClawDollSceneStateStart) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart)) + + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) + + sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params) + + case rule.ClawDollPlayerCancelPayCoin: + if sceneEx.playingSnid != playerEx.SnId { + logger.Logger.Trace("StateWaitPayCoin OnPlayerOp-----sceneEx.playingSnid:", sceneEx.playingSnid, " playerEx.SnId: ", playerEx.SnId) + return false + } + + // 先设置时间 + playingEx := sceneEx.GetPlayingEx() + if playingEx != nil { + playingEx.ReStartGame() + ClawdollSendPlayerInfo(s) + } + + // 再重置scene数据 + sceneEx.ReStartGame() + + s.ChangeSceneState(rule.ClawDollSceneStateWait) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateWait)) + + ClawdollBroadcastRoomState(s) + ClawdollBroadcastPlayingInfo(s) + } + + return false +} + +func (this *StateWaitPayCoin) OnEnter(s *base.Scene) { + logger.Logger.Trace("(this *StateWaitPayCoin) OnEnter, sceneid=", s.GetSceneId()) + this.BaseState.OnEnter(s) +} + +func (this *StateWaitPayCoin) OnLeave(s *base.Scene) { + logger.Logger.Trace("(this *StateWaitPayCoin) OnLeave, sceneid=", s.GetSceneId()) + this.BaseState.OnLeave(s) +} + +func (this *StateWaitPayCoin) OnTick(s *base.Scene) { + this.BaseState.OnTick(s) + if sceneEx, ok := s.ExtraData.(*SceneEx); ok { + if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneWaitPayCoinimeout { + + // 先设置时间 + playingEx := sceneEx.GetPlayingEx() + if playingEx != nil { + playingEx.ReStartGame() + ClawdollSendPlayerInfo(s) } + + // 再重置scene数据 + sceneEx.ReStartGame() + + s.ChangeSceneState(rule.ClawDollSceneStateWait) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateWait)) + + ClawdollBroadcastRoomState(s) + ClawdollBroadcastPlayingInfo(s) return } } @@ -567,6 +929,7 @@ func init() { PolicyClawdollSingleton.RegisteSceneState(&StateStart{}) PolicyClawdollSingleton.RegisteSceneState(&PlayGame{}) PolicyClawdollSingleton.RegisteSceneState(&StateBilled{}) + PolicyClawdollSingleton.RegisteSceneState(&StateWaitPayCoin{}) core.RegisteHook(core.HOOK_BEFORE_START, func() error { base.RegisteScenePolicy(common.GameId_Clawdoll, 0, PolicyClawdollSingleton) diff --git a/gamesrv/main.go b/gamesrv/main.go index 78d6f35..391ee70 100644 --- a/gamesrv/main.go +++ b/gamesrv/main.go @@ -19,6 +19,7 @@ import ( // game _ "mongo.games.com/game/gamesrv/chess" + _ "mongo.games.com/game/gamesrv/clawdoll" _ "mongo.games.com/game/gamesrv/fishing" _ "mongo.games.com/game/gamesrv/smallrocket" _ "mongo.games.com/game/gamesrv/thirteen" diff --git a/gamesrv/tienlen/scenedata_tienlen.go b/gamesrv/tienlen/scenedata_tienlen.go index f5c8548..e581d75 100644 --- a/gamesrv/tienlen/scenedata_tienlen.go +++ b/gamesrv/tienlen/scenedata_tienlen.go @@ -2114,6 +2114,7 @@ func (this *TienLenSceneData) SaveCustomLog() { state = 1 } log := &model.CustomLog{ + Platform: this.Platform, CycleId: this.CycleID, RoomConfigId: this.GetCustom().GetRoomConfigId(), RoomId: this.SceneId, diff --git a/gamesrv/tienlen/scenepolicy_tienlen.go b/gamesrv/tienlen/scenepolicy_tienlen.go index 5e654e1..46bf98c 100644 --- a/gamesrv/tienlen/scenepolicy_tienlen.go +++ b/gamesrv/tienlen/scenepolicy_tienlen.go @@ -825,7 +825,7 @@ func (this *SceneWaitStartStateTienLen) OnEnter(s *base.Scene) { if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok { sceneEx.Clear() sceneEx.SetGaming(false) - this.BroadcastRoomState(s, this.GetState()) + this.BroadcastRoomState(s, this.GetState(), int64(sceneEx.NumOfGames)) logger.Logger.Trace("(this *SceneWaitStartStateTienLen) OnEnter", this.GetState()) } } @@ -914,10 +914,12 @@ func (this *SceneWaitStartStateTienLen) OnTick(s *base.Scene) { } } if sceneEx.IsCustom() { - if sceneEx.CanStart() { - s.ChangeSceneState(rule.TienLenSceneStateHandCard) - } else { - s.ChangeSceneState(rule.TienLenSceneStateWaitPlayer) + if time.Now().Sub(sceneEx.StateStartTime) > rule.TienLenCustomWaiteStatTimeout { + if sceneEx.CanStart() { + s.ChangeSceneState(rule.TienLenSceneStateHandCard) + } else { + s.ChangeSceneState(rule.TienLenSceneStateWaitPlayer) + } } } } @@ -2608,7 +2610,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) { if p != nil { var items []*model.Item for _, v := range packBilled.List[0].Award { - itemData := srvdata.GameItemMgr.Get(p.Platform, p.SnId) + itemData := srvdata.GameItemMgr.Get(p.Platform, v.GetId()) if itemData != nil { items = append(items, &model.Item{ ItemId: v.GetId(), @@ -2763,7 +2765,10 @@ func (this *SceneBilledStateTienLen) OnLeave(s *base.Scene) { continue } player_data.Clear() - if sceneEx.IsMatchScene() { + if sceneEx.IsCustom() { + player_data.UnmarkFlag(base.PlayerState_WaitNext) + } + if sceneEx.IsMatchScene() || sceneEx.IsCustom() { continue } if !player_data.IsOnLine() { diff --git a/machine/action/action_server.go b/machine/action/action_server.go index 36963fe..6138a53 100644 --- a/machine/action/action_server.go +++ b/machine/action/action_server.go @@ -1,105 +1,315 @@ package action import ( + "bytes" "fmt" + "github.com/zegoim/zego_server_assistant/token/go/src/token04" + "math" "mongo.games.com/game/machine/machinedoll" "mongo.games.com/game/protocol/machine" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" + "mongo.games.com/goserver/core/timer" + "sync" "time" ) +type ConnMessageQueue struct { + queue chan []interface{} + conn *machinedoll.Conn + waitGroup *sync.WaitGroup +} + +var connMessageQueues = make(map[*machinedoll.Conn]*ConnMessageQueue) + +func Process(conn *machinedoll.Conn, f1 []func(), f2 []func()) { + // 获取或创建该 conn 对应的消息队列 + queue, ok := connMessageQueues[conn] + if !ok { + queue = &ConnMessageQueue{ + queue: make(chan []interface{}, 100), + conn: conn, + waitGroup: new(sync.WaitGroup), + } + connMessageQueues[conn] = queue + go processConnMessageQueue(queue) + } + + // 将消息添加到队列中 + queue.queue <- []interface{}{f1, f2} +} + +func processConnMessageQueue(queue *ConnMessageQueue) { + for msg := range queue.queue { + f1 := msg[0].([]func()) + f2 := msg[1].([]func()) + + queue.waitGroup.Add(len(f1)) + for _, f := range f1 { + go func(f func()) { + defer queue.waitGroup.Done() + f() + }(f) + } + queue.waitGroup.Wait() + + if len(f2) > 0 { + queue.waitGroup.Add(1) + go func() { + defer queue.waitGroup.Done() + timer.AfterTimer(func(h timer.TimerHandle, ud interface{}) bool { + for _, f := range f2 { + f() + } + return true + }, nil, 200*time.Millisecond) + }() + } + } +} + // 移动 func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data interface{}) error { + logger.Logger.Tracef("SMDollMachinePerateHandler %v", data) msg, ok := data.(*machine.SMDollMachineoPerate) if !ok { return nil } - conn := machinedoll.ConnMap[int(msg.Id)] - if conn == nil { + + conn, ok := machinedoll.MachineMgr.ConnMap[int(msg.GetId())] + if !ok || conn == nil { return nil } - if msg.Perate == 1 { + + switch msg.Perate { + case 1: //向前移动 - machinedoll.Backward(conn) - time.Sleep(200 * time.Millisecond) - machinedoll.BackwardStop(conn) - } else if msg.Perate == 2 { + f1 := []func(){ + func() { machinedoll.Backward(conn) }, + } + f2 := []func(){ + func() { machinedoll.BackwardStop(conn) }, + } + Process(conn, f1, f2) + case 2: //向后移动 - machinedoll.Forward(conn) - time.Sleep(200 * time.Millisecond) - machinedoll.ForwardStop(conn) - } else if msg.Perate == 3 { + f1 := []func(){ + func() { machinedoll.Forward(conn) }, + } + f2 := []func(){ + func() { machinedoll.ForwardStop(conn) }, + } + Process(conn, f1, f2) + case 3: //向左移动 - machinedoll.Left(conn) - time.Sleep(200 * time.Millisecond) - machinedoll.LeftStop(conn) - } else if msg.Perate == 4 { + f1 := []func(){ + func() { machinedoll.Left(conn) }, + } + f2 := []func(){ + func() { machinedoll.LeftStop(conn) }, + } + Process(conn, f1, f2) + case 4: //向右移动 - machinedoll.Right(conn) - time.Sleep(200 * time.Millisecond) - machinedoll.RightStop(conn) - } else if msg.Perate == 5 { + f1 := []func(){ + func() { machinedoll.Right(conn) }, + } + f2 := []func(){ + func() { machinedoll.RightStop(conn) }, + } + Process(conn, f1, f2) + case 5: //投币 - machinedoll.Coin(conn) - machinedoll.Backward(conn) - time.Sleep(200 * time.Millisecond) - machinedoll.BackwardStop(conn) + f1 := []func(){ + func() { machinedoll.Coin(conn) }, + } + f2 := []func(){ + func() {}, + } + Process(conn, f1, f2) + go DollMachineGrabResult(session, conn, msg.Snid, msg.GetId()) } return nil } // 下抓 func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interface{}) error { + logger.Logger.Tracef("SMDollMachineGrabHandler %v", data) msg, ok := data.(*machine.SMDollMachineGrab) if !ok { return nil } - conn := machinedoll.ConnMap[int(msg.Id)] - if conn == nil { + + conn, ok := machinedoll.MachineMgr.ConnMap[int(msg.GetId())] + if !ok || conn == nil { return nil } - typeId := msg.TypeId - if typeId == 1 { + + switch msg.GetTypeId() { + case 1: //弱抓 - machinedoll.WeakGrab(conn) - } else if typeId == 2 { + f1 := []func(){ + func() { machinedoll.WeakGrab(conn) }, + } + f2 := []func(){} + Process(conn, f1, f2) + case 2: //强力抓 - machinedoll.Grab(conn) - } else if typeId == 3 { - //必中抓 - machinedoll.SetPower(conn) - time.Sleep(200 * time.Millisecond) - machinedoll.Grab(conn) + f1 := []func(){ + func() { machinedoll.Grab(conn) }, + } + f2 := []func(){} + Process(conn, f1, f2) } - //返回消息 - session.Send(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), &machine.MSDollMachineGrab{ - Snid: msg.Snid, - Id: msg.GetId(), - Result: 1, - }) return nil } +// 监听抓取结果返回 +func DollMachineGrabResult(session *netlib.Session, conn *machinedoll.Conn, snid, id int32) { + num := int64(1) + for { + // 读取数据 + logger.Logger.Trace("监听抓取结果返回!") + buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + logger.Logger.Error("Failed to read response from client:", err) + return + } + // 将读取到的数据按照 221 进行分割 + parts := bytes.Split(buf[:n], []byte{221}) + fmt.Println("获取到的返回值:", parts) + instruction := []byte{0xAA, 0x05, 0x02, 0x50, 0x09, 0x00} + instruction1 := []byte{0xAA, 0x05, 0x02, 0x50, 0x09, 0x01} + // 遍历分割结果,打印出每个部分 + for i, part := range parts { + if len(part) > 0 { + part = part[:len(part)-1] // 去除最后一个字节,该字节为分隔符 + //fmt.Println("比较返回结果 part = ", part) + if bytes.Contains(part, instruction) && num != 1 { + fmt.Printf("Part %d: %s\n", i+1, part) + //回应数据 + _, err = conn.Write([]byte{0xAA, 0x04, 0x01, 0x50, 0x09, 0x5c, 0xdd}) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } + session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{ + Snid: snid, + Id: id, + Result: 0, + TypeId: 2, + }) + logger.Logger.Trace("没有抓到礼品!!!!!!!!snid = ", snid, "num = ", num) + return + } + if bytes.Contains(part, instruction1) && num != 1 { + fmt.Printf("Part %d: %s\n", i+1, part) + //回应数据 + _, err = conn.Write([]byte{0xAA, 0x04, 0x01, 0x50, 0x09, 0x5c, 0xdd}) + if err != nil { + logger.Logger.Error("Failed to read response from server:", err) + return + } + session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{ + Snid: snid, + Id: id, + Result: 1, + TypeId: 2, + }) + logger.Logger.Trace("抓到礼品了!!!!!!!!snid = ", snid, "num = ", num) + return + } + //上分成功 + coinData := []byte{0xAA, 0x04, 0x02, 0x03, 0x01} + if bytes.Contains(part, coinData) { + //返回消息 + session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{ + Snid: snid, + Id: id, + Result: 1, + TypeId: 1, + }) + } + //上分失败 + coinData = []byte{0xAA, 0x04, 0x02, 0x03, 0x00} + if bytes.Contains(part, coinData) { + //返回消息 + session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{ + Snid: snid, + Id: id, + Result: 0, + TypeId: 1, + }) + } + } + } + num++ + if num >= math.MaxInt64 { + num = 2 + } + } +} + // 与游戏服务器连接成功,向游戏服务器推送所有娃娃机连接 func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interface{}) error { - logger.Logger.Trace("与游戏服务器连接成功!!\n") - fmt.Printf("与游戏服务器连接成功!!\n") + logger.Logger.Trace("与游戏服务器连接成功") //开始向游戏服务器发送娃娃机连接信息 msg := &machine.MSDollMachineList{} - for i, _ := range machinedoll.ConnMap { + for i, _ := range machinedoll.MachineMgr.ConnMap { info := &machine.DollMachine{} info.Id = int32(i) - info.VideoAddr = "www.baidu.com" msg.Data = append(msg.Data, info) } session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg) - fmt.Printf("开始向游戏服务器发送娃娃机连接信息!\n", msg) + logger.Logger.Tracef("向游戏服务器发送娃娃机连接信息:%v", msg) return nil } + +// 获取进入视频房间token +func SMGetTokenHandler(session *netlib.Session, packetId int, data interface{}) error { + logger.Logger.Tracef("SMGetTokenHandler %v", data) + msg, ok := data.(*machine.SMGetToken) + if !ok { + return nil + } + // 请将 appId 修改为你的 appId,appid 为数字,从即构控制台获取 + // 举例:1234567890 + var appId uint32 = uint32(msg.GetAppId()) + + // 请修改为你的 serverSecret,serverSecret 为字符串,从即构控制台获取 + // 举例: "fa94dd0f974cf2e293728a526b028271" + serverSecret := msg.ServerSecret + + // 请将 userId 修改为用户的 user_id + userId := msg.GetSnid() + + // token 的有效时长,单位:秒 + var effectiveTimeInSeconds int64 = 3600 + // token业务认证扩展,基础鉴权token此处填空字符串 + var payload string = "" + + //生成token + token, err := token04.GenerateToken04(appId, string(userId), serverSecret, effectiveTimeInSeconds, payload) + if err != nil { + logger.Logger.Error(err) + return err + } + logger.Logger.Trace(token) + info := &machine.MSSendToken{} + info.Snid = msg.Snid + info.Token = token + info.Appid = msg.AppId + + session.Send(int(machine.DollMachinePacketID_PACKET_MSSendToken), info) + logger.Logger.Tracef("向游戏服务器发送娃娃机token:%v", info) + return nil +} + func init() { netlib.Register(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), &machine.SMDollMachineoPerate{}, SMDollMachinePerateHandler) netlib.Register(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), &machine.SMDollMachineGrab{}, SMDollMachineGrabHandler) //链接成功 返回消息 netlib.Register(int(machine.DollMachinePacketID_PACKET_SMGameLinkSucceed), &machine.SMGameLinkSucceed{}, SMGameLinkSucceedHandler) + netlib.Register(int(machine.DollMachinePacketID_PACKET_SMGetToken), &machine.SMGetToken{}, SMGetTokenHandler) } diff --git a/machine/machinedoll/command.go b/machine/machinedoll/command.go index ea8b82b..5ed8a95 100644 --- a/machine/machinedoll/command.go +++ b/machine/machinedoll/command.go @@ -8,7 +8,7 @@ import ( // 向前aa 05 01 50 01 01 54 dd func Forward(conn net.Conn) { instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x01, 0x01} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -19,7 +19,7 @@ func Forward(conn net.Conn) { // 向前停止aa 05 01 50 01 00 55 dd func ForwardStop(conn net.Conn) { instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x01, 0x00} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -31,7 +31,7 @@ func ForwardStop(conn net.Conn) { // aa 05 01 50 02 01 57 dd func Backward(conn net.Conn) { instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x02, 0x01} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -42,7 +42,7 @@ func Backward(conn net.Conn) { // 向后停止aa 05 01 50 02 00 56 dd func BackwardStop(conn net.Conn) { instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x02, 0x00} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -53,7 +53,7 @@ func BackwardStop(conn net.Conn) { // 向左aa 05 01 50 03 01 56 dd func Left(conn net.Conn) { instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x03, 0x01} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -64,7 +64,7 @@ func Left(conn net.Conn) { // 向左停止aa 05 01 50 03 00 57 dd func LeftStop(conn net.Conn) { instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x03, 0x00} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -75,7 +75,7 @@ func LeftStop(conn net.Conn) { // 向右 func Right(conn net.Conn) { instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x04, 0x01} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -86,7 +86,7 @@ func Right(conn net.Conn) { // 向右停止aa 05 01 50 04 00 50 dd func RightStop(conn net.Conn) { instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x04, 0x00} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -97,7 +97,34 @@ func RightStop(conn net.Conn) { // 强抓下抓 func Grab(conn net.Conn) { instruction := []byte{0xAA, 0x05, 0x01, 0x50, 0x06, 0x01} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } + /* + // 读取服务端的响应 + buf := make([]byte, 1024) + _, err = conn.Read(buf) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } + instruction = []byte{0xAA, 0x04, 0x01, 0x50, 0x09, 0x5c, 0xdd} + _, err = conn.Write(instruction) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + }*/ +} + +// 必中抓 +func Grab2(conn net.Conn) { + //设置电压 + + instruction := []byte{0xAA, 0x05, 0x01, 0x50, 0x06, 0x01} + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -115,7 +142,7 @@ func Grab(conn net.Conn) { // 弱抓aa 05 01 50 06 00 52 dd func WeakGrab(conn net.Conn) { instruction := []byte{0xAA, 0x05, 0x01, 0x50, 0x06, 0x00} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -126,56 +153,56 @@ func WeakGrab(conn net.Conn) { // 投币 func Coin(conn net.Conn) { moveCommand := []byte{0xaa, 0x08, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00} - moveCommand = calculateChecksum(moveCommand) + moveCommand = CalculateChecksum(moveCommand) // 发送指令到服务端 _, err := conn.Write(moveCommand) if err != nil { fmt.Println("Failed to send command to server:", err) return } - // 读取服务端的响应 - buf := make([]byte, 1024) - n, err := conn.Read(buf) - if err != nil { - fmt.Println("Failed to read response from server:", err) - return - } - if buf[4] == 1 { - fmt.Println("上分成功!!!!n = ", n) - } - if buf[4] == 0 { - fmt.Println("上分失败!!!") - } + /* // 读取服务端的响应 + buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } + if buf[4] == 1 { + fmt.Println("上分成功!!!!n = ", n) + } + if buf[4] == 0 { + fmt.Println("上分失败!!!") + }*/ } // 剩余局数清零 func ClearRemainingGames(conn net.Conn) { instruction := []byte{0xAA, 0x03, 0x01, 0x32} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) return } - // 读取服务端的响应 - buf := make([]byte, 1024) - n, err := conn.Read(buf) - if err != nil { - fmt.Println("Failed to read response from server:", err) - return - } - fmt.Println("n", n) + /* // 读取服务端的响应 + buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } + fmt.Println("n", n)*/ } // 计算校验码 -func calculateChecksum(data []byte) []byte { +func CalculateChecksum(data []byte) []byte { var value = byte(0) for i, datum := range data { if i > 0 { value ^= datum } } - fmt.Println("校验码 value = ", value) + //fmt.Println("校验码 value = ", value) data = append(data, value, 0xdd) return data @@ -186,20 +213,21 @@ func OpenMusic(conn net.Conn) { data[43] = 0x01 instruction := []byte{0xAA, 0x33, 0x01, 0x06} instruction = append(instruction, data...) - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) + //instruction[1] = byte(len(instruction) - 3) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) return } // 读取服务端的响应 - buf := make([]byte, 1024) - n, err := conn.Read(buf) - if err != nil { - fmt.Println("Failed to read response from server:", err) - return - } - fmt.Println("n", n) + /* buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } + fmt.Println("n", n)*/ } // 关闭音乐 @@ -207,64 +235,64 @@ func CloseMusic(conn net.Conn) { data[43] = 0x00 instruction := []byte{0xAA, 0x33, 0x01, 0x06} instruction = append(instruction, data...) - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) return } - // 读取服务端的响应 - buf := make([]byte, 1024) - n, err := conn.Read(buf) - if err != nil { - fmt.Println("Failed to read response from server:", err) - return - } - fmt.Println("n", n) + /* // 读取服务端的响应 + buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } + fmt.Println("n", n)*/ } // 恢复出厂设置 func RestoreFactorySettings(conn net.Conn) { instruction := []byte{0xAA, 0x03, 0x01, 0x38} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) return } - // 读取服务端的响应 - buf := make([]byte, 1024) - n, err := conn.Read(buf) - if err != nil { - fmt.Println("Failed to read response from server:", err) - return - } - fmt.Println("n", n) + /* // 读取服务端的响应 + buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } + fmt.Println("n", n)*/ } // 重启主板 func Reboot(conn net.Conn) { instruction := []byte{0xAA, 0x03, 0x01, 0x39} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) return } - // 读取服务端的响应 - buf := make([]byte, 1024) - n, err := conn.Read(buf) - if err != nil { - fmt.Println("Failed to read response from server:", err) - return - } - fmt.Println("n", n) + /* // 读取服务端的响应 + buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } + fmt.Println("n", n)*/ } // 暂停服务 func StopServer(conn net.Conn) { instruction := []byte{0xAA, 0x03, 0x01, 0x37} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -275,7 +303,7 @@ func StopServer(conn net.Conn) { // 开启服务 func StartServer(conn net.Conn) { instruction := []byte{0xAA, 0x03, 0x01, 0x36} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -286,34 +314,50 @@ func StartServer(conn net.Conn) { // 查询基础参数 func queryBaseParam(conn net.Conn) { instruction := []byte{0xAA, 0x03, 0x01, 0x05} - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) return } - // 读取服务端的响应 - buf := make([]byte, 1024) - n, err := conn.Read(buf) - if err != nil { - fmt.Println("Failed to read response from server:", err) - return - } + /* // 读取服务端的响应 + buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } - fmt.Println("n", n) + fmt.Println("n", n)*/ } -// 设置强力 +// 设置出奖模式 func SetPower(conn net.Conn) { - data[3] = 0x00 - data[16] = 0x01 - data[17] = 0xE0 - data[18] = 0x13 - data[19] = 0x88 + data[3] = 0x01 fmt.Println("data.len = ", len(data)) instruction := []byte{0xAA, 0x33, 0x01, 0x06} instruction = append(instruction, data...) - instruction = calculateChecksum(instruction) + instruction = CalculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } + /* // 读取服务端的响应 + buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } + fmt.Println("n", n)*/ +} + +// 基础设置 +func SetBaseParam(conn net.Conn) { + instruction := []byte{0xAA, 0x33, 0x01, 0x06} + instruction = append(instruction, data...) + instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) if err != nil { fmt.Println("Failed to send command to server:", err) @@ -327,55 +371,64 @@ func SetPower(conn net.Conn) { return } fmt.Println("n", n) + if buf[4] == 1 { + fmt.Println("设置成功!") + } else { + fmt.Println("设置失败!") + } } var data = []byte{ - 0x65, - 0x00, - 0x0F, - 0x02, - 0x0F, - 0x00, - 0x01, - 0x00, - 0x00, - 0x01, - 0xC8, - 0x00, - 0x7C, - 0x01, - 0x5A, - 0x00, - 0xE0, - 0x01, - 0xC8, - 0x00, - 0x14, - 0x32, - 0x32, - 0x50, - 0x34, - 0x08, - 0x00, - 0x00, - 0x00, - 0x00, - 0x78, - 0x00, - 0x32, - 0x02, - 0x00, - 0x00, - 0xC8, - 0x00, - 0x96, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x0F, - 0x07, - 0x08, - 0x00, + 0x65, //0 几币几玩 + 0x00, //1 几币几玩占用位 + 0x2D, //2 游戏时间 + 0x00, //3 出奖模式0 无概率 1 随机模式 2 固定模式 3 冠兴模式 + 0x0F, //4 出奖概率 + 0x00, //5 出奖概率占用位 + 0x00, //6 空中抓物 0关闭 1开启 + 0x00, //7 连续投币赠送 范围0~100 + 0x00, //8 保夹次数 范围0~6, 6为无限次 + 0x01, //9 保夹赠送模式 0送游戏 1送中奖 2送游戏和中奖 + + 0x80, //10 强抓力电压 + 0x01, //11 强抓力电压占用位 + 0x80, //12 中抓力电压 + 0x01, //13 中抓力电压占用位 + 0x78, //14 弱抓力电压 + 0x00, //15 弱抓力电压占用位 + 0xE0, //16 中奖电压 + 0x01, //17 中奖电压占用位 + 0xC8, //18 强抓力时间 + 0x00, //19 强抓力时间占用位 + + 0x14, //20 放抓时间 + 0x32, //21 前后速度 + 0x32, //22 左右速度 + 0x50, //23 上下速度 + 0x9A, //24 放线长度 + 0x06, //25 放线长度占用位 + 0x00, //26 礼品下放高度 + 0x00, //27 礼品下放高度占用位 + 0x14, //28 甩抓长度 + 0x00, //29 甩抓保护 + + 0x78, //30 甩抓电压 + 0x00, //31 甩抓电压占用位 + 0x32, //32 上拉保护 + 0x02, //33 天车自救时间 + 0x00, //34 下抓延时 + 0x00, //35 下抓延时占用位 + 0xC8, //36 抓物延时 + 0x00, //37 抓物延时占用位 + 0x96, //38 上停延时 + 0x00, //39 上停延时占用位 + + 0x00, //40 摇杆延时 + 0x00, //41 摇杆延时占用位 + 0x00, //42 抓物二收 + 0x00, //43 待机音乐开关 + 0x00, //44 音量大小调整 + 0x07, //45 待机音乐选择 + 0x08, //46 游戏音乐选择 + 0x00, //47 概率队列自动 } diff --git a/machine/machinedoll/machinemgr.go b/machine/machinedoll/machinemgr.go index eaece9c..3fc997e 100644 --- a/machine/machinedoll/machinemgr.go +++ b/machine/machinedoll/machinemgr.go @@ -3,47 +3,54 @@ package machinedoll import ( "encoding/json" "fmt" - "mongo.games.com/goserver/core/timer" - "os/signal" - "syscall" - - "mongo.games.com/game/protocol/machine" - "mongo.games.com/goserver/core/logger" - "mongo.games.com/goserver/core/netlib" - "mongo.games.com/goserver/srvlib" "net" "os" + "os/signal" "path/filepath" + "syscall" "time" + + "mongo.games.com/goserver/core/basic" + "mongo.games.com/goserver/core/logger" + "mongo.games.com/goserver/core/module" + "mongo.games.com/goserver/core/netlib" + "mongo.games.com/goserver/core/task" + "mongo.games.com/goserver/srvlib" + + "mongo.games.com/game/protocol/machine" ) var GameConn *netlib.Session -var ConnMap = make(map[int]net.Conn) - -type MachineManager struct { - DelConnMap map[int]string -} var MachineMgr = &MachineManager{ + ConnMap: map[int]*Conn{}, DelConnMap: make(map[int]string), } +type Conn struct { + Id int + net.Conn + Addr string +} + +type MachineManager struct { + ConnMap map[int]*Conn + DelConnMap map[int]string +} + func (this *MachineManager) ModuleName() string { return "MachineManager" } -// 心跳间隔时间(秒) -const heartbeatInterval = 1 - func (this *MachineManager) Init() { var serverAddrs []string programDir, err := os.Getwd() if err != nil { - fmt.Println("Error getting working directory:", err) + logger.Logger.Error("Error getting working directory:", err) return } configFile := filepath.Join(programDir, "machineIPConfig.json") - fmt.Println("构建配置文件的路径", configFile) + logger.Logger.Trace("构建配置文件的路径", configFile) fileData, err := os.ReadFile(configFile) if err != nil { logger.Logger.Error("Read robot account file error:", err) @@ -59,82 +66,89 @@ func (this *MachineManager) Init() { for i, addr := range serverAddrs { conn, err := net.DialTimeout("tcp", addr, 5*time.Second) if err != nil { - fmt.Println("Failed to connect to server:", err) + logger.Logger.Error("Failed to connect to server:", err) continue } - ConnMap[i+1] = conn - go this.StartHeartbeat(i+1, &conn, addr) + this.ConnMap[i+1] = &Conn{ + Id: i + 1, + Conn: conn, + Addr: addr, + } + SetBaseParam(conn) + logger.Logger.Trace("设置每台娃娃机基础配置!") + } - fmt.Println("Connected to server:\n", ConnMap[1].RemoteAddr()) - fmt.Println("投币请按Q!!!!") - fmt.Println("w向前s向后a向左d向右 j强力抓取k弱力抓取!") - // 监听 WASD 按键事件 - /* go listenKeyboardEvents(ConnMap[1]) + /* fmt.Println("Connected to server:\n", this.ConnMap[1].RemoteAddr()) + fmt.Println("投币请按Q!!!!") + fmt.Println("w向前s向后a向左d向右 j强力抓取k弱力抓取!") + // 监听 WASD 按键事件 + go listenKeyboardEvents(this.ConnMap[1]) // 监听中断信号,等待用户退出 waitForUserExit()*/ -} -func (this *MachineManager) StartHeartbeat(id int, conn *net.Conn, addr string) { - // 定期发送心跳包 - ticker := time.NewTicker(heartbeatInterval * time.Second) - defer ticker.Stop() - for { - select { - case <-ticker.C: - // 发送心跳包 - _, err := (*conn).Write([]byte("heartbeat")) +} + +func (this *MachineManager) Update() { + var delConn []*Conn + task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { + for _, v := range this.ConnMap { + _, err := v.Write([]byte("heartbeat")) if err != nil { - fmt.Println("Failed to send heartbeat:", err) - delete(ConnMap, id) - this.DelConnMap[id] = addr - //通知游戏服 - this.UpdateToGameServer() - fmt.Println("删除链接!!!!!!addr = ", addr) - go timer.StartTimer(timer.TimerActionWrapper(func(h timer.TimerHandle, ud interface{}) bool { - this.ReConnect() - return true - }), nil, time.Duration(5)*time.Second, 100) - return + delConn = append(delConn, v) + v.Close() + logger.Logger.Tracef("断开连接:%v", v.Addr) + this.UpdateToGameServer(v, 0) } } - } -} - -// 重连 -func (this *MachineManager) ReConnect() bool { - fmt.Println("================重连============") - delIds := []int{} - status := false - for id, addr := range this.DelConnMap { - conn, err := net.DialTimeout("tcp", addr, 5*time.Second) - if err != nil { - continue + return nil + }), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) { + for _, v := range delConn { + delete(this.ConnMap, v.Id) + this.DelConnMap[v.Id] = v.Addr } - ConnMap[id] = conn - delIds = append(delIds, id) - status = true - } - for _, id := range delIds { - delete(this.DelConnMap, id) - fmt.Println("重新链接成功!!!!!!id = ", id) - } - if status { - this.UpdateToGameServer() - return true - } - return false + + // 重连 + var delIds []*Conn + task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { + for id, addr := range this.DelConnMap { + conn, err := net.DialTimeout("tcp", addr, 5*time.Second) + if err != nil { + continue + } + logger.Logger.Tracef("娃娃机重连成功!addr = %v", addr) + delIds = append(delIds, &Conn{ + Id: id, + Conn: conn, + Addr: addr, + }) + } + return nil + }), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) { + for _, v := range delIds { + this.ConnMap[v.Id] = v + delete(this.DelConnMap, v.Id) + this.UpdateToGameServer(v, 1) + } + })).StartByFixExecutor(this.ModuleName()) + })).StartByFixExecutor(this.ModuleName()) } -func (this *MachineManager) UpdateToGameServer() { - msg := &machine.MSDollMachineList{} - for i, _ := range ConnMap { - info := &machine.DollMachine{} - info.Id = int32(i) - info.VideoAddr = "www.baidu.com" - msg.Data = append(msg.Data, info) +func (this *MachineManager) Shutdown() { + for _, v := range this.ConnMap { + v.Close() + this.UpdateToGameServer(v, 0) } - SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg) + + module.UnregisteModule(this) +} + +func (this *MachineManager) UpdateToGameServer(conn *Conn, status int32) { + msg := &machine.MSUpdateDollMachineStatus{} + msg.Id = int32(conn.Id) + msg.Status = status + msg.VideoAddr = conn.Addr + SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSUpdateDollMachineStatus), msg) } func SendToGameServer(pid int, msg interface{}) { @@ -149,7 +163,7 @@ func SendToGameServer(pid int, msg interface{}) { } func init() { - MachineMgr.Init() + module.RegisteModule(MachineMgr, time.Second, 0) } func listenKeyboardEvents(conn net.Conn) { @@ -227,6 +241,8 @@ func listenKeyboardEvents(conn net.Conn) { SetPower(conn) case "8": CloseMusic(conn) + case "9": + queryBaseParam(conn) } } } diff --git a/model/config.go b/model/config.go index bd47bb1..e569e0c 100644 --- a/model/config.go +++ b/model/config.go @@ -34,7 +34,7 @@ const ( type ShopInfo struct { Id int32 // 商品ID - Page int32 // 页面 1,金币页面 2,钻石页面 3,道具页面 + Page int32 // 页面 1,金币页面 2,钻石页面 3,道具页面 4,房卡 Order int32 // 排序 页面内商品的位置排序 Location []int32 // 显示位置 第1位,竖版大厅 第2位,Tienlen1级选场 第3位,捕鱼1级选场 Picture string // 图片id @@ -44,7 +44,7 @@ type ShopInfo struct { AdTime int32 // 观看几次广告 RepeatTimes int32 // 领取次数 CoolingTime []int32 // 观看冷却时间 - Type int32 // 获得类型 1,金币 2,钻石 3,道具类型 + Type int32 // 获得类型 1,金币 2,钻石 3,道具类型 4,房卡 Amount int64 // 获得数量 AddArea []int32 // 加送百分比(比如加送10%,就配置110) ItemId int32 // 获得道具ID @@ -139,6 +139,8 @@ type AllConfig struct { *webapi.AwardLogConfig // 新手引导配置 *webapi.GuideConfig + //娃娃机配置 + *webapi.MachineConfig MatchAudience map[int32]*webapi.MatchAudience // 比赛观众列表 key: 玩家id // 小精灵配置 *webapi.SpiritConfig diff --git a/model/customlog.go b/model/customlog.go index 08e6a27..67b82ec 100644 --- a/model/customlog.go +++ b/model/customlog.go @@ -1,9 +1,5 @@ package model -import ( - "github.com/globalsign/mgo/bson" -) - var ( DbCustomLogDBName = "log" DbCustomLogCollName = "log_custom" @@ -22,19 +18,18 @@ type RoundInfo struct { } type CustomLog struct { - Id bson.ObjectId `bson:"_id"` - Platform string `bson:"-"` - CycleId string // 本轮id,多局游戏属于同一轮 - RoomConfigId int32 // 房间配置id - GameFreeId int32 // 场次id - TotalRound int32 // 总局数 - PlayerNum int32 // 最大人数 - Password string // 密码 - CostType int32 // 付费方式 1房主 2AA - Voice int32 // 是否开启语音 1开启 - RoomId int32 // 房间id - SnId []PlayerInfo // 所有玩家 - List []RoundInfo // 对局记录 - StartTs, EndTs int64 // 开始,结束时间 - State int32 // 0正常结束 1后台中途解散 + Platform string `bson:"-"` + CycleId string // 本轮id,多局游戏属于同一轮 + RoomConfigId int32 // 房间配置id + GameFreeId int32 // 场次id + TotalRound int32 // 总局数 + PlayerNum int32 // 最大人数 + Password string // 密码 + CostType int32 // 付费方式 1房主 2AA + Voice int32 // 是否开启语音 1开启 + RoomId int32 // 房间id + SnId []PlayerInfo // 所有玩家 + List []RoundInfo // 对局记录 + StartTs, EndTs int64 // 开始,结束时间 + State int32 // 0正常结束 1后台中途解散 } diff --git a/model/gameplayerlistlog.go b/model/gameplayerlistlog.go index 4bbd768..4441b2d 100644 --- a/model/gameplayerlistlog.go +++ b/model/gameplayerlistlog.go @@ -99,6 +99,7 @@ func NewGamePlayerListLogEx(snid int32, gamedetailedlogid string, platform, chan cl.Time = tNow cl.MatchId = matchid cl.MatchType = matchType + cl.CycleId = cycleId return cl } diff --git a/model/jyb.go b/model/jyb.go index c365ef4..78b60f0 100644 --- a/model/jyb.go +++ b/model/jyb.go @@ -53,7 +53,7 @@ type JybInfo struct { JybId bson.ObjectId `bson:"_id"` // 礼包ID Platform string //平台 Name string // 礼包名称 - CodeType int32 // 礼包类型 1 通用 2 特殊 + CodeType int32 // 礼包类型 1 通用 2专属(自动生成兑换码,每个玩家领一个) 3活动(自动生产兑换码,每个兑换码领一个) StartTime int64 // 开始时间 Unix EndTime int64 // 结束时间 Content string // 礼包内容 diff --git a/protocol/clawdoll/clawdoll.pb.go b/protocol/clawdoll/clawdoll.pb.go index e395726..010b9fb 100644 --- a/protocol/clawdoll/clawdoll.pb.go +++ b/protocol/clawdoll/clawdoll.pb.go @@ -24,40 +24,55 @@ const ( type CLAWDOLLPacketID int32 const ( - CLAWDOLLPacketID_PACKET_CLAWDOLL_ZERO CLAWDOLLPacketID = 0 //弃用消息号 - CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMINFO CLAWDOLLPacketID = 5601 //房间信息 - CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP CLAWDOLLPacketID = 5602 //玩家操作(客户->服务) - CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PLAYEROP CLAWDOLLPacketID = 5603 //玩家操作(服务->客户) - CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMSTATE CLAWDOLLPacketID = 5604 //房间状态 - CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_GAMEBILLED CLAWDOLLPacketID = 5605 //游戏结算 - CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerEnter CLAWDOLLPacketID = 5606 // 玩家进入 - CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerLeave CLAWDOLLPacketID = 5607 // 玩家离开 - CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PLAYERINFO CLAWDOLLPacketID = 5608 // 玩家状态信息变化 + CLAWDOLLPacketID_PACKET_ZERO CLAWDOLLPacketID = 0 //弃用消息号 + CLAWDOLLPacketID_PACKET_SC_ROOMINFO CLAWDOLLPacketID = 5601 //房间信息 + CLAWDOLLPacketID_PACKET_CS_PLAYEROP CLAWDOLLPacketID = 5602 //玩家操作(客户->服务) + CLAWDOLLPacketID_PACKET_SC_PLAYEROP CLAWDOLLPacketID = 5603 //玩家操作(服务->客户) + CLAWDOLLPacketID_PACKET_SC_ROOMSTATE CLAWDOLLPacketID = 5604 //房间状态 + CLAWDOLLPacketID_PACKET_SC_GAMEBILLED CLAWDOLLPacketID = 5605 //游戏结算 + CLAWDOLLPacketID_PACKET_SC_PlayerEnter CLAWDOLLPacketID = 5606 // 玩家进入 + CLAWDOLLPacketID_PACKET_SC_PlayerLeave CLAWDOLLPacketID = 5607 // 玩家离开 + CLAWDOLLPacketID_PACKET_SC_PLAYERINFO CLAWDOLLPacketID = 5608 // 玩家状态信息变化 + CLAWDOLLPacketID_PACKET_CS_GETTOKEN CLAWDOLLPacketID = 5609 // 获取token + CLAWDOLLPacketID_PACKET_SC_SENDTOKEN CLAWDOLLPacketID = 5610 // 获取token + CLAWDOLLPacketID_PACKET_CS_WAITPLAYERS CLAWDOLLPacketID = 5611 // 获取等待玩家信息 (客户->服务) + CLAWDOLLPacketID_PACKET_SC_WAITPLAYERS CLAWDOLLPacketID = 5612 // 获取等待玩家信息 (服务->客户) + CLAWDOLLPacketID_PACKET_SC_PLAYINGINFO CLAWDOLLPacketID = 5613 // 正在控制娃娃机的玩家信息 (服务->客户) ) // Enum value maps for CLAWDOLLPacketID. var ( CLAWDOLLPacketID_name = map[int32]string{ - 0: "PACKET_CLAWDOLL_ZERO", - 5601: "PACKET_SC_CLAWDOLL_ROOMINFO", - 5602: "PACKET_CS_CLAWDOLL_PLAYEROP", - 5603: "PACKET_SC_CLAWDOLL_PLAYEROP", - 5604: "PACKET_SC_CLAWDOLL_ROOMSTATE", - 5605: "PACKET_SC_CLAWDOLL_GAMEBILLED", - 5606: "PACKET_SC_CLAWDOLL_PlayerEnter", - 5607: "PACKET_SC_CLAWDOLL_PlayerLeave", - 5608: "PACKET_SC_CLAWDOLL_PLAYERINFO", + 0: "PACKET_ZERO", + 5601: "PACKET_SC_ROOMINFO", + 5602: "PACKET_CS_PLAYEROP", + 5603: "PACKET_SC_PLAYEROP", + 5604: "PACKET_SC_ROOMSTATE", + 5605: "PACKET_SC_GAMEBILLED", + 5606: "PACKET_SC_PlayerEnter", + 5607: "PACKET_SC_PlayerLeave", + 5608: "PACKET_SC_PLAYERINFO", + 5609: "PACKET_CS_GETTOKEN", + 5610: "PACKET_SC_SENDTOKEN", + 5611: "PACKET_CS_WAITPLAYERS", + 5612: "PACKET_SC_WAITPLAYERS", + 5613: "PACKET_SC_PLAYINGINFO", } CLAWDOLLPacketID_value = map[string]int32{ - "PACKET_CLAWDOLL_ZERO": 0, - "PACKET_SC_CLAWDOLL_ROOMINFO": 5601, - "PACKET_CS_CLAWDOLL_PLAYEROP": 5602, - "PACKET_SC_CLAWDOLL_PLAYEROP": 5603, - "PACKET_SC_CLAWDOLL_ROOMSTATE": 5604, - "PACKET_SC_CLAWDOLL_GAMEBILLED": 5605, - "PACKET_SC_CLAWDOLL_PlayerEnter": 5606, - "PACKET_SC_CLAWDOLL_PlayerLeave": 5607, - "PACKET_SC_CLAWDOLL_PLAYERINFO": 5608, + "PACKET_ZERO": 0, + "PACKET_SC_ROOMINFO": 5601, + "PACKET_CS_PLAYEROP": 5602, + "PACKET_SC_PLAYEROP": 5603, + "PACKET_SC_ROOMSTATE": 5604, + "PACKET_SC_GAMEBILLED": 5605, + "PACKET_SC_PlayerEnter": 5606, + "PACKET_SC_PlayerLeave": 5607, + "PACKET_SC_PLAYERINFO": 5608, + "PACKET_CS_GETTOKEN": 5609, + "PACKET_SC_SENDTOKEN": 5610, + "PACKET_CS_WAITPLAYERS": 5611, + "PACKET_SC_WAITPLAYERS": 5612, + "PACKET_SC_PLAYINGINFO": 5613, } ) @@ -146,15 +161,16 @@ type CLAWDOLLPlayerData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` //名字 - SnId int32 `protobuf:"varint,2,opt,name=SnId,proto3" json:"SnId,omitempty"` //账号 - Head int32 `protobuf:"varint,3,opt,name=Head,proto3" json:"Head,omitempty"` //头像 - Sex int32 `protobuf:"varint,4,opt,name=Sex,proto3" json:"Sex,omitempty"` //性别 - Coin int64 `protobuf:"varint,5,opt,name=Coin,proto3" json:"Coin,omitempty"` //金币 - HeadOutLine int32 `protobuf:"varint,6,opt,name=HeadOutLine,proto3" json:"HeadOutLine,omitempty"` //头像框 - VIP int32 `protobuf:"varint,7,opt,name=VIP,proto3" json:"VIP,omitempty"` - Flag int32 `protobuf:"varint,8,opt,name=Flag,proto3" json:"Flag,omitempty"` //二进制标记 第一位:是否掉线(0:在线 1:掉线) 第二位:是否准备(0:未准备 1:已准备) - WinCoin int64 `protobuf:"varint,9,opt,name=WinCoin,proto3" json:"WinCoin,omitempty"` // 本局赢分 + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` //名字 + SnId int32 `protobuf:"varint,2,opt,name=SnId,proto3" json:"SnId,omitempty"` //账号 + Head int32 `protobuf:"varint,3,opt,name=Head,proto3" json:"Head,omitempty"` //头像 + Sex int32 `protobuf:"varint,4,opt,name=Sex,proto3" json:"Sex,omitempty"` //性别 + Coin int64 `protobuf:"varint,5,opt,name=Coin,proto3" json:"Coin,omitempty"` //金币 + HeadOutLine int32 `protobuf:"varint,6,opt,name=HeadOutLine,proto3" json:"HeadOutLine,omitempty"` //头像框 + VIP int32 `protobuf:"varint,7,opt,name=VIP,proto3" json:"VIP,omitempty"` + Flag int32 `protobuf:"varint,8,opt,name=Flag,proto3" json:"Flag,omitempty"` //二进制标记 第一位:是否掉线(0:在线 1:掉线) 第二位:是否准备(0:未准备 1:已准备) + WinCoin int64 `protobuf:"varint,9,opt,name=WinCoin,proto3" json:"WinCoin,omitempty"` // 本局赢分 + ClawDollState int32 `protobuf:"varint,10,opt,name=clawDollState,proto3" json:"clawDollState,omitempty"` // 玩家状态 } func (x *CLAWDOLLPlayerData) Reset() { @@ -252,6 +268,13 @@ func (x *CLAWDOLLPlayerData) GetWinCoin() int64 { return 0 } +func (x *CLAWDOLLPlayerData) GetClawDollState() int32 { + if x != nil { + return x.ClawDollState + } + return 0 +} + //房间信息 type SCCLAWDOLLRoomInfo struct { state protoimpl.MessageState @@ -394,8 +417,8 @@ type CSCLAWDOLLOp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OpCode int32 `protobuf:"varint,1,opt,name=OpCode,proto3" json:"OpCode,omitempty"` - Params []int64 `protobuf:"varint,2,rep,packed,name=Params,proto3" json:"Params,omitempty"` + OpCode int32 `protobuf:"varint,1,opt,name=OpCode,proto3" json:"OpCode,omitempty"` //操作码 1:上分 投币 2:下抓 3:玩家操控动作 + Params []int64 `protobuf:"varint,2,rep,packed,name=Params,proto3" json:"Params,omitempty"` //操作参数 1:无 } func (x *CSCLAWDOLLOp) Reset() { @@ -522,8 +545,8 @@ type SCCLAWDOLLRoundGameBilled struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RoundId int32 `protobuf:"varint,1,opt,name=RoundId,proto3" json:"RoundId,omitempty"` //牌局ID - ClowResult int32 `protobuf:"varint,2,opt,name=ClowResult,proto3" json:"ClowResult,omitempty"` //抓取结果 + RoundId int32 `protobuf:"varint,1,opt,name=RoundId,proto3" json:"RoundId,omitempty"` //局ID + ClowResult int32 `protobuf:"varint,2,opt,name=ClowResult,proto3" json:"ClowResult,omitempty"` //抓取结果 0: 没有抓住, 1:抓住娃娃 Award int64 `protobuf:"varint,3,opt,name=Award,proto3" json:"Award,omitempty"` //获奖金额 Balance int64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"Balance,omitempty"` //玩家余额 } @@ -650,9 +673,10 @@ type SCCLAWDOLLPlayerInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"` //玩家ID - GainCoin int64 `protobuf:"varint,2,opt,name=gainCoin,proto3" json:"gainCoin,omitempty"` //本局赢取 - Coin int64 `protobuf:"varint,3,opt,name=Coin,proto3" json:"Coin,omitempty"` // 玩家 + SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"` // 玩家ID + ClawDollState int32 `protobuf:"varint,2,opt,name=clawDollState,proto3" json:"clawDollState,omitempty"` // 玩家状态 + GainCoin int64 `protobuf:"varint,3,opt,name=gainCoin,proto3" json:"gainCoin,omitempty"` // 本局赢取 + Coin int64 `protobuf:"varint,4,opt,name=Coin,proto3" json:"Coin,omitempty"` // 玩家 } func (x *SCCLAWDOLLPlayerInfo) Reset() { @@ -694,6 +718,13 @@ func (x *SCCLAWDOLLPlayerInfo) GetSnId() int32 { return 0 } +func (x *SCCLAWDOLLPlayerInfo) GetClawDollState() int32 { + if x != nil { + return x.ClawDollState + } + return 0 +} + func (x *SCCLAWDOLLPlayerInfo) GetGainCoin() int64 { if x != nil { return x.GainCoin @@ -715,7 +746,7 @@ type SCCLAWDOLLPlayerEnter struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Data *CLAWDOLLPlayerData `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"` + Data *CLAWDOLLPlayerDigestInfo `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"` } func (x *SCCLAWDOLLPlayerEnter) Reset() { @@ -750,7 +781,7 @@ func (*SCCLAWDOLLPlayerEnter) Descriptor() ([]byte, []int) { return file_clawdoll_proto_rawDescGZIP(), []int{7} } -func (x *SCCLAWDOLLPlayerEnter) GetData() *CLAWDOLLPlayerData { +func (x *SCCLAWDOLLPlayerEnter) GetData() *CLAWDOLLPlayerDigestInfo { if x != nil { return x.Data } @@ -764,7 +795,7 @@ type SCCLAWDOLLPlayerLeave struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Pos int32 `protobuf:"varint,1,opt,name=Pos,proto3" json:"Pos,omitempty"` //玩家位置 + SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"` //玩家id } func (x *SCCLAWDOLLPlayerLeave) Reset() { @@ -799,18 +830,239 @@ func (*SCCLAWDOLLPlayerLeave) Descriptor() ([]byte, []int) { return file_clawdoll_proto_rawDescGZIP(), []int{8} } -func (x *SCCLAWDOLLPlayerLeave) GetPos() int32 { +func (x *SCCLAWDOLLPlayerLeave) GetSnId() int32 { if x != nil { - return x.Pos + return x.SnId } return 0 } +//玩家请求进入视频地址token +type CSCLAWDOLLGetToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CSCLAWDOLLGetToken) Reset() { + *x = CSCLAWDOLLGetToken{} + if protoimpl.UnsafeEnabled { + mi := &file_clawdoll_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CSCLAWDOLLGetToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CSCLAWDOLLGetToken) ProtoMessage() {} + +func (x *CSCLAWDOLLGetToken) ProtoReflect() protoreflect.Message { + mi := &file_clawdoll_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CSCLAWDOLLGetToken.ProtoReflect.Descriptor instead. +func (*CSCLAWDOLLGetToken) Descriptor() ([]byte, []int) { + return file_clawdoll_proto_rawDescGZIP(), []int{9} +} + +type SCCLAWDOLLSendToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LogicId int32 `protobuf:"varint,1,opt,name=LogicId,proto3" json:"LogicId,omitempty"` + Appid int64 `protobuf:"varint,2,opt,name=Appid,proto3" json:"Appid,omitempty"` + Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` +} + +func (x *SCCLAWDOLLSendToken) Reset() { + *x = SCCLAWDOLLSendToken{} + if protoimpl.UnsafeEnabled { + mi := &file_clawdoll_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SCCLAWDOLLSendToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SCCLAWDOLLSendToken) ProtoMessage() {} + +func (x *SCCLAWDOLLSendToken) ProtoReflect() protoreflect.Message { + mi := &file_clawdoll_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SCCLAWDOLLSendToken.ProtoReflect.Descriptor instead. +func (*SCCLAWDOLLSendToken) Descriptor() ([]byte, []int) { + return file_clawdoll_proto_rawDescGZIP(), []int{10} +} + +func (x *SCCLAWDOLLSendToken) GetLogicId() int32 { + if x != nil { + return x.LogicId + } + return 0 +} + +func (x *SCCLAWDOLLSendToken) GetAppid() int64 { + if x != nil { + return x.Appid + } + return 0 +} + +func (x *SCCLAWDOLLSendToken) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type CLAWDOLLWaitPlayers struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WaitPlayersInfo []*CLAWDOLLPlayerDigestInfo `protobuf:"bytes,1,rep,name=WaitPlayersInfo,proto3" json:"WaitPlayersInfo,omitempty"` +} + +func (x *CLAWDOLLWaitPlayers) Reset() { + *x = CLAWDOLLWaitPlayers{} + if protoimpl.UnsafeEnabled { + mi := &file_clawdoll_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CLAWDOLLWaitPlayers) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CLAWDOLLWaitPlayers) ProtoMessage() {} + +func (x *CLAWDOLLWaitPlayers) ProtoReflect() protoreflect.Message { + mi := &file_clawdoll_proto_msgTypes[11] + 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 CLAWDOLLWaitPlayers.ProtoReflect.Descriptor instead. +func (*CLAWDOLLWaitPlayers) Descriptor() ([]byte, []int) { + return file_clawdoll_proto_rawDescGZIP(), []int{11} +} + +func (x *CLAWDOLLWaitPlayers) GetWaitPlayersInfo() []*CLAWDOLLPlayerDigestInfo { + if x != nil { + return x.WaitPlayersInfo + } + return nil +} + +// 玩家摘要信息 +type CLAWDOLLPlayerDigestInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"` //账号 + Head int32 `protobuf:"varint,2,opt,name=Head,proto3" json:"Head,omitempty"` //头像 + HeadUrl string `protobuf:"bytes,3,opt,name=HeadUrl,proto3" json:"HeadUrl,omitempty"` //头像 + Name string `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"` //名字 +} + +func (x *CLAWDOLLPlayerDigestInfo) Reset() { + *x = CLAWDOLLPlayerDigestInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_clawdoll_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CLAWDOLLPlayerDigestInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CLAWDOLLPlayerDigestInfo) ProtoMessage() {} + +func (x *CLAWDOLLPlayerDigestInfo) ProtoReflect() protoreflect.Message { + mi := &file_clawdoll_proto_msgTypes[12] + 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 CLAWDOLLPlayerDigestInfo.ProtoReflect.Descriptor instead. +func (*CLAWDOLLPlayerDigestInfo) Descriptor() ([]byte, []int) { + return file_clawdoll_proto_rawDescGZIP(), []int{12} +} + +func (x *CLAWDOLLPlayerDigestInfo) GetSnId() int32 { + if x != nil { + return x.SnId + } + return 0 +} + +func (x *CLAWDOLLPlayerDigestInfo) GetHead() int32 { + if x != nil { + return x.Head + } + return 0 +} + +func (x *CLAWDOLLPlayerDigestInfo) GetHeadUrl() string { + if x != nil { + return x.HeadUrl + } + return "" +} + +func (x *CLAWDOLLPlayerDigestInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + var File_clawdoll_proto protoreflect.FileDescriptor var file_clawdoll_proto_rawDesc = []byte{ 0x0a, 0x0e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x08, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x22, 0xd8, 0x01, 0x0a, 0x12, 0x43, + 0x12, 0x08, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x22, 0xfe, 0x01, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, @@ -824,99 +1076,128 @@ var file_clawdoll_proto_rawDesc = []byte{ 0x28, 0x05, 0x52, 0x03, 0x56, 0x49, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x57, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x57, 0x69, - 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x22, 0xf6, 0x02, 0x0a, 0x12, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, - 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, - 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x52, 0x6f, - 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x47, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, - 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, - 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x75, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x75, 0x74, - 0x12, 0x36, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, - 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, - 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x54, 0x6f, 0x74, 0x61, - 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x54, - 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x6f, - 0x75, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x52, 0x6f, 0x75, - 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, - 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, - 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x65, 0x65, 0x49, 0x64, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x65, 0x65, 0x49, 0x64, - 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x10, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x3e, - 0x0a, 0x0c, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x4f, 0x70, 0x12, 0x16, - 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x88, - 0x01, 0x0a, 0x0c, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x4f, 0x70, 0x12, - 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, - 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x34, 0x0a, 0x09, 0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, - 0x6c, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x09, - 0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x19, 0x53, 0x43, - 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x61, 0x6d, - 0x65, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, - 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, - 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x43, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, - 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, - 0x65, 0x22, 0x43, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, - 0x6f, 0x6f, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x02, 0x52, 0x06, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x5a, 0x0a, 0x14, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, - 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, - 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, - 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x67, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x12, - 0x0a, 0x04, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x43, 0x6f, - 0x69, 0x6e, 0x22, 0x49, 0x0a, 0x15, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, - 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x04, 0x44, - 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6c, 0x61, 0x77, - 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x29, 0x0a, - 0x15, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x50, 0x6f, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x03, 0x50, 0x6f, 0x73, 0x2a, 0xc7, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41, - 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x18, 0x0a, - 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, - 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x52, 0x4f, - 0x4f, 0x4d, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe1, 0x2b, 0x12, 0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43, - 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, - 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b, 0x12, 0x20, 0x0a, 0x1b, 0x50, - 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, - 0x4c, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x21, 0x0a, - 0x1c, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, - 0x4f, 0x4c, 0x4c, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0xe4, 0x2b, - 0x12, 0x22, 0x0a, 0x1d, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, - 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x47, 0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45, - 0x44, 0x10, 0xe5, 0x2b, 0x12, 0x23, 0x0a, 0x1e, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, - 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x23, 0x0a, 0x1e, 0x50, 0x41, 0x43, - 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, - 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x10, 0xe7, 0x2b, 0x12, 0x22, - 0x0a, 0x1d, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, - 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10, - 0xe8, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, - 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, - 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, - 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79, 0x50, - 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28, 0x5a, 0x26, 0x6d, 0x6f, 0x6e, 0x67, - 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, - 0x6c, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x77, 0x44, 0x6f, 0x6c, + 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x63, 0x6c, + 0x61, 0x77, 0x44, 0x6f, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0xf6, 0x02, 0x0a, 0x12, + 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x61, + 0x6d, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x47, 0x61, 0x6d, 0x65, + 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x54, + 0x69, 0x6d, 0x65, 0x4f, 0x75, 0x74, 0x12, 0x36, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, + 0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x20, + 0x0a, 0x0b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x12, 0x18, 0x0a, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, + 0x65, 0x65, 0x49, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x47, 0x61, 0x6d, 0x65, + 0x46, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, 0x63, + 0x6f, 0x72, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, + 0x63, 0x6f, 0x72, 0x65, 0x22, 0x3e, 0x0a, 0x0c, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, + 0x4c, 0x4c, 0x4f, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x22, 0x88, 0x01, 0x0a, 0x0c, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, + 0x4f, 0x4c, 0x4c, 0x4f, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x43, + 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x03, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x34, 0x0a, 0x09, 0x4f, 0x70, 0x52, + 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x63, + 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x43, 0x6f, 0x64, 0x65, 0x52, 0x09, 0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x22, + 0x85, 0x01, 0x0a, 0x19, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, + 0x75, 0x6e, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, + 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x77, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x43, 0x6c, 0x6f, + 0x77, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, + 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x43, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, + 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x6f, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x02, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x80, 0x01, 0x0a, + 0x14, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6c, 0x61, + 0x77, 0x44, 0x6f, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0d, 0x63, 0x6c, 0x61, 0x77, 0x44, 0x6f, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x1a, 0x0a, 0x08, 0x67, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x08, 0x67, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x43, + 0x6f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x43, 0x6f, 0x69, 0x6e, 0x22, + 0x4f, 0x0a, 0x15, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, + 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, + 0x22, 0x2b, 0x0a, 0x15, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x22, 0x14, 0x0a, + 0x12, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x47, 0x65, 0x74, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x22, 0x5b, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, + 0x4c, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4c, 0x6f, + 0x67, 0x69, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x4c, 0x6f, 0x67, + 0x69, 0x63, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0x63, 0x0a, 0x13, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x57, 0x61, 0x69, 0x74, + 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x22, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, + 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x70, 0x0a, 0x18, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, + 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x04, 0x53, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x48, 0x65, 0x61, + 0x64, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x48, 0x65, 0x61, 0x64, + 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x2a, 0xfd, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41, 0x57, + 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x0f, 0x0a, 0x0b, + 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x17, 0x0a, + 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x49, + 0x4e, 0x46, 0x4f, 0x10, 0xe1, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x43, 0x53, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b, 0x12, + 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, + 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, + 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, + 0xe4, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, + 0x47, 0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0xe5, 0x2b, 0x12, 0x1a, 0x0a, + 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, + 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, + 0x76, 0x65, 0x10, 0xe7, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, + 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe8, 0x2b, + 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x47, 0x45, + 0x54, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xe9, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, + 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x54, 0x4f, 0x4b, 0x45, 0x4e, + 0x10, 0xea, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, + 0x5f, 0x57, 0x41, 0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xeb, 0x2b, 0x12, + 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x57, 0x41, 0x49, + 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xec, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, + 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x49, 0x4e, 0x47, + 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xed, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, + 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, + 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x52, + 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, + 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c, 0x52, + 0x65, 0x61, 0x64, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28, 0x5a, + 0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, + 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -932,7 +1213,7 @@ func file_clawdoll_proto_rawDescGZIP() []byte { } var file_clawdoll_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_clawdoll_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_clawdoll_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_clawdoll_proto_goTypes = []interface{}{ (CLAWDOLLPacketID)(0), // 0: clawdoll.CLAWDOLLPacketID (OpResultCode)(0), // 1: clawdoll.OpResultCode @@ -945,16 +1226,21 @@ var file_clawdoll_proto_goTypes = []interface{}{ (*SCCLAWDOLLPlayerInfo)(nil), // 8: clawdoll.SCCLAWDOLLPlayerInfo (*SCCLAWDOLLPlayerEnter)(nil), // 9: clawdoll.SCCLAWDOLLPlayerEnter (*SCCLAWDOLLPlayerLeave)(nil), // 10: clawdoll.SCCLAWDOLLPlayerLeave + (*CSCLAWDOLLGetToken)(nil), // 11: clawdoll.CSCLAWDOLLGetToken + (*SCCLAWDOLLSendToken)(nil), // 12: clawdoll.SCCLAWDOLLSendToken + (*CLAWDOLLWaitPlayers)(nil), // 13: clawdoll.CLAWDOLLWaitPlayers + (*CLAWDOLLPlayerDigestInfo)(nil), // 14: clawdoll.CLAWDOLLPlayerDigestInfo } var file_clawdoll_proto_depIdxs = []int32{ - 2, // 0: clawdoll.SCCLAWDOLLRoomInfo.Players:type_name -> clawdoll.CLAWDOLLPlayerData - 1, // 1: clawdoll.SCCLAWDOLLOp.OpRetCode:type_name -> clawdoll.OpResultCode - 2, // 2: clawdoll.SCCLAWDOLLPlayerEnter.Data:type_name -> clawdoll.CLAWDOLLPlayerData - 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 + 2, // 0: clawdoll.SCCLAWDOLLRoomInfo.Players:type_name -> clawdoll.CLAWDOLLPlayerData + 1, // 1: clawdoll.SCCLAWDOLLOp.OpRetCode:type_name -> clawdoll.OpResultCode + 14, // 2: clawdoll.SCCLAWDOLLPlayerEnter.Data:type_name -> clawdoll.CLAWDOLLPlayerDigestInfo + 14, // 3: clawdoll.CLAWDOLLWaitPlayers.WaitPlayersInfo:type_name -> clawdoll.CLAWDOLLPlayerDigestInfo + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_clawdoll_proto_init() } @@ -1071,6 +1357,54 @@ func file_clawdoll_proto_init() { return nil } } + file_clawdoll_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CSCLAWDOLLGetToken); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_clawdoll_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SCCLAWDOLLSendToken); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_clawdoll_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CLAWDOLLWaitPlayers); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_clawdoll_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CLAWDOLLPlayerDigestInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1078,7 +1412,7 @@ func file_clawdoll_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_clawdoll_proto_rawDesc, NumEnums: 2, - NumMessages: 9, + NumMessages: 13, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/clawdoll/clawdoll.proto b/protocol/clawdoll/clawdoll.proto index e7091b2..a3f075b 100644 --- a/protocol/clawdoll/clawdoll.proto +++ b/protocol/clawdoll/clawdoll.proto @@ -4,15 +4,20 @@ option go_package = "mongo.games.com/game/protocol/clawdoll"; //娃娃机 enum CLAWDOLLPacketID { - PACKET_CLAWDOLL_ZERO = 0; //弃用消息号 - PACKET_SC_CLAWDOLL_ROOMINFO = 5601; //房间信息 - PACKET_CS_CLAWDOLL_PLAYEROP = 5602; //玩家操作(客户->服务) - PACKET_SC_CLAWDOLL_PLAYEROP = 5603; //玩家操作(服务->客户) - PACKET_SC_CLAWDOLL_ROOMSTATE = 5604; //房间状态 - PACKET_SC_CLAWDOLL_GAMEBILLED = 5605; //游戏结算 - PACKET_SC_CLAWDOLL_PlayerEnter = 5606; // 玩家进入 - PACKET_SC_CLAWDOLL_PlayerLeave = 5607; // 玩家离开 - PACKET_SC_CLAWDOLL_PLAYERINFO = 5608; // 玩家状态信息变化 + PACKET_ZERO = 0; //弃用消息号 + PACKET_SC_ROOMINFO = 5601; //房间信息 + PACKET_CS_PLAYEROP = 5602; //玩家操作(客户->服务) + PACKET_SC_PLAYEROP = 5603; //玩家操作(服务->客户) + PACKET_SC_ROOMSTATE = 5604; //房间状态 + PACKET_SC_GAMEBILLED = 5605; //游戏结算 + PACKET_SC_PlayerEnter = 5606; // 玩家进入 + PACKET_SC_PlayerLeave = 5607; // 玩家离开 + PACKET_SC_PLAYERINFO = 5608; // 玩家状态信息变化 + PACKET_CS_GETTOKEN = 5609; // 获取token + PACKET_SC_SENDTOKEN = 5610; // 获取token + PACKET_CS_WAITPLAYERS = 5611; // 获取等待玩家信息 (客户->服务) + PACKET_SC_WAITPLAYERS = 5612; // 获取等待玩家信息 (服务->客户) + PACKET_SC_PLAYINGINFO = 5613; // 正在控制娃娃机的玩家信息 (服务->客户) } //操作结果 @@ -34,7 +39,7 @@ message CLAWDOLLPlayerData { int32 Flag = 8; //二进制标记 第一位:是否掉线(0:在线 1:掉线) 第二位:是否准备(0:未准备 1:已准备) int64 WinCoin = 9; // 本局赢分 - + int32 clawDollState = 10; // 玩家状态 } //房间信息 @@ -56,8 +61,10 @@ message SCCLAWDOLLRoomInfo { //玩家操作 message CSCLAWDOLLOp { - int32 OpCode = 1; - repeated int64 Params = 2; + int32 OpCode = 1; //操作码 1:上分 投币 2:下抓 3:玩家操控动作 + repeated int64 Params = 2; //操作参数 1:无 + //操作参数 2:无 + //操作参数 3:Params[0] 1-前 2-后 3-左 4-右 } //玩家操作返回 @@ -70,8 +77,8 @@ message SCCLAWDOLLOp { //发送给客户端的数据 单局结算 message SCCLAWDOLLRoundGameBilled { - int32 RoundId = 1; //牌局ID - int32 ClowResult = 2; //抓取结果 + int32 RoundId = 1; //局ID + int32 ClowResult = 2; //抓取结果 0: 没有抓住, 1:抓住娃娃 int64 Award = 3; //获奖金额 int64 Balance = 4; //玩家余额 } @@ -84,20 +91,42 @@ message SCCLAWDOLLRoomState { //玩家信息 message SCCLAWDOLLPlayerInfo { - int32 SnId = 1; //玩家ID - int64 gainCoin = 2; //本局赢取 - int64 Coin = 3; // 玩家 + int32 SnId = 1; // 玩家ID + int32 clawDollState = 2; // 玩家状态 + int64 gainCoin = 3; // 本局赢取 + int64 Coin = 4; // 玩家 } //玩家进入 //PACKET_SCCLAWDOLLPlayerEnter message SCCLAWDOLLPlayerEnter { - CLAWDOLLPlayerData Data = 1; + CLAWDOLLPlayerDigestInfo Data = 1; } //玩家离开 //PACKET_SCCLAWDOLLPlayerLeave message SCCLAWDOLLPlayerLeave { - int32 Pos = 1; //玩家位置 -} \ No newline at end of file + int32 SnId = 1; //玩家id +} +//玩家请求进入视频地址token +message CSCLAWDOLLGetToken { +} + +message SCCLAWDOLLSendToken { + int32 LogicId = 1; + int64 Appid = 2; + string Token = 3; +} + +message CLAWDOLLWaitPlayers { + repeated CLAWDOLLPlayerDigestInfo WaitPlayersInfo = 1; +} + +// 玩家摘要信息 +message CLAWDOLLPlayerDigestInfo { + int32 SnId = 1; //账号 + int32 Head = 2; //头像 + string HeadUrl = 3; //头像 + string Name = 4; //名字 +} diff --git a/protocol/dollmachine/dollmachine.pb.go b/protocol/dollmachine/dollmachine.pb.go deleted file mode 100644 index 6624f68..0000000 --- a/protocol/dollmachine/dollmachine.pb.go +++ /dev/null @@ -1,537 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1-devel -// protoc v3.19.4 -// source: dollmachine.proto - -package dollmachine - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -//S-GAME M-娃娃机主机 -//娃娃机协议 -type DollMachinePacketID int32 - -const ( - DollMachinePacketID_PACKET_SMDollMachineZero DollMachinePacketID = 0 - DollMachinePacketID_PACKET_SMDollMachineMove DollMachinePacketID = 3001 - DollMachinePacketID_PACKET_SMDollMachineGrab DollMachinePacketID = 3002 - DollMachinePacketID_PACKET_MSDollMachineGrab DollMachinePacketID = 3003 - DollMachinePacketID_PACKET_MSDollMachineList DollMachinePacketID = 3004 -) - -// Enum value maps for DollMachinePacketID. -var ( - DollMachinePacketID_name = map[int32]string{ - 0: "PACKET_SMDollMachineZero", - 3001: "PACKET_SMDollMachineMove", - 3002: "PACKET_SMDollMachineGrab", - 3003: "PACKET_MSDollMachineGrab", - 3004: "PACKET_MSDollMachineList", - } - DollMachinePacketID_value = map[string]int32{ - "PACKET_SMDollMachineZero": 0, - "PACKET_SMDollMachineMove": 3001, - "PACKET_SMDollMachineGrab": 3002, - "PACKET_MSDollMachineGrab": 3003, - "PACKET_MSDollMachineList": 3004, - } -) - -func (x DollMachinePacketID) Enum() *DollMachinePacketID { - p := new(DollMachinePacketID) - *p = x - return p -} - -func (x DollMachinePacketID) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (DollMachinePacketID) Descriptor() protoreflect.EnumDescriptor { - return file_dollmachine_proto_enumTypes[0].Descriptor() -} - -func (DollMachinePacketID) Type() protoreflect.EnumType { - return &file_dollmachine_proto_enumTypes[0] -} - -func (x DollMachinePacketID) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use DollMachinePacketID.Descriptor instead. -func (DollMachinePacketID) EnumDescriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{0} -} - -//移动 -type SMDollMachineMove struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` - Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识 - Direction int32 `protobuf:"varint,3,opt,name=Direction,proto3" json:"Direction,omitempty"` // 1-前 2-后 3-左 4-右 -} - -func (x *SMDollMachineMove) Reset() { - *x = SMDollMachineMove{} - if protoimpl.UnsafeEnabled { - mi := &file_dollmachine_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SMDollMachineMove) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SMDollMachineMove) ProtoMessage() {} - -func (x *SMDollMachineMove) ProtoReflect() protoreflect.Message { - mi := &file_dollmachine_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 SMDollMachineMove.ProtoReflect.Descriptor instead. -func (*SMDollMachineMove) Descriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{0} -} - -func (x *SMDollMachineMove) GetSnid() int32 { - if x != nil { - return x.Snid - } - return 0 -} - -func (x *SMDollMachineMove) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *SMDollMachineMove) GetDirection() int32 { - if x != nil { - return x.Direction - } - return 0 -} - -//下抓 -type SMDollMachineGrab struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TypeId int32 `protobuf:"varint,1,opt,name=TypeId,proto3" json:"TypeId,omitempty"` //1-弱力抓 2 -强力抓 3-必出抓 - Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识 - Snid int32 `protobuf:"varint,3,opt,name=Snid,proto3" json:"Snid,omitempty"` -} - -func (x *SMDollMachineGrab) Reset() { - *x = SMDollMachineGrab{} - if protoimpl.UnsafeEnabled { - mi := &file_dollmachine_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SMDollMachineGrab) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SMDollMachineGrab) ProtoMessage() {} - -func (x *SMDollMachineGrab) ProtoReflect() protoreflect.Message { - mi := &file_dollmachine_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SMDollMachineGrab.ProtoReflect.Descriptor instead. -func (*SMDollMachineGrab) Descriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{1} -} - -func (x *SMDollMachineGrab) GetTypeId() int32 { - if x != nil { - return x.TypeId - } - return 0 -} - -func (x *SMDollMachineGrab) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *SMDollMachineGrab) GetSnid() int32 { - if x != nil { - return x.Snid - } - return 0 -} - -//返回下抓结果 -type MSDollMachineGrab struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` - Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识 - Result int32 `protobuf:"varint,3,opt,name=Result,proto3" json:"Result,omitempty"` //1-中奖 其他未中奖 -} - -func (x *MSDollMachineGrab) Reset() { - *x = MSDollMachineGrab{} - if protoimpl.UnsafeEnabled { - mi := &file_dollmachine_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MSDollMachineGrab) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MSDollMachineGrab) ProtoMessage() {} - -func (x *MSDollMachineGrab) ProtoReflect() protoreflect.Message { - mi := &file_dollmachine_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MSDollMachineGrab.ProtoReflect.Descriptor instead. -func (*MSDollMachineGrab) Descriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{2} -} - -func (x *MSDollMachineGrab) GetSnid() int32 { - if x != nil { - return x.Snid - } - return 0 -} - -func (x *MSDollMachineGrab) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *MSDollMachineGrab) GetResult() int32 { - if x != nil { - return x.Result - } - return 0 -} - -//返回所有娃娃机连接 -type MSDollMachineList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data []*DollMachine `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` -} - -func (x *MSDollMachineList) Reset() { - *x = MSDollMachineList{} - if protoimpl.UnsafeEnabled { - mi := &file_dollmachine_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MSDollMachineList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MSDollMachineList) ProtoMessage() {} - -func (x *MSDollMachineList) ProtoReflect() protoreflect.Message { - mi := &file_dollmachine_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MSDollMachineList.ProtoReflect.Descriptor instead. -func (*MSDollMachineList) Descriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{3} -} - -func (x *MSDollMachineList) GetData() []*DollMachine { - if x != nil { - return x.Data - } - return nil -} - -type DollMachine struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` - Status int32 `protobuf:"varint,2,opt,name=Status,proto3" json:"Status,omitempty"` //1-空闲 2-无法使用 -} - -func (x *DollMachine) Reset() { - *x = DollMachine{} - if protoimpl.UnsafeEnabled { - mi := &file_dollmachine_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DollMachine) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DollMachine) ProtoMessage() {} - -func (x *DollMachine) ProtoReflect() protoreflect.Message { - mi := &file_dollmachine_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DollMachine.ProtoReflect.Descriptor instead. -func (*DollMachine) Descriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{4} -} - -func (x *DollMachine) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *DollMachine) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -var File_dollmachine_proto protoreflect.FileDescriptor - -var file_dollmachine_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x64, 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x64, 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, - 0x22, 0x55, 0x0a, 0x11, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, - 0x65, 0x4d, 0x6f, 0x76, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x44, 0x69, 0x72, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x44, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4f, 0x0a, 0x11, 0x53, 0x4d, 0x44, 0x6f, 0x6c, - 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x12, 0x16, 0x0a, 0x06, - 0x54, 0x79, 0x70, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x54, 0x79, - 0x70, 0x65, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x11, 0x4d, 0x53, 0x44, 0x6f, - 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x12, 0x12, 0x0a, - 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, - 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, - 0x64, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x41, 0x0a, 0x11, 0x4d, 0x53, 0x44, - 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2c, - 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, - 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2e, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, - 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x35, 0x0a, 0x0b, - 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x2a, 0xaf, 0x01, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, - 0x69, 0x6e, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x18, 0x50, - 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, - 0x69, 0x6e, 0x65, 0x5a, 0x65, 0x72, 0x6f, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, - 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, - 0x65, 0x4d, 0x6f, 0x76, 0x65, 0x10, 0xb9, 0x17, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, - 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, - 0x47, 0x72, 0x61, 0x62, 0x10, 0xba, 0x17, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, - 0x72, 0x61, 0x62, 0x10, 0xbb, 0x17, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, - 0x73, 0x74, 0x10, 0xbc, 0x17, 0x42, 0x2b, 0x5a, 0x29, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, - 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x64, 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, - 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_dollmachine_proto_rawDescOnce sync.Once - file_dollmachine_proto_rawDescData = file_dollmachine_proto_rawDesc -) - -func file_dollmachine_proto_rawDescGZIP() []byte { - file_dollmachine_proto_rawDescOnce.Do(func() { - file_dollmachine_proto_rawDescData = protoimpl.X.CompressGZIP(file_dollmachine_proto_rawDescData) - }) - return file_dollmachine_proto_rawDescData -} - -var file_dollmachine_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_dollmachine_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_dollmachine_proto_goTypes = []interface{}{ - (DollMachinePacketID)(0), // 0: dollmachine.DollMachinePacketID - (*SMDollMachineMove)(nil), // 1: dollmachine.SMDollMachineMove - (*SMDollMachineGrab)(nil), // 2: dollmachine.SMDollMachineGrab - (*MSDollMachineGrab)(nil), // 3: dollmachine.MSDollMachineGrab - (*MSDollMachineList)(nil), // 4: dollmachine.MSDollMachineList - (*DollMachine)(nil), // 5: dollmachine.DollMachine -} -var file_dollmachine_proto_depIdxs = []int32{ - 5, // 0: dollmachine.MSDollMachineList.data:type_name -> dollmachine.DollMachine - 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 -} - -func init() { file_dollmachine_proto_init() } -func file_dollmachine_proto_init() { - if File_dollmachine_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_dollmachine_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SMDollMachineMove); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dollmachine_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SMDollMachineGrab); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dollmachine_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MSDollMachineGrab); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dollmachine_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MSDollMachineList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dollmachine_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DollMachine); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_dollmachine_proto_rawDesc, - NumEnums: 1, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_dollmachine_proto_goTypes, - DependencyIndexes: file_dollmachine_proto_depIdxs, - EnumInfos: file_dollmachine_proto_enumTypes, - MessageInfos: file_dollmachine_proto_msgTypes, - }.Build() - File_dollmachine_proto = out.File - file_dollmachine_proto_rawDesc = nil - file_dollmachine_proto_goTypes = nil - file_dollmachine_proto_depIdxs = nil -} diff --git a/protocol/dollmachine/dollmachine.proto b/protocol/dollmachine/dollmachine.proto deleted file mode 100644 index 450795e..0000000 --- a/protocol/dollmachine/dollmachine.proto +++ /dev/null @@ -1,43 +0,0 @@ -syntax = "proto3"; -package dollmachine; -option go_package = "mongo.games.com/game/protocol/dollmachine"; - -//S-GAME M-娃娃机主机 -//娃娃机协议 -enum DollMachinePacketID { - PACKET_SMDollMachineZero = 0; - PACKET_SMDollMachineMove = 3001; - PACKET_SMDollMachineGrab = 3002; - PACKET_MSDollMachineGrab = 3003; - PACKET_MSDollMachineList = 3004; -} - -//移动 -message SMDollMachineMove{ - int32 Snid = 1; - int32 Id = 2; //娃娃机标识 - int32 Direction = 3; // 1-前 2-后 3-左 4-右 -} - -//下抓 -message SMDollMachineGrab{ - int32 TypeId = 1;//1-弱力抓 2 -强力抓 3-必出抓 - int32 Id =2; //娃娃机标识 - int32 Snid = 3; -} - -//返回下抓结果 -message MSDollMachineGrab{ - int32 Snid = 1; - int32 Id = 2; //娃娃机标识 - int32 Result = 3;//1-中奖 其他未中奖 -} - -//返回所有娃娃机连接 -message MSDollMachineList{ - repeated DollMachine data = 1; -} -message DollMachine{ - int32 Id = 1; - int32 Status = 2; //1-空闲 2-无法使用 -} \ No newline at end of file diff --git a/protocol/machine/machine.pb.go b/protocol/machine/machine.pb.go index 576911a..464b384 100644 --- a/protocol/machine/machine.pb.go +++ b/protocol/machine/machine.pb.go @@ -24,12 +24,15 @@ const ( type DollMachinePacketID int32 const ( - DollMachinePacketID_PACKET_SMDollMachineZero DollMachinePacketID = 0 - DollMachinePacketID_PACKET_SMGameLinkSucceed DollMachinePacketID = 20000 - DollMachinePacketID_PACKET_SMDollMachinePerate DollMachinePacketID = 20001 - DollMachinePacketID_PACKET_SMDollMachineGrab DollMachinePacketID = 20002 - DollMachinePacketID_PACKET_MSDollMachineGrab DollMachinePacketID = 20003 - DollMachinePacketID_PACKET_MSDollMachineList DollMachinePacketID = 20004 + DollMachinePacketID_PACKET_SMDollMachineZero DollMachinePacketID = 0 + DollMachinePacketID_PACKET_SMGameLinkSucceed DollMachinePacketID = 20000 + DollMachinePacketID_PACKET_SMDollMachinePerate DollMachinePacketID = 20001 + DollMachinePacketID_PACKET_SMDollMachineGrab DollMachinePacketID = 20002 + DollMachinePacketID_PACKET_MSDollMachineList DollMachinePacketID = 20003 + DollMachinePacketID_PACKET_MSUpdateDollMachineStatus DollMachinePacketID = 20004 + DollMachinePacketID_PACKET_MSDollMachineoPerateResult DollMachinePacketID = 20005 + DollMachinePacketID_PACKET_SMGetToken DollMachinePacketID = 20006 + DollMachinePacketID_PACKET_MSSendToken DollMachinePacketID = 20007 ) // Enum value maps for DollMachinePacketID. @@ -39,16 +42,22 @@ var ( 20000: "PACKET_SMGameLinkSucceed", 20001: "PACKET_SMDollMachinePerate", 20002: "PACKET_SMDollMachineGrab", - 20003: "PACKET_MSDollMachineGrab", - 20004: "PACKET_MSDollMachineList", + 20003: "PACKET_MSDollMachineList", + 20004: "PACKET_MSUpdateDollMachineStatus", + 20005: "PACKET_MSDollMachineoPerateResult", + 20006: "PACKET_SMGetToken", + 20007: "PACKET_MSSendToken", } DollMachinePacketID_value = map[string]int32{ - "PACKET_SMDollMachineZero": 0, - "PACKET_SMGameLinkSucceed": 20000, - "PACKET_SMDollMachinePerate": 20001, - "PACKET_SMDollMachineGrab": 20002, - "PACKET_MSDollMachineGrab": 20003, - "PACKET_MSDollMachineList": 20004, + "PACKET_SMDollMachineZero": 0, + "PACKET_SMGameLinkSucceed": 20000, + "PACKET_SMDollMachinePerate": 20001, + "PACKET_SMDollMachineGrab": 20002, + "PACKET_MSDollMachineList": 20003, + "PACKET_MSUpdateDollMachineStatus": 20004, + "PACKET_MSDollMachineoPerateResult": 20005, + "PACKET_SMGetToken": 20006, + "PACKET_MSSendToken": 20007, } ) @@ -80,6 +89,7 @@ func (DollMachinePacketID) EnumDescriptor() ([]byte, []int) { } //通知链接成功 +//PACKET_SMDollMachinePerate type SMGameLinkSucceed struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -119,6 +129,7 @@ func (*SMGameLinkSucceed) Descriptor() ([]byte, []int) { } //操作 +//PACKET_SMDollMachinePerate type SMDollMachineoPerate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -246,19 +257,20 @@ func (x *SMDollMachineGrab) GetSnid() int32 { return 0 } -//返回下抓结果 -type MSDollMachineGrab struct { +//PACKET_MSDollMachineoPerateResult +type MSDollMachineoPerateResult struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识 - Result int32 `protobuf:"varint,3,opt,name=Result,proto3" json:"Result,omitempty"` //1-中奖 其他未中奖 + Result int32 `protobuf:"varint,3,opt,name=Result,proto3" json:"Result,omitempty"` // 1-成功 0-失败 + TypeId int32 `protobuf:"varint,4,opt,name=TypeId,proto3" json:"TypeId,omitempty"` //1 投币 2 下抓结果 } -func (x *MSDollMachineGrab) Reset() { - *x = MSDollMachineGrab{} +func (x *MSDollMachineoPerateResult) Reset() { + *x = MSDollMachineoPerateResult{} if protoimpl.UnsafeEnabled { mi := &file_machine_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -266,13 +278,13 @@ func (x *MSDollMachineGrab) Reset() { } } -func (x *MSDollMachineGrab) String() string { +func (x *MSDollMachineoPerateResult) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MSDollMachineGrab) ProtoMessage() {} +func (*MSDollMachineoPerateResult) ProtoMessage() {} -func (x *MSDollMachineGrab) ProtoReflect() protoreflect.Message { +func (x *MSDollMachineoPerateResult) ProtoReflect() protoreflect.Message { mi := &file_machine_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -284,32 +296,39 @@ func (x *MSDollMachineGrab) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use MSDollMachineGrab.ProtoReflect.Descriptor instead. -func (*MSDollMachineGrab) Descriptor() ([]byte, []int) { +// Deprecated: Use MSDollMachineoPerateResult.ProtoReflect.Descriptor instead. +func (*MSDollMachineoPerateResult) Descriptor() ([]byte, []int) { return file_machine_proto_rawDescGZIP(), []int{3} } -func (x *MSDollMachineGrab) GetSnid() int32 { +func (x *MSDollMachineoPerateResult) GetSnid() int32 { if x != nil { return x.Snid } return 0 } -func (x *MSDollMachineGrab) GetId() int32 { +func (x *MSDollMachineoPerateResult) GetId() int32 { if x != nil { return x.Id } return 0 } -func (x *MSDollMachineGrab) GetResult() int32 { +func (x *MSDollMachineoPerateResult) GetResult() int32 { if x != nil { return x.Result } return 0 } +func (x *MSDollMachineoPerateResult) GetTypeId() int32 { + if x != nil { + return x.TypeId + } + return 0 +} + //返回所有娃娃机连接 type MSDollMachineList struct { state protoimpl.MessageState @@ -413,6 +432,198 @@ func (x *DollMachine) GetVideoAddr() string { return "" } +//更新娃娃机状态 +type MSUpdateDollMachineStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` + Status int32 `protobuf:"varint,2,opt,name=Status,proto3" json:"Status,omitempty"` //1-空闲 0-无法使用 + VideoAddr string `protobuf:"bytes,3,opt,name=VideoAddr,proto3" json:"VideoAddr,omitempty"` +} + +func (x *MSUpdateDollMachineStatus) Reset() { + *x = MSUpdateDollMachineStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_machine_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MSUpdateDollMachineStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MSUpdateDollMachineStatus) ProtoMessage() {} + +func (x *MSUpdateDollMachineStatus) ProtoReflect() protoreflect.Message { + mi := &file_machine_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MSUpdateDollMachineStatus.ProtoReflect.Descriptor instead. +func (*MSUpdateDollMachineStatus) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{6} +} + +func (x *MSUpdateDollMachineStatus) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *MSUpdateDollMachineStatus) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *MSUpdateDollMachineStatus) GetVideoAddr() string { + if x != nil { + return x.VideoAddr + } + return "" +} + +//获取token +type SMGetToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` + AppId int64 `protobuf:"varint,2,opt,name=AppId,proto3" json:"AppId,omitempty"` + ServerSecret string `protobuf:"bytes,3,opt,name=ServerSecret,proto3" json:"ServerSecret,omitempty"` +} + +func (x *SMGetToken) Reset() { + *x = SMGetToken{} + if protoimpl.UnsafeEnabled { + mi := &file_machine_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SMGetToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SMGetToken) ProtoMessage() {} + +func (x *SMGetToken) ProtoReflect() protoreflect.Message { + mi := &file_machine_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SMGetToken.ProtoReflect.Descriptor instead. +func (*SMGetToken) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{7} +} + +func (x *SMGetToken) GetSnid() int32 { + if x != nil { + return x.Snid + } + return 0 +} + +func (x *SMGetToken) GetAppId() int64 { + if x != nil { + return x.AppId + } + return 0 +} + +func (x *SMGetToken) GetServerSecret() string { + if x != nil { + return x.ServerSecret + } + return "" +} + +//返回token +type MSSendToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` + Appid int64 `protobuf:"varint,2,opt,name=Appid,proto3" json:"Appid,omitempty"` + Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` +} + +func (x *MSSendToken) Reset() { + *x = MSSendToken{} + if protoimpl.UnsafeEnabled { + mi := &file_machine_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MSSendToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MSSendToken) ProtoMessage() {} + +func (x *MSSendToken) ProtoReflect() protoreflect.Message { + mi := &file_machine_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MSSendToken.ProtoReflect.Descriptor instead. +func (*MSSendToken) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{8} +} + +func (x *MSSendToken) GetSnid() int32 { + if x != nil { + return x.Snid + } + return 0 +} + +func (x *MSSendToken) GetAppid() int64 { + if x != nil { + return x.Appid + } + return 0 +} + +func (x *MSSendToken) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + var File_machine_proto protoreflect.FileDescriptor var file_machine_proto_rawDesc = []byte{ @@ -429,36 +640,61 @@ var file_machine_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x54, 0x79, 0x70, 0x65, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, - 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x11, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, - 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x22, 0x3d, 0x0a, 0x11, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, - 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, - 0x2e, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x22, 0x3b, 0x0a, 0x0b, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, - 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x2a, - 0xd5, 0x01, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, - 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5a, - 0x65, 0x72, 0x6f, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, - 0x53, 0x4d, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, - 0x64, 0x10, 0xa0, 0x9c, 0x01, 0x12, 0x20, 0x0a, 0x1a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, - 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x10, 0xa1, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, - 0x72, 0x61, 0x62, 0x10, 0xa2, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, - 0x72, 0x61, 0x62, 0x10, 0xa3, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, - 0x69, 0x73, 0x74, 0x10, 0xa4, 0x9c, 0x01, 0x42, 0x27, 0x5a, 0x25, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, - 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x64, 0x22, 0x70, 0x0a, 0x1a, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x6f, 0x50, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, + 0x53, 0x6e, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x54, 0x79, 0x70, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x54, 0x79, + 0x70, 0x65, 0x49, 0x64, 0x22, 0x3d, 0x0a, 0x11, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, + 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, + 0x65, 0x2e, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x22, 0x3b, 0x0a, 0x0b, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, + 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, + 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, + 0x22, 0x61, 0x0a, 0x19, 0x4d, 0x53, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x6c, 0x6c, + 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x0a, + 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, + 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, + 0x64, 0x64, 0x72, 0x22, 0x5a, 0x0a, 0x0a, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x22, + 0x4d, 0x0a, 0x0b, 0x4d, 0x53, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x12, + 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, + 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2a, 0xb9, + 0x02, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, 0x61, + 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5a, 0x65, + 0x72, 0x6f, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, + 0x4d, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, + 0x10, 0xa0, 0x9c, 0x01, 0x12, 0x20, 0x0a, 0x1a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, + 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x10, 0xa1, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72, + 0x61, 0x62, 0x10, 0xa2, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, + 0x73, 0x74, 0x10, 0xa3, 0x9c, 0x01, 0x12, 0x26, 0x0a, 0x20, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x4d, 0x53, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, + 0x68, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x10, 0xa4, 0x9c, 0x01, 0x12, 0x27, + 0x0a, 0x21, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, + 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x6f, 0x50, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x10, 0xa5, 0x9c, 0x01, 0x12, 0x17, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, + 0x54, 0x5f, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa6, 0x9c, 0x01, + 0x12, 0x18, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x53, 0x65, 0x6e, + 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa7, 0x9c, 0x01, 0x42, 0x27, 0x5a, 0x25, 0x6d, 0x6f, + 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, + 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -474,15 +710,18 @@ func file_machine_proto_rawDescGZIP() []byte { } var file_machine_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_machine_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_machine_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_machine_proto_goTypes = []interface{}{ - (DollMachinePacketID)(0), // 0: machine.DollMachinePacketID - (*SMGameLinkSucceed)(nil), // 1: machine.SMGameLinkSucceed - (*SMDollMachineoPerate)(nil), // 2: machine.SMDollMachineoPerate - (*SMDollMachineGrab)(nil), // 3: machine.SMDollMachineGrab - (*MSDollMachineGrab)(nil), // 4: machine.MSDollMachineGrab - (*MSDollMachineList)(nil), // 5: machine.MSDollMachineList - (*DollMachine)(nil), // 6: machine.DollMachine + (DollMachinePacketID)(0), // 0: machine.DollMachinePacketID + (*SMGameLinkSucceed)(nil), // 1: machine.SMGameLinkSucceed + (*SMDollMachineoPerate)(nil), // 2: machine.SMDollMachineoPerate + (*SMDollMachineGrab)(nil), // 3: machine.SMDollMachineGrab + (*MSDollMachineoPerateResult)(nil), // 4: machine.MSDollMachineoPerateResult + (*MSDollMachineList)(nil), // 5: machine.MSDollMachineList + (*DollMachine)(nil), // 6: machine.DollMachine + (*MSUpdateDollMachineStatus)(nil), // 7: machine.MSUpdateDollMachineStatus + (*SMGetToken)(nil), // 8: machine.SMGetToken + (*MSSendToken)(nil), // 9: machine.MSSendToken } var file_machine_proto_depIdxs = []int32{ 6, // 0: machine.MSDollMachineList.data:type_name -> machine.DollMachine @@ -536,7 +775,7 @@ func file_machine_proto_init() { } } file_machine_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MSDollMachineGrab); i { + switch v := v.(*MSDollMachineoPerateResult); i { case 0: return &v.state case 1: @@ -571,6 +810,42 @@ func file_machine_proto_init() { return nil } } + file_machine_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MSUpdateDollMachineStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_machine_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SMGetToken); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_machine_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MSSendToken); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -578,7 +853,7 @@ func file_machine_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_machine_proto_rawDesc, NumEnums: 1, - NumMessages: 6, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/machine/machine.proto b/protocol/machine/machine.proto index 00b6124..472cb4b 100644 --- a/protocol/machine/machine.proto +++ b/protocol/machine/machine.proto @@ -10,14 +10,19 @@ enum DollMachinePacketID { PACKET_SMGameLinkSucceed = 20000; PACKET_SMDollMachinePerate = 20001; PACKET_SMDollMachineGrab = 20002; - PACKET_MSDollMachineGrab = 20003; - PACKET_MSDollMachineList = 20004; + PACKET_MSDollMachineList = 20003; + PACKET_MSUpdateDollMachineStatus = 20004; + PACKET_MSDollMachineoPerateResult = 20005; + PACKET_SMGetToken = 20006; + PACKET_MSSendToken = 20007; } //通知链接成功 +//PACKET_SMDollMachinePerate message SMGameLinkSucceed{ } //操作 +//PACKET_SMDollMachinePerate message SMDollMachineoPerate{ int32 Snid = 1; int32 Id = 2; //娃娃机标识 @@ -31,13 +36,15 @@ message SMDollMachineGrab{ int32 Snid = 3; } -//返回下抓结果 -message MSDollMachineGrab{ +//PACKET_MSDollMachineoPerateResult +message MSDollMachineoPerateResult{ int32 Snid = 1; - int32 Id = 2; //娃娃机标识 - int32 Result = 3;//1-中奖 其他未中奖 + int32 Id = 2; //娃娃机标识 + int32 Result = 3;// 1-成功 0-失败 + int32 TypeId = 4;//1 投币 2 下抓结果 } + //返回所有娃娃机连接 message MSDollMachineList{ repeated DollMachine data = 1; @@ -45,4 +52,22 @@ message MSDollMachineList{ message DollMachine{ int32 Id = 1; string VideoAddr = 2; +} +//更新娃娃机状态 +message MSUpdateDollMachineStatus{ + int32 Id = 1; + int32 Status = 2; //1-空闲 0-无法使用 + string VideoAddr = 3; +} +//获取token +message SMGetToken{ + int32 Snid = 1; + int64 AppId = 2; + string ServerSecret = 3; +} +//返回token +message MSSendToken{ + int32 Snid = 1; + int64 Appid = 2; + string Token = 3; } \ No newline at end of file diff --git a/protocol/webapi/common.pb.go b/protocol/webapi/common.pb.go index a284f6a..bb8e8a7 100644 --- a/protocol/webapi/common.pb.go +++ b/protocol/webapi/common.pb.go @@ -8193,6 +8193,134 @@ func (x *GuideConfig) GetSkip() int32 { return 0 } +//娃娃机配置视频 +// etcd /game/machine_config +type MachineConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Platform string `protobuf:"bytes,1,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台 + Info []*MachineInfo `protobuf:"bytes,2,rep,name=Info,proto3" json:"Info,omitempty"` +} + +func (x *MachineConfig) Reset() { + *x = MachineConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_common_proto_msgTypes[86] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MachineConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MachineConfig) ProtoMessage() {} + +func (x *MachineConfig) ProtoReflect() protoreflect.Message { + mi := &file_common_proto_msgTypes[86] + 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 MachineConfig.ProtoReflect.Descriptor instead. +func (*MachineConfig) Descriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{86} +} + +func (x *MachineConfig) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *MachineConfig) GetInfo() []*MachineInfo { + if x != nil { + return x.Info + } + return nil +} + +type MachineInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MachineId int32 `protobuf:"varint,1,opt,name=MachineId,proto3" json:"MachineId,omitempty"` //娃娃机Id + AppId int64 `protobuf:"varint,2,opt,name=AppId,proto3" json:"AppId,omitempty"` + ServerSecret string `protobuf:"bytes,3,opt,name=ServerSecret,proto3" json:"ServerSecret,omitempty"` + StreamId string `protobuf:"bytes,4,opt,name=StreamId,proto3" json:"StreamId,omitempty"` +} + +func (x *MachineInfo) Reset() { + *x = MachineInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_common_proto_msgTypes[87] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MachineInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MachineInfo) ProtoMessage() {} + +func (x *MachineInfo) ProtoReflect() protoreflect.Message { + mi := &file_common_proto_msgTypes[87] + 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 MachineInfo.ProtoReflect.Descriptor instead. +func (*MachineInfo) Descriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{87} +} + +func (x *MachineInfo) GetMachineId() int32 { + if x != nil { + return x.MachineId + } + return 0 +} + +func (x *MachineInfo) GetAppId() int64 { + if x != nil { + return x.AppId + } + return 0 +} + +func (x *MachineInfo) GetServerSecret() string { + if x != nil { + return x.ServerSecret + } + return "" +} + +func (x *MachineInfo) GetStreamId() string { + if x != nil { + return x.StreamId + } + return "" +} + // etcd /game/match_audience type MatchAudience struct { state protoimpl.MessageState @@ -8207,7 +8335,7 @@ type MatchAudience struct { func (x *MatchAudience) Reset() { *x = MatchAudience{} if protoimpl.UnsafeEnabled { - mi := &file_common_proto_msgTypes[86] + mi := &file_common_proto_msgTypes[88] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8220,7 +8348,7 @@ func (x *MatchAudience) String() string { func (*MatchAudience) ProtoMessage() {} func (x *MatchAudience) ProtoReflect() protoreflect.Message { - mi := &file_common_proto_msgTypes[86] + mi := &file_common_proto_msgTypes[88] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8233,7 +8361,7 @@ func (x *MatchAudience) ProtoReflect() protoreflect.Message { // Deprecated: Use MatchAudience.ProtoReflect.Descriptor instead. func (*MatchAudience) Descriptor() ([]byte, []int) { - return file_common_proto_rawDescGZIP(), []int{86} + return file_common_proto_rawDescGZIP(), []int{88} } func (x *MatchAudience) GetPlatform() string { @@ -8271,7 +8399,7 @@ type SpiritConfig struct { func (x *SpiritConfig) Reset() { *x = SpiritConfig{} if protoimpl.UnsafeEnabled { - mi := &file_common_proto_msgTypes[87] + mi := &file_common_proto_msgTypes[89] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8284,7 +8412,7 @@ func (x *SpiritConfig) String() string { func (*SpiritConfig) ProtoMessage() {} func (x *SpiritConfig) ProtoReflect() protoreflect.Message { - mi := &file_common_proto_msgTypes[87] + mi := &file_common_proto_msgTypes[89] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8297,7 +8425,7 @@ func (x *SpiritConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use SpiritConfig.ProtoReflect.Descriptor instead. func (*SpiritConfig) Descriptor() ([]byte, []int) { - return file_common_proto_rawDescGZIP(), []int{87} + return file_common_proto_rawDescGZIP(), []int{89} } func (x *SpiritConfig) GetPlatform() string { @@ -8337,7 +8465,7 @@ type RoomType struct { func (x *RoomType) Reset() { *x = RoomType{} if protoimpl.UnsafeEnabled { - mi := &file_common_proto_msgTypes[88] + mi := &file_common_proto_msgTypes[90] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8350,7 +8478,7 @@ func (x *RoomType) String() string { func (*RoomType) ProtoMessage() {} func (x *RoomType) ProtoReflect() protoreflect.Message { - mi := &file_common_proto_msgTypes[88] + mi := &file_common_proto_msgTypes[90] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8363,7 +8491,7 @@ func (x *RoomType) ProtoReflect() protoreflect.Message { // Deprecated: Use RoomType.ProtoReflect.Descriptor instead. func (*RoomType) Descriptor() ([]byte, []int) { - return file_common_proto_rawDescGZIP(), []int{88} + return file_common_proto_rawDescGZIP(), []int{90} } func (x *RoomType) GetPlatform() string { @@ -8428,7 +8556,7 @@ type RoomConfig struct { func (x *RoomConfig) Reset() { *x = RoomConfig{} if protoimpl.UnsafeEnabled { - mi := &file_common_proto_msgTypes[89] + mi := &file_common_proto_msgTypes[91] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8441,7 +8569,7 @@ func (x *RoomConfig) String() string { func (*RoomConfig) ProtoMessage() {} func (x *RoomConfig) ProtoReflect() protoreflect.Message { - mi := &file_common_proto_msgTypes[89] + mi := &file_common_proto_msgTypes[91] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8454,7 +8582,7 @@ func (x *RoomConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use RoomConfig.ProtoReflect.Descriptor instead. func (*RoomConfig) Descriptor() ([]byte, []int) { - return file_common_proto_rawDescGZIP(), []int{89} + return file_common_proto_rawDescGZIP(), []int{91} } func (x *RoomConfig) GetPlatform() string { @@ -9866,56 +9994,70 @@ var file_common_proto_rawDesc = []byte{ 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6b, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x04, 0x53, 0x6b, 0x69, 0x70, 0x22, 0x4f, 0x0a, 0x0d, 0x4d, 0x61, 0x74, 0x63, 0x68, - 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, + 0x05, 0x52, 0x04, 0x53, 0x6b, 0x69, 0x70, 0x22, 0x54, 0x0a, 0x0d, 0x4d, 0x61, 0x63, 0x68, 0x69, + 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, - 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x54, 0x73, 0x22, 0x4c, 0x0a, 0x0c, 0x53, 0x70, 0x69, 0x72, - 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, - 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, - 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x02, 0x4f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x55, 0x72, 0x6c, 0x22, 0x72, 0x0a, 0x08, 0x52, 0x6f, 0x6f, 0x6d, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, + 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x81, 0x01, + 0x0a, 0x0b, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, + 0x09, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x09, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, + 0x70, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49, + 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, + 0x64, 0x22, 0x4f, 0x0a, 0x0d, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, + 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x12, + 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, + 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, + 0x54, 0x73, 0x22, 0x4c, 0x0a, 0x0c, 0x53, 0x70, 0x69, 0x72, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, - 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, - 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, - 0x4f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x53, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x22, 0xcc, 0x03, 0x0a, 0x0a, 0x52, - 0x6f, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, - 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, - 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x6f, 0x6f, - 0x6d, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x52, 0x6f, 0x6f, - 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x02, 0x4f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x12, 0x24, 0x0a, - 0x04, 0x43, 0x6f, 0x73, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x77, 0x65, - 0x62, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x43, - 0x6f, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x08, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x74, 0x65, - 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x24, 0x0a, - 0x0d, 0x4f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x09, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x4f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x65, 0x65, 0x49, - 0x64, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x65, - 0x65, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x0b, 0x20, 0x03, - 0x28, 0x05, 0x52, 0x05, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x4e, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x05, 0x52, 0x09, 0x50, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x4e, 0x75, 0x6d, 0x12, 0x22, 0x0a, 0x0c, 0x4e, 0x65, 0x65, 0x64, 0x50, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x4e, - 0x65, 0x65, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x43, - 0x6f, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x43, - 0x6f, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x6f, 0x69, 0x63, 0x65, - 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x56, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x55, 0x52, 0x49, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x55, 0x52, 0x49, 0x42, 0x26, 0x5a, 0x24, 0x6d, 0x6f, 0x6e, - 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x77, 0x65, 0x62, 0x61, 0x70, - 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x4f, 0x6e, 0x12, 0x10, + 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x72, 0x6c, + 0x22, 0x72, 0x0a, 0x08, 0x52, 0x6f, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, + 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, + 0x4f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x4f, 0x6e, 0x12, 0x16, 0x0a, 0x06, + 0x53, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x6f, + 0x72, 0x74, 0x49, 0x64, 0x22, 0xcc, 0x03, 0x0a, 0x0a, 0x52, 0x6f, 0x6f, 0x6d, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, + 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x6f, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x52, 0x6f, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x4f, 0x6e, 0x12, + 0x16, 0x0a, 0x06, 0x53, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x53, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x04, 0x43, 0x6f, 0x73, 0x74, 0x18, + 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x49, + 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x43, 0x6f, 0x73, 0x74, 0x12, 0x28, 0x0a, + 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x4f, 0x6e, 0x43, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, + 0x4f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, + 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x65, 0x65, 0x49, 0x64, 0x18, 0x0a, 0x20, 0x03, 0x28, + 0x05, 0x52, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x14, 0x0a, + 0x05, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x52, 0x6f, + 0x75, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4e, 0x75, 0x6d, + 0x18, 0x0c, 0x20, 0x03, 0x28, 0x05, 0x52, 0x09, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4e, 0x75, + 0x6d, 0x12, 0x22, 0x0a, 0x0c, 0x4e, 0x65, 0x65, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x4e, 0x65, 0x65, 0x64, 0x50, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6f, 0x73, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x43, 0x6f, 0x73, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x56, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x49, 0x6d, 0x61, 0x67, 0x65, + 0x55, 0x52, 0x49, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x49, 0x6d, 0x61, 0x67, 0x65, + 0x55, 0x52, 0x49, 0x42, 0x26, 0x5a, 0x24, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, + 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -9930,7 +10072,7 @@ func file_common_proto_rawDescGZIP() []byte { return file_common_proto_rawDescData } -var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 100) +var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 102) var file_common_proto_goTypes = []interface{}{ (*MysqlDbSetting)(nil), // 0: webapi.MysqlDbSetting (*MongoDbSetting)(nil), // 1: webapi.MongoDbSetting @@ -10018,36 +10160,38 @@ var file_common_proto_goTypes = []interface{}{ (*AwardLogInfo)(nil), // 83: webapi.AwardLogInfo (*AnnouncerLogInfo)(nil), // 84: webapi.AnnouncerLogInfo (*GuideConfig)(nil), // 85: webapi.GuideConfig - (*MatchAudience)(nil), // 86: webapi.MatchAudience - (*SpiritConfig)(nil), // 87: webapi.SpiritConfig - (*RoomType)(nil), // 88: webapi.RoomType - (*RoomConfig)(nil), // 89: webapi.RoomConfig - nil, // 90: webapi.Platform.BindTelRewardEntry - nil, // 91: webapi.PlayerData.RankScoreEntry - nil, // 92: webapi.ItemShop.AwardEntry - nil, // 93: webapi.VIPcfg.AwardEntry - nil, // 94: webapi.VIPcfg.Privilege1Entry - nil, // 95: webapi.VIPcfg.Privilege7Entry - nil, // 96: webapi.VIPcfg.Privilege9Entry - nil, // 97: webapi.ActInviteConfig.PayScoreEntry - nil, // 98: webapi.SkinLevel.UpItemEntry - nil, // 99: webapi.SkinItem.UnlockParamEntry - (*server.DB_GameFree)(nil), // 100: server.DB_GameFree - (*server.DB_GameItem)(nil), // 101: server.DB_GameItem + (*MachineConfig)(nil), // 86: webapi.MachineConfig + (*MachineInfo)(nil), // 87: webapi.MachineInfo + (*MatchAudience)(nil), // 88: webapi.MatchAudience + (*SpiritConfig)(nil), // 89: webapi.SpiritConfig + (*RoomType)(nil), // 90: webapi.RoomType + (*RoomConfig)(nil), // 91: webapi.RoomConfig + nil, // 92: webapi.Platform.BindTelRewardEntry + nil, // 93: webapi.PlayerData.RankScoreEntry + nil, // 94: webapi.ItemShop.AwardEntry + nil, // 95: webapi.VIPcfg.AwardEntry + nil, // 96: webapi.VIPcfg.Privilege1Entry + nil, // 97: webapi.VIPcfg.Privilege7Entry + nil, // 98: webapi.VIPcfg.Privilege9Entry + nil, // 99: webapi.ActInviteConfig.PayScoreEntry + nil, // 100: webapi.SkinLevel.UpItemEntry + nil, // 101: webapi.SkinItem.UnlockParamEntry + (*server.DB_GameFree)(nil), // 102: server.DB_GameFree + (*server.DB_GameItem)(nil), // 103: server.DB_GameItem } var file_common_proto_depIdxs = []int32{ 2, // 0: webapi.Platform.Leaderboard:type_name -> webapi.RankSwitch 3, // 1: webapi.Platform.ClubConfig:type_name -> webapi.ClubConfig 4, // 2: webapi.Platform.ThirdGameMerchant:type_name -> webapi.ThirdGame - 90, // 3: webapi.Platform.BindTelReward:type_name -> webapi.Platform.BindTelRewardEntry + 92, // 3: webapi.Platform.BindTelReward:type_name -> webapi.Platform.BindTelRewardEntry 6, // 4: webapi.GameConfigGlobal.GameStatus:type_name -> webapi.GameStatus - 100, // 5: webapi.GameFree.DbGameFree:type_name -> server.DB_GameFree + 102, // 5: webapi.GameFree.DbGameFree:type_name -> server.DB_GameFree 8, // 6: webapi.PlatformGameConfig.DbGameFrees:type_name -> webapi.GameFree 0, // 7: webapi.PlatformDbConfig.Mysql:type_name -> webapi.MysqlDbSetting 1, // 8: webapi.PlatformDbConfig.MongoDb:type_name -> webapi.MongoDbSetting 1, // 9: webapi.PlatformDbConfig.MongoDbLog:type_name -> webapi.MongoDbSetting - 100, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree - 91, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry + 102, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree + 93, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry 32, // 12: webapi.PlayerData.Items:type_name -> webapi.ItemInfo 14, // 13: webapi.PlayerData.RoleUnlockList:type_name -> webapi.ModInfo 14, // 14: webapi.PlayerData.PetUnlockList:type_name -> webapi.ModInfo @@ -10060,7 +10204,7 @@ var file_common_proto_depIdxs = []int32{ 32, // 21: webapi.ExchangeShop.Items:type_name -> webapi.ItemInfo 25, // 22: webapi.ExchangeShopList.List:type_name -> webapi.ExchangeShop 29, // 23: webapi.ExchangeShopList.Weight:type_name -> webapi.ShopWeight - 92, // 24: webapi.ItemShop.Award:type_name -> webapi.ItemShop.AwardEntry + 94, // 24: webapi.ItemShop.Award:type_name -> webapi.ItemShop.AwardEntry 30, // 25: webapi.ItemShopList.List:type_name -> webapi.ItemShop 32, // 26: webapi.MatchInfoAward.ItemId:type_name -> webapi.ItemInfo 33, // 27: webapi.GameMatchDate.Award:type_name -> webapi.MatchInfoAward @@ -10081,14 +10225,14 @@ var file_common_proto_depIdxs = []int32{ 38, // 42: webapi.WelfareSpree.Item:type_name -> webapi.WelfareDate 48, // 43: webapi.WelfareFirstPayDataList.List:type_name -> webapi.WelfareSpree 48, // 44: webapi.WelfareContinuousPayDataList.List:type_name -> webapi.WelfareSpree - 93, // 45: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry - 94, // 46: webapi.VIPcfg.Privilege1:type_name -> webapi.VIPcfg.Privilege1Entry - 95, // 47: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry - 96, // 48: webapi.VIPcfg.Privilege9:type_name -> webapi.VIPcfg.Privilege9Entry + 95, // 45: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry + 96, // 46: webapi.VIPcfg.Privilege1:type_name -> webapi.VIPcfg.Privilege1Entry + 97, // 47: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry + 98, // 48: webapi.VIPcfg.Privilege9:type_name -> webapi.VIPcfg.Privilege9Entry 51, // 49: webapi.VIPcfgDataList.List:type_name -> webapi.VIPcfg 38, // 50: webapi.ChessRankConfig.Item:type_name -> webapi.WelfareDate 55, // 51: webapi.ChessRankcfgData.Datas:type_name -> webapi.ChessRankConfig - 97, // 52: webapi.ActInviteConfig.PayScore:type_name -> webapi.ActInviteConfig.PayScoreEntry + 99, // 52: webapi.ActInviteConfig.PayScore:type_name -> webapi.ActInviteConfig.PayScoreEntry 62, // 53: webapi.ActInviteConfig.Awards1:type_name -> webapi.RankAward 62, // 54: webapi.ActInviteConfig.Awards2:type_name -> webapi.RankAward 62, // 55: webapi.ActInviteConfig.Awards3:type_name -> webapi.RankAward @@ -10105,24 +10249,25 @@ var file_common_proto_depIdxs = []int32{ 69, // 66: webapi.DiamondLotteryData.Info:type_name -> webapi.DiamondLotteryInfo 70, // 67: webapi.DiamondLotteryData.Players:type_name -> webapi.DiamondLotteryPlayers 72, // 68: webapi.DiamondLotteryConfig.LotteryData:type_name -> webapi.DiamondLotteryData - 101, // 69: webapi.ItemConfig.Items:type_name -> server.DB_GameItem + 103, // 69: webapi.ItemConfig.Items:type_name -> server.DB_GameItem 32, // 70: webapi.RankAwardInfo.Item:type_name -> webapi.ItemInfo 75, // 71: webapi.RankTypeInfo.Award:type_name -> webapi.RankAwardInfo 76, // 72: webapi.RankTypeConfig.Info:type_name -> webapi.RankTypeInfo - 98, // 73: webapi.SkinLevel.UpItem:type_name -> webapi.SkinLevel.UpItemEntry - 99, // 74: webapi.SkinItem.UnlockParam:type_name -> webapi.SkinItem.UnlockParamEntry + 100, // 73: webapi.SkinLevel.UpItem:type_name -> webapi.SkinLevel.UpItemEntry + 101, // 74: webapi.SkinItem.UnlockParam:type_name -> webapi.SkinItem.UnlockParamEntry 78, // 75: webapi.SkinItem.Levels:type_name -> webapi.SkinLevel 79, // 76: webapi.SkinConfig.Items:type_name -> webapi.SkinItem 82, // 77: webapi.AwardLogConfig.AwardLog:type_name -> webapi.AwardLogData 84, // 78: webapi.AwardLogConfig.AnnouncerLog:type_name -> webapi.AnnouncerLogInfo 83, // 79: webapi.AwardLogData.AwardLog:type_name -> webapi.AwardLogInfo - 32, // 80: webapi.RoomConfig.Cost:type_name -> webapi.ItemInfo - 32, // 81: webapi.RoomConfig.Reward:type_name -> webapi.ItemInfo - 82, // [82:82] is the sub-list for method output_type - 82, // [82:82] is the sub-list for method input_type - 82, // [82:82] is the sub-list for extension type_name - 82, // [82:82] is the sub-list for extension extendee - 0, // [0:82] is the sub-list for field type_name + 87, // 80: webapi.MachineConfig.Info:type_name -> webapi.MachineInfo + 32, // 81: webapi.RoomConfig.Cost:type_name -> webapi.ItemInfo + 32, // 82: webapi.RoomConfig.Reward:type_name -> webapi.ItemInfo + 83, // [83:83] is the sub-list for method output_type + 83, // [83:83] is the sub-list for method input_type + 83, // [83:83] is the sub-list for extension type_name + 83, // [83:83] is the sub-list for extension extendee + 0, // [0:83] is the sub-list for field type_name } func init() { file_common_proto_init() } @@ -11164,7 +11309,7 @@ func file_common_proto_init() { } } file_common_proto_msgTypes[86].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MatchAudience); i { + switch v := v.(*MachineConfig); i { case 0: return &v.state case 1: @@ -11176,7 +11321,7 @@ func file_common_proto_init() { } } file_common_proto_msgTypes[87].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SpiritConfig); i { + switch v := v.(*MachineInfo); i { case 0: return &v.state case 1: @@ -11188,7 +11333,7 @@ func file_common_proto_init() { } } file_common_proto_msgTypes[88].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RoomType); i { + switch v := v.(*MatchAudience); i { case 0: return &v.state case 1: @@ -11200,6 +11345,30 @@ func file_common_proto_init() { } } file_common_proto_msgTypes[89].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SpiritConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_common_proto_msgTypes[90].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RoomType); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_common_proto_msgTypes[91].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RoomConfig); i { case 0: return &v.state @@ -11218,7 +11387,7 @@ func file_common_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_common_proto_rawDesc, NumEnums: 0, - NumMessages: 100, + NumMessages: 102, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/webapi/common.proto b/protocol/webapi/common.proto index 81526a1..66d4c4b 100644 --- a/protocol/webapi/common.proto +++ b/protocol/webapi/common.proto @@ -899,6 +899,18 @@ message GuideConfig { int32 Skip = 3; // 引导跳过开关 1开启 2关闭 } +//娃娃机配置视频 +// etcd /game/machine_config +message MachineConfig{ + string Platform = 1; // 平台 + repeated MachineInfo Info = 2; +} +message MachineInfo{ + int32 MachineId = 1; //娃娃机Id + int64 AppId = 2; + string ServerSecret = 3; + string StreamId = 4; +} // etcd /game/match_audience message MatchAudience { string Platform = 1; // 平台 diff --git a/protocol/webapi/webapi.proto b/protocol/webapi/webapi.proto index 41d749d..40464af 100644 --- a/protocol/webapi/webapi.proto +++ b/protocol/webapi/webapi.proto @@ -990,4 +990,4 @@ message SARoomInfo{ string Msg = 2; //错误信息 repeated int32 SnId = 3; // 玩家id repeated RoundInfo List = 4; // 每局结算 -} \ No newline at end of file +} diff --git a/public b/public index fd8bef9..d789cca 160000 --- a/public +++ b/public @@ -1 +1 @@ -Subproject commit fd8bef907ea15489504529da70f72038444b54e0 +Subproject commit d789cca81a36ddbaf30e5414b6c4fe530e0631f6 diff --git a/worldsrv/action_game.go b/worldsrv/action_game.go index d53bca5..7785ce8 100644 --- a/worldsrv/action_game.go +++ b/worldsrv/action_game.go @@ -1319,6 +1319,10 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{ return nil } + if cfg.GetCostType() == 1 { + sp.CostPayment(scene, p) + } + pack = &gamehall.SCCreatePrivateRoom{ OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game, GameFreeId: msg.GetGameFreeId(), @@ -1348,6 +1352,8 @@ func CSGetPrivateRoomListHandler(s *netlib.Session, packetId int, data interface return nil } + PlayerNotifySingle.AddTime(p.SnId, common.NotifyPrivateRoomList, time.Second*15) + pack := &gamehall.SCGetPrivateRoomList{} scenes := SceneMgrSingleton.FindRoomList(&FindRoomParam{ Platform: p.Platform, diff --git a/worldsrv/bagmgr.go b/worldsrv/bagmgr.go index 497c69d..acb0556 100644 --- a/worldsrv/bagmgr.go +++ b/worldsrv/bagmgr.go @@ -450,7 +450,7 @@ func (this *BagMgr) AddItem(p *Player, itemId, itemNum int64, add int64, gainWay return this.AddItems(p, []*Item{{ItemId: int32(itemId), ItemNum: itemNum}}, add, gainWay, operator, remark, gameId, gameFreeId, noLog, params...) } -func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Item, gainWay int32, operator, remark string, +func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*model.Item, gainWay int32, operator, remark string, gameId, gameFreeId int64, noLog bool, callback func(err error)) { var findPlayer *model.PlayerBaseInfo task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { diff --git a/worldsrv/hundredscenemgr.go b/worldsrv/hundredscenemgr.go index 2766caa..70c59e0 100644 --- a/worldsrv/hundredscenemgr.go +++ b/worldsrv/hundredscenemgr.go @@ -346,7 +346,7 @@ func (this *HundredSceneMgr) ModuleName() string { } func (this *HundredSceneMgr) Init() { - this.TryCreateRoom() + //this.TryCreateRoom() } func (this *HundredSceneMgr) Update() { diff --git a/worldsrv/playernotify.go b/worldsrv/playernotify.go index 7999b8e..e944769 100644 --- a/worldsrv/playernotify.go +++ b/worldsrv/playernotify.go @@ -3,6 +3,8 @@ package main import ( "time" + "mongo.games.com/goserver/core/logger" + "mongo.games.com/game/common" ) @@ -76,4 +78,5 @@ func (p *PlayerNotify) GetPlayers(tp common.NotifyType) []int32 { func (p *PlayerNotify) SendToClient(tp common.NotifyType, packetId int, pack interface{}) { ids := p.GetPlayers(tp) PlayerMgrSington.BroadcastMessageToTarget(ids, packetId, pack) + logger.Logger.Tracef("PlayerNotify SendToClient tp:%v ids:%v", tp, ids) } diff --git a/worldsrv/scene.go b/worldsrv/scene.go index bd5e0eb..333f90e 100644 --- a/worldsrv/scene.go +++ b/worldsrv/scene.go @@ -135,6 +135,12 @@ func NewScene(args *CreateSceneParam) *Scene { } } } + if s.MatchParam == nil { + s.MatchParam = new(serverproto.MatchParam) + } + if s.CustomParam == nil { + s.CustomParam = new(serverproto.CustomParam) + } s.sp.OnStart(s) return s } @@ -422,6 +428,7 @@ func (this *Scene) PlayerEnter(p *Player, pos int, ischangeroom bool) bool { } this.gameSess.AddPlayer(p) FirePlayerEnterScene(p, this) + this.sp.OnPlayerEnter(this, p) return true } @@ -507,6 +514,8 @@ func (this *Scene) lastScene(p *Player) { } func (this *Scene) DelPlayer(p *Player) bool { + FirePlayerLeaveScene(p, this) + this.sp.OnPlayerLeave(this, p) if p.scene != this { roomId := 0 if p.scene != nil { diff --git a/worldsrv/scenemgr.go b/worldsrv/scenemgr.go index 4938b49..42c33e6 100644 --- a/worldsrv/scenemgr.go +++ b/worldsrv/scenemgr.go @@ -85,7 +85,7 @@ func (m *SceneMgr) GenOneMatchSceneId() int { func (m *SceneMgr) GenPassword() string { for i := 0; i < 100; i++ { - s := strconv.Itoa(common.RandInt(10000, 100000)) + s := strconv.Itoa(common.RandInt(100000, 1000000)) if _, ok := m.password[s]; !ok { m.password[s] = struct{}{} return s @@ -155,7 +155,7 @@ func (m *SceneMgr) GetScenesByGameFreeId(gameFreeId int32) []*Scene { func (m *SceneMgr) GetMatchRoom(sortId int64) []*Scene { var scenes []*Scene for _, value := range m.scenes { - if value.MatchSortId == sortId { + if value.GetMatchSortId() == sortId { s := m.GetScene(value.sceneId) if s != nil { scenes = append(scenes, value) diff --git a/worldsrv/scenepolicydata.go b/worldsrv/scenepolicydata.go index 015e7b0..2aa2754 100644 --- a/worldsrv/scenepolicydata.go +++ b/worldsrv/scenepolicydata.go @@ -2,6 +2,8 @@ package main import ( "math" + "mongo.games.com/goserver/core/logger" + "mongo.games.com/game/common" "mongo.games.com/game/model" hallproto "mongo.games.com/game/protocol/gamehall" @@ -29,6 +31,10 @@ func (spd *ScenePolicyData) OnStart(s *Scene) { // 场景关闭事件 func (spd *ScenePolicyData) OnStop(s *Scene) { s.NotifyPrivateRoom(common.ListDel) + // 房主付费,房间没有玩就解散了,返还房主建房费用 + if s.IsCustom() && s.GetCostType() == 1 && s.currRound == 0 { + spd.GiveCostPayment(s, s.creator) + } } // 场景心跳事件 @@ -60,8 +66,10 @@ func (spd *ScenePolicyData) OnSceneState(s *Scene, state int) { case common.SceneStateStart: s.NotifyPrivateRoom(common.ListModify) if s.IsCustom() { - for _, v := range s.players { - spd.CostPayment(s, v) + if s.GetCostType() == 2 { + for _, v := range s.players { + spd.CostPayment(s, v) + } } } @@ -85,13 +93,13 @@ func (spd *ScenePolicyData) CanEnter(s *Scene, p *Player) int { return 0 } -func (spd *ScenePolicyData) costEnough(costType, playerNum int, roomConfig *webapi.RoomConfig, p *Player, f func(items []*model.Item)) bool { +func (spd *ScenePolicyData) costEnough(costType, playerNum int, roomConfig *webapi.RoomConfig, snid int32, f func(items []*model.Item)) bool { isEnough := true var items []*model.Item if costType == 1 { // 房主 for _, v := range roomConfig.GetCost() { - if item := BagMgrSingleton.GetItem(p.SnId, v.GetItemId()); item == nil || item.ItemNum < v.GetItemNum() { + if item := BagMgrSingleton.GetItem(snid, v.GetItemId()); item == nil || item.ItemNum < v.GetItemNum() { isEnough = false break } else { @@ -105,7 +113,7 @@ func (spd *ScenePolicyData) costEnough(costType, playerNum int, roomConfig *weba // AA for _, v := range roomConfig.GetCost() { n := int64(math.Ceil(float64(v.GetItemNum()) / float64(playerNum))) - if item := BagMgrSingleton.GetItem(p.SnId, v.GetItemId()); item == nil || item.ItemNum < n { + if item := BagMgrSingleton.GetItem(snid, v.GetItemId()); item == nil || item.ItemNum < n { isEnough = false break } else { @@ -126,7 +134,7 @@ func (spd *ScenePolicyData) CostEnough(costType, playerNum int, roomConfig *weba if roomConfig == nil { return false } - return spd.costEnough(costType, playerNum, roomConfig, p, func(items []*model.Item) {}) + return spd.costEnough(costType, playerNum, roomConfig, p.SnId, func(items []*model.Item) {}) } func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool { @@ -134,7 +142,10 @@ func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool { if roomConfig == nil { return false } - return spd.costEnough(int(roomConfig.GetCostType()), s.playerNum, roomConfig, p, func(items []*model.Item) { + return spd.costEnough(int(roomConfig.GetCostType()), s.playerNum, roomConfig, p.SnId, func(items []*model.Item) { + for _, v := range items { + v.ItemNum = -v.ItemNum + } BagMgrSingleton.AddItemsV2(&model.AddItemParam{ P: p.PlayerData, Change: items, @@ -148,6 +159,47 @@ func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool { }) } +// GiveCostPayment 退房费 +func (spd *ScenePolicyData) GiveCostPayment(s *Scene, snid int32) bool { + roomConfig := PlatformMgrSingleton.GetConfig(s.limitPlatform.IdStr).RoomConfig[s.GetRoomConfigId()] + if roomConfig == nil { + return false + } + + if roomConfig.GetCostType() != 1 { // 只有房主付费才有返还 + return false + } + + var items []*model.Item + for _, v := range roomConfig.GetCost() { + items = append(items, &model.Item{ + ItemId: v.GetItemId(), + ItemNum: v.GetItemNum(), + }) + } + + p := PlayerMgrSington.GetPlayerBySnId(snid) + if p != nil { + BagMgrSingleton.AddItemsV2(&model.AddItemParam{ + P: p.PlayerData, + Change: items, + GainWay: common.GainWayRoomCost, + Operator: "system", + Remark: "竞技场房间费用返还", + GameId: int64(s.gameId), + GameFreeId: int64(s.dbGameFree.GetId()), + NoLog: false, + RoomConfigId: roomConfig.GetId(), + }) + } else { + BagMgrSingleton.AddItemsOffline(s.limitPlatform.IdStr, snid, items, common.GainWayRoomCost, "system", + "竞技场费用返还", int64(s.gameId), int64(s.dbGameFree.GetId()), false, func(err error) { + logger.Logger.Errorf("竞技场房间费用返还失败, err: %v", err) + }) + } + return false +} + func (spd *ScenePolicyData) GetBetState() int32 { return spd.BetState } diff --git a/worldsrv/shopmgr.go b/worldsrv/shopmgr.go index 5cce9b1..a296bee 100644 --- a/worldsrv/shopmgr.go +++ b/worldsrv/shopmgr.go @@ -63,6 +63,8 @@ const ( ShopTypeCoin = iota + 1 // 金币 ShopTypeDiamond // 钻石 ShopTypeItem // 道具 + ShopTypeFangKa // 房卡 + ShopTypeMax ) // 兑换商品状态 @@ -539,10 +541,10 @@ func (this *ShopMgr) shopAddItem(p *Player, shopInfo *model.ShopInfo, vipShopId // createOrder 保存购买记录 func (this *ShopMgr) createOrder(p *Player, shopInfo *model.ShopInfo, costNum int64, amount [3]int32) { - if shopInfo.Type < ShopTypeCoin && shopInfo.Type > ShopTypeItem { - logger.Logger.Errorf("createOrder err: type = %v", shopInfo.Type) - return - } + //if shopInfo.Type < ShopTypeCoin && shopInfo.Type >= ShopTypeMax { + // logger.Logger.Errorf("createOrder err: type = %v", shopInfo.Type) + // return + //} task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { dbShop := model.NewDbShop(p.Platform, shopInfo.Page, amount[:], "sys", 0, shopInfo.ConstType, int32(costNum), @@ -1228,17 +1230,15 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any, amount[ShopTypeDiamond-1] = int32(addTotal) var itemInfo []model.ItemInfo var webItemInfo []*webapi_proto.ItemInfo - if shopInfo.AddItemInfo != nil { - for _, info := range shopInfo.AddItemInfo { - itemInfo = append(itemInfo, model.ItemInfo{ - ItemId: info.ItemId, - ItemNum: int64(info.ItemNum), - }) - webItemInfo = append(webItemInfo, &webapi_proto.ItemInfo{ - ItemId: info.ItemId, - ItemNum: info.ItemNum, - }) - } + for _, info := range shopInfo.GetItems() { + itemInfo = append(itemInfo, model.ItemInfo{ + ItemId: info.ItemId, + ItemNum: info.ItemNum, + }) + webItemInfo = append(webItemInfo, &webapi_proto.ItemInfo{ + ItemId: info.ItemId, + ItemNum: info.ItemNum, + }) } dbShop = this.NewDbShop(p, shopInfo.Page, amount[:], ShopConsumeMoney, costNum, diff --git a/worldsrv/trascate_webapi.go b/worldsrv/trascate_webapi.go index 7106457..454fedd 100644 --- a/worldsrv/trascate_webapi.go +++ b/worldsrv/trascate_webapi.go @@ -3375,19 +3375,25 @@ func init() { } addvcoin := msg.NeedNum jPrice := msg.JPrice - var items []*Item + var items []*model.Item //V卡 if addvcoin > 0 { - items = append(items, &Item{ItemId: common.ItemIDVCard, ItemNum: int64(addvcoin)}) + items = append(items, &model.Item{ItemId: common.ItemIDVCard, ItemNum: int64(addvcoin)}) } //金券 if jPrice > 0 { - items = append(items, &Item{ItemId: common.ItemIDJCard, ItemNum: int64(jPrice)}) + items = append(items, &model.Item{ItemId: common.ItemIDJCard, ItemNum: int64(jPrice)}) } remark := fmt.Sprintf("兑换撤单 %v-%v", msg.GoodsId, msg.Name) if player != nil { // 在线 - if _, code, _ := BagMgrSingleton.AddItems(player, items, 0, common.GainWay_Exchange, "system", remark, 0, 0, false); code != bag.OpResultCode_OPRC_Sucess { // 领取失败 + if _, code, _ := BagMgrSingleton.AddItemsV2(&model.AddItemParam{ + P: player.PlayerData, + Change: items, + GainWay: common.GainWay_Exchange, + Operator: "system", + Remark: remark, + }); code != bag.OpResultCode_OPRC_Sucess { // 领取失败 logger.Logger.Errorf("UpExchangeStatus AddItems err", code) pack.Msg = "AddItems err" return common.ResponseTag_ParamError, pack @@ -3744,9 +3750,9 @@ func init() { pack.Msg = "参数错误" return common.ResponseTag_ParamError, pack } - var items []*Item + var items []*model.Item for _, info := range msg.ItemInfo { - items = append(items, &Item{ + items = append(items, &model.Item{ ItemId: info.ItemId, // 物品id ItemNum: info.ItemNum, // 数量 ObtainTime: time.Now().Unix(), @@ -3755,7 +3761,13 @@ func init() { p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) if p != nil { //获取道具Id - BagMgrSingleton.AddItems(p, items, 0, msg.GetTypeId(), "system", msg.GetRemark(), 0, 0, false) + BagMgrSingleton.AddItemsV2(&model.AddItemParam{ + P: p.PlayerData, + Change: items, + GainWay: msg.GetTypeId(), + Operator: "system", + Remark: msg.GetRemark(), + }) pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "AddItem success" return common.ResponseTag_Ok, pack