diff --git a/.gitignore b/.gitignore index c07a73d..d800412 100644 --- a/.gitignore +++ b/.gitignore @@ -4,113 +4,38 @@ Public/Publish/Server/gateway Public/Publish/Server/scene # Unity生成的目录 -Client/unity_clone_0/ -Client/unity/[Ll]ibrary/ -Client/unity/[Tt]emp/ -Client/unity/[Oo]bj/ -Client/unity/[Bb]uild/ -Client/unity/[Bb]uilds/ -Client/unity/[Ll]ogs/ -Client/unity/[Uu]ser[Ss]ettings/ -Client/unity/[Mm]emoryCaptures/ +Client/Point/[Ll]ibrary/ +Client/Point/[Tt]emp/ +Client/Point/[Oo]bj/ +Client/Point/[Bb]uild/ +Client/Point/[Bb]uilds/ +Client/Point/[Ll]ogs/ +Client/Point/[Uu]ser[Ss]ettings/ +Client/Point/[Mm]emoryCaptures/ # Unity缓存和配置文件 -Client/unity/.vs/ -Client/unity/.idea/ -Client/unity/.vscode/ -Client/unity/*.csproj -Client/unity/*.unityproj -Client/unity/*.sln -Client/unity/*.suo -Client/unity/*.tmp -Client/unity/*.user -Client/unity/*.userprefs -Client/unity/*.pidb -Client/unity/*.booproj -Client/unity/*.svd -Client/unity/*.pdb -Client/unity/*.mdb -Client/unity/*.opendb -Client/unity/*.VC.db +Client/Point/.vs/ +Client/Point/.idea/ +Client/Point/.vscode/ +Client/Point/*.csproj +Client/Point/*.unityproj +Client/Point/*.sln +Client/Point/*.suo +Client/Point/*.tmp +Client/Point/*.user +Client/Point/*.userprefs +Client/Point/*.pidb +Client/Point/*.booproj +Client/Point/*.svd +Client/Point/*.pdb +Client/Point/*.mdb +Client/Point/*.opendb +Client/Point/*.VC.db # Unity元数据 -Client/unity/*.pidb.meta -Client/unity/*.pdb.meta -Client/unity/*.mdb.meta +Client/Point/*.pidb.meta +Client/Point/*.pdb.meta +Client/Point/*.mdb.meta # Crashlytics -Client/unity/crashlytics-build.properties - -# Unity生成的目录 -Client/Combat/[Ll]ibrary/ -Client/Combat/[Tt]emp/ -Client/Combat/[Oo]bj/ -Client/Combat/[Bb]uild/ -Client/Combat/[Bb]uilds/ -Client/Combat/[Ll]ogs/ -Client/Combat/[Uu]ser[Ss]ettings/ -Client/Combat/[Mm]emoryCaptures/ - -# Unity缓存和配置文件 -Client/Combat/.vs/ -Client/Combat/.idea/ -Client/Combat/.vscode/ -Client/Combat/*.csproj -Client/Combat/*.unityproj -Client/Combat/*.sln -Client/Combat/*.suo -Client/Combat/*.tmp -Client/Combat/*.user -Client/Combat/*.userprefs -Client/Combat/*.pidb -Client/Combat/*.booproj -Client/Combat/*.svd -Client/Combat/*.pdb -Client/Combat/*.mdb -Client/Combat/*.opendb -Client/Combat/*.VC.db - -# Unity元数据 -Client/Combat/*.pidb.meta -Client/Combat/*.pdb.meta -Client/Combat/*.mdb.meta - -# Crashlytics -Client/Combat/crashlytics-build.properties - -# Unity生成的目录 -Client/Combat2/[Ll]ibrary/ -Client/Combat2/[Tt]emp/ -Client/Combat2/[Oo]bj/ -Client/Combat2/[Bb]uild/ -Client/Combat2/[Bb]uilds/ -Client/Combat2/[Ll]ogs/ -Client/Combat2/[Uu]ser[Ss]ettings/ -Client/Combat2/[Mm]emoryCaptures/ - -# Unity缓存和配置文件 -Client/Combat2/.vs/ -Client/Combat2/.idea/ -Client/Combat2/.vscode/ -Client/Combat2/*.csproj -Client/Combat2/*.unityproj -Client/Combat2/*.sln -Client/Combat2/*.suo -Client/Combat2/*.tmp -Client/Combat2/*.user -Client/Combat2/*.userprefs -Client/Combat2/*.pidb -Client/Combat2/*.booproj -Client/Combat2/*.svd -Client/Combat2/*.pdb -Client/Combat2/*.mdb -Client/Combat2/*.opendb -Client/Combat2/*.VC.db - -# Unity元数据 -Client/Combat2/*.pidb.meta -Client/Combat2/*.pdb.meta -Client/Combat2/*.mdb.meta - -# Crashlytics -Client/Combat2/crashlytics-build.properties \ No newline at end of file +Client/Point/crashlytics-build.properties \ No newline at end of file diff --git a/Public/Proto/ServerClient/gen/common/proto/sc/sc_common/sc_common.pb.go b/Public/Proto/ServerClient/gen/common/proto/sc/sc_common/sc_common.pb.go new file mode 100644 index 0000000..dccafd4 --- /dev/null +++ b/Public/Proto/ServerClient/gen/common/proto/sc/sc_common/sc_common.pb.go @@ -0,0 +1,62 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: sc_common.proto + +package sc_common + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_sc_common_proto protoreflect.FileDescriptor + +var file_sc_common_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x42, 0x1b, 0x5a, 0x19, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_sc_common_proto_goTypes = []interface{}{} +var file_sc_common_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 +} + +func init() { file_sc_common_proto_init() } +func file_sc_common_proto_init() { + if File_sc_common_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sc_common_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sc_common_proto_goTypes, + DependencyIndexes: file_sc_common_proto_depIdxs, + }.Build() + File_sc_common_proto = out.File + file_sc_common_proto_rawDesc = nil + file_sc_common_proto_goTypes = nil + file_sc_common_proto_depIdxs = nil +} diff --git a/Server/common/proto/gen/cs/action.pb.go b/Public/Proto/ServerClient/gen/common/proto/sc/sc_pb/action.pb.go similarity index 79% rename from Server/common/proto/gen/cs/action.pb.go rename to Public/Proto/ServerClient/gen/common/proto/sc/sc_pb/action.pb.go index 6179734..cb9977a 100644 --- a/Server/common/proto/gen/cs/action.pb.go +++ b/Public/Proto/ServerClient/gen/common/proto/sc/sc_pb/action.pb.go @@ -2,12 +2,12 @@ // versions: // protoc-gen-go v1.32.0 // protoc v4.25.1 -// source: cs/action.proto +// source: action.proto -package cs +package sc_pb import ( - _ "common/proto/gen/common" + _ "common/proto/sc/sc_common" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -52,11 +52,11 @@ func (x ActionID) String() string { } func (ActionID) Descriptor() protoreflect.EnumDescriptor { - return file_cs_action_proto_enumTypes[0].Descriptor() + return file_action_proto_enumTypes[0].Descriptor() } func (ActionID) Type() protoreflect.EnumType { - return &file_cs_action_proto_enumTypes[0] + return &file_action_proto_enumTypes[0] } func (x ActionID) Number() protoreflect.EnumNumber { @@ -65,7 +65,7 @@ func (x ActionID) Number() protoreflect.EnumNumber { // Deprecated: Use ActionID.Descriptor instead. func (ActionID) EnumDescriptor() ([]byte, []int) { - return file_cs_action_proto_rawDescGZIP(), []int{0} + return file_action_proto_rawDescGZIP(), []int{0} } // MESSAGE_ID_ENTER_INSTANCE @@ -80,7 +80,7 @@ type C2S_EnterInstance struct { func (x *C2S_EnterInstance) Reset() { *x = C2S_EnterInstance{} if protoimpl.UnsafeEnabled { - mi := &file_cs_action_proto_msgTypes[0] + mi := &file_action_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93,7 +93,7 @@ func (x *C2S_EnterInstance) String() string { func (*C2S_EnterInstance) ProtoMessage() {} func (x *C2S_EnterInstance) ProtoReflect() protoreflect.Message { - mi := &file_cs_action_proto_msgTypes[0] + mi := &file_action_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106,7 +106,7 @@ func (x *C2S_EnterInstance) ProtoReflect() protoreflect.Message { // Deprecated: Use C2S_EnterInstance.ProtoReflect.Descriptor instead. func (*C2S_EnterInstance) Descriptor() ([]byte, []int) { - return file_cs_action_proto_rawDescGZIP(), []int{0} + return file_action_proto_rawDescGZIP(), []int{0} } func (x *C2S_EnterInstance) GetInstanceID() int32 { @@ -127,7 +127,7 @@ type S2C_EnterInstance struct { func (x *S2C_EnterInstance) Reset() { *x = S2C_EnterInstance{} if protoimpl.UnsafeEnabled { - mi := &file_cs_action_proto_msgTypes[1] + mi := &file_action_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -140,7 +140,7 @@ func (x *S2C_EnterInstance) String() string { func (*S2C_EnterInstance) ProtoMessage() {} func (x *S2C_EnterInstance) ProtoReflect() protoreflect.Message { - mi := &file_cs_action_proto_msgTypes[1] + mi := &file_action_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -153,7 +153,7 @@ func (x *S2C_EnterInstance) ProtoReflect() protoreflect.Message { // Deprecated: Use S2C_EnterInstance.ProtoReflect.Descriptor instead. func (*S2C_EnterInstance) Descriptor() ([]byte, []int) { - return file_cs_action_proto_rawDescGZIP(), []int{1} + return file_action_proto_rawDescGZIP(), []int{1} } func (x *S2C_EnterInstance) GetInfo() *PositionInfo { @@ -175,7 +175,7 @@ type C2S_Action struct { func (x *C2S_Action) Reset() { *x = C2S_Action{} if protoimpl.UnsafeEnabled { - mi := &file_cs_action_proto_msgTypes[2] + mi := &file_action_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -188,7 +188,7 @@ func (x *C2S_Action) String() string { func (*C2S_Action) ProtoMessage() {} func (x *C2S_Action) ProtoReflect() protoreflect.Message { - mi := &file_cs_action_proto_msgTypes[2] + mi := &file_action_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -201,7 +201,7 @@ func (x *C2S_Action) ProtoReflect() protoreflect.Message { // Deprecated: Use C2S_Action.ProtoReflect.Descriptor instead. func (*C2S_Action) Descriptor() ([]byte, []int) { - return file_cs_action_proto_rawDescGZIP(), []int{2} + return file_action_proto_rawDescGZIP(), []int{2} } func (x *C2S_Action) GetAction() ActionID { @@ -232,7 +232,7 @@ type PositionInfo struct { func (x *PositionInfo) Reset() { *x = PositionInfo{} if protoimpl.UnsafeEnabled { - mi := &file_cs_action_proto_msgTypes[3] + mi := &file_action_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -245,7 +245,7 @@ func (x *PositionInfo) String() string { func (*PositionInfo) ProtoMessage() {} func (x *PositionInfo) ProtoReflect() protoreflect.Message { - mi := &file_cs_action_proto_msgTypes[3] + mi := &file_action_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -258,7 +258,7 @@ func (x *PositionInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use PositionInfo.ProtoReflect.Descriptor instead. func (*PositionInfo) Descriptor() ([]byte, []int) { - return file_cs_action_proto_rawDescGZIP(), []int{3} + return file_action_proto_rawDescGZIP(), []int{3} } func (x *PositionInfo) GetUID() int32 { @@ -293,7 +293,7 @@ type S2C_Position struct { func (x *S2C_Position) Reset() { *x = S2C_Position{} if protoimpl.UnsafeEnabled { - mi := &file_cs_action_proto_msgTypes[4] + mi := &file_action_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -306,7 +306,7 @@ func (x *S2C_Position) String() string { func (*S2C_Position) ProtoMessage() {} func (x *S2C_Position) ProtoReflect() protoreflect.Message { - mi := &file_cs_action_proto_msgTypes[4] + mi := &file_action_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -319,7 +319,7 @@ func (x *S2C_Position) ProtoReflect() protoreflect.Message { // Deprecated: Use S2C_Position.ProtoReflect.Descriptor instead. func (*S2C_Position) Descriptor() ([]byte, []int) { - return file_cs_action_proto_rawDescGZIP(), []int{4} + return file_action_proto_rawDescGZIP(), []int{4} } func (x *S2C_Position) GetInfo() []*PositionInfo { @@ -329,11 +329,11 @@ func (x *S2C_Position) GetInfo() []*PositionInfo { return nil } -var File_cs_action_proto protoreflect.FileDescriptor +var File_action_proto protoreflect.FileDescriptor -var file_cs_action_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x63, 0x73, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, +var file_action_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, + 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x33, 0x0a, 0x11, 0x43, 0x32, 0x53, 0x5f, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, @@ -355,26 +355,26 @@ var file_cs_action_proto_rawDesc = []byte{ 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x2a, 0x34, 0x0a, 0x08, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x4f, 0x56, 0x45, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x43, 0x54, 0x49, - 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x41, 0x54, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x10, 0x42, 0x15, - 0x5a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x65, 0x6e, 0x2f, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x41, 0x54, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x10, 0x42, 0x17, + 0x5a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, + 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_cs_action_proto_rawDescOnce sync.Once - file_cs_action_proto_rawDescData = file_cs_action_proto_rawDesc + file_action_proto_rawDescOnce sync.Once + file_action_proto_rawDescData = file_action_proto_rawDesc ) -func file_cs_action_proto_rawDescGZIP() []byte { - file_cs_action_proto_rawDescOnce.Do(func() { - file_cs_action_proto_rawDescData = protoimpl.X.CompressGZIP(file_cs_action_proto_rawDescData) +func file_action_proto_rawDescGZIP() []byte { + file_action_proto_rawDescOnce.Do(func() { + file_action_proto_rawDescData = protoimpl.X.CompressGZIP(file_action_proto_rawDescData) }) - return file_cs_action_proto_rawDescData + return file_action_proto_rawDescData } -var file_cs_action_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_cs_action_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_cs_action_proto_goTypes = []interface{}{ +var file_action_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_action_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_action_proto_goTypes = []interface{}{ (ActionID)(0), // 0: ActionID (*C2S_EnterInstance)(nil), // 1: C2S_EnterInstance (*S2C_EnterInstance)(nil), // 2: S2C_EnterInstance @@ -382,7 +382,7 @@ var file_cs_action_proto_goTypes = []interface{}{ (*PositionInfo)(nil), // 4: PositionInfo (*S2C_Position)(nil), // 5: S2C_Position } -var file_cs_action_proto_depIdxs = []int32{ +var file_action_proto_depIdxs = []int32{ 4, // 0: S2C_EnterInstance.Info:type_name -> PositionInfo 0, // 1: C2S_Action.Action:type_name -> ActionID 4, // 2: S2C_Position.Info:type_name -> PositionInfo @@ -393,13 +393,13 @@ var file_cs_action_proto_depIdxs = []int32{ 0, // [0:3] is the sub-list for field type_name } -func init() { file_cs_action_proto_init() } -func file_cs_action_proto_init() { - if File_cs_action_proto != nil { +func init() { file_action_proto_init() } +func file_action_proto_init() { + if File_action_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_cs_action_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_action_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*C2S_EnterInstance); i { case 0: return &v.state @@ -411,7 +411,7 @@ func file_cs_action_proto_init() { return nil } } - file_cs_action_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_action_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*S2C_EnterInstance); i { case 0: return &v.state @@ -423,7 +423,7 @@ func file_cs_action_proto_init() { return nil } } - file_cs_action_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_action_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*C2S_Action); i { case 0: return &v.state @@ -435,7 +435,7 @@ func file_cs_action_proto_init() { return nil } } - file_cs_action_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_action_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PositionInfo); i { case 0: return &v.state @@ -447,7 +447,7 @@ func file_cs_action_proto_init() { return nil } } - file_cs_action_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_action_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*S2C_Position); i { case 0: return &v.state @@ -464,19 +464,19 @@ func file_cs_action_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cs_action_proto_rawDesc, + RawDescriptor: file_action_proto_rawDesc, NumEnums: 1, NumMessages: 5, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_cs_action_proto_goTypes, - DependencyIndexes: file_cs_action_proto_depIdxs, - EnumInfos: file_cs_action_proto_enumTypes, - MessageInfos: file_cs_action_proto_msgTypes, + GoTypes: file_action_proto_goTypes, + DependencyIndexes: file_action_proto_depIdxs, + EnumInfos: file_action_proto_enumTypes, + MessageInfos: file_action_proto_msgTypes, }.Build() - File_cs_action_proto = out.File - file_cs_action_proto_rawDesc = nil - file_cs_action_proto_goTypes = nil - file_cs_action_proto_depIdxs = nil + File_action_proto = out.File + file_action_proto_rawDesc = nil + file_action_proto_goTypes = nil + file_action_proto_depIdxs = nil } diff --git a/Server/common/proto/gen/cs/define.pb.go b/Public/Proto/ServerClient/gen/common/proto/sc/sc_pb/define.pb.go similarity index 71% rename from Server/common/proto/gen/cs/define.pb.go rename to Public/Proto/ServerClient/gen/common/proto/sc/sc_pb/define.pb.go index b7e6a1e..3ef780c 100644 --- a/Server/common/proto/gen/cs/define.pb.go +++ b/Public/Proto/ServerClient/gen/common/proto/sc/sc_pb/define.pb.go @@ -2,12 +2,12 @@ // versions: // protoc-gen-go v1.32.0 // protoc v4.25.1 -// source: cs/define.proto +// source: define.proto -package cs +package sc_pb import ( - _ "common/proto/gen/common" + _ "common/proto/sc/sc_common" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -57,11 +57,11 @@ func (x MessageID) String() string { } func (MessageID) Descriptor() protoreflect.EnumDescriptor { - return file_cs_define_proto_enumTypes[0].Descriptor() + return file_define_proto_enumTypes[0].Descriptor() } func (MessageID) Type() protoreflect.EnumType { - return &file_cs_define_proto_enumTypes[0] + return &file_define_proto_enumTypes[0] } func (x MessageID) Number() protoreflect.EnumNumber { @@ -70,7 +70,7 @@ func (x MessageID) Number() protoreflect.EnumNumber { // Deprecated: Use MessageID.Descriptor instead. func (MessageID) EnumDescriptor() ([]byte, []int) { - return file_cs_define_proto_rawDescGZIP(), []int{0} + return file_define_proto_rawDescGZIP(), []int{0} } type Message struct { @@ -85,7 +85,7 @@ type Message struct { func (x *Message) Reset() { *x = Message{} if protoimpl.UnsafeEnabled { - mi := &file_cs_define_proto_msgTypes[0] + mi := &file_define_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98,7 +98,7 @@ func (x *Message) String() string { func (*Message) ProtoMessage() {} func (x *Message) ProtoReflect() protoreflect.Message { - mi := &file_cs_define_proto_msgTypes[0] + mi := &file_define_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111,7 +111,7 @@ func (x *Message) ProtoReflect() protoreflect.Message { // Deprecated: Use Message.ProtoReflect.Descriptor instead. func (*Message) Descriptor() ([]byte, []int) { - return file_cs_define_proto_rawDescGZIP(), []int{0} + return file_define_proto_rawDescGZIP(), []int{0} } func (x *Message) GetID() MessageID { @@ -128,11 +128,11 @@ func (x *Message) GetPayload() []byte { return nil } -var File_cs_define_proto protoreflect.FileDescriptor +var File_define_proto protoreflect.FileDescriptor -var file_cs_define_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x63, 0x73, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, +var file_define_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, + 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3f, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x52, 0x02, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, @@ -144,30 +144,30 @@ var file_cs_define_proto_rawDesc = []byte{ 0x43, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, - 0x4f, 0x4e, 0x10, 0x03, 0x42, 0x15, 0x5a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x4f, 0x4e, 0x10, 0x03, 0x42, 0x17, 0x5a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_cs_define_proto_rawDescOnce sync.Once - file_cs_define_proto_rawDescData = file_cs_define_proto_rawDesc + file_define_proto_rawDescOnce sync.Once + file_define_proto_rawDescData = file_define_proto_rawDesc ) -func file_cs_define_proto_rawDescGZIP() []byte { - file_cs_define_proto_rawDescOnce.Do(func() { - file_cs_define_proto_rawDescData = protoimpl.X.CompressGZIP(file_cs_define_proto_rawDescData) +func file_define_proto_rawDescGZIP() []byte { + file_define_proto_rawDescOnce.Do(func() { + file_define_proto_rawDescData = protoimpl.X.CompressGZIP(file_define_proto_rawDescData) }) - return file_cs_define_proto_rawDescData + return file_define_proto_rawDescData } -var file_cs_define_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_cs_define_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_cs_define_proto_goTypes = []interface{}{ +var file_define_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_define_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_define_proto_goTypes = []interface{}{ (MessageID)(0), // 0: MessageID (*Message)(nil), // 1: Message } -var file_cs_define_proto_depIdxs = []int32{ +var file_define_proto_depIdxs = []int32{ 0, // 0: Message.ID:type_name -> MessageID 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type @@ -176,13 +176,13 @@ var file_cs_define_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_cs_define_proto_init() } -func file_cs_define_proto_init() { - if File_cs_define_proto != nil { +func init() { file_define_proto_init() } +func file_define_proto_init() { + if File_define_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_cs_define_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_define_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Message); i { case 0: return &v.state @@ -199,19 +199,19 @@ func file_cs_define_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cs_define_proto_rawDesc, + RawDescriptor: file_define_proto_rawDesc, NumEnums: 1, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_cs_define_proto_goTypes, - DependencyIndexes: file_cs_define_proto_depIdxs, - EnumInfos: file_cs_define_proto_enumTypes, - MessageInfos: file_cs_define_proto_msgTypes, + GoTypes: file_define_proto_goTypes, + DependencyIndexes: file_define_proto_depIdxs, + EnumInfos: file_define_proto_enumTypes, + MessageInfos: file_define_proto_msgTypes, }.Build() - File_cs_define_proto = out.File - file_cs_define_proto_rawDesc = nil - file_cs_define_proto_goTypes = nil - file_cs_define_proto_depIdxs = nil + File_define_proto = out.File + file_define_proto_rawDesc = nil + file_define_proto_goTypes = nil + file_define_proto_depIdxs = nil } diff --git a/Public/Proto/ServerClient/gen_proto.bat b/Public/Proto/ServerClient/gen_proto.bat new file mode 100644 index 0000000..3865bb2 --- /dev/null +++ b/Public/Proto/ServerClient/gen_proto.bat @@ -0,0 +1,4 @@ +@echo off + +protoc --proto_path=./sources --go_out=./gen ./sources/*.proto +xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q \ No newline at end of file diff --git a/Server/common/proto/cs/action.proto b/Public/Proto/ServerClient/sources/action.proto similarity index 88% rename from Server/common/proto/cs/action.proto rename to Public/Proto/ServerClient/sources/action.proto index dc4edb6..ad65d54 100644 --- a/Server/common/proto/cs/action.proto +++ b/Public/Proto/ServerClient/sources/action.proto @@ -1,7 +1,7 @@ syntax = "proto3"; -option go_package = "common/proto/gen/cs"; -import "common.proto"; +option go_package = "common/proto/sc/sc_pb"; +import "sc_common.proto"; // MESSAGE_ID_ENTER_INSTANCE message C2S_EnterInstance { diff --git a/Server/common/proto/cs/define.proto b/Public/Proto/ServerClient/sources/define.proto similarity index 78% rename from Server/common/proto/cs/define.proto rename to Public/Proto/ServerClient/sources/define.proto index 83a1f21..e7509cf 100644 --- a/Server/common/proto/cs/define.proto +++ b/Public/Proto/ServerClient/sources/define.proto @@ -1,7 +1,7 @@ syntax = "proto3"; -option go_package = "common/proto/gen/cs"; -import "common.proto"; +option go_package = "common/proto/sc/sc_pb"; +import "sc_common.proto"; enum MessageID { MESSAGE_ID_INVALID = 0; diff --git a/Public/Proto/ServerClient/sources/sc_common.proto b/Public/Proto/ServerClient/sources/sc_common.proto new file mode 100644 index 0000000..e496d95 --- /dev/null +++ b/Public/Proto/ServerClient/sources/sc_common.proto @@ -0,0 +1,3 @@ +syntax = "proto3"; + +option go_package = "common/proto/sc/sc_common"; \ No newline at end of file diff --git a/Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway.pb.go b/Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway.pb.go new file mode 100644 index 0000000..37b1632 --- /dev/null +++ b/Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway.pb.go @@ -0,0 +1,221 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: service_gateway.proto + +package grpc_pb + +import ( + _ "common/proto/ss/ss_common" + 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 ToClientReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"` + MessageID int32 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` + Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` +} + +func (x *ToClientReq) Reset() { + *x = ToClientReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_gateway_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ToClientReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToClientReq) ProtoMessage() {} + +func (x *ToClientReq) ProtoReflect() protoreflect.Message { + mi := &file_service_gateway_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 ToClientReq.ProtoReflect.Descriptor instead. +func (*ToClientReq) Descriptor() ([]byte, []int) { + return file_service_gateway_proto_rawDescGZIP(), []int{0} +} + +func (x *ToClientReq) GetUID() int32 { + if x != nil { + return x.UID + } + return 0 +} + +func (x *ToClientReq) GetMessageID() int32 { + if x != nil { + return x.MessageID + } + return 0 +} + +func (x *ToClientReq) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type ToClientResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ToClientResp) Reset() { + *x = ToClientResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_gateway_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ToClientResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToClientResp) ProtoMessage() {} + +func (x *ToClientResp) ProtoReflect() protoreflect.Message { + mi := &file_service_gateway_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 ToClientResp.ProtoReflect.Descriptor instead. +func (*ToClientResp) Descriptor() ([]byte, []int) { + return file_service_gateway_proto_rawDescGZIP(), []int{1} +} + +var File_service_gateway_proto protoreflect.FileDescriptor + +var file_service_gateway_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, 0x54, 0x6f, 0x43, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x55, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x22, 0x0e, 0x0a, 0x0c, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x32, 0x36, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2b, 0x0a, 0x08, + 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x0c, 0x2e, 0x54, 0x6f, 0x43, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_gateway_proto_rawDescOnce sync.Once + file_service_gateway_proto_rawDescData = file_service_gateway_proto_rawDesc +) + +func file_service_gateway_proto_rawDescGZIP() []byte { + file_service_gateway_proto_rawDescOnce.Do(func() { + file_service_gateway_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_gateway_proto_rawDescData) + }) + return file_service_gateway_proto_rawDescData +} + +var file_service_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_service_gateway_proto_goTypes = []interface{}{ + (*ToClientReq)(nil), // 0: ToClientReq + (*ToClientResp)(nil), // 1: ToClientResp +} +var file_service_gateway_proto_depIdxs = []int32{ + 0, // 0: Gateway.ToClient:input_type -> ToClientReq + 1, // 1: Gateway.ToClient:output_type -> ToClientResp + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] 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 +} + +func init() { file_service_gateway_proto_init() } +func file_service_gateway_proto_init() { + if File_service_gateway_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_service_gateway_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ToClientReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_gateway_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ToClientResp); 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_service_gateway_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_gateway_proto_goTypes, + DependencyIndexes: file_service_gateway_proto_depIdxs, + MessageInfos: file_service_gateway_proto_msgTypes, + }.Build() + File_service_gateway_proto = out.File + file_service_gateway_proto_rawDesc = nil + file_service_gateway_proto_goTypes = nil + file_service_gateway_proto_depIdxs = nil +} diff --git a/Server/common/proto/gen/grpc_pb/gateway_grpc.pb.go b/Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go similarity index 92% rename from Server/common/proto/gen/grpc_pb/gateway_grpc.pb.go rename to Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go index b0c5317..6cfe501 100644 --- a/Server/common/proto/gen/grpc_pb/gateway_grpc.pb.go +++ b/Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go @@ -2,12 +2,11 @@ // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc v4.25.1 -// source: grpc/gateway.proto +// source: service_gateway.proto package grpc_pb import ( - common "common/proto/gen/common" context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -45,7 +44,7 @@ func (c *gatewayClient) ToClient(ctx context.Context, opts ...grpc.CallOption) ( type Gateway_ToClientClient interface { Send(*ToClientReq) error - CloseAndRecv() (*common.Empty, error) + CloseAndRecv() (*ToClientResp, error) grpc.ClientStream } @@ -57,11 +56,11 @@ func (x *gatewayToClientClient) Send(m *ToClientReq) error { return x.ClientStream.SendMsg(m) } -func (x *gatewayToClientClient) CloseAndRecv() (*common.Empty, error) { +func (x *gatewayToClientClient) CloseAndRecv() (*ToClientResp, error) { if err := x.ClientStream.CloseSend(); err != nil { return nil, err } - m := new(common.Empty) + m := new(ToClientResp) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -101,7 +100,7 @@ func _Gateway_ToClient_Handler(srv interface{}, stream grpc.ServerStream) error } type Gateway_ToClientServer interface { - SendAndClose(*common.Empty) error + SendAndClose(*ToClientResp) error Recv() (*ToClientReq, error) grpc.ServerStream } @@ -110,7 +109,7 @@ type gatewayToClientServer struct { grpc.ServerStream } -func (x *gatewayToClientServer) SendAndClose(m *common.Empty) error { +func (x *gatewayToClientServer) SendAndClose(m *ToClientResp) error { return x.ServerStream.SendMsg(m) } @@ -136,5 +135,5 @@ var Gateway_ServiceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: "grpc/gateway.proto", + Metadata: "service_gateway.proto", } diff --git a/Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene.pb.go b/Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene.pb.go new file mode 100644 index 0000000..a1d0386 --- /dev/null +++ b/Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene.pb.go @@ -0,0 +1,388 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: service_scene.proto + +package grpc_pb + +import ( + _ "common/proto/ss/ss_common" + 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 EnterReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"` // 用户ID + GatewaySID int64 `protobuf:"varint,2,opt,name=GatewaySID,proto3" json:"GatewaySID,omitempty"` // 网关服务ID + InstanceID int32 `protobuf:"varint,3,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // 副本ID +} + +func (x *EnterReq) Reset() { + *x = EnterReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnterReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnterReq) ProtoMessage() {} + +func (x *EnterReq) ProtoReflect() protoreflect.Message { + mi := &file_service_scene_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 EnterReq.ProtoReflect.Descriptor instead. +func (*EnterReq) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{0} +} + +func (x *EnterReq) GetUID() int32 { + if x != nil { + return x.UID + } + return 0 +} + +func (x *EnterReq) GetGatewaySID() int64 { + if x != nil { + return x.GatewaySID + } + return 0 +} + +func (x *EnterReq) GetInstanceID() int32 { + if x != nil { + return x.InstanceID + } + return 0 +} + +type EnterResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SceneSID int64 `protobuf:"varint,1,opt,name=SceneSID,proto3" json:"SceneSID,omitempty"` // 场景服务ID + UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 +} + +func (x *EnterResp) Reset() { + *x = EnterResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnterResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnterResp) ProtoMessage() {} + +func (x *EnterResp) ProtoReflect() protoreflect.Message { + mi := &file_service_scene_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 EnterResp.ProtoReflect.Descriptor instead. +func (*EnterResp) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{1} +} + +func (x *EnterResp) GetSceneSID() int64 { + if x != nil { + return x.SceneSID + } + return 0 +} + +func (x *EnterResp) GetUniqueNo() int64 { + if x != nil { + return x.UniqueNo + } + return 0 +} + +type ActionReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UniqueNo int64 `protobuf:"varint,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 + UID int32 `protobuf:"varint,2,opt,name=UID,proto3" json:"UID,omitempty"` // 用户ID + Action int32 `protobuf:"varint,3,opt,name=Action,proto3" json:"Action,omitempty"` // 动作ID + Payload []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,omitempty"` // 动作数据 +} + +func (x *ActionReq) Reset() { + *x = ActionReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ActionReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ActionReq) ProtoMessage() {} + +func (x *ActionReq) ProtoReflect() protoreflect.Message { + mi := &file_service_scene_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 ActionReq.ProtoReflect.Descriptor instead. +func (*ActionReq) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{2} +} + +func (x *ActionReq) GetUniqueNo() int64 { + if x != nil { + return x.UniqueNo + } + return 0 +} + +func (x *ActionReq) GetUID() int32 { + if x != nil { + return x.UID + } + return 0 +} + +func (x *ActionReq) GetAction() int32 { + if x != nil { + return x.Action + } + return 0 +} + +func (x *ActionReq) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type ActionResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ActionResp) Reset() { + *x = ActionResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ActionResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ActionResp) ProtoMessage() {} + +func (x *ActionResp) ProtoReflect() protoreflect.Message { + mi := &file_service_scene_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 ActionResp.ProtoReflect.Descriptor instead. +func (*ActionResp) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{3} +} + +var File_service_scene_proto protoreflect.FileDescriptor + +var file_service_scene_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x55, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, + 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x53, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x49, 0x44, 0x22, 0x43, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x12, 0x1a, 0x0a, + 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x22, 0x6b, 0x0a, 0x09, 0x41, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x55, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x0c, 0x0a, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x32, 0x50, 0x0a, 0x05, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x20, 0x0a, + 0x05, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x09, 0x2e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x1a, 0x0a, 0x2e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, + 0x25, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x2e, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0b, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_scene_proto_rawDescOnce sync.Once + file_service_scene_proto_rawDescData = file_service_scene_proto_rawDesc +) + +func file_service_scene_proto_rawDescGZIP() []byte { + file_service_scene_proto_rawDescOnce.Do(func() { + file_service_scene_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_scene_proto_rawDescData) + }) + return file_service_scene_proto_rawDescData +} + +var file_service_scene_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_service_scene_proto_goTypes = []interface{}{ + (*EnterReq)(nil), // 0: EnterReq + (*EnterResp)(nil), // 1: EnterResp + (*ActionReq)(nil), // 2: ActionReq + (*ActionResp)(nil), // 3: ActionResp +} +var file_service_scene_proto_depIdxs = []int32{ + 0, // 0: Scene.Enter:input_type -> EnterReq + 2, // 1: Scene.Action:input_type -> ActionReq + 1, // 2: Scene.Enter:output_type -> EnterResp + 3, // 3: Scene.Action:output_type -> ActionResp + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] 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 +} + +func init() { file_service_scene_proto_init() } +func file_service_scene_proto_init() { + if File_service_scene_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_service_scene_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnterReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_scene_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnterResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_scene_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActionReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_scene_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActionResp); 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_service_scene_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_scene_proto_goTypes, + DependencyIndexes: file_service_scene_proto_depIdxs, + MessageInfos: file_service_scene_proto_msgTypes, + }.Build() + File_service_scene_proto = out.File + file_service_scene_proto_rawDesc = nil + file_service_scene_proto_goTypes = nil + file_service_scene_proto_depIdxs = nil +} diff --git a/Server/common/proto/gen/grpc_pb/scene_grpc.pb.go b/Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene_grpc.pb.go similarity index 93% rename from Server/common/proto/gen/grpc_pb/scene_grpc.pb.go rename to Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene_grpc.pb.go index 8ad0280..6a7dfe0 100644 --- a/Server/common/proto/gen/grpc_pb/scene_grpc.pb.go +++ b/Public/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene_grpc.pb.go @@ -2,12 +2,11 @@ // versions: // - protoc-gen-go-grpc v1.2.0 // - protoc v4.25.1 -// source: grpc/scene.proto +// source: service_scene.proto package grpc_pb import ( - common "common/proto/gen/common" context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -55,7 +54,7 @@ func (c *sceneClient) Action(ctx context.Context, opts ...grpc.CallOption) (Scen type Scene_ActionClient interface { Send(*ActionReq) error - CloseAndRecv() (*common.Empty, error) + CloseAndRecv() (*ActionResp, error) grpc.ClientStream } @@ -67,11 +66,11 @@ func (x *sceneActionClient) Send(m *ActionReq) error { return x.ClientStream.SendMsg(m) } -func (x *sceneActionClient) CloseAndRecv() (*common.Empty, error) { +func (x *sceneActionClient) CloseAndRecv() (*ActionResp, error) { if err := x.ClientStream.CloseSend(); err != nil { return nil, err } - m := new(common.Empty) + m := new(ActionResp) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -133,7 +132,7 @@ func _Scene_Action_Handler(srv interface{}, stream grpc.ServerStream) error { } type Scene_ActionServer interface { - SendAndClose(*common.Empty) error + SendAndClose(*ActionResp) error Recv() (*ActionReq, error) grpc.ServerStream } @@ -142,7 +141,7 @@ type sceneActionServer struct { grpc.ServerStream } -func (x *sceneActionServer) SendAndClose(m *common.Empty) error { +func (x *sceneActionServer) SendAndClose(m *ActionResp) error { return x.ServerStream.SendMsg(m) } @@ -173,5 +172,5 @@ var Scene_ServiceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: "grpc/scene.proto", + Metadata: "service_scene.proto", } diff --git a/Public/Proto/ServerInternal/gen/common/proto/ss/ss_common/ss_common.pb.go b/Public/Proto/ServerInternal/gen/common/proto/ss/ss_common/ss_common.pb.go new file mode 100644 index 0000000..d070b7b --- /dev/null +++ b/Public/Proto/ServerInternal/gen/common/proto/ss/ss_common/ss_common.pb.go @@ -0,0 +1,62 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: ss_common.proto + +package ss_common + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_ss_common_proto protoreflect.FileDescriptor + +var file_ss_common_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x42, 0x1b, 0x5a, 0x19, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_ss_common_proto_goTypes = []interface{}{} +var file_ss_common_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 +} + +func init() { file_ss_common_proto_init() } +func file_ss_common_proto_init() { + if File_ss_common_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ss_common_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ss_common_proto_goTypes, + DependencyIndexes: file_ss_common_proto_depIdxs, + }.Build() + File_ss_common_proto = out.File + file_ss_common_proto_rawDesc = nil + file_ss_common_proto_goTypes = nil + file_ss_common_proto_depIdxs = nil +} diff --git a/Public/Proto/ServerInternal/gen_proto.bat b/Public/Proto/ServerInternal/gen_proto.bat new file mode 100644 index 0000000..a51c921 --- /dev/null +++ b/Public/Proto/ServerInternal/gen_proto.bat @@ -0,0 +1,9 @@ +@echo off + +@REM protoc --proto_path=. --go_out=.. ./proto/common.proto +@REM protoc --proto_path=./proto --go_out=.. ./proto/grpc/*.proto +protoc --proto_path=./sources --go_out=./gen --go-grpc_out=./gen ./sources/*.proto +@REM protoc --proto_path=./proto --go_out=.. ./proto/cs/*.proto + +@REM xcopy ./proto/cs/*.* ../../Client/web/proto/ +xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q \ No newline at end of file diff --git a/Public/Proto/ServerInternal/sources/service_gateway.proto b/Public/Proto/ServerInternal/sources/service_gateway.proto new file mode 100644 index 0000000..e23330a --- /dev/null +++ b/Public/Proto/ServerInternal/sources/service_gateway.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +option go_package = "common/proto/ss/grpc_pb"; +import "ss_common.proto"; + +service Gateway { + rpc ToClient(stream ToClientReq) returns (ToClientResp) {} +} + +message ToClientReq { + int32 UID = 1; + int32 MessageID = 2; + bytes Payload = 3; +} + +message ToClientResp { +} diff --git a/Server/common/proto/grpc/scene.proto b/Public/Proto/ServerInternal/sources/service_scene.proto similarity index 76% rename from Server/common/proto/grpc/scene.proto rename to Public/Proto/ServerInternal/sources/service_scene.proto index f7536ae..1fdd9b5 100644 --- a/Server/common/proto/grpc/scene.proto +++ b/Public/Proto/ServerInternal/sources/service_scene.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -option go_package = "common/proto/gen/grpc_pb"; -import "common.proto"; +option go_package = "common/proto/ss/grpc_pb"; +import "ss_common.proto"; service Scene { rpc Enter(EnterReq) returns (EnterResp) {} - rpc Action(stream ActionReq) returns (Empty) {} + rpc Action(stream ActionReq) returns (ActionResp) {} } message EnterReq { @@ -25,3 +25,6 @@ message ActionReq { int32 Action = 3; // 动作ID bytes Payload = 4; // 动作数据 } + +message ActionResp { +} \ No newline at end of file diff --git a/Public/Proto/ServerInternal/sources/ss_common.proto b/Public/Proto/ServerInternal/sources/ss_common.proto new file mode 100644 index 0000000..87c4fc5 --- /dev/null +++ b/Public/Proto/ServerInternal/sources/ss_common.proto @@ -0,0 +1,3 @@ +syntax = "proto3"; + +option go_package = "common/proto/ss/ss_common"; \ No newline at end of file diff --git a/Public/Publish/Client/build-all.bat b/Public/Publish/Client/build-all.bat new file mode 100644 index 0000000..56287f3 --- /dev/null +++ b/Public/Publish/Client/build-all.bat @@ -0,0 +1,18 @@ +@echo off +setlocal + +set "LOCAL_DIR=C:\my-project\dist" +set "REMOTE_USER=your_username" +set "REMOTE_HOST=192.168.1.100" +set "REMOTE_PATH=/home/your_username/webapp" + +scp -r -C "%LOCAL_DIR%" "%REMOTE_USER%@%REMOTE_HOST%:%REMOTE_PATH%" + +if %errorlevel% equ 0 ( + echo 上传成功! +) else ( + echo 上传失败!请检查网络、密码或路径。 + pause +) + +endlocal \ No newline at end of file diff --git a/Server/Gateway/app/web.go b/Server/Gateway/app/web.go index 85ddbbc..4882712 100644 --- a/Server/Gateway/app/web.go +++ b/Server/Gateway/app/web.go @@ -20,7 +20,7 @@ type ModuleWebServer struct { func (m *ModuleWebServer) Init() error { m.wg = &sync.WaitGroup{} - m.router = http_gateway.InitRouter(config.Get()) + m.router = http_gateway.InitRouter() return nil } diff --git a/Server/Gateway/grpc_server/server/server.go b/Server/Gateway/grpc_server/server/server.go index 853e46d..f587c22 100644 --- a/Server/Gateway/grpc_server/server/server.go +++ b/Server/Gateway/grpc_server/server/server.go @@ -2,9 +2,8 @@ package server import ( "common/log" - "common/proto/gen/common" - "common/proto/gen/cs" - "common/proto/gen/grpc_pb" + "common/proto/sc/sc_pb" + "common/proto/ss/grpc_pb" "gateway/handler/ws_handler" "sync" ) @@ -25,16 +24,16 @@ func (s *Server) ToClient(server grpc_pb.Gateway_ToClientServer) error { } else { if args.UID == -1 { for _, client := range ws_handler.UserMgr.GetAll() { - client.WriteBytes(cs.MessageID(args.MessageID), args.Payload) + client.WriteBytes(sc_pb.MessageID(args.MessageID), args.Payload) } } else { if client := ws_handler.UserMgr.GetByUID(int(args.UID)); client != nil { - client.WriteBytes(cs.MessageID(args.MessageID), args.Payload) + client.WriteBytes(sc_pb.MessageID(args.MessageID), args.Payload) } } } } }() wg.Wait() - return server.SendAndClose(&common.Empty{}) + return server.SendAndClose(&grpc_pb.ToClientResp{}) } diff --git a/Server/Gateway/grpc_server/server/server_init.go b/Server/Gateway/grpc_server/server/server_init.go index 9d5b18a..a3df142 100644 --- a/Server/Gateway/grpc_server/server/server_init.go +++ b/Server/Gateway/grpc_server/server/server_init.go @@ -3,7 +3,7 @@ package server import ( "common/discover/common" "common/net/grpc/service" - "common/proto/gen/grpc_pb" + "common/proto/ss/grpc_pb" "gateway/handler/ws_handler" "google.golang.org/grpc" ) diff --git a/Server/Gateway/handler/http_handler/helper/render/render.go b/Server/Gateway/handler/http_handler/helper/render/render.go index a928ba4..2349f2b 100644 --- a/Server/Gateway/handler/http_handler/helper/render/render.go +++ b/Server/Gateway/handler/http_handler/helper/render/render.go @@ -20,6 +20,15 @@ func Json(c *gin.Context, code *Code, data interface{}) { c.JSON(http.StatusOK, result) } +func JsonByStatus(c *gin.Context, status int, code *Code, data interface{}) { + result := &RespJsonData{ + Code: code.Code(), + Msg: code.Message(), + Data: data, + } + c.JSON(status, result) +} + func AbortJson(c *gin.Context, code *Code, data interface{}) { result := &RespJsonData{ Code: code.Code(), diff --git a/Server/Gateway/handler/ws_handler/client.go b/Server/Gateway/handler/ws_handler/client.go index 573c1c6..ee74672 100644 --- a/Server/Gateway/handler/ws_handler/client.go +++ b/Server/Gateway/handler/ws_handler/client.go @@ -3,7 +3,7 @@ package ws_handler import ( "common/log" "common/net/socket" - "common/proto/gen/cs" + "common/proto/sc/sc_pb" "context" "fmt" "go.uber.org/zap" @@ -85,13 +85,13 @@ func (c *Client) OnEvent(event Event) { } // WriteMessage 向客户端发送消息 -func (c *Client) WriteMessage(id cs.MessageID, data proto.Message) { +func (c *Client) WriteMessage(id sc_pb.MessageID, data proto.Message) { d, err := proto.Marshal(data) if err != nil { c.logger.Errorf("WriteMessage proto.Marshal err: %v", err) return } - m, err := proto.Marshal(&cs.Message{ + m, err := proto.Marshal(&sc_pb.Message{ ID: id, Payload: d, }) @@ -105,8 +105,8 @@ func (c *Client) WriteMessage(id cs.MessageID, data proto.Message) { } // WriteBytes 向客户端发送字节数据 -func (c *Client) WriteBytes(id cs.MessageID, data []byte) { - m, err := proto.Marshal(&cs.Message{ +func (c *Client) WriteBytes(id sc_pb.MessageID, data []byte) { + m, err := proto.Marshal(&sc_pb.Message{ ID: id, Payload: data, }) diff --git a/Server/Gateway/handler/ws_handler/handler.go b/Server/Gateway/handler/ws_handler/handler.go index ff25d5b..2d57ef7 100644 --- a/Server/Gateway/handler/ws_handler/handler.go +++ b/Server/Gateway/handler/ws_handler/handler.go @@ -2,8 +2,8 @@ package ws_handler import ( "common/net/grpc/service" - "common/proto/gen/cs" - "common/proto/gen/grpc_pb" + "common/proto/sc/sc_pb" + "common/proto/ss/grpc_pb" "gateway/grpc_server/stream_client" "google.golang.org/protobuf/proto" "time" @@ -12,7 +12,7 @@ import ( func (c *Client) handle(event Event) { switch e := event.(type) { case *ClientEvent: - msg := &cs.Message{} + msg := &sc_pb.Message{} if err := proto.Unmarshal(e.Msg, msg); err != nil { c.logger.Errorf("handle event proto.Unmarshal err: %v", err) c.cancel() @@ -20,16 +20,16 @@ func (c *Client) handle(event Event) { } c.logger.Infof("收到客户端消息:%v", msg.ID) switch msg.ID { - case cs.MessageID_MESSAGE_ID_ENTER_INSTANCE: - m := &cs.C2S_EnterInstance{} + case sc_pb.MessageID_MESSAGE_ID_ENTER_INSTANCE: + m := &sc_pb.C2S_EnterInstance{} if err := proto.Unmarshal(msg.Payload, m); err != nil { c.logger.Errorf("handle event proto.Unmarshal err: %v", err) c.cancel() return } c.onEnter(m) - case cs.MessageID_MESSAGE_ID_ACTION: - m := &cs.C2S_Action{} + case sc_pb.MessageID_MESSAGE_ID_ACTION: + m := &sc_pb.C2S_Action{} if err := proto.Unmarshal(msg.Payload, m); err != nil { c.logger.Errorf("handle event proto.Unmarshal err: %v", err) c.cancel() @@ -42,7 +42,7 @@ func (c *Client) handle(event Event) { } } -func (c *Client) onEnter(msg *cs.C2S_EnterInstance) { +func (c *Client) onEnter(msg *sc_pb.C2S_EnterInstance) { client, err := service.SceneNewClient() if err != nil { c.logger.Errorf("SceneNewClient err: %v", err) @@ -60,8 +60,8 @@ func (c *Client) onEnter(msg *cs.C2S_EnterInstance) { c.SceneSID = resp.SceneSID c.UniqueNo = resp.UniqueNo c.InstanceID = int(msg.InstanceID) - c.WriteMessage(cs.MessageID_MESSAGE_ID_POSITION, &cs.S2C_Position{ - Info: []*cs.PositionInfo{{ + c.WriteMessage(sc_pb.MessageID_MESSAGE_ID_POSITION, &sc_pb.S2C_Position{ + Info: []*sc_pb.PositionInfo{{ UID: int32(c.UID), X: 1, Y: 1, @@ -69,7 +69,7 @@ func (c *Client) onEnter(msg *cs.C2S_EnterInstance) { }) } -func (c *Client) onAction(msg *cs.C2S_Action) { +func (c *Client) onAction(msg *sc_pb.C2S_Action) { if c.SceneSID == 0 { return } diff --git a/Server/Gateway/net/http_gateway/router.go b/Server/Gateway/net/http_gateway/router.go index 7757b2c..0601188 100644 --- a/Server/Gateway/net/http_gateway/router.go +++ b/Server/Gateway/net/http_gateway/router.go @@ -2,14 +2,14 @@ package http_gateway import ( "common/log" - "gateway/config" "gateway/handler/http_handler" + "gateway/handler/http_handler/helper/render" "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" "net/http" ) -func InitRouter(cfg *config.Config) *gin.Engine { +func InitRouter() *gin.Engine { gin.SetMode(gin.ReleaseMode) r := gin.New() @@ -21,16 +21,10 @@ func InitRouter(cfg *config.Config) *gin.Engine { r.HandleMethodNotAllowed = true r.NoMethod(func(c *gin.Context) { - c.JSON(http.StatusMethodNotAllowed, gin.H{ - "result": false, - "error": "Method Not Allowed", - }) + render.JsonByStatus(c, http.StatusMethodNotAllowed, render.Failed, "Method Not Allowed") }) r.NoRoute(func(c *gin.Context) { - c.JSON(http.StatusNotFound, gin.H{ - "result": false, - "error": "Endpoint Not Found", - }) + render.JsonByStatus(c, http.StatusNotFound, render.Failed, "Endpoint Not Found") }) initBaseRouter(r) diff --git a/Server/common/net/grpc/service/client_gateway.go b/Server/common/net/grpc/service/client_gateway.go index 51073ba..8bed0a6 100644 --- a/Server/common/net/grpc/service/client_gateway.go +++ b/Server/common/net/grpc/service/client_gateway.go @@ -3,7 +3,7 @@ package service import ( "common/discover" "common/discover/common" - "common/proto/gen/grpc_pb" + "common/proto/ss/grpc_pb" ) func GatewayNewClient(sid ...int64) (grpc_pb.GatewayClient, error) { diff --git a/Server/common/net/grpc/service/client_scene.go b/Server/common/net/grpc/service/client_scene.go index 97ed224..02a9417 100644 --- a/Server/common/net/grpc/service/client_scene.go +++ b/Server/common/net/grpc/service/client_scene.go @@ -3,7 +3,7 @@ package service import ( "common/discover" "common/discover/common" - "common/proto/gen/grpc_pb" + "common/proto/ss/grpc_pb" ) func SceneNewClient(sid ...int64) (grpc_pb.SceneClient, error) { diff --git a/Server/common/proto/common.proto b/Server/common/proto/common.proto deleted file mode 100644 index 1e8305a..0000000 --- a/Server/common/proto/common.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; - -option go_package = "common/proto/gen/common"; - -// 空 -message Empty { -} \ No newline at end of file diff --git a/Server/common/proto/gen/common/common.pb.go b/Server/common/proto/gen/common/common.pb.go deleted file mode 100644 index fc98246..0000000 --- a/Server/common/proto/gen/common/common.pb.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 -// source: proto/common.proto - -package common - -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 Empty struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Empty) Reset() { - *x = Empty{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_common_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Empty) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Empty) ProtoMessage() {} - -func (x *Empty) ProtoReflect() protoreflect.Message { - mi := &file_proto_common_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 Empty.ProtoReflect.Descriptor instead. -func (*Empty) Descriptor() ([]byte, []int) { - return file_proto_common_proto_rawDescGZIP(), []int{0} -} - -var File_proto_common_proto protoreflect.FileDescriptor - -var file_proto_common_proto_rawDesc = []byte{ - 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x19, 0x5a, - 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, - 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_proto_common_proto_rawDescOnce sync.Once - file_proto_common_proto_rawDescData = file_proto_common_proto_rawDesc -) - -func file_proto_common_proto_rawDescGZIP() []byte { - file_proto_common_proto_rawDescOnce.Do(func() { - file_proto_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_common_proto_rawDescData) - }) - return file_proto_common_proto_rawDescData -} - -var file_proto_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_proto_common_proto_goTypes = []interface{}{ - (*Empty)(nil), // 0: Empty -} -var file_proto_common_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 -} - -func init() { file_proto_common_proto_init() } -func file_proto_common_proto_init() { - if File_proto_common_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_proto_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Empty); 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_proto_common_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_proto_common_proto_goTypes, - DependencyIndexes: file_proto_common_proto_depIdxs, - MessageInfos: file_proto_common_proto_msgTypes, - }.Build() - File_proto_common_proto = out.File - file_proto_common_proto_rawDesc = nil - file_proto_common_proto_goTypes = nil - file_proto_common_proto_depIdxs = nil -} diff --git a/Server/common/proto/gen/grpc_pb/gateway.pb.go b/Server/common/proto/gen/grpc_pb/gateway.pb.go deleted file mode 100644 index 0ef4ee5..0000000 --- a/Server/common/proto/gen/grpc_pb/gateway.pb.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 -// source: grpc/gateway.proto - -package grpc_pb - -import ( - common "common/proto/gen/common" - 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 ToClientReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"` - MessageID int32 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` -} - -func (x *ToClientReq) Reset() { - *x = ToClientReq{} - if protoimpl.UnsafeEnabled { - mi := &file_grpc_gateway_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ToClientReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToClientReq) ProtoMessage() {} - -func (x *ToClientReq) ProtoReflect() protoreflect.Message { - mi := &file_grpc_gateway_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 ToClientReq.ProtoReflect.Descriptor instead. -func (*ToClientReq) Descriptor() ([]byte, []int) { - return file_grpc_gateway_proto_rawDescGZIP(), []int{0} -} - -func (x *ToClientReq) GetUID() int32 { - if x != nil { - return x.UID - } - return 0 -} - -func (x *ToClientReq) GetMessageID() int32 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *ToClientReq) GetPayload() []byte { - if x != nil { - return x.Payload - } - return nil -} - -var File_grpc_gateway_proto protoreflect.FileDescriptor - -var file_grpc_gateway_proto_rawDesc = []byte{ - 0x0a, 0x12, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, - 0x55, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, - 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x32, 0x2f, 0x0a, 0x07, 0x47, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x24, 0x0a, 0x08, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x12, 0x0c, 0x2e, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, - 0x1a, 0x06, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x28, 0x01, 0x42, 0x1a, 0x5a, 0x18, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_grpc_gateway_proto_rawDescOnce sync.Once - file_grpc_gateway_proto_rawDescData = file_grpc_gateway_proto_rawDesc -) - -func file_grpc_gateway_proto_rawDescGZIP() []byte { - file_grpc_gateway_proto_rawDescOnce.Do(func() { - file_grpc_gateway_proto_rawDescData = protoimpl.X.CompressGZIP(file_grpc_gateway_proto_rawDescData) - }) - return file_grpc_gateway_proto_rawDescData -} - -var file_grpc_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_grpc_gateway_proto_goTypes = []interface{}{ - (*ToClientReq)(nil), // 0: ToClientReq - (*common.Empty)(nil), // 1: Empty -} -var file_grpc_gateway_proto_depIdxs = []int32{ - 0, // 0: Gateway.ToClient:input_type -> ToClientReq - 1, // 1: Gateway.ToClient:output_type -> Empty - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] 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 -} - -func init() { file_grpc_gateway_proto_init() } -func file_grpc_gateway_proto_init() { - if File_grpc_gateway_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_grpc_gateway_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ToClientReq); 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_grpc_gateway_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_grpc_gateway_proto_goTypes, - DependencyIndexes: file_grpc_gateway_proto_depIdxs, - MessageInfos: file_grpc_gateway_proto_msgTypes, - }.Build() - File_grpc_gateway_proto = out.File - file_grpc_gateway_proto_rawDesc = nil - file_grpc_gateway_proto_goTypes = nil - file_grpc_gateway_proto_depIdxs = nil -} diff --git a/Server/common/proto/gen/grpc_pb/scene.pb.go b/Server/common/proto/gen/grpc_pb/scene.pb.go deleted file mode 100644 index 812dac3..0000000 --- a/Server/common/proto/gen/grpc_pb/scene.pb.go +++ /dev/null @@ -1,337 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 -// source: grpc/scene.proto - -package grpc_pb - -import ( - common "common/proto/gen/common" - 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 EnterReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"` // 用户ID - GatewaySID int64 `protobuf:"varint,2,opt,name=GatewaySID,proto3" json:"GatewaySID,omitempty"` // 网关服务ID - InstanceID int32 `protobuf:"varint,3,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // 副本ID -} - -func (x *EnterReq) Reset() { - *x = EnterReq{} - if protoimpl.UnsafeEnabled { - mi := &file_grpc_scene_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EnterReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnterReq) ProtoMessage() {} - -func (x *EnterReq) ProtoReflect() protoreflect.Message { - mi := &file_grpc_scene_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 EnterReq.ProtoReflect.Descriptor instead. -func (*EnterReq) Descriptor() ([]byte, []int) { - return file_grpc_scene_proto_rawDescGZIP(), []int{0} -} - -func (x *EnterReq) GetUID() int32 { - if x != nil { - return x.UID - } - return 0 -} - -func (x *EnterReq) GetGatewaySID() int64 { - if x != nil { - return x.GatewaySID - } - return 0 -} - -func (x *EnterReq) GetInstanceID() int32 { - if x != nil { - return x.InstanceID - } - return 0 -} - -type EnterResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SceneSID int64 `protobuf:"varint,1,opt,name=SceneSID,proto3" json:"SceneSID,omitempty"` // 场景服务ID - UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 -} - -func (x *EnterResp) Reset() { - *x = EnterResp{} - if protoimpl.UnsafeEnabled { - mi := &file_grpc_scene_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EnterResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnterResp) ProtoMessage() {} - -func (x *EnterResp) ProtoReflect() protoreflect.Message { - mi := &file_grpc_scene_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 EnterResp.ProtoReflect.Descriptor instead. -func (*EnterResp) Descriptor() ([]byte, []int) { - return file_grpc_scene_proto_rawDescGZIP(), []int{1} -} - -func (x *EnterResp) GetSceneSID() int64 { - if x != nil { - return x.SceneSID - } - return 0 -} - -func (x *EnterResp) GetUniqueNo() int64 { - if x != nil { - return x.UniqueNo - } - return 0 -} - -type ActionReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UniqueNo int64 `protobuf:"varint,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 - UID int32 `protobuf:"varint,2,opt,name=UID,proto3" json:"UID,omitempty"` // 用户ID - Action int32 `protobuf:"varint,3,opt,name=Action,proto3" json:"Action,omitempty"` // 动作ID - Payload []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,omitempty"` // 动作数据 -} - -func (x *ActionReq) Reset() { - *x = ActionReq{} - if protoimpl.UnsafeEnabled { - mi := &file_grpc_scene_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ActionReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ActionReq) ProtoMessage() {} - -func (x *ActionReq) ProtoReflect() protoreflect.Message { - mi := &file_grpc_scene_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 ActionReq.ProtoReflect.Descriptor instead. -func (*ActionReq) Descriptor() ([]byte, []int) { - return file_grpc_scene_proto_rawDescGZIP(), []int{2} -} - -func (x *ActionReq) GetUniqueNo() int64 { - if x != nil { - return x.UniqueNo - } - return 0 -} - -func (x *ActionReq) GetUID() int32 { - if x != nil { - return x.UID - } - return 0 -} - -func (x *ActionReq) GetAction() int32 { - if x != nil { - return x.Action - } - return 0 -} - -func (x *ActionReq) GetPayload() []byte { - if x != nil { - return x.Payload - } - return nil -} - -var File_grpc_scene_proto protoreflect.FileDescriptor - -var file_grpc_scene_proto_rawDesc = []byte{ - 0x0a, 0x10, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x5c, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, - 0x55, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x55, 0x49, 0x44, 0x12, 0x1e, - 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x49, 0x44, 0x12, 0x1e, - 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x22, 0x43, - 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x53, - 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, - 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, - 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, - 0x65, 0x4e, 0x6f, 0x22, 0x6b, 0x0a, 0x09, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, - 0x55, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x55, 0x49, 0x44, 0x12, 0x16, - 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x32, 0x4b, 0x0a, 0x05, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x20, 0x0a, 0x05, 0x45, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x09, 0x2e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, - 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x20, 0x0a, 0x06, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x1a, 0x06, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x28, 0x01, 0x42, 0x1a, 0x5a, - 0x18, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, - 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_grpc_scene_proto_rawDescOnce sync.Once - file_grpc_scene_proto_rawDescData = file_grpc_scene_proto_rawDesc -) - -func file_grpc_scene_proto_rawDescGZIP() []byte { - file_grpc_scene_proto_rawDescOnce.Do(func() { - file_grpc_scene_proto_rawDescData = protoimpl.X.CompressGZIP(file_grpc_scene_proto_rawDescData) - }) - return file_grpc_scene_proto_rawDescData -} - -var file_grpc_scene_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_grpc_scene_proto_goTypes = []interface{}{ - (*EnterReq)(nil), // 0: EnterReq - (*EnterResp)(nil), // 1: EnterResp - (*ActionReq)(nil), // 2: ActionReq - (*common.Empty)(nil), // 3: Empty -} -var file_grpc_scene_proto_depIdxs = []int32{ - 0, // 0: Scene.Enter:input_type -> EnterReq - 2, // 1: Scene.Action:input_type -> ActionReq - 1, // 2: Scene.Enter:output_type -> EnterResp - 3, // 3: Scene.Action:output_type -> Empty - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] 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 -} - -func init() { file_grpc_scene_proto_init() } -func file_grpc_scene_proto_init() { - if File_grpc_scene_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_grpc_scene_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnterReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_grpc_scene_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnterResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_grpc_scene_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ActionReq); 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_grpc_scene_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_grpc_scene_proto_goTypes, - DependencyIndexes: file_grpc_scene_proto_depIdxs, - MessageInfos: file_grpc_scene_proto_msgTypes, - }.Build() - File_grpc_scene_proto = out.File - file_grpc_scene_proto_rawDesc = nil - file_grpc_scene_proto_goTypes = nil - file_grpc_scene_proto_depIdxs = nil -} diff --git a/Server/common/proto/grpc/gateway.proto b/Server/common/proto/grpc/gateway.proto deleted file mode 100644 index d32e0e3..0000000 --- a/Server/common/proto/grpc/gateway.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; - -option go_package = "common/proto/gen/grpc_pb"; -import "common.proto"; - -service Gateway { - rpc ToClient(stream ToClientReq) returns (Empty) {} -} - -message ToClientReq { - int32 UID = 1; - int32 MessageID = 2; - bytes Payload = 3; -} - diff --git a/Server/common/proto/sc/sc_common/sc_common.pb.go b/Server/common/proto/sc/sc_common/sc_common.pb.go new file mode 100644 index 0000000..dccafd4 --- /dev/null +++ b/Server/common/proto/sc/sc_common/sc_common.pb.go @@ -0,0 +1,62 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: sc_common.proto + +package sc_common + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_sc_common_proto protoreflect.FileDescriptor + +var file_sc_common_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x42, 0x1b, 0x5a, 0x19, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_sc_common_proto_goTypes = []interface{}{} +var file_sc_common_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 +} + +func init() { file_sc_common_proto_init() } +func file_sc_common_proto_init() { + if File_sc_common_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sc_common_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sc_common_proto_goTypes, + DependencyIndexes: file_sc_common_proto_depIdxs, + }.Build() + File_sc_common_proto = out.File + file_sc_common_proto_rawDesc = nil + file_sc_common_proto_goTypes = nil + file_sc_common_proto_depIdxs = nil +} diff --git a/Server/common/proto/sc/sc_pb/action.pb.go b/Server/common/proto/sc/sc_pb/action.pb.go new file mode 100644 index 0000000..cb9977a --- /dev/null +++ b/Server/common/proto/sc/sc_pb/action.pb.go @@ -0,0 +1,482 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: action.proto + +package sc_pb + +import ( + _ "common/proto/sc/sc_common" + 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) +) + +// MESSAGE_ID_ACTION +type ActionID int32 + +const ( + ActionID_ACTION_ID_MOVE ActionID = 0 // 0-15都是移动指令 + ActionID_ACTION_ID_ATTACK ActionID = 16 // 攻击指令 +) + +// Enum value maps for ActionID. +var ( + ActionID_name = map[int32]string{ + 0: "ACTION_ID_MOVE", + 16: "ACTION_ID_ATTACK", + } + ActionID_value = map[string]int32{ + "ACTION_ID_MOVE": 0, + "ACTION_ID_ATTACK": 16, + } +) + +func (x ActionID) Enum() *ActionID { + p := new(ActionID) + *p = x + return p +} + +func (x ActionID) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ActionID) Descriptor() protoreflect.EnumDescriptor { + return file_action_proto_enumTypes[0].Descriptor() +} + +func (ActionID) Type() protoreflect.EnumType { + return &file_action_proto_enumTypes[0] +} + +func (x ActionID) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ActionID.Descriptor instead. +func (ActionID) EnumDescriptor() ([]byte, []int) { + return file_action_proto_rawDescGZIP(), []int{0} +} + +// MESSAGE_ID_ENTER_INSTANCE +type C2S_EnterInstance struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InstanceID int32 `protobuf:"varint,1,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` +} + +func (x *C2S_EnterInstance) Reset() { + *x = C2S_EnterInstance{} + if protoimpl.UnsafeEnabled { + mi := &file_action_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *C2S_EnterInstance) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*C2S_EnterInstance) ProtoMessage() {} + +func (x *C2S_EnterInstance) ProtoReflect() protoreflect.Message { + mi := &file_action_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 C2S_EnterInstance.ProtoReflect.Descriptor instead. +func (*C2S_EnterInstance) Descriptor() ([]byte, []int) { + return file_action_proto_rawDescGZIP(), []int{0} +} + +func (x *C2S_EnterInstance) GetInstanceID() int32 { + if x != nil { + return x.InstanceID + } + return 0 +} + +type S2C_EnterInstance struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Info *PositionInfo `protobuf:"bytes,1,opt,name=Info,proto3" json:"Info,omitempty"` +} + +func (x *S2C_EnterInstance) Reset() { + *x = S2C_EnterInstance{} + if protoimpl.UnsafeEnabled { + mi := &file_action_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *S2C_EnterInstance) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*S2C_EnterInstance) ProtoMessage() {} + +func (x *S2C_EnterInstance) ProtoReflect() protoreflect.Message { + mi := &file_action_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 S2C_EnterInstance.ProtoReflect.Descriptor instead. +func (*S2C_EnterInstance) Descriptor() ([]byte, []int) { + return file_action_proto_rawDescGZIP(), []int{1} +} + +func (x *S2C_EnterInstance) GetInfo() *PositionInfo { + if x != nil { + return x.Info + } + return nil +} + +type C2S_Action struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Action ActionID `protobuf:"varint,1,opt,name=Action,proto3,enum=ActionID" json:"Action,omitempty"` // 指令ID + Payload []byte `protobuf:"bytes,2,opt,name=Payload,proto3" json:"Payload,omitempty"` // 指令数据 +} + +func (x *C2S_Action) Reset() { + *x = C2S_Action{} + if protoimpl.UnsafeEnabled { + mi := &file_action_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *C2S_Action) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*C2S_Action) ProtoMessage() {} + +func (x *C2S_Action) ProtoReflect() protoreflect.Message { + mi := &file_action_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 C2S_Action.ProtoReflect.Descriptor instead. +func (*C2S_Action) Descriptor() ([]byte, []int) { + return file_action_proto_rawDescGZIP(), []int{2} +} + +func (x *C2S_Action) GetAction() ActionID { + if x != nil { + return x.Action + } + return ActionID_ACTION_ID_MOVE +} + +func (x *C2S_Action) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +// MESSAGE_ID_POSITION +type PositionInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"` + X float64 `protobuf:"fixed64,2,opt,name=X,proto3" json:"X,omitempty"` + Y float64 `protobuf:"fixed64,3,opt,name=Y,proto3" json:"Y,omitempty"` +} + +func (x *PositionInfo) Reset() { + *x = PositionInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_action_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PositionInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PositionInfo) ProtoMessage() {} + +func (x *PositionInfo) ProtoReflect() protoreflect.Message { + mi := &file_action_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 PositionInfo.ProtoReflect.Descriptor instead. +func (*PositionInfo) Descriptor() ([]byte, []int) { + return file_action_proto_rawDescGZIP(), []int{3} +} + +func (x *PositionInfo) GetUID() int32 { + if x != nil { + return x.UID + } + return 0 +} + +func (x *PositionInfo) GetX() float64 { + if x != nil { + return x.X + } + return 0 +} + +func (x *PositionInfo) GetY() float64 { + if x != nil { + return x.Y + } + return 0 +} + +type S2C_Position struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Info []*PositionInfo `protobuf:"bytes,1,rep,name=Info,proto3" json:"Info,omitempty"` +} + +func (x *S2C_Position) Reset() { + *x = S2C_Position{} + if protoimpl.UnsafeEnabled { + mi := &file_action_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *S2C_Position) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*S2C_Position) ProtoMessage() {} + +func (x *S2C_Position) ProtoReflect() protoreflect.Message { + mi := &file_action_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 S2C_Position.ProtoReflect.Descriptor instead. +func (*S2C_Position) Descriptor() ([]byte, []int) { + return file_action_proto_rawDescGZIP(), []int{4} +} + +func (x *S2C_Position) GetInfo() []*PositionInfo { + if x != nil { + return x.Info + } + return nil +} + +var File_action_proto protoreflect.FileDescriptor + +var file_action_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, + 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x33, 0x0a, 0x11, 0x43, 0x32, 0x53, 0x5f, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x49, 0x44, 0x22, 0x36, 0x0a, 0x11, 0x53, 0x32, 0x43, 0x5f, 0x45, 0x6e, 0x74, 0x65, + 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x49, 0x6e, 0x66, + 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x49, 0x0a, 0x0a, + 0x43, 0x32, 0x53, 0x5f, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x06, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x41, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, + 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x3c, 0x0a, 0x0c, 0x50, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x55, 0x49, 0x44, 0x12, 0x0c, 0x0a, 0x01, 0x58, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x01, 0x52, 0x01, 0x58, 0x12, 0x0c, 0x0a, 0x01, 0x59, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x01, 0x59, 0x22, 0x31, 0x0a, 0x0c, 0x53, 0x32, 0x43, 0x5f, 0x50, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x2a, 0x34, 0x0a, 0x08, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, + 0x44, 0x5f, 0x4d, 0x4f, 0x56, 0x45, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x43, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x41, 0x54, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x10, 0x42, 0x17, + 0x5a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, + 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_action_proto_rawDescOnce sync.Once + file_action_proto_rawDescData = file_action_proto_rawDesc +) + +func file_action_proto_rawDescGZIP() []byte { + file_action_proto_rawDescOnce.Do(func() { + file_action_proto_rawDescData = protoimpl.X.CompressGZIP(file_action_proto_rawDescData) + }) + return file_action_proto_rawDescData +} + +var file_action_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_action_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_action_proto_goTypes = []interface{}{ + (ActionID)(0), // 0: ActionID + (*C2S_EnterInstance)(nil), // 1: C2S_EnterInstance + (*S2C_EnterInstance)(nil), // 2: S2C_EnterInstance + (*C2S_Action)(nil), // 3: C2S_Action + (*PositionInfo)(nil), // 4: PositionInfo + (*S2C_Position)(nil), // 5: S2C_Position +} +var file_action_proto_depIdxs = []int32{ + 4, // 0: S2C_EnterInstance.Info:type_name -> PositionInfo + 0, // 1: C2S_Action.Action:type_name -> ActionID + 4, // 2: S2C_Position.Info:type_name -> PositionInfo + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_action_proto_init() } +func file_action_proto_init() { + if File_action_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_action_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*C2S_EnterInstance); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_action_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*S2C_EnterInstance); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_action_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*C2S_Action); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_action_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PositionInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_action_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*S2C_Position); 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_action_proto_rawDesc, + NumEnums: 1, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_action_proto_goTypes, + DependencyIndexes: file_action_proto_depIdxs, + EnumInfos: file_action_proto_enumTypes, + MessageInfos: file_action_proto_msgTypes, + }.Build() + File_action_proto = out.File + file_action_proto_rawDesc = nil + file_action_proto_goTypes = nil + file_action_proto_depIdxs = nil +} diff --git a/Server/common/proto/sc/sc_pb/define.pb.go b/Server/common/proto/sc/sc_pb/define.pb.go new file mode 100644 index 0000000..3ef780c --- /dev/null +++ b/Server/common/proto/sc/sc_pb/define.pb.go @@ -0,0 +1,217 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: define.proto + +package sc_pb + +import ( + _ "common/proto/sc/sc_common" + 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 MessageID int32 + +const ( + MessageID_MESSAGE_ID_INVALID MessageID = 0 + MessageID_MESSAGE_ID_ENTER_INSTANCE MessageID = 1 // 进入副本 + MessageID_MESSAGE_ID_ACTION MessageID = 2 // 指令 + MessageID_MESSAGE_ID_POSITION MessageID = 3 // 位置更新 +) + +// Enum value maps for MessageID. +var ( + MessageID_name = map[int32]string{ + 0: "MESSAGE_ID_INVALID", + 1: "MESSAGE_ID_ENTER_INSTANCE", + 2: "MESSAGE_ID_ACTION", + 3: "MESSAGE_ID_POSITION", + } + MessageID_value = map[string]int32{ + "MESSAGE_ID_INVALID": 0, + "MESSAGE_ID_ENTER_INSTANCE": 1, + "MESSAGE_ID_ACTION": 2, + "MESSAGE_ID_POSITION": 3, + } +) + +func (x MessageID) Enum() *MessageID { + p := new(MessageID) + *p = x + return p +} + +func (x MessageID) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MessageID) Descriptor() protoreflect.EnumDescriptor { + return file_define_proto_enumTypes[0].Descriptor() +} + +func (MessageID) Type() protoreflect.EnumType { + return &file_define_proto_enumTypes[0] +} + +func (x MessageID) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MessageID.Descriptor instead. +func (MessageID) EnumDescriptor() ([]byte, []int) { + return file_define_proto_rawDescGZIP(), []int{0} +} + +type Message struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID MessageID `protobuf:"varint,1,opt,name=ID,proto3,enum=MessageID" json:"ID,omitempty"` + Payload []byte `protobuf:"bytes,2,opt,name=Payload,proto3" json:"Payload,omitempty"` +} + +func (x *Message) Reset() { + *x = Message{} + if protoimpl.UnsafeEnabled { + mi := &file_define_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message) ProtoMessage() {} + +func (x *Message) ProtoReflect() protoreflect.Message { + mi := &file_define_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 Message.ProtoReflect.Descriptor instead. +func (*Message) Descriptor() ([]byte, []int) { + return file_define_proto_rawDescGZIP(), []int{0} +} + +func (x *Message) GetID() MessageID { + if x != nil { + return x.ID + } + return MessageID_MESSAGE_ID_INVALID +} + +func (x *Message) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +var File_define_proto protoreflect.FileDescriptor + +var file_define_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, + 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x3f, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x02, 0x49, 0x44, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x49, 0x44, 0x52, 0x02, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x2a, 0x72, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x16, 0x0a, + 0x12, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x49, 0x4e, 0x56, 0x41, + 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, + 0x5f, 0x49, 0x44, 0x5f, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4e, + 0x43, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, + 0x49, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x4d, + 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, + 0x4f, 0x4e, 0x10, 0x03, 0x42, 0x17, 0x5a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_define_proto_rawDescOnce sync.Once + file_define_proto_rawDescData = file_define_proto_rawDesc +) + +func file_define_proto_rawDescGZIP() []byte { + file_define_proto_rawDescOnce.Do(func() { + file_define_proto_rawDescData = protoimpl.X.CompressGZIP(file_define_proto_rawDescData) + }) + return file_define_proto_rawDescData +} + +var file_define_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_define_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_define_proto_goTypes = []interface{}{ + (MessageID)(0), // 0: MessageID + (*Message)(nil), // 1: Message +} +var file_define_proto_depIdxs = []int32{ + 0, // 0: Message.ID:type_name -> MessageID + 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_define_proto_init() } +func file_define_proto_init() { + if File_define_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_define_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message); 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_define_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_define_proto_goTypes, + DependencyIndexes: file_define_proto_depIdxs, + EnumInfos: file_define_proto_enumTypes, + MessageInfos: file_define_proto_msgTypes, + }.Build() + File_define_proto = out.File + file_define_proto_rawDesc = nil + file_define_proto_goTypes = nil + file_define_proto_depIdxs = nil +} diff --git a/Server/common/proto/ss/grpc_pb/service_gateway.pb.go b/Server/common/proto/ss/grpc_pb/service_gateway.pb.go new file mode 100644 index 0000000..37b1632 --- /dev/null +++ b/Server/common/proto/ss/grpc_pb/service_gateway.pb.go @@ -0,0 +1,221 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: service_gateway.proto + +package grpc_pb + +import ( + _ "common/proto/ss/ss_common" + 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 ToClientReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"` + MessageID int32 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` + Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` +} + +func (x *ToClientReq) Reset() { + *x = ToClientReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_gateway_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ToClientReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToClientReq) ProtoMessage() {} + +func (x *ToClientReq) ProtoReflect() protoreflect.Message { + mi := &file_service_gateway_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 ToClientReq.ProtoReflect.Descriptor instead. +func (*ToClientReq) Descriptor() ([]byte, []int) { + return file_service_gateway_proto_rawDescGZIP(), []int{0} +} + +func (x *ToClientReq) GetUID() int32 { + if x != nil { + return x.UID + } + return 0 +} + +func (x *ToClientReq) GetMessageID() int32 { + if x != nil { + return x.MessageID + } + return 0 +} + +func (x *ToClientReq) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type ToClientResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ToClientResp) Reset() { + *x = ToClientResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_gateway_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ToClientResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToClientResp) ProtoMessage() {} + +func (x *ToClientResp) ProtoReflect() protoreflect.Message { + mi := &file_service_gateway_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 ToClientResp.ProtoReflect.Descriptor instead. +func (*ToClientResp) Descriptor() ([]byte, []int) { + return file_service_gateway_proto_rawDescGZIP(), []int{1} +} + +var File_service_gateway_proto protoreflect.FileDescriptor + +var file_service_gateway_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, 0x54, 0x6f, 0x43, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x55, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x22, 0x0e, 0x0a, 0x0c, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x32, 0x36, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2b, 0x0a, 0x08, + 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x0c, 0x2e, 0x54, 0x6f, 0x43, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_gateway_proto_rawDescOnce sync.Once + file_service_gateway_proto_rawDescData = file_service_gateway_proto_rawDesc +) + +func file_service_gateway_proto_rawDescGZIP() []byte { + file_service_gateway_proto_rawDescOnce.Do(func() { + file_service_gateway_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_gateway_proto_rawDescData) + }) + return file_service_gateway_proto_rawDescData +} + +var file_service_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_service_gateway_proto_goTypes = []interface{}{ + (*ToClientReq)(nil), // 0: ToClientReq + (*ToClientResp)(nil), // 1: ToClientResp +} +var file_service_gateway_proto_depIdxs = []int32{ + 0, // 0: Gateway.ToClient:input_type -> ToClientReq + 1, // 1: Gateway.ToClient:output_type -> ToClientResp + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] 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 +} + +func init() { file_service_gateway_proto_init() } +func file_service_gateway_proto_init() { + if File_service_gateway_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_service_gateway_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ToClientReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_gateway_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ToClientResp); 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_service_gateway_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_gateway_proto_goTypes, + DependencyIndexes: file_service_gateway_proto_depIdxs, + MessageInfos: file_service_gateway_proto_msgTypes, + }.Build() + File_service_gateway_proto = out.File + file_service_gateway_proto_rawDesc = nil + file_service_gateway_proto_goTypes = nil + file_service_gateway_proto_depIdxs = nil +} diff --git a/Server/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go b/Server/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go new file mode 100644 index 0000000..6cfe501 --- /dev/null +++ b/Server/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.25.1 +// source: service_gateway.proto + +package grpc_pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// GatewayClient is the client API for Gateway service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type GatewayClient interface { + ToClient(ctx context.Context, opts ...grpc.CallOption) (Gateway_ToClientClient, error) +} + +type gatewayClient struct { + cc grpc.ClientConnInterface +} + +func NewGatewayClient(cc grpc.ClientConnInterface) GatewayClient { + return &gatewayClient{cc} +} + +func (c *gatewayClient) ToClient(ctx context.Context, opts ...grpc.CallOption) (Gateway_ToClientClient, error) { + stream, err := c.cc.NewStream(ctx, &Gateway_ServiceDesc.Streams[0], "/Gateway/ToClient", opts...) + if err != nil { + return nil, err + } + x := &gatewayToClientClient{stream} + return x, nil +} + +type Gateway_ToClientClient interface { + Send(*ToClientReq) error + CloseAndRecv() (*ToClientResp, error) + grpc.ClientStream +} + +type gatewayToClientClient struct { + grpc.ClientStream +} + +func (x *gatewayToClientClient) Send(m *ToClientReq) error { + return x.ClientStream.SendMsg(m) +} + +func (x *gatewayToClientClient) CloseAndRecv() (*ToClientResp, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(ToClientResp) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// GatewayServer is the server API for Gateway service. +// All implementations must embed UnimplementedGatewayServer +// for forward compatibility +type GatewayServer interface { + ToClient(Gateway_ToClientServer) error + mustEmbedUnimplementedGatewayServer() +} + +// UnimplementedGatewayServer must be embedded to have forward compatible implementations. +type UnimplementedGatewayServer struct { +} + +func (UnimplementedGatewayServer) ToClient(Gateway_ToClientServer) error { + return status.Errorf(codes.Unimplemented, "method ToClient not implemented") +} +func (UnimplementedGatewayServer) mustEmbedUnimplementedGatewayServer() {} + +// UnsafeGatewayServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to GatewayServer will +// result in compilation errors. +type UnsafeGatewayServer interface { + mustEmbedUnimplementedGatewayServer() +} + +func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer) { + s.RegisterService(&Gateway_ServiceDesc, srv) +} + +func _Gateway_ToClient_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(GatewayServer).ToClient(&gatewayToClientServer{stream}) +} + +type Gateway_ToClientServer interface { + SendAndClose(*ToClientResp) error + Recv() (*ToClientReq, error) + grpc.ServerStream +} + +type gatewayToClientServer struct { + grpc.ServerStream +} + +func (x *gatewayToClientServer) SendAndClose(m *ToClientResp) error { + return x.ServerStream.SendMsg(m) +} + +func (x *gatewayToClientServer) Recv() (*ToClientReq, error) { + m := new(ToClientReq) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Gateway_ServiceDesc is the grpc.ServiceDesc for Gateway service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Gateway_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "Gateway", + HandlerType: (*GatewayServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "ToClient", + Handler: _Gateway_ToClient_Handler, + ClientStreams: true, + }, + }, + Metadata: "service_gateway.proto", +} diff --git a/Server/common/proto/ss/grpc_pb/service_scene.pb.go b/Server/common/proto/ss/grpc_pb/service_scene.pb.go new file mode 100644 index 0000000..a1d0386 --- /dev/null +++ b/Server/common/proto/ss/grpc_pb/service_scene.pb.go @@ -0,0 +1,388 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: service_scene.proto + +package grpc_pb + +import ( + _ "common/proto/ss/ss_common" + 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 EnterReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"` // 用户ID + GatewaySID int64 `protobuf:"varint,2,opt,name=GatewaySID,proto3" json:"GatewaySID,omitempty"` // 网关服务ID + InstanceID int32 `protobuf:"varint,3,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // 副本ID +} + +func (x *EnterReq) Reset() { + *x = EnterReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnterReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnterReq) ProtoMessage() {} + +func (x *EnterReq) ProtoReflect() protoreflect.Message { + mi := &file_service_scene_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 EnterReq.ProtoReflect.Descriptor instead. +func (*EnterReq) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{0} +} + +func (x *EnterReq) GetUID() int32 { + if x != nil { + return x.UID + } + return 0 +} + +func (x *EnterReq) GetGatewaySID() int64 { + if x != nil { + return x.GatewaySID + } + return 0 +} + +func (x *EnterReq) GetInstanceID() int32 { + if x != nil { + return x.InstanceID + } + return 0 +} + +type EnterResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SceneSID int64 `protobuf:"varint,1,opt,name=SceneSID,proto3" json:"SceneSID,omitempty"` // 场景服务ID + UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 +} + +func (x *EnterResp) Reset() { + *x = EnterResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnterResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnterResp) ProtoMessage() {} + +func (x *EnterResp) ProtoReflect() protoreflect.Message { + mi := &file_service_scene_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 EnterResp.ProtoReflect.Descriptor instead. +func (*EnterResp) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{1} +} + +func (x *EnterResp) GetSceneSID() int64 { + if x != nil { + return x.SceneSID + } + return 0 +} + +func (x *EnterResp) GetUniqueNo() int64 { + if x != nil { + return x.UniqueNo + } + return 0 +} + +type ActionReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UniqueNo int64 `protobuf:"varint,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 + UID int32 `protobuf:"varint,2,opt,name=UID,proto3" json:"UID,omitempty"` // 用户ID + Action int32 `protobuf:"varint,3,opt,name=Action,proto3" json:"Action,omitempty"` // 动作ID + Payload []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,omitempty"` // 动作数据 +} + +func (x *ActionReq) Reset() { + *x = ActionReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ActionReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ActionReq) ProtoMessage() {} + +func (x *ActionReq) ProtoReflect() protoreflect.Message { + mi := &file_service_scene_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 ActionReq.ProtoReflect.Descriptor instead. +func (*ActionReq) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{2} +} + +func (x *ActionReq) GetUniqueNo() int64 { + if x != nil { + return x.UniqueNo + } + return 0 +} + +func (x *ActionReq) GetUID() int32 { + if x != nil { + return x.UID + } + return 0 +} + +func (x *ActionReq) GetAction() int32 { + if x != nil { + return x.Action + } + return 0 +} + +func (x *ActionReq) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type ActionResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ActionResp) Reset() { + *x = ActionResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ActionResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ActionResp) ProtoMessage() {} + +func (x *ActionResp) ProtoReflect() protoreflect.Message { + mi := &file_service_scene_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 ActionResp.ProtoReflect.Descriptor instead. +func (*ActionResp) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{3} +} + +var File_service_scene_proto protoreflect.FileDescriptor + +var file_service_scene_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x55, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, + 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x53, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x49, 0x44, 0x22, 0x43, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x12, 0x1a, 0x0a, + 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x22, 0x6b, 0x0a, 0x09, 0x41, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, + 0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x55, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x0c, 0x0a, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x32, 0x50, 0x0a, 0x05, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x20, 0x0a, + 0x05, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x09, 0x2e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x1a, 0x0a, 0x2e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, + 0x25, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x2e, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0b, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_scene_proto_rawDescOnce sync.Once + file_service_scene_proto_rawDescData = file_service_scene_proto_rawDesc +) + +func file_service_scene_proto_rawDescGZIP() []byte { + file_service_scene_proto_rawDescOnce.Do(func() { + file_service_scene_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_scene_proto_rawDescData) + }) + return file_service_scene_proto_rawDescData +} + +var file_service_scene_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_service_scene_proto_goTypes = []interface{}{ + (*EnterReq)(nil), // 0: EnterReq + (*EnterResp)(nil), // 1: EnterResp + (*ActionReq)(nil), // 2: ActionReq + (*ActionResp)(nil), // 3: ActionResp +} +var file_service_scene_proto_depIdxs = []int32{ + 0, // 0: Scene.Enter:input_type -> EnterReq + 2, // 1: Scene.Action:input_type -> ActionReq + 1, // 2: Scene.Enter:output_type -> EnterResp + 3, // 3: Scene.Action:output_type -> ActionResp + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] 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 +} + +func init() { file_service_scene_proto_init() } +func file_service_scene_proto_init() { + if File_service_scene_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_service_scene_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnterReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_scene_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnterResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_scene_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActionReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_scene_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActionResp); 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_service_scene_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_scene_proto_goTypes, + DependencyIndexes: file_service_scene_proto_depIdxs, + MessageInfos: file_service_scene_proto_msgTypes, + }.Build() + File_service_scene_proto = out.File + file_service_scene_proto_rawDesc = nil + file_service_scene_proto_goTypes = nil + file_service_scene_proto_depIdxs = nil +} diff --git a/Server/common/proto/ss/grpc_pb/service_scene_grpc.pb.go b/Server/common/proto/ss/grpc_pb/service_scene_grpc.pb.go new file mode 100644 index 0000000..6a7dfe0 --- /dev/null +++ b/Server/common/proto/ss/grpc_pb/service_scene_grpc.pb.go @@ -0,0 +1,176 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.25.1 +// source: service_scene.proto + +package grpc_pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// SceneClient is the client API for Scene service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SceneClient interface { + Enter(ctx context.Context, in *EnterReq, opts ...grpc.CallOption) (*EnterResp, error) + Action(ctx context.Context, opts ...grpc.CallOption) (Scene_ActionClient, error) +} + +type sceneClient struct { + cc grpc.ClientConnInterface +} + +func NewSceneClient(cc grpc.ClientConnInterface) SceneClient { + return &sceneClient{cc} +} + +func (c *sceneClient) Enter(ctx context.Context, in *EnterReq, opts ...grpc.CallOption) (*EnterResp, error) { + out := new(EnterResp) + err := c.cc.Invoke(ctx, "/Scene/Enter", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sceneClient) Action(ctx context.Context, opts ...grpc.CallOption) (Scene_ActionClient, error) { + stream, err := c.cc.NewStream(ctx, &Scene_ServiceDesc.Streams[0], "/Scene/Action", opts...) + if err != nil { + return nil, err + } + x := &sceneActionClient{stream} + return x, nil +} + +type Scene_ActionClient interface { + Send(*ActionReq) error + CloseAndRecv() (*ActionResp, error) + grpc.ClientStream +} + +type sceneActionClient struct { + grpc.ClientStream +} + +func (x *sceneActionClient) Send(m *ActionReq) error { + return x.ClientStream.SendMsg(m) +} + +func (x *sceneActionClient) CloseAndRecv() (*ActionResp, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(ActionResp) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// SceneServer is the server API for Scene service. +// All implementations must embed UnimplementedSceneServer +// for forward compatibility +type SceneServer interface { + Enter(context.Context, *EnterReq) (*EnterResp, error) + Action(Scene_ActionServer) error + mustEmbedUnimplementedSceneServer() +} + +// UnimplementedSceneServer must be embedded to have forward compatible implementations. +type UnimplementedSceneServer struct { +} + +func (UnimplementedSceneServer) Enter(context.Context, *EnterReq) (*EnterResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Enter not implemented") +} +func (UnimplementedSceneServer) Action(Scene_ActionServer) error { + return status.Errorf(codes.Unimplemented, "method Action not implemented") +} +func (UnimplementedSceneServer) mustEmbedUnimplementedSceneServer() {} + +// UnsafeSceneServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SceneServer will +// result in compilation errors. +type UnsafeSceneServer interface { + mustEmbedUnimplementedSceneServer() +} + +func RegisterSceneServer(s grpc.ServiceRegistrar, srv SceneServer) { + s.RegisterService(&Scene_ServiceDesc, srv) +} + +func _Scene_Enter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EnterReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SceneServer).Enter(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Scene/Enter", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SceneServer).Enter(ctx, req.(*EnterReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Scene_Action_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(SceneServer).Action(&sceneActionServer{stream}) +} + +type Scene_ActionServer interface { + SendAndClose(*ActionResp) error + Recv() (*ActionReq, error) + grpc.ServerStream +} + +type sceneActionServer struct { + grpc.ServerStream +} + +func (x *sceneActionServer) SendAndClose(m *ActionResp) error { + return x.ServerStream.SendMsg(m) +} + +func (x *sceneActionServer) Recv() (*ActionReq, error) { + m := new(ActionReq) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Scene_ServiceDesc is the grpc.ServiceDesc for Scene service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Scene_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "Scene", + HandlerType: (*SceneServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Enter", + Handler: _Scene_Enter_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Action", + Handler: _Scene_Action_Handler, + ClientStreams: true, + }, + }, + Metadata: "service_scene.proto", +} diff --git a/Server/common/proto/ss/ss_common/ss_common.pb.go b/Server/common/proto/ss/ss_common/ss_common.pb.go new file mode 100644 index 0000000..d070b7b --- /dev/null +++ b/Server/common/proto/ss/ss_common/ss_common.pb.go @@ -0,0 +1,62 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: ss_common.proto + +package ss_common + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_ss_common_proto protoreflect.FileDescriptor + +var file_ss_common_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x42, 0x1b, 0x5a, 0x19, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_ss_common_proto_goTypes = []interface{}{} +var file_ss_common_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 +} + +func init() { file_ss_common_proto_init() } +func file_ss_common_proto_init() { + if File_ss_common_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ss_common_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ss_common_proto_goTypes, + DependencyIndexes: file_ss_common_proto_depIdxs, + }.Build() + File_ss_common_proto = out.File + file_ss_common_proto_rawDesc = nil + file_ss_common_proto_goTypes = nil + file_ss_common_proto_depIdxs = nil +} diff --git a/Server/scene/grpc_server/server/server.go b/Server/scene/grpc_server/server/server.go index b8cfe1f..18f2b1a 100644 --- a/Server/scene/grpc_server/server/server.go +++ b/Server/scene/grpc_server/server/server.go @@ -2,8 +2,7 @@ package server import ( "common/log" - "common/proto/gen/common" - "common/proto/gen/grpc_pb" + "common/proto/ss/grpc_pb" "context" "scene/instance" "sync" @@ -52,5 +51,5 @@ func (s *Server) Action(server grpc_pb.Scene_ActionServer) error { } }() wg.Wait() - return server.SendAndClose(&common.Empty{}) + return server.SendAndClose(&grpc_pb.ActionResp{}) } diff --git a/Server/scene/grpc_server/server/server_init.go b/Server/scene/grpc_server/server/server_init.go index 780fa68..b3c239b 100644 --- a/Server/scene/grpc_server/server/server_init.go +++ b/Server/scene/grpc_server/server/server_init.go @@ -3,7 +3,7 @@ package server import ( "common/discover/common" "common/net/grpc/service" - "common/proto/gen/grpc_pb" + "common/proto/ss/grpc_pb" "google.golang.org/grpc" ) diff --git a/Server/scene/instance/instance.go b/Server/scene/instance/instance.go index 62ec811..b0a6cf1 100644 --- a/Server/scene/instance/instance.go +++ b/Server/scene/instance/instance.go @@ -3,8 +3,8 @@ package instance import ( "common/discover" "common/log" - "common/proto/gen/cs" - "common/proto/gen/grpc_pb" + "common/proto/sc/sc_pb" + "common/proto/ss/grpc_pb" "common/utils" "context" "fmt" @@ -97,12 +97,12 @@ func (i *Instance) onEvent(e proto.Message) { // 逻辑帧 func (i *Instance) onLogic() { - positionUpdate := make([]*cs.PositionInfo, 0) + positionUpdate := make([]*sc_pb.PositionInfo, 0) sid := int64(0) // 优先处理移动指令 for _, node := range i.players { if node.LogicMove() { - positionUpdate = append(positionUpdate, &cs.PositionInfo{ + positionUpdate = append(positionUpdate, &sc_pb.PositionInfo{ UID: int32(node.UID), X: node.Position[0], Y: node.Position[1], @@ -111,12 +111,12 @@ func (i *Instance) onLogic() { } } if len(positionUpdate) > 0 { - payload, _ := proto.Marshal(&cs.S2C_Position{ + payload, _ := proto.Marshal(&sc_pb.S2C_Position{ Info: positionUpdate, }) if err := stream_client.SendMessageToGateway(sid, stream_client.FunToClient, &grpc_pb.ToClientReq{ UID: -1, - MessageID: int32(cs.MessageID_MESSAGE_ID_POSITION), + MessageID: int32(sc_pb.MessageID_MESSAGE_ID_POSITION), Payload: payload, }); err != nil { i.logger.Errorf("send action err: %v", err) diff --git a/Server/scene/npc/npc.go b/Server/scene/npc/npc.go index 97f1da8..98291fe 100644 --- a/Server/scene/npc/npc.go +++ b/Server/scene/npc/npc.go @@ -1,7 +1,7 @@ package npc import ( - "common/proto/gen/grpc_pb" + "common/proto/ss/grpc_pb" ) // NPCNode 定义NPC节点 diff --git a/Server/scene/npc/player.go b/Server/scene/npc/player.go index 6eb3b31..97174aa 100644 --- a/Server/scene/npc/player.go +++ b/Server/scene/npc/player.go @@ -1,7 +1,7 @@ package npc import ( - "common/proto/gen/grpc_pb" + "common/proto/ss/grpc_pb" ) // PlayerNode 定义玩家节点结构体