diff --git a/gamesrv/action/action_machine.go b/gamesrv/action/action_machine.go index d6a5b9c..4f2f1d5 100644 --- a/gamesrv/action/action_machine.go +++ b/gamesrv/action/action_machine.go @@ -17,7 +17,7 @@ type DollMachine struct { VideoAddr string } -func MSDollMachineList(session *netlib.Session, packetId int, data interface{}) error { +func MSDollMachineListHandler(session *netlib.Session, packetId int, data interface{}) error { logger.Logger.Tracef("TestHandler %v", data) MachineMap = make(map[int]*DollMachine) if msg, ok := data.(*machine.MSDollMachineList); ok { @@ -74,7 +74,7 @@ func MSUpdateDollMachineStatusHandler(session *netlib.Session, packetId int, dat return nil } func init() { - netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineList) + netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineListHandler) //更新娃娃机链接状态 netlib.Register(int(machine.DollMachinePacketID_PACKET_MSUpdateDollMachineStatus), &machine.MSUpdateDollMachineStatus{}, MSUpdateDollMachineStatusHandler) } diff --git a/gamesrv/clawdoll/action_clawdoll.go b/gamesrv/clawdoll/action_clawdoll.go index 591aca8..2340d03 100644 --- a/gamesrv/clawdoll/action_clawdoll.go +++ b/gamesrv/clawdoll/action_clawdoll.go @@ -4,6 +4,7 @@ import ( "mongo.games.com/game/common" "mongo.games.com/game/gamesrv/base" "mongo.games.com/game/protocol/clawdoll" + "mongo.games.com/game/protocol/machine" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" ) @@ -48,8 +49,28 @@ func (h *CSPlayerOpHandler) Process(s *netlib.Session, packetid int, data interf } return nil } - +func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data interface{}) error { + logger.Logger.Tracef("收到返回上分结果!!!!!!!!!!") + if msg, ok := data.(*machine.MSDollMachineoPerateResult); ok { + switch msg.TypeId { + case 1: + if msg.Result == 1 { + logger.Logger.Tracef("上分成功!!!!!!!!!!!!snid = ", msg.Snid) + } else { + logger.Logger.Tracef("上分失败!!!!!!!!!!!!snid = ", msg.Snid) + } + case 2: + if msg.Result == 1 { + logger.Logger.Tracef("下抓成功!!!!!!!!!!!!snid = ", msg.Snid) + } else { + logger.Logger.Tracef("下抓失败!!!!!!!!!!!!snid = ", msg.Snid) + } + } + } + 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) } diff --git a/gamesrv/clawdoll/scene_clawdoll.go b/gamesrv/clawdoll/scene_clawdoll.go index 994eb68..e363fcc 100644 --- a/gamesrv/clawdoll/scene_clawdoll.go +++ b/gamesrv/clawdoll/scene_clawdoll.go @@ -210,9 +210,7 @@ func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) { // 向娃娃机主机发送消息 func (this *SceneEx) SendToMachine(pid int, msg interface{}) { - if this.machineConn == nil { - this.machineConn = srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001) - } + this.machineConn = srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001) if this.machineConn != nil { this.machineConn.Send(pid, msg) } else { diff --git a/machine/action/action_server.go b/machine/action/action_server.go index 7be9270..e7acc8d 100644 --- a/machine/action/action_server.go +++ b/machine/action/action_server.go @@ -75,6 +75,25 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte 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 + } + if buf[4] == 1 { + fmt.Println("上分成功!!!!n = ", n) + } + 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]), + }) } return nil } @@ -93,7 +112,7 @@ func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interf } send := func(net.Conn) { - session.Send(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), &machine.MSDollMachineGrab{ + session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineGrab), &machine.MSDollMachineGrab{ Snid: msg.Snid, Id: msg.GetId(), Result: 1, @@ -107,9 +126,6 @@ func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interf case 2: //强力抓 Process(conn, 0, []DoneFunc{machinedoll.Grab}, []DoneFunc{send}, false) - case 3: - //必中抓 - Process(conn, 200*time.Millisecond, []DoneFunc{machinedoll.SetPower}, []DoneFunc{machinedoll.Grab, send}, false) } return nil } diff --git a/protocol/machine/machine.pb.go b/protocol/machine/machine.pb.go index b7f2ec9..65ef2f3 100644 --- a/protocol/machine/machine.pb.go +++ b/protocol/machine/machine.pb.go @@ -24,13 +24,13 @@ const ( type DollMachinePacketID int32 const ( - DollMachinePacketID_PACKET_SMDollMachineZero DollMachinePacketID = 0 - DollMachinePacketID_PACKET_SMGameLinkSucceed DollMachinePacketID = 20000 - DollMachinePacketID_PACKET_SMDollMachinePerate DollMachinePacketID = 20001 - DollMachinePacketID_PACKET_SMDollMachineGrab DollMachinePacketID = 20002 - DollMachinePacketID_PACKET_MSDollMachineGrab DollMachinePacketID = 20003 - DollMachinePacketID_PACKET_MSDollMachineList DollMachinePacketID = 20004 - DollMachinePacketID_PACKET_MSUpdateDollMachineStatus DollMachinePacketID = 20005 + DollMachinePacketID_PACKET_SMDollMachineZero DollMachinePacketID = 0 + DollMachinePacketID_PACKET_SMGameLinkSucceed DollMachinePacketID = 20000 + DollMachinePacketID_PACKET_SMDollMachinePerate DollMachinePacketID = 20001 + DollMachinePacketID_PACKET_SMDollMachineGrab DollMachinePacketID = 20002 + DollMachinePacketID_PACKET_MSDollMachineList DollMachinePacketID = 20003 + DollMachinePacketID_PACKET_MSUpdateDollMachineStatus DollMachinePacketID = 20004 + DollMachinePacketID_PACKET_MSDollMachineoPerateResult DollMachinePacketID = 20005 ) // Enum value maps for DollMachinePacketID. @@ -40,18 +40,18 @@ var ( 20000: "PACKET_SMGameLinkSucceed", 20001: "PACKET_SMDollMachinePerate", 20002: "PACKET_SMDollMachineGrab", - 20003: "PACKET_MSDollMachineGrab", - 20004: "PACKET_MSDollMachineList", - 20005: "PACKET_MSUpdateDollMachineStatus", + 20003: "PACKET_MSDollMachineList", + 20004: "PACKET_MSUpdateDollMachineStatus", + 20005: "PACKET_MSDollMachineoPerateResult", } DollMachinePacketID_value = map[string]int32{ - "PACKET_SMDollMachineZero": 0, - "PACKET_SMGameLinkSucceed": 20000, - "PACKET_SMDollMachinePerate": 20001, - "PACKET_SMDollMachineGrab": 20002, - "PACKET_MSDollMachineGrab": 20003, - "PACKET_MSDollMachineList": 20004, - "PACKET_MSUpdateDollMachineStatus": 20005, + "PACKET_SMDollMachineZero": 0, + "PACKET_SMGameLinkSucceed": 20000, + "PACKET_SMDollMachinePerate": 20001, + "PACKET_SMDollMachineGrab": 20002, + "PACKET_MSDollMachineList": 20003, + "PACKET_MSUpdateDollMachineStatus": 20004, + "PACKET_MSDollMachineoPerateResult": 20005, } ) @@ -83,6 +83,7 @@ func (DollMachinePacketID) EnumDescriptor() ([]byte, []int) { } //通知链接成功 +//PACKET_SMDollMachinePerate type SMGameLinkSucceed struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -122,6 +123,7 @@ func (*SMGameLinkSucceed) Descriptor() ([]byte, []int) { } //操作 +//PACKET_SMDollMachinePerate type SMDollMachineoPerate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -249,19 +251,20 @@ func (x *SMDollMachineGrab) GetSnid() int32 { return 0 } -//返回下抓结果 -type MSDollMachineGrab struct { +//PACKET_MSDollMachineoPerateResult +type MSDollMachineoPerateResult struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识 - Result int32 `protobuf:"varint,3,opt,name=Result,proto3" json:"Result,omitempty"` //1-中奖 其他未中奖 + Result int32 `protobuf:"varint,3,opt,name=Result,proto3" json:"Result,omitempty"` // 1-成功 0-失败 + TypeId int32 `protobuf:"varint,4,opt,name=TypeId,proto3" json:"TypeId,omitempty"` //1 投币 2 下抓结果 } -func (x *MSDollMachineGrab) Reset() { - *x = MSDollMachineGrab{} +func (x *MSDollMachineoPerateResult) Reset() { + *x = MSDollMachineoPerateResult{} if protoimpl.UnsafeEnabled { mi := &file_machine_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -269,13 +272,13 @@ func (x *MSDollMachineGrab) Reset() { } } -func (x *MSDollMachineGrab) String() string { +func (x *MSDollMachineoPerateResult) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MSDollMachineGrab) ProtoMessage() {} +func (*MSDollMachineoPerateResult) ProtoMessage() {} -func (x *MSDollMachineGrab) ProtoReflect() protoreflect.Message { +func (x *MSDollMachineoPerateResult) ProtoReflect() protoreflect.Message { mi := &file_machine_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -287,32 +290,39 @@ func (x *MSDollMachineGrab) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use MSDollMachineGrab.ProtoReflect.Descriptor instead. -func (*MSDollMachineGrab) Descriptor() ([]byte, []int) { +// Deprecated: Use MSDollMachineoPerateResult.ProtoReflect.Descriptor instead. +func (*MSDollMachineoPerateResult) Descriptor() ([]byte, []int) { return file_machine_proto_rawDescGZIP(), []int{3} } -func (x *MSDollMachineGrab) GetSnid() int32 { +func (x *MSDollMachineoPerateResult) GetSnid() int32 { if x != nil { return x.Snid } return 0 } -func (x *MSDollMachineGrab) GetId() int32 { +func (x *MSDollMachineoPerateResult) GetId() int32 { if x != nil { return x.Id } return 0 } -func (x *MSDollMachineGrab) GetResult() int32 { +func (x *MSDollMachineoPerateResult) GetResult() int32 { if x != nil { return x.Result } return 0 } +func (x *MSDollMachineoPerateResult) GetTypeId() int32 { + if x != nil { + return x.TypeId + } + return 0 +} + //返回所有娃娃机连接 type MSDollMachineList struct { state protoimpl.MessageState @@ -496,45 +506,47 @@ var file_machine_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x54, 0x79, 0x70, 0x65, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, - 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x11, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, - 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x22, 0x3d, 0x0a, 0x11, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, - 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, - 0x2e, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x22, 0x3b, 0x0a, 0x0b, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, - 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x22, - 0x61, 0x0a, 0x19, 0x4d, 0x53, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, - 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x0a, 0x02, - 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, - 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, - 0x64, 0x72, 0x2a, 0xfd, 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, 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, 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, + 0x69, 0x64, 0x22, 0x70, 0x0a, 0x1a, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x6f, 0x50, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, + 0x53, 0x6e, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x54, 0x79, 0x70, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x54, 0x79, + 0x70, 0x65, 0x49, 0x64, 0x22, 0x3d, 0x0a, 0x11, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, + 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, + 0x65, 0x2e, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x22, 0x3b, 0x0a, 0x0b, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, + 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, + 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, + 0x22, 0x61, 0x0a, 0x19, 0x4d, 0x53, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x6c, 0x6c, + 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x0a, + 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, + 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, + 0x64, 0x64, 0x72, 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, } var ( @@ -552,14 +564,14 @@ 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_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 - (*MSUpdateDollMachineStatus)(nil), // 7: machine.MSUpdateDollMachineStatus + (DollMachinePacketID)(0), // 0: machine.DollMachinePacketID + (*SMGameLinkSucceed)(nil), // 1: machine.SMGameLinkSucceed + (*SMDollMachineoPerate)(nil), // 2: machine.SMDollMachineoPerate + (*SMDollMachineGrab)(nil), // 3: machine.SMDollMachineGrab + (*MSDollMachineoPerateResult)(nil), // 4: machine.MSDollMachineoPerateResult + (*MSDollMachineList)(nil), // 5: machine.MSDollMachineList + (*DollMachine)(nil), // 6: machine.DollMachine + (*MSUpdateDollMachineStatus)(nil), // 7: machine.MSUpdateDollMachineStatus } var file_machine_proto_depIdxs = []int32{ 6, // 0: machine.MSDollMachineList.data:type_name -> machine.DollMachine @@ -613,7 +625,7 @@ func file_machine_proto_init() { } } file_machine_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MSDollMachineGrab); i { + switch v := v.(*MSDollMachineoPerateResult); i { case 0: return &v.state case 1: diff --git a/protocol/machine/machine.proto b/protocol/machine/machine.proto index 8d941c7..1e4933d 100644 --- a/protocol/machine/machine.proto +++ b/protocol/machine/machine.proto @@ -10,15 +10,17 @@ enum DollMachinePacketID { PACKET_SMGameLinkSucceed = 20000; PACKET_SMDollMachinePerate = 20001; PACKET_SMDollMachineGrab = 20002; - PACKET_MSDollMachineGrab = 20003; - PACKET_MSDollMachineList = 20004; - PACKET_MSUpdateDollMachineStatus = 20005; + PACKET_MSDollMachineList = 20003; + PACKET_MSUpdateDollMachineStatus = 20004; + PACKET_MSDollMachineoPerateResult = 20005; } //通知链接成功 +//PACKET_SMDollMachinePerate message SMGameLinkSucceed{ } //操作 +//PACKET_SMDollMachinePerate message SMDollMachineoPerate{ int32 Snid = 1; int32 Id = 2; //娃娃机标识 @@ -32,13 +34,15 @@ message SMDollMachineGrab{ int32 Snid = 3; } -//返回下抓结果 -message MSDollMachineGrab{ +//PACKET_MSDollMachineoPerateResult +message MSDollMachineoPerateResult{ int32 Snid = 1; - int32 Id = 2; //娃娃机标识 - int32 Result = 3;//1-中奖 其他未中奖 + int32 Id = 2; //娃娃机标识 + int32 Result = 3;// 1-成功 0-失败 + int32 TypeId = 4;//1 投币 2 下抓结果 } + //返回所有娃娃机连接 message MSDollMachineList{ repeated DollMachine data = 1;