diff --git a/gamesrv/action/action_machine.go b/gamesrv/action/action_machine.go index 92d56e6..61d61a9 100644 --- a/gamesrv/action/action_machine.go +++ b/gamesrv/action/action_machine.go @@ -4,22 +4,65 @@ import ( "mongo.games.com/game/protocol/machine" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" + "sync" ) -var MachineMap = make(map[int]string) +var MachineMap = make(map[int]*DollMachine) +var MachineMapLock = sync.Mutex{} + +type DollMachine struct { + Id int + MachineStatus int32 //娃娃机链接状态 0:离线 1:在线 + Status bool //是否空闲 + VideoAddr string +} func MSDollMachineList(session *netlib.Session, packetId int, data interface{}) error { logger.Logger.Tracef("TestHandler %v", data) - MachineMap = make(map[int]string) + MachineMap = make(map[int]*DollMachine) if msg, ok := data.(*machine.MSDollMachineList); ok { for i, info := range msg.Data { - MachineMap[i+1] = info.VideoAddr + MachineMap[i+1] = &DollMachine{ + Id: i + 1, + Status: false, + VideoAddr: info.VideoAddr, + MachineStatus: 1, + } logger.Logger.Tracef("MachineMap[%v] = %v", i, info.VideoAddr) } } return nil } +// 获取空闲娃娃机标识 +func GetFreeDollMachineId() int { + // 获取互斥锁 + MachineMapLock.Lock() + defer MachineMapLock.Unlock() + for i, v := range MachineMap { + if v.Status == false { + v.Status = true + return i + } + } + return 0 +} + +// 获取指定娃娃机链接状态 +func GetDollMachineStatus(id int) int32 { + return MachineMap[id].MachineStatus +} + +func MSUpdateDollMachineStatusHandler(session *netlib.Session, packetId int, data interface{}) error { + logger.Logger.Tracef("MSUpdateDollMachineStatusHandler %v", data) + if msg, ok := data.(*machine.MSUpdateDollMachineStatus); ok { + MachineMap[int(msg.Id)].MachineStatus = msg.Status + logger.Logger.Tracef("更新娃娃机连接状态 id = %d,status= %d", msg.Id, msg.GetStatus()) + } + return nil +} func init() { netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineList) + //更新娃娃机链接状态 + netlib.Register(int(machine.DollMachinePacketID_PACKET_MSUpdateDollMachineStatus), &machine.MSUpdateDollMachineStatus{}, MSUpdateDollMachineStatusHandler) } diff --git a/gamesrv/clawdoll/scene_clawdoll.go b/gamesrv/clawdoll/scene_clawdoll.go index fd6a518..b663a30 100644 --- a/gamesrv/clawdoll/scene_clawdoll.go +++ b/gamesrv/clawdoll/scene_clawdoll.go @@ -1,13 +1,14 @@ package clawdoll import ( - "mongo.games.com/game/protocol/clawdoll" - "mongo.games.com/goserver/core/logger" - "mongo.games.com/game/common" rule "mongo.games.com/game/gamerule/clawdoll" "mongo.games.com/game/gamesrv/base" "mongo.games.com/game/proto" + "mongo.games.com/game/protocol/clawdoll" + "mongo.games.com/goserver/core/logger" + "mongo.games.com/goserver/core/netlib" + "mongo.games.com/goserver/srvlib" ) type PlayerData struct { @@ -41,9 +42,12 @@ type SceneEx struct { PlayerBackup map[int32]*PlayerData // 本局离场玩家数据备份 seats []*PlayerEx // 本局游戏中的玩家状态数据 - RoundId int // 局数,第几局 - robotNum int // 参与游戏的机器人数量 - logid string + RoundId int // 局数,第几局 + robotNum int // 参与游戏的机器人数量 + logid string + machineId int //娃娃机ID + machineConn *netlib.Session //娃娃机链接 + machineStatus int32 //娃娃机链接状态 0:离线 1:在线 } // 游戏是否能开始 @@ -203,3 +207,15 @@ func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) { BeUnderAgentCode: p.BeUnderAgentCode, } } + +// 向娃娃机主机发送消息 +func (this *SceneEx) SendToMachine(pid int, msg interface{}) { + if this.machineConn == nil { + this.machineConn = srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001) + } + if this.machineConn != nil { + this.machineConn.Send(pid, msg) + } else { + logger.Logger.Error("MachineConn is nil !") + } +} diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 46bc199..4b8ef1e 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -1,6 +1,7 @@ package clawdoll import ( + "mongo.games.com/game/gamesrv/action" "mongo.games.com/game/protocol/clawdoll" "time" @@ -61,15 +62,38 @@ func (this *PolicyClawdoll) OnTick(s *base.Scene) { if s.SceneState != nil { s.SceneState.OnTick(s) } + + sceneEx, ok := s.ExtraData.(*SceneEx) + if ok { + if sceneEx.machineId == 0 { + sceneEx.machineId = action.GetFreeDollMachineId() + } + if sceneEx.machineId != 0 { + machineStatus := action.GetDollMachineStatus(sceneEx.machineId) + if machineStatus == 0 { + //链接状态不可用 踢出所有玩家 + for _, p := range sceneEx.players { + sceneEx.delPlayer(p.Player) + } + sceneEx.machineStatus = 0 + logger.Logger.Trace("娃娃机离线,当前场景暂停服务!") + //通知客户单房间不可用 + } else { + if sceneEx.machineStatus == 0 { + sceneEx.machineStatus = machineStatus + //通知客户端房间可用 + } + } + } + } + } func (this *PolicyClawdoll) OnPlayerEnter(s *base.Scene, p *base.Player) { if s == nil || p == nil { return } - logger.Logger.Trace("(this *PolicyClawdoll) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.SnId) - if sceneEx, ok := s.ExtraData.(*SceneEx); ok { pos := -1 for i := 0; i < sceneEx.GetPlayerNum(); i++ { diff --git a/machine/machinedoll/machinemgr.go b/machine/machinedoll/machinemgr.go index eaece9c..196850e 100644 --- a/machine/machinedoll/machinemgr.go +++ b/machine/machinedoll/machinemgr.go @@ -89,7 +89,7 @@ func (this *MachineManager) StartHeartbeat(id int, conn *net.Conn, addr string) delete(ConnMap, id) this.DelConnMap[id] = addr //通知游戏服 - this.UpdateToGameServer() + this.UpdateToGameServer(id, 0) fmt.Println("删除链接!!!!!!addr = ", addr) go timer.StartTimer(timer.TimerActionWrapper(func(h timer.TimerHandle, ud interface{}) bool { this.ReConnect() @@ -105,7 +105,6 @@ func (this *MachineManager) StartHeartbeat(id int, conn *net.Conn, addr string) 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 { @@ -113,28 +112,20 @@ func (this *MachineManager) ReConnect() bool { } ConnMap[id] = conn delIds = append(delIds, id) - status = true + this.UpdateToGameServer(id, 1) } 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 (this *MachineManager) UpdateToGameServer(id int, status int32) { + msg := &machine.MSUpdateDollMachineStatus{} + msg.Status = status + msg.Id = int32(id) + SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSUpdateDollMachineStatus), msg) } func SendToGameServer(pid int, msg interface{}) { diff --git a/protocol/dollmachine/dollmachine.pb.go b/protocol/dollmachine/dollmachine.pb.go deleted file mode 100644 index 6624f68..0000000 --- a/protocol/dollmachine/dollmachine.pb.go +++ /dev/null @@ -1,537 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1-devel -// protoc v3.19.4 -// source: dollmachine.proto - -package dollmachine - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -//S-GAME M-娃娃机主机 -//娃娃机协议 -type DollMachinePacketID int32 - -const ( - DollMachinePacketID_PACKET_SMDollMachineZero DollMachinePacketID = 0 - DollMachinePacketID_PACKET_SMDollMachineMove DollMachinePacketID = 3001 - DollMachinePacketID_PACKET_SMDollMachineGrab DollMachinePacketID = 3002 - DollMachinePacketID_PACKET_MSDollMachineGrab DollMachinePacketID = 3003 - DollMachinePacketID_PACKET_MSDollMachineList DollMachinePacketID = 3004 -) - -// Enum value maps for DollMachinePacketID. -var ( - DollMachinePacketID_name = map[int32]string{ - 0: "PACKET_SMDollMachineZero", - 3001: "PACKET_SMDollMachineMove", - 3002: "PACKET_SMDollMachineGrab", - 3003: "PACKET_MSDollMachineGrab", - 3004: "PACKET_MSDollMachineList", - } - DollMachinePacketID_value = map[string]int32{ - "PACKET_SMDollMachineZero": 0, - "PACKET_SMDollMachineMove": 3001, - "PACKET_SMDollMachineGrab": 3002, - "PACKET_MSDollMachineGrab": 3003, - "PACKET_MSDollMachineList": 3004, - } -) - -func (x DollMachinePacketID) Enum() *DollMachinePacketID { - p := new(DollMachinePacketID) - *p = x - return p -} - -func (x DollMachinePacketID) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (DollMachinePacketID) Descriptor() protoreflect.EnumDescriptor { - return file_dollmachine_proto_enumTypes[0].Descriptor() -} - -func (DollMachinePacketID) Type() protoreflect.EnumType { - return &file_dollmachine_proto_enumTypes[0] -} - -func (x DollMachinePacketID) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use DollMachinePacketID.Descriptor instead. -func (DollMachinePacketID) EnumDescriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{0} -} - -//移动 -type SMDollMachineMove struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` - Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识 - Direction int32 `protobuf:"varint,3,opt,name=Direction,proto3" json:"Direction,omitempty"` // 1-前 2-后 3-左 4-右 -} - -func (x *SMDollMachineMove) Reset() { - *x = SMDollMachineMove{} - if protoimpl.UnsafeEnabled { - mi := &file_dollmachine_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SMDollMachineMove) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SMDollMachineMove) ProtoMessage() {} - -func (x *SMDollMachineMove) ProtoReflect() protoreflect.Message { - mi := &file_dollmachine_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SMDollMachineMove.ProtoReflect.Descriptor instead. -func (*SMDollMachineMove) Descriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{0} -} - -func (x *SMDollMachineMove) GetSnid() int32 { - if x != nil { - return x.Snid - } - return 0 -} - -func (x *SMDollMachineMove) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *SMDollMachineMove) GetDirection() int32 { - if x != nil { - return x.Direction - } - return 0 -} - -//下抓 -type SMDollMachineGrab struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TypeId int32 `protobuf:"varint,1,opt,name=TypeId,proto3" json:"TypeId,omitempty"` //1-弱力抓 2 -强力抓 3-必出抓 - Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识 - Snid int32 `protobuf:"varint,3,opt,name=Snid,proto3" json:"Snid,omitempty"` -} - -func (x *SMDollMachineGrab) Reset() { - *x = SMDollMachineGrab{} - if protoimpl.UnsafeEnabled { - mi := &file_dollmachine_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SMDollMachineGrab) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SMDollMachineGrab) ProtoMessage() {} - -func (x *SMDollMachineGrab) ProtoReflect() protoreflect.Message { - mi := &file_dollmachine_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SMDollMachineGrab.ProtoReflect.Descriptor instead. -func (*SMDollMachineGrab) Descriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{1} -} - -func (x *SMDollMachineGrab) GetTypeId() int32 { - if x != nil { - return x.TypeId - } - return 0 -} - -func (x *SMDollMachineGrab) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *SMDollMachineGrab) GetSnid() int32 { - if x != nil { - return x.Snid - } - return 0 -} - -//返回下抓结果 -type MSDollMachineGrab struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` - Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识 - Result int32 `protobuf:"varint,3,opt,name=Result,proto3" json:"Result,omitempty"` //1-中奖 其他未中奖 -} - -func (x *MSDollMachineGrab) Reset() { - *x = MSDollMachineGrab{} - if protoimpl.UnsafeEnabled { - mi := &file_dollmachine_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MSDollMachineGrab) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MSDollMachineGrab) ProtoMessage() {} - -func (x *MSDollMachineGrab) ProtoReflect() protoreflect.Message { - mi := &file_dollmachine_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MSDollMachineGrab.ProtoReflect.Descriptor instead. -func (*MSDollMachineGrab) Descriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{2} -} - -func (x *MSDollMachineGrab) GetSnid() int32 { - if x != nil { - return x.Snid - } - return 0 -} - -func (x *MSDollMachineGrab) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *MSDollMachineGrab) GetResult() int32 { - if x != nil { - return x.Result - } - return 0 -} - -//返回所有娃娃机连接 -type MSDollMachineList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data []*DollMachine `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` -} - -func (x *MSDollMachineList) Reset() { - *x = MSDollMachineList{} - if protoimpl.UnsafeEnabled { - mi := &file_dollmachine_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MSDollMachineList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MSDollMachineList) ProtoMessage() {} - -func (x *MSDollMachineList) ProtoReflect() protoreflect.Message { - mi := &file_dollmachine_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MSDollMachineList.ProtoReflect.Descriptor instead. -func (*MSDollMachineList) Descriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{3} -} - -func (x *MSDollMachineList) GetData() []*DollMachine { - if x != nil { - return x.Data - } - return nil -} - -type DollMachine struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` - Status int32 `protobuf:"varint,2,opt,name=Status,proto3" json:"Status,omitempty"` //1-空闲 2-无法使用 -} - -func (x *DollMachine) Reset() { - *x = DollMachine{} - if protoimpl.UnsafeEnabled { - mi := &file_dollmachine_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DollMachine) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DollMachine) ProtoMessage() {} - -func (x *DollMachine) ProtoReflect() protoreflect.Message { - mi := &file_dollmachine_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DollMachine.ProtoReflect.Descriptor instead. -func (*DollMachine) Descriptor() ([]byte, []int) { - return file_dollmachine_proto_rawDescGZIP(), []int{4} -} - -func (x *DollMachine) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *DollMachine) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -var File_dollmachine_proto protoreflect.FileDescriptor - -var file_dollmachine_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x64, 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x64, 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, - 0x22, 0x55, 0x0a, 0x11, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, - 0x65, 0x4d, 0x6f, 0x76, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x44, 0x69, 0x72, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x44, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4f, 0x0a, 0x11, 0x53, 0x4d, 0x44, 0x6f, 0x6c, - 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x12, 0x16, 0x0a, 0x06, - 0x54, 0x79, 0x70, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x54, 0x79, - 0x70, 0x65, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x11, 0x4d, 0x53, 0x44, 0x6f, - 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x12, 0x12, 0x0a, - 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, - 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, - 0x64, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x41, 0x0a, 0x11, 0x4d, 0x53, 0x44, - 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2c, - 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, - 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2e, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, - 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x35, 0x0a, 0x0b, - 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x2a, 0xaf, 0x01, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, - 0x69, 0x6e, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x18, 0x50, - 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, - 0x69, 0x6e, 0x65, 0x5a, 0x65, 0x72, 0x6f, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, - 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, - 0x65, 0x4d, 0x6f, 0x76, 0x65, 0x10, 0xb9, 0x17, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, - 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, - 0x47, 0x72, 0x61, 0x62, 0x10, 0xba, 0x17, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, - 0x72, 0x61, 0x62, 0x10, 0xbb, 0x17, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, - 0x73, 0x74, 0x10, 0xbc, 0x17, 0x42, 0x2b, 0x5a, 0x29, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, - 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x64, 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, - 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_dollmachine_proto_rawDescOnce sync.Once - file_dollmachine_proto_rawDescData = file_dollmachine_proto_rawDesc -) - -func file_dollmachine_proto_rawDescGZIP() []byte { - file_dollmachine_proto_rawDescOnce.Do(func() { - file_dollmachine_proto_rawDescData = protoimpl.X.CompressGZIP(file_dollmachine_proto_rawDescData) - }) - return file_dollmachine_proto_rawDescData -} - -var file_dollmachine_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_dollmachine_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_dollmachine_proto_goTypes = []interface{}{ - (DollMachinePacketID)(0), // 0: dollmachine.DollMachinePacketID - (*SMDollMachineMove)(nil), // 1: dollmachine.SMDollMachineMove - (*SMDollMachineGrab)(nil), // 2: dollmachine.SMDollMachineGrab - (*MSDollMachineGrab)(nil), // 3: dollmachine.MSDollMachineGrab - (*MSDollMachineList)(nil), // 4: dollmachine.MSDollMachineList - (*DollMachine)(nil), // 5: dollmachine.DollMachine -} -var file_dollmachine_proto_depIdxs = []int32{ - 5, // 0: dollmachine.MSDollMachineList.data:type_name -> dollmachine.DollMachine - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_dollmachine_proto_init() } -func file_dollmachine_proto_init() { - if File_dollmachine_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_dollmachine_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SMDollMachineMove); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dollmachine_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SMDollMachineGrab); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dollmachine_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MSDollMachineGrab); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dollmachine_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MSDollMachineList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dollmachine_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DollMachine); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_dollmachine_proto_rawDesc, - NumEnums: 1, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_dollmachine_proto_goTypes, - DependencyIndexes: file_dollmachine_proto_depIdxs, - EnumInfos: file_dollmachine_proto_enumTypes, - MessageInfos: file_dollmachine_proto_msgTypes, - }.Build() - File_dollmachine_proto = out.File - file_dollmachine_proto_rawDesc = nil - file_dollmachine_proto_goTypes = nil - file_dollmachine_proto_depIdxs = nil -} diff --git a/protocol/dollmachine/dollmachine.proto b/protocol/dollmachine/dollmachine.proto deleted file mode 100644 index 450795e..0000000 --- a/protocol/dollmachine/dollmachine.proto +++ /dev/null @@ -1,43 +0,0 @@ -syntax = "proto3"; -package dollmachine; -option go_package = "mongo.games.com/game/protocol/dollmachine"; - -//S-GAME M-娃娃机主机 -//娃娃机协议 -enum DollMachinePacketID { - PACKET_SMDollMachineZero = 0; - PACKET_SMDollMachineMove = 3001; - PACKET_SMDollMachineGrab = 3002; - PACKET_MSDollMachineGrab = 3003; - PACKET_MSDollMachineList = 3004; -} - -//移动 -message SMDollMachineMove{ - int32 Snid = 1; - int32 Id = 2; //娃娃机标识 - int32 Direction = 3; // 1-前 2-后 3-左 4-右 -} - -//下抓 -message SMDollMachineGrab{ - int32 TypeId = 1;//1-弱力抓 2 -强力抓 3-必出抓 - int32 Id =2; //娃娃机标识 - int32 Snid = 3; -} - -//返回下抓结果 -message MSDollMachineGrab{ - int32 Snid = 1; - int32 Id = 2; //娃娃机标识 - int32 Result = 3;//1-中奖 其他未中奖 -} - -//返回所有娃娃机连接 -message MSDollMachineList{ - repeated DollMachine data = 1; -} -message DollMachine{ - int32 Id = 1; - int32 Status = 2; //1-空闲 2-无法使用 -} \ No newline at end of file diff --git a/protocol/machine/machine.pb.go b/protocol/machine/machine.pb.go index 576911a..257ca48 100644 --- a/protocol/machine/machine.pb.go +++ b/protocol/machine/machine.pb.go @@ -24,12 +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_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 ) // Enum value maps for DollMachinePacketID. @@ -41,14 +42,16 @@ var ( 20002: "PACKET_SMDollMachineGrab", 20003: "PACKET_MSDollMachineGrab", 20004: "PACKET_MSDollMachineList", + 20005: "PACKET_MSUpdateDollMachineStatus", } DollMachinePacketID_value = map[string]int32{ - "PACKET_SMDollMachineZero": 0, - "PACKET_SMGameLinkSucceed": 20000, - "PACKET_SMDollMachinePerate": 20001, - "PACKET_SMDollMachineGrab": 20002, - "PACKET_MSDollMachineGrab": 20003, - "PACKET_MSDollMachineList": 20004, + "PACKET_SMDollMachineZero": 0, + "PACKET_SMGameLinkSucceed": 20000, + "PACKET_SMDollMachinePerate": 20001, + "PACKET_SMDollMachineGrab": 20002, + "PACKET_MSDollMachineGrab": 20003, + "PACKET_MSDollMachineList": 20004, + "PACKET_MSUpdateDollMachineStatus": 20005, } ) @@ -413,6 +416,62 @@ func (x *DollMachine) GetVideoAddr() string { return "" } +//更新娃娃机状态 +type MSUpdateDollMachineStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` + Status int32 `protobuf:"varint,2,opt,name=Status,proto3" json:"Status,omitempty"` //1-空闲 0-无法使用 +} + +func (x *MSUpdateDollMachineStatus) Reset() { + *x = MSUpdateDollMachineStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_machine_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MSUpdateDollMachineStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MSUpdateDollMachineStatus) ProtoMessage() {} + +func (x *MSUpdateDollMachineStatus) ProtoReflect() protoreflect.Message { + mi := &file_machine_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MSUpdateDollMachineStatus.ProtoReflect.Descriptor instead. +func (*MSUpdateDollMachineStatus) Descriptor() ([]byte, []int) { + return file_machine_proto_rawDescGZIP(), []int{6} +} + +func (x *MSUpdateDollMachineStatus) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *MSUpdateDollMachineStatus) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + var File_machine_proto protoreflect.FileDescriptor var file_machine_proto_rawDesc = []byte{ @@ -441,24 +500,31 @@ var file_machine_proto_rawDesc = []byte{ 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, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x22, + 0x43, 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, 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, } var ( @@ -474,15 +540,16 @@ func file_machine_proto_rawDescGZIP() []byte { } var file_machine_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_machine_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_machine_proto_msgTypes = make([]protoimpl.MessageInfo, 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 + (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 } var file_machine_proto_depIdxs = []int32{ 6, // 0: machine.MSDollMachineList.data:type_name -> machine.DollMachine @@ -571,6 +638,18 @@ func file_machine_proto_init() { return nil } } + file_machine_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MSUpdateDollMachineStatus); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -578,7 +657,7 @@ func file_machine_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_machine_proto_rawDesc, NumEnums: 1, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/machine/machine.proto b/protocol/machine/machine.proto index 00b6124..642b236 100644 --- a/protocol/machine/machine.proto +++ b/protocol/machine/machine.proto @@ -12,6 +12,7 @@ enum DollMachinePacketID { PACKET_SMDollMachineGrab = 20002; PACKET_MSDollMachineGrab = 20003; PACKET_MSDollMachineList = 20004; + PACKET_MSUpdateDollMachineStatus = 20005; } //通知链接成功 message SMGameLinkSucceed{ @@ -45,4 +46,9 @@ message MSDollMachineList{ message DollMachine{ int32 Id = 1; string VideoAddr = 2; +} +//更新娃娃机状态 +message MSUpdateDollMachineStatus{ + int32 Id = 1; + int32 Status = 2; //1-空闲 0-无法使用 } \ No newline at end of file diff --git a/public b/public index 682e8f3..d789cca 160000 --- a/public +++ b/public @@ -1 +1 @@ -Subproject commit 682e8f3ccf7d1056210c3ee68c9d1db271d9069d +Subproject commit d789cca81a36ddbaf30e5414b6c4fe530e0631f6