diff --git a/cmd/test/action/protocode.go b/cmd/test/action/protocode.go index 3a5f6b6..46ae088 100644 --- a/cmd/test/action/protocode.go +++ b/cmd/test/action/protocode.go @@ -15,14 +15,14 @@ func GetTestActionMap() map[interface{}]interface{} { am[uint32(pb.ProtoCode_RoleEndBattleRpc)] = RoleEndBattleRsp am[uint32(pb.ProtoCode_EquipmentDelRpc)] = EquipmentDelRsp am[uint32(pb.ProtoCode_HeroUpLevelRpc)] = HeroUpLevelRsp + am[uint32(pb.ProtoCode_DisConnectNty)] = DisConnectNty + am[uint32(pb.ProtoCode_RoleUpdateItemsNty)] = RoleUpdateItemsNty am[uint32(pb.ProtoCode_HeartRsp)] = HeartRsp - am[uint32(pb.ProtoCode_DisConnectRsp)] = DisConnectRsp am[uint32(pb.ProtoCode_RoleRsp)] = RoleRsp am[uint32(pb.ProtoCode_RoleUpdatePropertyRsp)] = RoleUpdatePropertyRsp am[uint32(pb.ProtoCode_RoleEndBattleRsp)] = RoleEndBattleRsp am[uint32(pb.ProtoCode_EquipmentAddRsp)] = EquipmentAddRsp am[uint32(pb.ProtoCode_HeroUpLevelRsp)] = HeroUpLevelRsp - am[uint32(pb.ProtoCode_RoleUpdateItemsNty)] = RoleUpdateItemsNty return am } diff --git a/pb/game.pb.go b/pb/game.pb.go index 17228e0..5897c04 100644 --- a/pb/game.pb.go +++ b/pb/game.pb.go @@ -227,14 +227,14 @@ func (x *CreateReq) GetDevice() string { return "" } -type DisConnectRsp struct { +type DisConnectNty struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *DisConnectRsp) Reset() { - *x = DisConnectRsp{} +func (x *DisConnectNty) Reset() { + *x = DisConnectNty{} if protoimpl.UnsafeEnabled { mi := &file_game_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -242,13 +242,13 @@ func (x *DisConnectRsp) Reset() { } } -func (x *DisConnectRsp) String() string { +func (x *DisConnectNty) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DisConnectRsp) ProtoMessage() {} +func (*DisConnectNty) ProtoMessage() {} -func (x *DisConnectRsp) ProtoReflect() protoreflect.Message { +func (x *DisConnectNty) ProtoReflect() protoreflect.Message { mi := &file_game_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -260,8 +260,8 @@ func (x *DisConnectRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DisConnectRsp.ProtoReflect.Descriptor instead. -func (*DisConnectRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use DisConnectNty.ProtoReflect.Descriptor instead. +func (*DisConnectNty) Descriptor() ([]byte, []int) { return file_game_proto_rawDescGZIP(), []int{4} } @@ -1086,7 +1086,7 @@ var file_game_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x52, 0x73, 0x70, 0x22, 0x31, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x65, 0x63, 0x74, 0x4e, 0x74, 0x79, 0x22, 0x31, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x22, 0x37, 0x0a, 0x09, 0x45, 0x71, 0x75, @@ -1181,7 +1181,7 @@ var file_game_proto_goTypes = []interface{}{ (*HeartRsp)(nil), // 1: game.HeartRsp (*LoginReq)(nil), // 2: game.LoginReq (*CreateReq)(nil), // 3: game.CreateReq - (*DisConnectRsp)(nil), // 4: game.DisConnectRsp + (*DisConnectNty)(nil), // 4: game.DisConnectNty (*ChangeTeamReq)(nil), // 5: game.ChangeTeamReq (*EquipInfo)(nil), // 6: game.EquipInfo (*HeroEquipReferReq)(nil), // 7: game.HeroEquipReferReq @@ -1275,7 +1275,7 @@ func file_game_proto_init() { } } file_game_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DisConnectRsp); i { + switch v := v.(*DisConnectNty); i { case 0: return &v.state case 1: diff --git a/pb/protocode.pb.go b/pb/protocode.pb.go index fc01ced..6dbdf3e 100644 --- a/pb/protocode.pb.go +++ b/pb/protocode.pb.go @@ -34,14 +34,14 @@ const ( ProtoCode_RoleEndBattleRpc ProtoCode = 8 ProtoCode_EquipmentDelRpc ProtoCode = 9 ProtoCode_HeroUpLevelRpc ProtoCode = 10 - ProtoCode_HeartRsp ProtoCode = 11 - ProtoCode_DisConnectRsp ProtoCode = 12 - ProtoCode_RoleRsp ProtoCode = 13 - ProtoCode_RoleUpdatePropertyRsp ProtoCode = 14 - ProtoCode_RoleEndBattleRsp ProtoCode = 15 - ProtoCode_EquipmentAddRsp ProtoCode = 16 - ProtoCode_HeroUpLevelRsp ProtoCode = 17 - ProtoCode_RoleUpdateItemsNty ProtoCode = 18 + ProtoCode_DisConnectNty ProtoCode = 11 + ProtoCode_RoleUpdateItemsNty ProtoCode = 12 + ProtoCode_HeartRsp ProtoCode = 13 + ProtoCode_RoleRsp ProtoCode = 14 + ProtoCode_RoleUpdatePropertyRsp ProtoCode = 15 + ProtoCode_RoleEndBattleRsp ProtoCode = 16 + ProtoCode_EquipmentAddRsp ProtoCode = 17 + ProtoCode_HeroUpLevelRsp ProtoCode = 18 ) // Enum value maps for ProtoCode. @@ -58,14 +58,14 @@ var ( 8: "RoleEndBattleRpc", 9: "EquipmentDelRpc", 10: "HeroUpLevelRpc", - 11: "HeartRsp", - 12: "DisConnectRsp", - 13: "RoleRsp", - 14: "RoleUpdatePropertyRsp", - 15: "RoleEndBattleRsp", - 16: "EquipmentAddRsp", - 17: "HeroUpLevelRsp", - 18: "RoleUpdateItemsNty", + 11: "DisConnectNty", + 12: "RoleUpdateItemsNty", + 13: "HeartRsp", + 14: "RoleRsp", + 15: "RoleUpdatePropertyRsp", + 16: "RoleEndBattleRsp", + 17: "EquipmentAddRsp", + 18: "HeroUpLevelRsp", } ProtoCode_value = map[string]int32{ "UNKNOWN": 0, @@ -79,14 +79,14 @@ var ( "RoleEndBattleRpc": 8, "EquipmentDelRpc": 9, "HeroUpLevelRpc": 10, - "HeartRsp": 11, - "DisConnectRsp": 12, - "RoleRsp": 13, - "RoleUpdatePropertyRsp": 14, - "RoleEndBattleRsp": 15, - "EquipmentAddRsp": 16, - "HeroUpLevelRsp": 17, - "RoleUpdateItemsNty": 18, + "DisConnectNty": 11, + "RoleUpdateItemsNty": 12, + "HeartRsp": 13, + "RoleRsp": 14, + "RoleUpdatePropertyRsp": 15, + "RoleEndBattleRsp": 16, + "EquipmentAddRsp": 17, + "HeroUpLevelRsp": 18, } ) @@ -135,17 +135,17 @@ var file_protocode_proto_rawDesc = []byte{ 0x6f, 0x6c, 0x65, 0x45, 0x6e, 0x64, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x70, 0x63, 0x10, 0x08, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x52, 0x70, 0x63, 0x10, 0x09, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x55, 0x70, - 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x70, 0x63, 0x10, 0x0a, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, - 0x61, 0x72, 0x74, 0x52, 0x73, 0x70, 0x10, 0x0b, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x73, 0x70, 0x10, 0x0c, 0x12, 0x0b, 0x0a, 0x07, 0x52, - 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x10, 0x0d, 0x12, 0x19, 0x0a, 0x15, 0x52, 0x6f, 0x6c, 0x65, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x52, 0x73, - 0x70, 0x10, 0x0e, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x6f, 0x6c, 0x65, 0x45, 0x6e, 0x64, 0x42, 0x61, - 0x74, 0x74, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x10, 0x0f, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x71, 0x75, - 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x52, 0x73, 0x70, 0x10, 0x10, 0x12, 0x12, - 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x55, 0x70, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x73, 0x70, - 0x10, 0x11, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x49, 0x74, 0x65, 0x6d, 0x73, 0x4e, 0x74, 0x79, 0x10, 0x12, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, + 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x70, 0x63, 0x10, 0x0a, 0x12, 0x11, 0x0a, 0x0d, 0x44, 0x69, + 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x4e, 0x74, 0x79, 0x10, 0x0b, 0x12, 0x16, 0x0a, + 0x12, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, + 0x4e, 0x74, 0x79, 0x10, 0x0c, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x73, + 0x70, 0x10, 0x0d, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x10, 0x0e, + 0x12, 0x19, 0x0a, 0x15, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, + 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x52, 0x73, 0x70, 0x10, 0x0f, 0x12, 0x14, 0x0a, 0x10, 0x52, + 0x6f, 0x6c, 0x65, 0x45, 0x6e, 0x64, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x10, + 0x10, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64, + 0x64, 0x52, 0x73, 0x70, 0x10, 0x11, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x55, 0x70, + 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x73, 0x70, 0x10, 0x12, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/tools/generator.py b/tools/generator.py index e4065ee..e1e2259 100644 --- a/tools/generator.py +++ b/tools/generator.py @@ -61,26 +61,6 @@ def generatorProto(path): continue GoCodeData += GoProtoCodeLine.format(messageStr[:n1], messageStr[:n1]) GoCodeTestData += GoProtoCodeTestReqLine.format(messageStr[:n1], messageStr[:n1]) - - # rsp - for line in lines: - if line.find("message") == -1: - continue - sline = line.split(' ') - if len(sline) < 2: - continue - - messageStr = sline[1].replace('\n', '').replace('{', "") - n2 = messageStr.find('Rsp') - loginReq = messageStr.find('LoginReq') - - if n2 != -1: - code += 1 - ProtoCodeData += ProtoCodeLineRsp.format(messageStr[:n2], code) - if loginReq != -1: - continue - GoCodeTestData += GoProtoCodeTestRspLine.format(messageStr[:n2], messageStr[:n2]) - # nty for line in lines: if line.find("message") == -1: @@ -100,6 +80,24 @@ def generatorProto(path): continue GoCodeTestData += GoProtoCodeTestNtyLine.format(messageStr[:n3], messageStr[:n3]) + # rsp 满足客户端需要 + for line in lines: + if line.find("message") == -1: + continue + sline = line.split(' ') + if len(sline) < 2: + continue + + messageStr = sline[1].replace('\n', '').replace('{', "") + n2 = messageStr.find('Rsp') + loginReq = messageStr.find('LoginReq') + if n2 != -1: + code += 1 + ProtoCodeData += ProtoCodeLineRsp.format(messageStr[:n2], code) + if loginReq != -1: + continue + GoCodeTestData += GoProtoCodeTestRspLine.format(messageStr[:n2], messageStr[:n2]) + # protocode.go gostr = GoProtoCodeStr.format(GoCodeData) -- libgit2 0.21.2