This commit is contained in:
2025-07-04 23:41:19 +08:00
parent 7c2c32a31a
commit f0fd00d706
27 changed files with 1206 additions and 163 deletions

View File

@@ -3,14 +3,30 @@ syntax = "proto3";
option go_package = "common/proto/gen/cs";
import "common.proto";
enum ActionID {
ACTION_ID_INVALID = 0;
ACTION_ID_MOVE = 1; // 1-15都是移动指令
ACTION_ID_ATTACK = 16; // 攻击指令
// MESSAGE_ID_ENTER_INSTANCE
message C2S_EnterInstance {
int32 InstanceID = 1;
}
message S2C_EnterInstance {
PositionInfo Info = 1;
}
// 指令
// MESSAGE_ID_ACTION
enum ActionID {
ACTION_ID_MOVE = 0; // 0-15都是移动指令
ACTION_ID_ATTACK = 16; // 攻击指令
}
message C2S_Action {
ActionID Action = 1; // 指令ID
bytes Payload = 2; // 指令数据
}
// MESSAGE_ID_POSITION
message PositionInfo {
int32 UID = 1;
double X = 2;
double Y = 3;
}
message S2C_Position {
repeated PositionInfo Info = 1;
}

View File

@@ -5,10 +5,12 @@ import "common.proto";
enum MessageID {
MESSAGE_ID_INVALID = 0;
MESSAGE_ID_C2S_ACTION = 1; // 指令
MESSAGE_ID_ENTER_INSTANCE = 1; // 进入副本
MESSAGE_ID_ACTION = 2; // 指令
MESSAGE_ID_POSITION = 3; // 位置更新
}
message Message {
MessageID id = 1;
bytes payload = 2;
MessageID ID = 1;
bytes Payload = 2;
}

View File

@@ -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: cs/action.proto
package cs
import (
_ "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)
)
// 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_cs_action_proto_enumTypes[0].Descriptor()
}
func (ActionID) Type() protoreflect.EnumType {
return &file_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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_cs_action_proto_rawDescGZIP(), []int{4}
}
func (x *S2C_Position) GetInfo() []*PositionInfo {
if x != nil {
return x.Info
}
return nil
}
var File_cs_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,
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, 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,
}
var (
file_cs_action_proto_rawDescOnce sync.Once
file_cs_action_proto_rawDescData = file_cs_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)
})
return file_cs_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{}{
(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_cs_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_cs_action_proto_init() }
func file_cs_action_proto_init() {
if File_cs_action_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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,
}.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
}

View File

@@ -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: cs/define.proto
package cs
import (
_ "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 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_cs_define_proto_enumTypes[0].Descriptor()
}
func (MessageID) Type() protoreflect.EnumType {
return &file_cs_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_cs_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_cs_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_cs_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_cs_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_cs_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,
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, 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,
}
var (
file_cs_define_proto_rawDescOnce sync.Once
file_cs_define_proto_rawDescData = file_cs_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)
})
return file_cs_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{}{
(MessageID)(0), // 0: MessageID
(*Message)(nil), // 1: Message
}
var file_cs_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_cs_define_proto_init() }
func file_cs_define_proto_init() {
if File_cs_define_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cs_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_cs_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,
}.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
}

View File

@@ -26,8 +26,9 @@ type ToClientReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"`
Payload []byte `protobuf:"bytes,2,opt,name=Payload,proto3" json:"Payload,omitempty"`
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() {
@@ -69,6 +70,13 @@ func (x *ToClientReq) GetUID() int32 {
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
@@ -81,16 +89,17 @@ 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, 0x39, 0x0a, 0x0b, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65,
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, 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, 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,
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 (

View File

@@ -27,7 +27,7 @@ type EnterReq struct {
unknownFields protoimpl.UnknownFields
UID int32 `protobuf:"varint,1,opt,name=UID,proto3" json:"UID,omitempty"` // 用户ID
SID int64 `protobuf:"varint,2,opt,name=SID,proto3" json:"SID,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
}
@@ -70,9 +70,9 @@ func (x *EnterReq) GetUID() int32 {
return 0
}
func (x *EnterReq) GetSID() int64 {
func (x *EnterReq) GetGatewaySID() int64 {
if x != nil {
return x.SID
return x.GatewaySID
}
return 0
}
@@ -89,7 +89,7 @@ type EnterResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SID int64 `protobuf:"varint,1,opt,name=SID,proto3" json:"SID,omitempty"` // 服务ID
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"` // 副本唯一编号
}
@@ -125,9 +125,9 @@ func (*EnterResp) Descriptor() ([]byte, []int) {
return file_grpc_scene_proto_rawDescGZIP(), []int{1}
}
func (x *EnterResp) GetSID() int64 {
func (x *EnterResp) GetSceneSID() int64 {
if x != nil {
return x.SID
return x.SceneSID
}
return 0
}
@@ -215,29 +215,31 @@ 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, 0x4e, 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, 0x10,
0x0a, 0x03, 0x53, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 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, 0x39, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a,
0x03, 0x53, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 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,
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 (

View File

@@ -9,6 +9,7 @@ service Gateway {
message ToClientReq {
int32 UID = 1;
bytes Payload = 2;
int32 MessageID = 2;
bytes Payload = 3;
}

View File

@@ -10,12 +10,12 @@ service Scene {
message EnterReq {
int32 UID = 1; // 用户ID
int64 SID = 2; // 服务ID
int64 GatewaySID = 2; // 网关服务ID
int32 InstanceID = 3; // 副本ID
}
message EnterResp {
int64 SID = 1; // 服务ID
int64 SceneSID = 1; // 场景服务ID
int64 UniqueNo = 2; // 副本唯一编号
}