diff --git a/gamesrv/action/action_machine.go b/gamesrv/action/action_machine.go index da91b62..b86128a 100644 --- a/gamesrv/action/action_machine.go +++ b/gamesrv/action/action_machine.go @@ -6,12 +6,11 @@ import ( "mongo.games.com/goserver/core/netlib" ) -func TestHandler(session *netlib.Session, packetId int, data interface{}) error { +func MSDollMachineList(session *netlib.Session, packetId int, data interface{}) error { logger.Logger.Tracef("TestHandler %v", data) return nil } func init() { - // 修改皮肤 - netlib.Register(int(machine.PacketID_Test), &machine.SCTest{}, TestHandler) + netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineList) } diff --git a/gamesrv/base/srvsessmgr.go b/gamesrv/base/srvsessmgr.go index fa1510d..c401c26 100644 --- a/gamesrv/base/srvsessmgr.go +++ b/gamesrv/base/srvsessmgr.go @@ -1,14 +1,13 @@ package base import ( + "fmt" "mongo.games.com/game/common" "mongo.games.com/game/protocol/machine" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" - "mongo.games.com/goserver/core/timer" "mongo.games.com/goserver/srvlib" "mongo.games.com/goserver/srvlib/protocol" - "time" ) var SrvSessMgrSington = &SrvSessMgr{} @@ -32,12 +31,8 @@ func (this *SrvSessMgr) OnRegiste(s *netlib.Session) { NpcServerAgentSingleton.OnConnected() } else if srvInfo.GetType() == 10 { logger.Logger.Warn("(this *SrvSessMgr) OnRegiste (Machine):", s) - timer.StartTimer(timer.TimerActionWrapper(func(h timer.TimerHandle, ud interface{}) bool { - s.Send(int(machine.PacketID_Test), &machine.CSTest{ - Ts: time.Now().Unix(), - }) - return true - }), nil, 3*time.Second, 100) + s.Send(int(machine.DollMachinePacketID_PACKET_SMGameLinkSucceed), &machine.SMGameLinkSucceed{}) + fmt.Printf("与娃娃机服务器连接成功\n") } } } diff --git a/gamesrv/machine/action_machine.go b/gamesrv/machine/action_machine.go new file mode 100644 index 0000000..901b7dc --- /dev/null +++ b/gamesrv/machine/action_machine.go @@ -0,0 +1,10 @@ +package machine + +import ( + "mongo.games.com/game/protocol/machine" + "mongo.games.com/goserver/core/netlib" +) + +func init() { + netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineList) +} diff --git a/machine/action/action_server.go b/machine/action/action_server.go index a628803..a0a4c98 100644 --- a/machine/action/action_server.go +++ b/machine/action/action_server.go @@ -1,26 +1,103 @@ package action import ( + "fmt" + "mongo.games.com/game/machine/machinedoll" "mongo.games.com/game/protocol/machine" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" "time" ) -func TestHandler(session *netlib.Session, packetId int, data interface{}) error { - logger.Logger.Tracef("TestHandler %v", data) - msg, ok := data.(*machine.CSTest) +// 移动 +func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data interface{}) error { + msg, ok := data.(*machine.SMDollMachineoPerate) if !ok { return nil } - session.Send(int(machine.PacketID_Test), &machine.SCTest{ - Ts: time.Now().Unix(), - }) - logger.Logger.Tracef("PacketID_Test: %v", msg) + conn := machinedoll.ConnMap[int(msg.Id)] + if conn == nil { + return nil + } + if msg.Perate == 1 { + //向前移动 + machinedoll.Backward(conn) + time.Sleep(200 * time.Millisecond) + machinedoll.BackwardStop(conn) + } else if msg.Perate == 2 { + //向后移动 + machinedoll.Forward(conn) + time.Sleep(200 * time.Millisecond) + machinedoll.ForwardStop(conn) + } else if msg.Perate == 3 { + //向左移动 + machinedoll.Left(conn) + time.Sleep(200 * time.Millisecond) + machinedoll.LeftStop(conn) + } else if msg.Perate == 4 { + //向右移动 + machinedoll.Right(conn) + time.Sleep(200 * time.Millisecond) + machinedoll.RightStop(conn) + } else if msg.Perate == 5 { + //投币 + machinedoll.Coin(conn) + machinedoll.Backward(conn) + time.Sleep(200 * time.Millisecond) + machinedoll.BackwardStop(conn) + } return nil } -func init() { - // 修改皮肤 - netlib.Register(int(machine.PacketID_Test), &machine.CSTest{}, TestHandler) +// 下抓 +func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interface{}) error { + msg, ok := data.(*machine.SMDollMachineGrab) + if !ok { + return nil + } + conn := machinedoll.ConnMap[int(msg.Id)] + if conn == nil { + return nil + } + typeId := msg.TypeId + if typeId == 1 { + //弱抓 + machinedoll.WeakGrab(conn) + } else if typeId == 2 { + //强力抓 + machinedoll.Grab(conn) + } else if typeId == 3 { + //必中抓 + machinedoll.Grab(conn) + } + //返回消息 + session.Send(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), &machine.MSDollMachineGrab{ + Snid: msg.Snid, + Id: msg.GetId(), + Result: 1, + }) + return nil +} + +// 与游戏服务器连接成功,向游戏服务器推送所有娃娃机连接 +func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interface{}) error { + logger.Logger.Trace("与游戏服务器连接成功!!\n") + fmt.Printf("与游戏服务器连接成功!!\n") + //开始向游戏服务器发送娃娃机连接信息 + msg := &machine.MSDollMachineList{} + for i, _ := range machinedoll.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") + 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) } diff --git a/machine/machineIPConfig.json b/machine/machineIPConfig.json new file mode 100644 index 0000000..bc26b98 --- /dev/null +++ b/machine/machineIPConfig.json @@ -0,0 +1,3 @@ +[ + "192.168.31.221:8800" +] \ No newline at end of file diff --git a/machine/machinedoll/command.go b/machine/machinedoll/command.go new file mode 100644 index 0000000..d4970d8 --- /dev/null +++ b/machine/machinedoll/command.go @@ -0,0 +1,374 @@ +package machinedoll + +import ( + "fmt" + "net" +) + +// 向前aa 05 01 50 01 01 54 dd +func Forward(conn net.Conn) { + instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x01, 0x01} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 向前停止aa 05 01 50 01 00 55 dd +func ForwardStop(conn net.Conn) { + instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x01, 0x00} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 向后 +// aa 05 01 50 02 01 57 dd +func Backward(conn net.Conn) { + instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x02, 0x01} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 向后停止aa 05 01 50 02 00 56 dd +func BackwardStop(conn net.Conn) { + instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x02, 0x00} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 向左aa 05 01 50 03 01 56 dd +func Left(conn net.Conn) { + instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x03, 0x01} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 向左停止aa 05 01 50 03 00 57 dd +func LeftStop(conn net.Conn) { + instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x03, 0x00} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 向右 +func Right(conn net.Conn) { + instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x04, 0x01} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 向右停止aa 05 01 50 04 00 50 dd +func RightStop(conn net.Conn) { + instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x04, 0x00} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 强抓下抓 +func Grab(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) + return + } +} + +// 弱抓aa 05 01 50 06 00 52 dd +func WeakGrab(conn net.Conn) { + instruction := []byte{0xAA, 0x05, 0x01, 0x50, 0x06, 0x00} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 投币 +func Coin(conn net.Conn) { + moveCommand := []byte{0xaa, 0x08, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00} + 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("上分失败!!!") + } +} + +// 剩余局数清零 +func ClearRemainingGames(conn net.Conn) { + instruction := []byte{0xAA, 0x03, 0x01, 0x32} + 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 calculateChecksum(data []byte) []byte { + var value = byte(0) + for i, datum := range data { + if i > 0 { + value ^= datum + } + } + fmt.Println("校验码 value = ", value) + data = append(data, value, 0xdd) + return data + +} + +// 开启音乐 +func OpenMusic(conn net.Conn) { + data[43] = 0x01 + 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) + 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 CloseMusic(conn net.Conn) { + data[43] = 0x00 + 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) + 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 RestoreFactorySettings(conn net.Conn) { + instruction := []byte{0xAA, 0x03, 0x01, 0x38} + 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 Reboot(conn net.Conn) { + instruction := []byte{0xAA, 0x03, 0x01, 0x39} + 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 StopServer(conn net.Conn) { + instruction := []byte{0xAA, 0x03, 0x01, 0x37} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 开启服务 +func StartServer(conn net.Conn) { + instruction := []byte{0xAA, 0x03, 0x01, 0x36} + instruction = calculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } +} + +// 查询基础参数 +func queryBaseParam(conn net.Conn) { + instruction := []byte{0xAA, 0x03, 0x01, 0x05} + 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 SetPower(conn net.Conn) { + data[3] = 0x00 + data[16] = 0x01 + data[17] = 0xE0 + data[18] = 0x13 + data[19] = 0x88 + fmt.Println("data.len = ", len(data)) + 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) + 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) +} + +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, +} diff --git a/machine/machinedoll/machinemgr.go b/machine/machinedoll/machinemgr.go new file mode 100644 index 0000000..36cedee --- /dev/null +++ b/machine/machinedoll/machinemgr.go @@ -0,0 +1,257 @@ +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" + "path/filepath" + "time" +) + +var GameConn *netlib.Session +var ConnMap = make(map[int]net.Conn) + +type MachineManager struct { + DelConnMap map[int]string +} + +var MachineMgr = &MachineManager{ + DelConnMap: make(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) + return + } + + // 构建配置文件的绝对路径 + configFile := filepath.Join(programDir, "machineIPConfig.json") + + fileData, err := os.ReadFile(configFile) + if err != nil { + logger.Logger.Error("Read robot account file error:", err) + return + } else { + if err = json.Unmarshal(fileData, &serverAddrs); err != nil { + logger.Logger.Error("Unmarshal robot account data error:", err) + return + } + } + //与娃娃机创建连接 + // 遍历每个服务器地址,建立连接 + 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) + continue + } + ConnMap[i+1] = conn + go this.StartHeartbeat(i+1, &conn, addr) + } + 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]) + + // 监听中断信号,等待用户退出 + //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")) + 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 + } + } + } +} + +// 重连 +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 + } + 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 +} + +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) + } + SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg) +} + +func SendToGameServer(pid int, msg interface{}) { + if GameConn == nil { + GameConn = srvlib.ServerSessionMgrSington.GetSession(1, 7, 701) + } + if GameConn != nil { + GameConn.Send(pid, msg) + } else { + logger.Logger.Error("GameConn is nil !") + } +} + +func init() { + MachineMgr.Init() +} + +func listenKeyboardEvents(conn net.Conn) { + for { + // 读取键盘事件 + key := readKeyboardEvent() + switch key { + case "w": + Backward(conn) + time.Sleep(200 * time.Millisecond) + BackwardStop(conn) + case "W": + Backward(conn) + time.Sleep(200 * time.Millisecond) + BackwardStop(conn) + case "a": + Left(conn) + time.Sleep(200 * time.Millisecond) + LeftStop(conn) + case "A": + Left(conn) + time.Sleep(200 * time.Millisecond) + LeftStop(conn) + case "s": + Forward(conn) + time.Sleep(200 * time.Millisecond) + ForwardStop(conn) + case "S": + Forward(conn) + time.Sleep(200 * time.Millisecond) + ForwardStop(conn) + case "d": + Right(conn) + time.Sleep(200 * time.Millisecond) + RightStop(conn) + case "D": + Right(conn) + time.Sleep(200 * time.Millisecond) + RightStop(conn) + case "j": + Grab(conn) + case "J": + Grab(conn) + + case "k": + WeakGrab(conn) + case "K": + WeakGrab(conn) + + case "q": + Coin(conn) + Backward(conn) + time.Sleep(200 * time.Millisecond) + BackwardStop(conn) + case "Q": + Coin(conn) + + Backward(conn) + time.Sleep(150 * time.Millisecond) + BackwardStop(conn) + case "1": + RestoreFactorySettings(conn) + case "2": + OpenMusic(conn) + case "3": + Reboot(conn) + case "4": + StopServer(conn) + case "5": + StartServer(conn) + case "6": + ClearRemainingGames(conn) + case "7": + SetPower(conn) + case "8": + CloseMusic(conn) + } + } +} + +func readKeyboardEvent() string { + var b [1]byte + var done uint32 + err := syscall.ReadFile(syscall.Stdin, b[:], &done, nil) + if err != nil { + panic(err) + } + + return string(b[:]) +} + +func waitForUserExit() { + // 创建一个信号通道 + signalChan := make(chan os.Signal, 1) + + // 监听中断信号 + signal.Notify(signalChan, os.Interrupt) + + // 等待用户按下 Ctrl+C 退出 + <-signalChan + fmt.Println("退出程序...") +} diff --git a/machine/main.go b/machine/main.go index e2f28a5..0a35031 100644 --- a/machine/main.go +++ b/machine/main.go @@ -1,17 +1,15 @@ package main import ( - "mongo.games.com/goserver/core" - "mongo.games.com/goserver/core/module" - _ "mongo.games.com/game" _ "mongo.games.com/game/machine/action" + "mongo.games.com/goserver/core" + "mongo.games.com/goserver/core/module" ) func main() { defer core.ClosePackages() core.LoadPackages("config.json") - w := module.Start() w.Wait("main()") } diff --git a/protocol/gameMachine/machine.pb.go b/protocol/gameMachine/machine.pb.go new file mode 100644 index 0000000..576911a --- /dev/null +++ b/protocol/gameMachine/machine.pb.go @@ -0,0 +1,594 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1-devel +// protoc v3.19.4 +// source: machine.proto + +package machine + +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) +) + +//娃娃机协议 +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 +) + +// Enum value maps for DollMachinePacketID. +var ( + DollMachinePacketID_name = map[int32]string{ + 0: "PACKET_SMDollMachineZero", + 20000: "PACKET_SMGameLinkSucceed", + 20001: "PACKET_SMDollMachinePerate", + 20002: "PACKET_SMDollMachineGrab", + 20003: "PACKET_MSDollMachineGrab", + 20004: "PACKET_MSDollMachineList", + } + DollMachinePacketID_value = map[string]int32{ + "PACKET_SMDollMachineZero": 0, + "PACKET_SMGameLinkSucceed": 20000, + "PACKET_SMDollMachinePerate": 20001, + "PACKET_SMDollMachineGrab": 20002, + "PACKET_MSDollMachineGrab": 20003, + "PACKET_MSDollMachineList": 20004, + } +) + +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_machine_proto_enumTypes[0].Descriptor() +} + +func (DollMachinePacketID) Type() protoreflect.EnumType { + return &file_machine_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_machine_proto_rawDescGZIP(), []int{0} +} + +//通知链接成功 +type SMGameLinkSucceed struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SMGameLinkSucceed) Reset() { + *x = SMGameLinkSucceed{} + if protoimpl.UnsafeEnabled { + mi := &file_machine_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SMGameLinkSucceed) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SMGameLinkSucceed) ProtoMessage() {} + +func (x *SMGameLinkSucceed) ProtoReflect() protoreflect.Message { + mi := &file_machine_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 SMGameLinkSucceed.ProtoReflect.Descriptor instead. +func (*SMGameLinkSucceed) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{0} +} + +//操作 +type SMDollMachineoPerate 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"` //娃娃机标识 + Perate int32 `protobuf:"varint,3,opt,name=Perate,proto3" json:"Perate,omitempty"` // 1-前 2-后 3-左 4-右 5-投币 +} + +func (x *SMDollMachineoPerate) Reset() { + *x = SMDollMachineoPerate{} + if protoimpl.UnsafeEnabled { + mi := &file_machine_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SMDollMachineoPerate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SMDollMachineoPerate) ProtoMessage() {} + +func (x *SMDollMachineoPerate) ProtoReflect() protoreflect.Message { + mi := &file_machine_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 SMDollMachineoPerate.ProtoReflect.Descriptor instead. +func (*SMDollMachineoPerate) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{1} +} + +func (x *SMDollMachineoPerate) GetSnid() int32 { + if x != nil { + return x.Snid + } + return 0 +} + +func (x *SMDollMachineoPerate) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *SMDollMachineoPerate) GetPerate() int32 { + if x != nil { + return x.Perate + } + 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_machine_proto_msgTypes[2] + 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_machine_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 SMDollMachineGrab.ProtoReflect.Descriptor instead. +func (*SMDollMachineGrab) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{2} +} + +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_machine_proto_msgTypes[3] + 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_machine_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 MSDollMachineGrab.ProtoReflect.Descriptor instead. +func (*MSDollMachineGrab) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{3} +} + +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_machine_proto_msgTypes[4] + 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_machine_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 MSDollMachineList.ProtoReflect.Descriptor instead. +func (*MSDollMachineList) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{4} +} + +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"` + VideoAddr string `protobuf:"bytes,2,opt,name=VideoAddr,proto3" json:"VideoAddr,omitempty"` +} + +func (x *DollMachine) Reset() { + *x = DollMachine{} + if protoimpl.UnsafeEnabled { + mi := &file_machine_proto_msgTypes[5] + 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_machine_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DollMachine.ProtoReflect.Descriptor instead. +func (*DollMachine) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{5} +} + +func (x *DollMachine) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *DollMachine) GetVideoAddr() string { + if x != nil { + return x.VideoAddr + } + return "" +} + +var File_machine_proto protoreflect.FileDescriptor + +var file_machine_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x07, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x53, 0x4d, 0x47, 0x61, + 0x6d, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x22, 0x52, 0x0a, + 0x14, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x6f, 0x50, + 0x65, 0x72, 0x61, 0x74, 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, 0x16, 0x0a, 0x06, 0x50, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x50, 0x65, 0x72, 0x61, 0x74, + 0x65, 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, 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, +} + +var ( + file_machine_proto_rawDescOnce sync.Once + file_machine_proto_rawDescData = file_machine_proto_rawDesc +) + +func file_machine_proto_rawDescGZIP() []byte { + file_machine_proto_rawDescOnce.Do(func() { + file_machine_proto_rawDescData = protoimpl.X.CompressGZIP(file_machine_proto_rawDescData) + }) + return file_machine_proto_rawDescData +} + +var file_machine_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_machine_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +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 +} +var file_machine_proto_depIdxs = []int32{ + 6, // 0: machine.MSDollMachineList.data:type_name -> machine.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_machine_proto_init() } +func file_machine_proto_init() { + if File_machine_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_machine_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SMGameLinkSucceed); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_machine_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SMDollMachineoPerate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_machine_proto_msgTypes[2].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_machine_proto_msgTypes[3].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_machine_proto_msgTypes[4].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_machine_proto_msgTypes[5].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_machine_proto_rawDesc, + NumEnums: 1, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_machine_proto_goTypes, + DependencyIndexes: file_machine_proto_depIdxs, + EnumInfos: file_machine_proto_enumTypes, + MessageInfos: file_machine_proto_msgTypes, + }.Build() + File_machine_proto = out.File + file_machine_proto_rawDesc = nil + file_machine_proto_goTypes = nil + file_machine_proto_depIdxs = nil +} diff --git a/protocol/gameMachine/machine.proto b/protocol/gameMachine/machine.proto new file mode 100644 index 0000000..00b6124 --- /dev/null +++ b/protocol/gameMachine/machine.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; +package machine; +option go_package = "mongo.games.com/game/protocol/machine"; + +//S-GAME M-娃娃机主机 + +//娃娃机协议 +enum DollMachinePacketID { + PACKET_SMDollMachineZero = 0; + PACKET_SMGameLinkSucceed = 20000; + PACKET_SMDollMachinePerate = 20001; + PACKET_SMDollMachineGrab = 20002; + PACKET_MSDollMachineGrab = 20003; + PACKET_MSDollMachineList = 20004; +} +//通知链接成功 +message SMGameLinkSucceed{ +} + +//操作 +message SMDollMachineoPerate{ + int32 Snid = 1; + int32 Id = 2; //娃娃机标识 + int32 Perate = 3; // 1-前 2-后 3-左 4-右 5-投币 +} + +//下抓 +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; + string VideoAddr = 2; +} \ No newline at end of file diff --git a/protocol/machine/machine.pb.go b/protocol/machine/machine.pb.go index 9c90207..576911a 100644 --- a/protocol/machine/machine.pb.go +++ b/protocol/machine/machine.pb.go @@ -20,63 +20,74 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type PacketID int32 +//娃娃机协议 +type DollMachinePacketID int32 const ( - PacketID_Zero PacketID = 0 // 弃用消息号 - PacketID_Test PacketID = 20000 // 测试 + 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 ) -// Enum value maps for PacketID. +// Enum value maps for DollMachinePacketID. var ( - PacketID_name = map[int32]string{ - 0: "Zero", - 20000: "Test", + DollMachinePacketID_name = map[int32]string{ + 0: "PACKET_SMDollMachineZero", + 20000: "PACKET_SMGameLinkSucceed", + 20001: "PACKET_SMDollMachinePerate", + 20002: "PACKET_SMDollMachineGrab", + 20003: "PACKET_MSDollMachineGrab", + 20004: "PACKET_MSDollMachineList", } - PacketID_value = map[string]int32{ - "Zero": 0, - "Test": 20000, + DollMachinePacketID_value = map[string]int32{ + "PACKET_SMDollMachineZero": 0, + "PACKET_SMGameLinkSucceed": 20000, + "PACKET_SMDollMachinePerate": 20001, + "PACKET_SMDollMachineGrab": 20002, + "PACKET_MSDollMachineGrab": 20003, + "PACKET_MSDollMachineList": 20004, } ) -func (x PacketID) Enum() *PacketID { - p := new(PacketID) +func (x DollMachinePacketID) Enum() *DollMachinePacketID { + p := new(DollMachinePacketID) *p = x return p } -func (x PacketID) String() string { +func (x DollMachinePacketID) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (PacketID) Descriptor() protoreflect.EnumDescriptor { +func (DollMachinePacketID) Descriptor() protoreflect.EnumDescriptor { return file_machine_proto_enumTypes[0].Descriptor() } -func (PacketID) Type() protoreflect.EnumType { +func (DollMachinePacketID) Type() protoreflect.EnumType { return &file_machine_proto_enumTypes[0] } -func (x PacketID) Number() protoreflect.EnumNumber { +func (x DollMachinePacketID) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use PacketID.Descriptor instead. -func (PacketID) EnumDescriptor() ([]byte, []int) { +// Deprecated: Use DollMachinePacketID.Descriptor instead. +func (DollMachinePacketID) EnumDescriptor() ([]byte, []int) { return file_machine_proto_rawDescGZIP(), []int{0} } -// Test -type CSTest struct { +//通知链接成功 +type SMGameLinkSucceed struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Ts int64 `protobuf:"varint,1,opt,name=Ts,proto3" json:"Ts,omitempty"` } -func (x *CSTest) Reset() { - *x = CSTest{} +func (x *SMGameLinkSucceed) Reset() { + *x = SMGameLinkSucceed{} if protoimpl.UnsafeEnabled { mi := &file_machine_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -84,13 +95,13 @@ func (x *CSTest) Reset() { } } -func (x *CSTest) String() string { +func (x *SMGameLinkSucceed) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CSTest) ProtoMessage() {} +func (*SMGameLinkSucceed) ProtoMessage() {} -func (x *CSTest) ProtoReflect() protoreflect.Message { +func (x *SMGameLinkSucceed) ProtoReflect() protoreflect.Message { mi := &file_machine_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -102,28 +113,24 @@ func (x *CSTest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CSTest.ProtoReflect.Descriptor instead. -func (*CSTest) Descriptor() ([]byte, []int) { +// Deprecated: Use SMGameLinkSucceed.ProtoReflect.Descriptor instead. +func (*SMGameLinkSucceed) Descriptor() ([]byte, []int) { return file_machine_proto_rawDescGZIP(), []int{0} } -func (x *CSTest) GetTs() int64 { - if x != nil { - return x.Ts - } - return 0 -} - -type SCTest struct { +//操作 +type SMDollMachineoPerate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Ts int64 `protobuf:"varint,1,opt,name=Ts,proto3" json:"Ts,omitempty"` + Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` + Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识 + Perate int32 `protobuf:"varint,3,opt,name=Perate,proto3" json:"Perate,omitempty"` // 1-前 2-后 3-左 4-右 5-投币 } -func (x *SCTest) Reset() { - *x = SCTest{} +func (x *SMDollMachineoPerate) Reset() { + *x = SMDollMachineoPerate{} if protoimpl.UnsafeEnabled { mi := &file_machine_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -131,13 +138,13 @@ func (x *SCTest) Reset() { } } -func (x *SCTest) String() string { +func (x *SMDollMachineoPerate) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SCTest) ProtoMessage() {} +func (*SMDollMachineoPerate) ProtoMessage() {} -func (x *SCTest) ProtoReflect() protoreflect.Message { +func (x *SMDollMachineoPerate) ProtoReflect() protoreflect.Message { mi := &file_machine_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -149,31 +156,309 @@ func (x *SCTest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SCTest.ProtoReflect.Descriptor instead. -func (*SCTest) Descriptor() ([]byte, []int) { +// Deprecated: Use SMDollMachineoPerate.ProtoReflect.Descriptor instead. +func (*SMDollMachineoPerate) Descriptor() ([]byte, []int) { return file_machine_proto_rawDescGZIP(), []int{1} } -func (x *SCTest) GetTs() int64 { +func (x *SMDollMachineoPerate) GetSnid() int32 { if x != nil { - return x.Ts + return x.Snid } return 0 } +func (x *SMDollMachineoPerate) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *SMDollMachineoPerate) GetPerate() int32 { + if x != nil { + return x.Perate + } + 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_machine_proto_msgTypes[2] + 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_machine_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 SMDollMachineGrab.ProtoReflect.Descriptor instead. +func (*SMDollMachineGrab) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{2} +} + +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_machine_proto_msgTypes[3] + 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_machine_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 MSDollMachineGrab.ProtoReflect.Descriptor instead. +func (*MSDollMachineGrab) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{3} +} + +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_machine_proto_msgTypes[4] + 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_machine_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 MSDollMachineList.ProtoReflect.Descriptor instead. +func (*MSDollMachineList) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{4} +} + +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"` + VideoAddr string `protobuf:"bytes,2,opt,name=VideoAddr,proto3" json:"VideoAddr,omitempty"` +} + +func (x *DollMachine) Reset() { + *x = DollMachine{} + if protoimpl.UnsafeEnabled { + mi := &file_machine_proto_msgTypes[5] + 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_machine_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DollMachine.ProtoReflect.Descriptor instead. +func (*DollMachine) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{5} +} + +func (x *DollMachine) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *DollMachine) GetVideoAddr() string { + if x != nil { + return x.VideoAddr + } + return "" +} + var File_machine_proto protoreflect.FileDescriptor var file_machine_proto_rawDesc = []byte{ 0x0a, 0x0d, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x07, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x22, 0x18, 0x0a, 0x06, 0x43, 0x53, 0x54, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, - 0x54, 0x73, 0x22, 0x18, 0x0a, 0x06, 0x53, 0x43, 0x54, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, - 0x54, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x54, 0x73, 0x2a, 0x20, 0x0a, 0x08, - 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x65, 0x72, 0x6f, - 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x10, 0xa0, 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, + 0x07, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x22, 0x13, 0x0a, 0x11, 0x53, 0x4d, 0x47, 0x61, + 0x6d, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x22, 0x52, 0x0a, + 0x14, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x6f, 0x50, + 0x65, 0x72, 0x61, 0x74, 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, 0x16, 0x0a, 0x06, 0x50, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x50, 0x65, 0x72, 0x61, 0x74, + 0x65, 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, 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, } var ( @@ -189,18 +474,23 @@ func file_machine_proto_rawDescGZIP() []byte { } var file_machine_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_machine_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_machine_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_machine_proto_goTypes = []interface{}{ - (PacketID)(0), // 0: machine.PacketID - (*CSTest)(nil), // 1: machine.CSTest - (*SCTest)(nil), // 2: machine.SCTest + (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 } var file_machine_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 6, // 0: machine.MSDollMachineList.data:type_name -> machine.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_machine_proto_init() } @@ -210,7 +500,7 @@ func file_machine_proto_init() { } if !protoimpl.UnsafeEnabled { file_machine_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CSTest); i { + switch v := v.(*SMGameLinkSucceed); i { case 0: return &v.state case 1: @@ -222,7 +512,55 @@ func file_machine_proto_init() { } } file_machine_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SCTest); i { + switch v := v.(*SMDollMachineoPerate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_machine_proto_msgTypes[2].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_machine_proto_msgTypes[3].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_machine_proto_msgTypes[4].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_machine_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DollMachine); i { case 0: return &v.state case 1: @@ -240,7 +578,7 @@ func file_machine_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_machine_proto_rawDesc, NumEnums: 1, - NumMessages: 2, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/machine/machine.proto b/protocol/machine/machine.proto index 5e74e0b..00b6124 100644 --- a/protocol/machine/machine.proto +++ b/protocol/machine/machine.proto @@ -2,15 +2,47 @@ syntax = "proto3"; package machine; option go_package = "mongo.games.com/game/protocol/machine"; -enum PacketID { - Zero = 0;// 弃用消息号 - Test = 20000; // 测试 +//S-GAME M-娃娃机主机 + +//娃娃机协议 +enum DollMachinePacketID { + PACKET_SMDollMachineZero = 0; + PACKET_SMGameLinkSucceed = 20000; + PACKET_SMDollMachinePerate = 20001; + PACKET_SMDollMachineGrab = 20002; + PACKET_MSDollMachineGrab = 20003; + PACKET_MSDollMachineList = 20004; +} +//通知链接成功 +message SMGameLinkSucceed{ } -// Test -message CSTest { - int64 Ts = 1; +//操作 +message SMDollMachineoPerate{ + int32 Snid = 1; + int32 Id = 2; //娃娃机标识 + int32 Perate = 3; // 1-前 2-后 3-左 4-右 5-投币 } -message SCTest { - int64 Ts = 1; + +//下抓 +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; + string VideoAddr = 2; } \ No newline at end of file diff --git a/public b/public index a4b6207..d789cca 160000 --- a/public +++ b/public @@ -1 +1 @@ -Subproject commit a4b6207c925174cbd308d9e6792bb42ec7210be2 +Subproject commit d789cca81a36ddbaf30e5414b6c4fe530e0631f6