diff --git a/gamesrv/action/action_machine.go b/gamesrv/action/action_machine.go index 4f2f1d5..c577f4e 100644 --- a/gamesrv/action/action_machine.go +++ b/gamesrv/action/action_machine.go @@ -13,7 +13,7 @@ var MachineMapLock = sync.Mutex{} type DollMachine struct { Id int MachineStatus int32 //娃娃机链接状态 0:离线 1:在线 - Status bool //是否空闲 + Status bool //标记是否被占用 VideoAddr string } diff --git a/gamesrv/clawdoll/action_clawdoll.go b/gamesrv/clawdoll/action_clawdoll.go index 2340d03..6cd153c 100644 --- a/gamesrv/clawdoll/action_clawdoll.go +++ b/gamesrv/clawdoll/action_clawdoll.go @@ -69,8 +69,69 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data } 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 msg, 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 + pack.AppId = msg.Appid + pack.ServerSecret = msg.ServerSecret + scene := p.GetScene() + if scene == nil { + return nil + } + sceneEx, ok := scene.ExtraData.(*SceneEx) + if !ok { + return nil + } + 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.GetPlayer(int64(msg.Snid)) + if p == nil { + logger.Logger.Warn("MSSendTokenHandler p == nil") + return nil + } + pack := &clawdoll.SCCLAWDOLLSendToken{ + Token: token, + } + p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_SENDTOKEN), pack) + } + return nil +} func init() { common.RegisterHandler(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP), &CSPlayerOpHandler{}) netlib.RegisterFactory(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP), &CSPlayerOpPacketFactory{}) netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{}, MSDollMachineoCoinResultHandler) + //客户端请求token + common.RegisterHandler(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP), &CSGetTokenHandler{}) + netlib.RegisterFactory(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP), &CSGetTokenPacketFactory{}) + //获取token返回 + netlib.Register(int(machine.DollMachinePacketID_PACKET_MSSendToken), &machine.MSSendToken{}, MSSendTokenHandler) } diff --git a/machine/action/action_server.go b/machine/action/action_server.go index 117cea1..f42592d 100644 --- a/machine/action/action_server.go +++ b/machine/action/action_server.go @@ -1,48 +1,70 @@ package action import ( + "bytes" "fmt" - "net" - "time" - - "mongo.games.com/goserver/core/basic" - "mongo.games.com/goserver/core/logger" - "mongo.games.com/goserver/core/netlib" - "mongo.games.com/goserver/core/task" - "mongo.games.com/goserver/core/timer" - + "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 DoneFunc func(c net.Conn) +type ConnMessageQueue struct { + queue chan []interface{} + conn *machinedoll.Conn + waitGroup *sync.WaitGroup +} -func Process(conn *machinedoll.Conn, sec time.Duration, f1, f2 []DoneFunc, isSync bool) { - var ch chan struct{} - if isSync { - ch = make(chan struct{}, 1) +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) } - task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - for _, v := range f1 { - v(conn) + + // 将消息添加到队列中 + 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 { - timer.AfterTimer(func(h timer.TimerHandle, ud interface{}) bool { - Process(conn, 0, f2, nil, isSync) - if isSync { - ch <- struct{}{} - } - return true - }, nil, sec) - } else { - if isSync { - ch <- struct{}{} - } + 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) + }() } - return nil - }), nil).StartByFixExecutor(fmt.Sprintf("Machine%v", conn.Addr)) - if isSync { - <-ch } } @@ -62,39 +84,50 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte switch msg.Perate { case 1: //向前移动 - Process(conn, 200*time.Millisecond, []DoneFunc{machinedoll.Backward}, []DoneFunc{machinedoll.BackwardStop}, false) + f1 := []func(){ + func() { machinedoll.Backward(conn) }, + } + f2 := []func(){ + func() { machinedoll.BackwardStop(conn) }, + } + Process(conn, f1, f2) case 2: //向后移动 - Process(conn, 200*time.Millisecond, []DoneFunc{machinedoll.Forward}, []DoneFunc{machinedoll.ForwardStop}, false) + f1 := []func(){ + func() { machinedoll.Forward(conn) }, + } + f2 := []func(){ + func() { machinedoll.ForwardStop(conn) }, + } + Process(conn, f1, f2) case 3: //向左移动 - Process(conn, 200*time.Millisecond, []DoneFunc{machinedoll.Left}, []DoneFunc{machinedoll.LeftStop}, false) + f1 := []func(){ + func() { machinedoll.Left(conn) }, + } + f2 := []func(){ + func() { machinedoll.LeftStop(conn) }, + } + Process(conn, f1, f2) case 4: //向右移动 - Process(conn, 200*time.Millisecond, []DoneFunc{machinedoll.Right}, []DoneFunc{machinedoll.RightStop}, false) + f1 := []func(){ + func() { machinedoll.Right(conn) }, + } + f2 := []func(){ + func() { machinedoll.RightStop(conn) }, + } + Process(conn, f1, f2) case 5: //投币 - Process(conn, 0*time.Millisecond, []DoneFunc{machinedoll.Coin, machinedoll.Coin}, []DoneFunc{}, false) - // 读取服务端的响应 - buf := make([]byte, 1024) - n, err := conn.Read(buf) - if err != nil { - fmt.Println("Failed to read response from server:", err) - return nil + f1 := []func(){ + func() { machinedoll.Coin(conn) }, } - if buf[4] == 1 { - fmt.Println("上分成功!!!!n = ", n) + f2 := []func(){ + func() {}, } - if buf[4] == 0 { - fmt.Println("上分失败!!!") - } - //返回消息 - session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{ - Snid: msg.Snid, - Id: msg.GetId(), - Result: int32(buf[4]), - TypeId: 1, - }) + Process(conn, f1, f2) + go DollMachineGrabResult(session, conn, msg.Snid, msg.GetId()) } return nil } @@ -112,26 +145,114 @@ func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interf return nil } - send := func(net.Conn) { - session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{ - Snid: msg.Snid, - Id: msg.GetId(), - Result: 1, - TypeId: 2, - }) - } - switch msg.GetTypeId() { case 1: //弱抓 - Process(conn, 0, []DoneFunc{machinedoll.WeakGrab}, []DoneFunc{send}, false) + f1 := []func(){ + func() { machinedoll.WeakGrab(conn) }, + } + f2 := []func(){} + Process(conn, f1, f2) case 2: //强力抓 - Process(conn, 0, []DoneFunc{machinedoll.Grab}, []DoneFunc{send}, false) + f1 := []func(){ + func() { machinedoll.Grab(conn) }, + } + f2 := []func(){} + Process(conn, f1, f2) } return nil } +// 监听抓取结果返回 +func DollMachineGrabResult(session *netlib.Session, conn *machinedoll.Conn, snid, id int32) { + num := int64(1) + for { + // 读取数据 + fmt.Println("监听抓取结果返回!") + buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + fmt.Println("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, + }) + fmt.Println("没有抓到礼品!!!!!!!!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 { + fmt.Println("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, + }) + fmt.Println("抓到礼品了!!!!!!!!snid = ", snid, "num = ", num) + return + } + //上分成功 + coinData := []byte{0xAA, 0x04, 0x02, 0x03, 0x01} + if bytes.Contains(part, coinData) { + //返回消息 + fmt.Println("上分成功!") + 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) { + //返回消息 + fmt.Println("上分失败!") + 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("与游戏服务器连接成功") @@ -147,9 +268,49 @@ func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interf 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 { + fmt.Println(err) + return err + } + fmt.Println(token) + info := &machine.MSSendToken{} + info.Snid = msg.Snid + info.Token = token + 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 9e56bb7..26c0031 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,25 +97,26 @@ 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 - } + /* + // 读取服务端的响应 + 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 + }*/ } // 必中抓 @@ -123,7 +124,7 @@ func Grab2(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) @@ -141,7 +142,7 @@ func Grab2(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) @@ -152,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 @@ -212,7 +213,7 @@ 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 { @@ -220,13 +221,13 @@ func OpenMusic(conn net.Conn) { 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)*/ } // 关闭音乐 @@ -234,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) @@ -302,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) @@ -313,30 +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] = 0x01 fmt.Println("data.len = ", len(data)) - instruction := []byte{0xAA, 0x04, 0x01, 0x06} + 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) @@ -350,13 +371,18 @@ func SetPower(conn net.Conn) { return } fmt.Println("n", n) + if buf[4] == 1 { + fmt.Println("设置成功!") + } else { + fmt.Println("设置失败!") + } } var data = []byte{ 0x65, //0 几币几玩 0x00, //1 几币几玩占用位 - 0x1E, //2 游戏时间 - 0x00, //3 出奖模式 + 0x2D, //2 游戏时间 + 0x00, //3 出奖模式0 无概率 1 随机模式 2 固定模式 3 冠兴模式 0x0F, //4 出奖概率 0x00, //5 出奖概率占用位 0x00, //6 空中抓物 0关闭 1开启 @@ -364,11 +390,11 @@ var data = []byte{ 0x00, //8 保夹次数 范围0~6, 6为无限次 0x01, //9 保夹赠送模式 0送游戏 1送中奖 2送游戏和中奖 - 0x04, //10 强抓力电压 - 0x50, //11 强抓力电压占用位 - 0x7C, //12 中抓力电压 - 0x00, //13 中抓力电压占用位 - 0x5A, //14 弱抓力电压 + 0x80, //10 强抓力电压 + 0x01, //11 强抓力电压占用位 + 0x80, //12 中抓力电压 + 0x01, //13 中抓力电压占用位 + 0x78, //14 弱抓力电压 0x00, //15 弱抓力电压占用位 0xE0, //16 中奖电压 0x01, //17 中奖电压占用位 @@ -379,8 +405,8 @@ var data = []byte{ 0x32, //21 前后速度 0x32, //22 左右速度 0x50, //23 上下速度 - 0x34, //24 放线长度 - 0x08, //25 放线长度占用位 + 0x9A, //24 放线长度 + 0x06, //25 放线长度占用位 0x00, //26 礼品下放高度 0x00, //27 礼品下放高度占用位 0x00, //28 甩抓长度 @@ -401,66 +427,8 @@ var data = []byte{ 0x00, //41 摇杆延时占用位 0x00, //42 抓物二收 0x00, //43 待机音乐开关 - 0x0F, //44 音量大小调整 + 0x00, //44 音量大小调整 0x07, //45 待机音乐选择 0x08, //46 游戏音乐选择 0x00, //47 概率队列自动 } - -/* -var data = []byte{ - 101, //0 几币几玩 - 0, //1 几币几玩占用位 - 30, //2 游戏时间 - 0, //3 出奖模式0无概率 1随机模式 2固定模式 3冠兴模式 - 15, //4 出奖概率 - 0, //5 出奖概率占用位 - 1, //6 空中抓物 0关闭 1开启 - 0, //7 连续投币赠送 范围0~100 - 0, //8 保夹次数 范围0~6, 6为无限次 - 1, //9 保夹赠送模式 0送游戏 1送中奖 2送游戏和中奖 - - 200, //10 强抓力电压 - 0, //11 强抓力电压占用位 - 124, //12 中抓力电压 - 1, //13 中抓力电压占用位 - 90, //14 弱抓力电压 - 0, //15 弱抓力电压占用位 - 224, //16 中奖电压 - 1, //17 中奖电压占用位 - 200, //18 强抓力时间 - 0, //19 强抓力时间占用位 - - 20, //20 放抓时间 - 50, //21 前后速度 - 50, //22 左右速度 - 80, //23 上下速度 - 52, //24 放线长度 - 8, //25 放线长度占用位 - 0, //26 礼品下放高度 - 0, //27 礼品下放高度占用位 - 0, //28 甩抓长度 - 0, //29 甩抓保护 - - 120, //30 甩抓电压 - 0, //31 甩抓电压占用位 - 50, //32 上拉保护 - 2, //33 天车自救时间 - 0, //34 下抓延时 - 0, //35 下抓延时占用位 - 200, //36 抓物延时 - 0, //37 抓物延时占用位 - 150, //38 上停延时 - 0, //39 上停延时占用位 - - 0, //40 摇杆延时 - 0, //41 摇杆延时占用位 - 0, //42 抓物二收 - 1, //43 待机音乐开关 - 15, //44 音量大小调整 - 7, //45 待机音乐选择 - 8, //46 游戏音乐选择 - 0, //47 概率队列自动 -} - -*/ diff --git a/machine/machinedoll/machinemgr.go b/machine/machinedoll/machinemgr.go index 3c6827d..57ad3d2 100644 --- a/machine/machinedoll/machinemgr.go +++ b/machine/machinedoll/machinemgr.go @@ -74,6 +74,8 @@ func (this *MachineManager) Init() { Conn: conn, Addr: addr, } + SetBaseParam(conn) + fmt.Println("设置每台娃娃机基础配置!") } /* fmt.Println("Connected to server:\n", this.ConnMap[1].RemoteAddr()) @@ -96,6 +98,7 @@ func (this *MachineManager) Update() { delConn = append(delConn, v) v.Close() logger.Logger.Tracef("断开连接:%v", v.Addr) + fmt.Println("娃娃机断开连接!!!!!!!!!!!") this.UpdateToGameServer(v, 0) } } @@ -115,6 +118,7 @@ func (this *MachineManager) Update() { continue } logger.Logger.Tracef("重连成功:%v", addr) + fmt.Println("娃娃机重连成功!!!!!!!!!!!") delIds = append(delIds, &Conn{ Id: id, Conn: conn, diff --git a/protocol/clawdoll/clawdoll.pb.go b/protocol/clawdoll/clawdoll.pb.go index 437be49..30f9f00 100644 --- a/protocol/clawdoll/clawdoll.pb.go +++ b/protocol/clawdoll/clawdoll.pb.go @@ -33,6 +33,8 @@ const ( CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerEnter CLAWDOLLPacketID = 5606 // 玩家进入 CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerLeave CLAWDOLLPacketID = 5607 // 玩家离开 CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PLAYERINFO CLAWDOLLPacketID = 5608 // 玩家状态信息变化 + CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_GETTOKEN CLAWDOLLPacketID = 5609 // 获取token + CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_SENDTOKEN CLAWDOLLPacketID = 5610 // 获取token ) // Enum value maps for CLAWDOLLPacketID. @@ -47,6 +49,8 @@ var ( 5606: "PACKET_SC_CLAWDOLL_PlayerEnter", 5607: "PACKET_SC_CLAWDOLL_PlayerLeave", 5608: "PACKET_SC_CLAWDOLL_PLAYERINFO", + 5609: "PACKET_CS_CLAWDOLL_GETTOKEN", + 5610: "PACKET_SC_CLAWDOLL_SENDTOKEN", } CLAWDOLLPacketID_value = map[string]int32{ "PACKET_CLAWDOLL_ZERO": 0, @@ -58,6 +62,8 @@ var ( "PACKET_SC_CLAWDOLL_PlayerEnter": 5606, "PACKET_SC_CLAWDOLL_PlayerLeave": 5607, "PACKET_SC_CLAWDOLL_PLAYERINFO": 5608, + "PACKET_CS_CLAWDOLL_GETTOKEN": 5609, + "PACKET_SC_CLAWDOLL_SENDTOKEN": 5610, } ) @@ -806,6 +812,109 @@ func (x *SCCLAWDOLLPlayerLeave) GetPos() int32 { return 0 } +//玩家请求进入视频地址token +type CSCLAWDOLLGetToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Appid int64 `protobuf:"varint,1,opt,name=Appid,proto3" json:"Appid,omitempty"` + ServerSecret string `protobuf:"bytes,2,opt,name=serverSecret,proto3" json:"serverSecret,omitempty"` +} + +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} +} + +func (x *CSCLAWDOLLGetToken) GetAppid() int64 { + if x != nil { + return x.Appid + } + return 0 +} + +func (x *CSCLAWDOLLGetToken) GetServerSecret() string { + if x != nil { + return x.ServerSecret + } + return "" +} + +type SCCLAWDOLLSendToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,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) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + var File_clawdoll_proto protoreflect.FileDescriptor var file_clawdoll_proto_rawDesc = []byte{ @@ -886,37 +995,49 @@ var file_clawdoll_proto_rawDesc = []byte{ 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, + 0x01, 0x28, 0x05, 0x52, 0x03, 0x50, 0x6f, 0x73, 0x22, 0x4e, 0x0a, 0x12, 0x43, 0x53, 0x43, 0x4c, + 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, + 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, + 0x70, 0x70, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x22, 0x2b, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, + 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2a, 0x8c, 0x03, 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, 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, + 0x4c, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe8, 0x2b, 0x12, + 0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x43, 0x4c, 0x41, + 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x47, 0x45, 0x54, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xe9, + 0x2b, 0x12, 0x21, 0x0a, 0x1c, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, + 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x54, 0x4f, 0x4b, 0x45, + 0x4e, 0x10, 0xea, 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 +1053,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, 11) var file_clawdoll_proto_goTypes = []interface{}{ (CLAWDOLLPacketID)(0), // 0: clawdoll.CLAWDOLLPacketID (OpResultCode)(0), // 1: clawdoll.OpResultCode @@ -945,6 +1066,8 @@ 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 } var file_clawdoll_proto_depIdxs = []int32{ 2, // 0: clawdoll.SCCLAWDOLLRoomInfo.Players:type_name -> clawdoll.CLAWDOLLPlayerData @@ -1071,6 +1194,30 @@ 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 + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1078,7 +1225,7 @@ func file_clawdoll_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_clawdoll_proto_rawDesc, NumEnums: 2, - NumMessages: 9, + NumMessages: 11, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/clawdoll/clawdoll.proto b/protocol/clawdoll/clawdoll.proto index 579ae56..a2d08c4 100644 --- a/protocol/clawdoll/clawdoll.proto +++ b/protocol/clawdoll/clawdoll.proto @@ -13,6 +13,8 @@ enum CLAWDOLLPacketID { PACKET_SC_CLAWDOLL_PlayerEnter = 5606; // 玩家进入 PACKET_SC_CLAWDOLL_PlayerLeave = 5607; // 玩家离开 PACKET_SC_CLAWDOLL_PLAYERINFO = 5608; // 玩家状态信息变化 + PACKET_CS_CLAWDOLL_GETTOKEN = 5609; // 获取token + PACKET_SC_CLAWDOLL_SENDTOKEN = 5610; // 获取token } //操作结果 @@ -102,4 +104,13 @@ message SCCLAWDOLLPlayerEnter { //PACKET_SCCLAWDOLLPlayerLeave message SCCLAWDOLLPlayerLeave { int32 Pos = 1; //玩家位置 +} +//玩家请求进入视频地址token +message CSCLAWDOLLGetToken { + int64 Appid = 1; + string serverSecret = 2; +} + +message SCCLAWDOLLSendToken { + string Token = 1; } \ No newline at end of file diff --git a/protocol/machine/machine.pb.go b/protocol/machine/machine.pb.go index 65ef2f3..1f7d7f4 100644 --- a/protocol/machine/machine.pb.go +++ b/protocol/machine/machine.pb.go @@ -31,6 +31,8 @@ const ( 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. @@ -43,6 +45,8 @@ var ( 20003: "PACKET_MSDollMachineList", 20004: "PACKET_MSUpdateDollMachineStatus", 20005: "PACKET_MSDollMachineoPerateResult", + 20006: "PACKET_SMGetToken", + 20007: "PACKET_MSSendToken", } DollMachinePacketID_value = map[string]int32{ "PACKET_SMDollMachineZero": 0, @@ -52,6 +56,8 @@ var ( "PACKET_MSDollMachineList": 20003, "PACKET_MSUpdateDollMachineStatus": 20004, "PACKET_MSDollMachineoPerateResult": 20005, + "PACKET_SMGetToken": 20006, + "PACKET_MSSendToken": 20007, } ) @@ -490,6 +496,126 @@ func (x *MSUpdateDollMachineStatus) GetVideoAddr() string { 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"` + Token string `protobuf:"bytes,2,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) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + var File_machine_proto protoreflect.FileDescriptor var file_machine_proto_rawDesc = []byte{ @@ -527,26 +653,39 @@ var file_machine_proto_rawDesc = []byte{ 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, 0x2a, 0x86, 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, 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, + 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, + 0x37, 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, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 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 ( @@ -562,7 +701,7 @@ func file_machine_proto_rawDescGZIP() []byte { } var file_machine_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_machine_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +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 @@ -572,6 +711,8 @@ var file_machine_proto_goTypes = []interface{}{ (*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 @@ -672,6 +813,30 @@ func file_machine_proto_init() { 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{ @@ -679,7 +844,7 @@ func file_machine_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_machine_proto_rawDesc, NumEnums: 1, - NumMessages: 7, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/machine/machine.proto b/protocol/machine/machine.proto index 1e4933d..a5b5e5c 100644 --- a/protocol/machine/machine.proto +++ b/protocol/machine/machine.proto @@ -13,6 +13,8 @@ enum DollMachinePacketID { PACKET_MSDollMachineList = 20003; PACKET_MSUpdateDollMachineStatus = 20004; PACKET_MSDollMachineoPerateResult = 20005; + PACKET_SMGetToken = 20006; + PACKET_MSSendToken = 20007; } //通知链接成功 //PACKET_SMDollMachinePerate @@ -56,4 +58,15 @@ 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; + string Token = 2; } \ No newline at end of file