diff --git a/Proto/ServerClient/gen/client/Action.cs b/Proto/ServerClient/gen/client/Action.cs new file mode 100644 index 0000000..788354b --- /dev/null +++ b/Proto/ServerClient/gen/client/Action.cs @@ -0,0 +1,1302 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: action.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +/// Holder for reflection information generated from action.proto +public static partial class ActionReflection { + + #region Descriptor + /// File descriptor for action.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ActionReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CgxhY3Rpb24ucHJvdG8aD3NjX2NvbW1vbi5wcm90byInChFDMlNfRW50ZXJJ", + "bnN0YW5jZRISCgpJbnN0YW5jZUlEGAEgASgFIjAKEVMyQ19FbnRlckluc3Rh", + "bmNlEhsKBEluZm8YASABKAsyDS5Qb3NpdGlvbkluZm8ieQoKQzJTX0FjdGlv", + "bhIQCghTZXF1ZW5jZRgBIAEoDRIRCglUaW1lc3RhbXAYAiABKAMSGQoGQWN0", + "aW9uGAMgASgOMgkuQWN0aW9uSUQSDAoERGlyWBgEIAEoERIMCgREaXJZGAUg", + "ASgREg8KB1NraWxsSUQYBiABKAUiMQoMUG9zaXRpb25JbmZvEgsKA1VTThgB", + "IAEoAxIJCgFYGAIgASgREgkKAVkYAyABKBEiKwoMUzJDX1Bvc2l0aW9uEhsK", + "BEluZm8YASADKAsyDS5Qb3NpdGlvbkluZm8qSwoIQWN0aW9uSUQSFQoRQUNU", + "SU9OX0lEX0lOVkFMSUQQABISCg5BQ1RJT05fSURfTU9WRRABEhQKEEFDVElP", + "Tl9JRF9BVFRBQ0sQAkIXWhVjb21tb24vcHJvdG8vc2Mvc2NfcGJiBnByb3Rv", + "Mw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::ScCommonReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ActionID), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::C2S_EnterInstance), global::C2S_EnterInstance.Parser, new[]{ "InstanceID" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::S2C_EnterInstance), global::S2C_EnterInstance.Parser, new[]{ "Info" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::C2S_Action), global::C2S_Action.Parser, new[]{ "Sequence", "Timestamp", "Action", "DirX", "DirY", "SkillID" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::PositionInfo), global::PositionInfo.Parser, new[]{ "USN", "X", "Y" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::S2C_Position), global::S2C_Position.Parser, new[]{ "Info" }, null, null, null, null) + })); + } + #endregion + +} +#region Enums +/// +/// MESSAGE_ID_ACTION +/// +public enum ActionID { + [pbr::OriginalName("ACTION_ID_INVALID")] Invalid = 0, + /// + /// 移动 + /// + [pbr::OriginalName("ACTION_ID_MOVE")] Move = 1, + /// + /// 攻击 + /// + [pbr::OriginalName("ACTION_ID_ATTACK")] Attack = 2, +} + +#endregion + +#region Messages +/// +/// MESSAGE_ID_ENTER_INSTANCE +/// +[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] +public sealed partial class C2S_EnterInstance : pb::IMessage +#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage +#endif +{ + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new C2S_EnterInstance()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ActionReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public C2S_EnterInstance() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public C2S_EnterInstance(C2S_EnterInstance other) : this() { + instanceID_ = other.instanceID_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public C2S_EnterInstance Clone() { + return new C2S_EnterInstance(this); + } + + /// Field number for the "InstanceID" field. + public const int InstanceIDFieldNumber = 1; + private int instanceID_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int InstanceID { + get { return instanceID_; } + set { + instanceID_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as C2S_EnterInstance); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(C2S_EnterInstance other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (InstanceID != other.InstanceID) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (InstanceID != 0) hash ^= InstanceID.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (InstanceID != 0) { + output.WriteRawTag(8); + output.WriteInt32(InstanceID); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (InstanceID != 0) { + output.WriteRawTag(8); + output.WriteInt32(InstanceID); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (InstanceID != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(InstanceID); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(C2S_EnterInstance other) { + if (other == null) { + return; + } + if (other.InstanceID != 0) { + InstanceID = other.InstanceID; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + InstanceID = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + InstanceID = input.ReadInt32(); + break; + } + } + } + } + #endif + +} + +[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] +public sealed partial class S2C_EnterInstance : pb::IMessage +#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage +#endif +{ + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new S2C_EnterInstance()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ActionReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_EnterInstance() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_EnterInstance(S2C_EnterInstance other) : this() { + info_ = other.info_ != null ? other.info_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_EnterInstance Clone() { + return new S2C_EnterInstance(this); + } + + /// Field number for the "Info" field. + public const int InfoFieldNumber = 1; + private global::PositionInfo info_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::PositionInfo Info { + get { return info_; } + set { + info_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as S2C_EnterInstance); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(S2C_EnterInstance other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Info, other.Info)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (info_ != null) hash ^= Info.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (info_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Info); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (info_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Info); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (info_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Info); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(S2C_EnterInstance other) { + if (other == null) { + return; + } + if (other.info_ != null) { + if (info_ == null) { + Info = new global::PositionInfo(); + } + Info.MergeFrom(other.Info); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (info_ == null) { + Info = new global::PositionInfo(); + } + input.ReadMessage(Info); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (info_ == null) { + Info = new global::PositionInfo(); + } + input.ReadMessage(Info); + break; + } + } + } + } + #endif + +} + +[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] +public sealed partial class C2S_Action : pb::IMessage +#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage +#endif +{ + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new C2S_Action()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ActionReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public C2S_Action() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public C2S_Action(C2S_Action other) : this() { + sequence_ = other.sequence_; + timestamp_ = other.timestamp_; + action_ = other.action_; + dirX_ = other.dirX_; + dirY_ = other.dirY_; + skillID_ = other.skillID_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public C2S_Action Clone() { + return new C2S_Action(this); + } + + /// Field number for the "Sequence" field. + public const int SequenceFieldNumber = 1; + private uint sequence_; + /// + /// 指令序号 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint Sequence { + get { return sequence_; } + set { + sequence_ = value; + } + } + + /// Field number for the "Timestamp" field. + public const int TimestampFieldNumber = 2; + private long timestamp_; + /// + /// 时间戳(毫秒) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Timestamp { + get { return timestamp_; } + set { + timestamp_ = value; + } + } + + /// Field number for the "Action" field. + public const int ActionFieldNumber = 3; + private global::ActionID action_ = global::ActionID.Invalid; + /// + /// 指令ID + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ActionID Action { + get { return action_; } + set { + action_ = value; + } + } + + /// Field number for the "DirX" field. + public const int DirXFieldNumber = 4; + private int dirX_; + /// + /// 移动-X方向(×100 缩放) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int DirX { + get { return dirX_; } + set { + dirX_ = value; + } + } + + /// Field number for the "DirY" field. + public const int DirYFieldNumber = 5; + private int dirY_; + /// + /// 移动-Y方向(×100 缩放) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int DirY { + get { return dirY_; } + set { + dirY_ = value; + } + } + + /// Field number for the "SkillID" field. + public const int SkillIDFieldNumber = 6; + private int skillID_; + /// + /// 攻击-技能ID + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int SkillID { + get { return skillID_; } + set { + skillID_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as C2S_Action); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(C2S_Action other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Sequence != other.Sequence) return false; + if (Timestamp != other.Timestamp) return false; + if (Action != other.Action) return false; + if (DirX != other.DirX) return false; + if (DirY != other.DirY) return false; + if (SkillID != other.SkillID) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Sequence != 0) hash ^= Sequence.GetHashCode(); + if (Timestamp != 0L) hash ^= Timestamp.GetHashCode(); + if (Action != global::ActionID.Invalid) hash ^= Action.GetHashCode(); + if (DirX != 0) hash ^= DirX.GetHashCode(); + if (DirY != 0) hash ^= DirY.GetHashCode(); + if (SkillID != 0) hash ^= SkillID.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Sequence != 0) { + output.WriteRawTag(8); + output.WriteUInt32(Sequence); + } + if (Timestamp != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Timestamp); + } + if (Action != global::ActionID.Invalid) { + output.WriteRawTag(24); + output.WriteEnum((int) Action); + } + if (DirX != 0) { + output.WriteRawTag(32); + output.WriteSInt32(DirX); + } + if (DirY != 0) { + output.WriteRawTag(40); + output.WriteSInt32(DirY); + } + if (SkillID != 0) { + output.WriteRawTag(48); + output.WriteInt32(SkillID); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Sequence != 0) { + output.WriteRawTag(8); + output.WriteUInt32(Sequence); + } + if (Timestamp != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Timestamp); + } + if (Action != global::ActionID.Invalid) { + output.WriteRawTag(24); + output.WriteEnum((int) Action); + } + if (DirX != 0) { + output.WriteRawTag(32); + output.WriteSInt32(DirX); + } + if (DirY != 0) { + output.WriteRawTag(40); + output.WriteSInt32(DirY); + } + if (SkillID != 0) { + output.WriteRawTag(48); + output.WriteInt32(SkillID); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Sequence != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Sequence); + } + if (Timestamp != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Timestamp); + } + if (Action != global::ActionID.Invalid) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Action); + } + if (DirX != 0) { + size += 1 + pb::CodedOutputStream.ComputeSInt32Size(DirX); + } + if (DirY != 0) { + size += 1 + pb::CodedOutputStream.ComputeSInt32Size(DirY); + } + if (SkillID != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(SkillID); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(C2S_Action other) { + if (other == null) { + return; + } + if (other.Sequence != 0) { + Sequence = other.Sequence; + } + if (other.Timestamp != 0L) { + Timestamp = other.Timestamp; + } + if (other.Action != global::ActionID.Invalid) { + Action = other.Action; + } + if (other.DirX != 0) { + DirX = other.DirX; + } + if (other.DirY != 0) { + DirY = other.DirY; + } + if (other.SkillID != 0) { + SkillID = other.SkillID; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Sequence = input.ReadUInt32(); + break; + } + case 16: { + Timestamp = input.ReadInt64(); + break; + } + case 24: { + Action = (global::ActionID) input.ReadEnum(); + break; + } + case 32: { + DirX = input.ReadSInt32(); + break; + } + case 40: { + DirY = input.ReadSInt32(); + break; + } + case 48: { + SkillID = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Sequence = input.ReadUInt32(); + break; + } + case 16: { + Timestamp = input.ReadInt64(); + break; + } + case 24: { + Action = (global::ActionID) input.ReadEnum(); + break; + } + case 32: { + DirX = input.ReadSInt32(); + break; + } + case 40: { + DirY = input.ReadSInt32(); + break; + } + case 48: { + SkillID = input.ReadInt32(); + break; + } + } + } + } + #endif + +} + +/// +/// MESSAGE_ID_POSITION +/// +[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] +public sealed partial class PositionInfo : pb::IMessage +#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage +#endif +{ + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PositionInfo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ActionReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PositionInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PositionInfo(PositionInfo other) : this() { + uSN_ = other.uSN_; + x_ = other.x_; + y_ = other.y_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PositionInfo Clone() { + return new PositionInfo(this); + } + + /// Field number for the "USN" field. + public const int USNFieldNumber = 1; + private long uSN_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long USN { + get { return uSN_; } + set { + uSN_ = value; + } + } + + /// Field number for the "X" field. + public const int XFieldNumber = 2; + private int x_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int X { + get { return x_; } + set { + x_ = value; + } + } + + /// Field number for the "Y" field. + public const int YFieldNumber = 3; + private int y_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Y { + get { return y_; } + set { + y_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as PositionInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(PositionInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (USN != other.USN) return false; + if (X != other.X) return false; + if (Y != other.Y) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (USN != 0L) hash ^= USN.GetHashCode(); + if (X != 0) hash ^= X.GetHashCode(); + if (Y != 0) hash ^= Y.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (USN != 0L) { + output.WriteRawTag(8); + output.WriteInt64(USN); + } + if (X != 0) { + output.WriteRawTag(16); + output.WriteSInt32(X); + } + if (Y != 0) { + output.WriteRawTag(24); + output.WriteSInt32(Y); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (USN != 0L) { + output.WriteRawTag(8); + output.WriteInt64(USN); + } + if (X != 0) { + output.WriteRawTag(16); + output.WriteSInt32(X); + } + if (Y != 0) { + output.WriteRawTag(24); + output.WriteSInt32(Y); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (USN != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(USN); + } + if (X != 0) { + size += 1 + pb::CodedOutputStream.ComputeSInt32Size(X); + } + if (Y != 0) { + size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Y); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(PositionInfo other) { + if (other == null) { + return; + } + if (other.USN != 0L) { + USN = other.USN; + } + if (other.X != 0) { + X = other.X; + } + if (other.Y != 0) { + Y = other.Y; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + USN = input.ReadInt64(); + break; + } + case 16: { + X = input.ReadSInt32(); + break; + } + case 24: { + Y = input.ReadSInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + USN = input.ReadInt64(); + break; + } + case 16: { + X = input.ReadSInt32(); + break; + } + case 24: { + Y = input.ReadSInt32(); + break; + } + } + } + } + #endif + +} + +[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] +public sealed partial class S2C_Position : pb::IMessage +#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage +#endif +{ + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new S2C_Position()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ActionReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_Position() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_Position(S2C_Position other) : this() { + info_ = other.info_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_Position Clone() { + return new S2C_Position(this); + } + + /// Field number for the "Info" field. + public const int InfoFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_info_codec + = pb::FieldCodec.ForMessage(10, global::PositionInfo.Parser); + private readonly pbc::RepeatedField info_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Info { + get { return info_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as S2C_Position); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(S2C_Position other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!info_.Equals(other.info_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= info_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + info_.WriteTo(output, _repeated_info_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + info_.WriteTo(ref output, _repeated_info_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += info_.CalculateSize(_repeated_info_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(S2C_Position other) { + if (other == null) { + return; + } + info_.Add(other.info_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + info_.AddEntriesFrom(input, _repeated_info_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + info_.AddEntriesFrom(ref input, _repeated_info_codec); + break; + } + } + } + } + #endif + +} + +#endregion + + +#endregion Designer generated code diff --git a/Proto/ServerClient/gen/client/Define.cs b/Proto/ServerClient/gen/client/Define.cs new file mode 100644 index 0000000..29e9197 --- /dev/null +++ b/Proto/ServerClient/gen/client/Define.cs @@ -0,0 +1,303 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: define.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +/// Holder for reflection information generated from define.proto +public static partial class DefineReflection { + + #region Descriptor + /// File descriptor for define.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DefineReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CgxkZWZpbmUucHJvdG8aD3NjX2NvbW1vbi5wcm90byIyCgdNZXNzYWdlEhYK", + "AklEGAEgASgOMgouTWVzc2FnZUlEEg8KB1BheWxvYWQYAiABKAwqwgEKCU1l", + "c3NhZ2VJRBIWChJNRVNTQUdFX0lEX0lOVkFMSUQQABIXChNNRVNTQUdFX0lE", + "X0tJQ0tfT1VUEAESFwoTTUVTU0FHRV9JRF9RVUVVRV9VUBACEhwKGE1FU1NB", + "R0VfSURfTE9HSU5fU1VDQ0VTUxADEh0KGU1FU1NBR0VfSURfRU5URVJfSU5T", + "VEFOQ0UQZRIVChFNRVNTQUdFX0lEX0FDVElPThBmEhcKE01FU1NBR0VfSURf", + "UE9TSVRJT04QZ0IXWhVjb21tb24vcHJvdG8vc2Mvc2NfcGJiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::ScCommonReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::MessageID), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Message), global::Message.Parser, new[]{ "ID", "Payload" }, null, null, null, null) + })); + } + #endregion + +} +#region Enums +public enum MessageID { + [pbr::OriginalName("MESSAGE_ID_INVALID")] Invalid = 0, + /// + /// 服务器踢人 + /// + [pbr::OriginalName("MESSAGE_ID_KICK_OUT")] KickOut = 1, + /// + /// 排队中 + /// + [pbr::OriginalName("MESSAGE_ID_QUEUE_UP")] QueueUp = 2, + /// + /// 登录成功 + /// + [pbr::OriginalName("MESSAGE_ID_LOGIN_SUCCESS")] LoginSuccess = 3, + /// + /// 进入副本 + /// + [pbr::OriginalName("MESSAGE_ID_ENTER_INSTANCE")] EnterInstance = 101, + /// + /// 指令 + /// + [pbr::OriginalName("MESSAGE_ID_ACTION")] Action = 102, + /// + /// 位置更新 + /// + [pbr::OriginalName("MESSAGE_ID_POSITION")] Position = 103, +} + +#endregion + +#region Messages +[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] +public sealed partial class Message : pb::IMessage +#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage +#endif +{ + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Message()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::DefineReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Message() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Message(Message other) : this() { + iD_ = other.iD_; + payload_ = other.payload_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Message Clone() { + return new Message(this); + } + + /// Field number for the "ID" field. + public const int IDFieldNumber = 1; + private global::MessageID iD_ = global::MessageID.Invalid; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::MessageID ID { + get { return iD_; } + set { + iD_ = value; + } + } + + /// Field number for the "Payload" field. + public const int PayloadFieldNumber = 2; + private pb::ByteString payload_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString Payload { + get { return payload_; } + set { + payload_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Message); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Message other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ID != other.ID) return false; + if (Payload != other.Payload) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ID != global::MessageID.Invalid) hash ^= ID.GetHashCode(); + if (Payload.Length != 0) hash ^= Payload.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ID != global::MessageID.Invalid) { + output.WriteRawTag(8); + output.WriteEnum((int) ID); + } + if (Payload.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Payload); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ID != global::MessageID.Invalid) { + output.WriteRawTag(8); + output.WriteEnum((int) ID); + } + if (Payload.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Payload); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ID != global::MessageID.Invalid) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ID); + } + if (Payload.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Payload); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Message other) { + if (other == null) { + return; + } + if (other.ID != global::MessageID.Invalid) { + ID = other.ID; + } + if (other.Payload.Length != 0) { + Payload = other.Payload; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + ID = (global::MessageID) input.ReadEnum(); + break; + } + case 18: { + Payload = input.ReadBytes(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ID = (global::MessageID) input.ReadEnum(); + break; + } + case 18: { + Payload = input.ReadBytes(); + break; + } + } + } + } + #endif + +} + +#endregion + + +#endregion Designer generated code diff --git a/Proto/ServerClient/gen/client/ScCommon.cs b/Proto/ServerClient/gen/client/ScCommon.cs new file mode 100644 index 0000000..fed1db3 --- /dev/null +++ b/Proto/ServerClient/gen/client/ScCommon.cs @@ -0,0 +1,35 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: sc_common.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +/// Holder for reflection information generated from sc_common.proto +public static partial class ScCommonReflection { + + #region Descriptor + /// File descriptor for sc_common.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ScCommonReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg9zY19jb21tb24ucHJvdG9CG1oZY29tbW9uL3Byb3RvL3NjL3NjX2NvbW1v", + "bmIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, null)); + } + #endregion + +} + +#endregion Designer generated code diff --git a/Proto/ServerClient/gen/client/Service.cs b/Proto/ServerClient/gen/client/Service.cs new file mode 100644 index 0000000..48b68ee --- /dev/null +++ b/Proto/ServerClient/gen/client/Service.cs @@ -0,0 +1,661 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: service.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +/// Holder for reflection information generated from service.proto +public static partial class ServiceReflection { + + #region Descriptor + /// File descriptor for service.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ServiceReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg1zZXJ2aWNlLnByb3RvGg9zY19jb21tb24ucHJvdG8iJQoLUzJDX0tpY2tP", + "dXQSFgoCSUQYASABKA4yCi5LaWNrT3V0SUQiIwoLUzJDX1F1ZXVlVXASFAoM", + "UXVldWVVcENvdW50GAEgASgFIiYKEFMyQ19Mb2dpblN1Y2Nlc3MSEgoKSW5z", + "dGFuY2VJRBgBIAEoBSq+AQoJS2lja091dElEEhcKE0tJQ0tfT1VUX0lEX0lO", + "VkFMSUQQABIfChtLSUNLX09VVF9JRF9EVVBMSUNBVEVfTE9HSU4QARIbChdL", + "SUNLX09VVF9JRF9TRVJWRVJfQlVTWRACEhwKGEtJQ0tfT1VUX0lEX1NFUlZF", + "Ul9DTE9TRRADEh0KGUtJQ0tfT1VUX0lEX1FVRVVFX1VQX0ZVTEwQBBIdChlL", + "SUNLX09VVF9JRF9UT0tFTl9JTlZBTElEEAVCF1oVY29tbW9uL3Byb3RvL3Nj", + "L3NjX3BiYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::ScCommonReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::KickOutID), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::S2C_KickOut), global::S2C_KickOut.Parser, new[]{ "ID" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::S2C_QueueUp), global::S2C_QueueUp.Parser, new[]{ "QueueUpCount" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::S2C_LoginSuccess), global::S2C_LoginSuccess.Parser, new[]{ "InstanceID" }, null, null, null, null) + })); + } + #endregion + +} +#region Enums +/// +/// MESSAGE_ID_KICK_OUT +/// +public enum KickOutID { + [pbr::OriginalName("KICK_OUT_ID_INVALID")] Invalid = 0, + /// + /// 重复登录 + /// + [pbr::OriginalName("KICK_OUT_ID_DUPLICATE_LOGIN")] DuplicateLogin = 1, + /// + /// 服务器繁忙 + /// + [pbr::OriginalName("KICK_OUT_ID_SERVER_BUSY")] ServerBusy = 2, + /// + /// 服务器关闭 + /// + [pbr::OriginalName("KICK_OUT_ID_SERVER_CLOSE")] ServerClose = 3, + /// + /// 排队上限 + /// + [pbr::OriginalName("KICK_OUT_ID_QUEUE_UP_FULL")] QueueUpFull = 4, + /// + /// Token无效 + /// + [pbr::OriginalName("KICK_OUT_ID_TOKEN_INVALID")] TokenInvalid = 5, +} + +#endregion + +#region Messages +[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] +public sealed partial class S2C_KickOut : pb::IMessage +#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage +#endif +{ + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new S2C_KickOut()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_KickOut() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_KickOut(S2C_KickOut other) : this() { + iD_ = other.iD_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_KickOut Clone() { + return new S2C_KickOut(this); + } + + /// Field number for the "ID" field. + public const int IDFieldNumber = 1; + private global::KickOutID iD_ = global::KickOutID.Invalid; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::KickOutID ID { + get { return iD_; } + set { + iD_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as S2C_KickOut); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(S2C_KickOut other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ID != other.ID) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ID != global::KickOutID.Invalid) hash ^= ID.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ID != global::KickOutID.Invalid) { + output.WriteRawTag(8); + output.WriteEnum((int) ID); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ID != global::KickOutID.Invalid) { + output.WriteRawTag(8); + output.WriteEnum((int) ID); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ID != global::KickOutID.Invalid) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ID); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(S2C_KickOut other) { + if (other == null) { + return; + } + if (other.ID != global::KickOutID.Invalid) { + ID = other.ID; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + ID = (global::KickOutID) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ID = (global::KickOutID) input.ReadEnum(); + break; + } + } + } + } + #endif + +} + +/// +/// MESSAGE_ID_QUEUE_UP +/// +[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] +public sealed partial class S2C_QueueUp : pb::IMessage +#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage +#endif +{ + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new S2C_QueueUp()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_QueueUp() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_QueueUp(S2C_QueueUp other) : this() { + queueUpCount_ = other.queueUpCount_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_QueueUp Clone() { + return new S2C_QueueUp(this); + } + + /// Field number for the "QueueUpCount" field. + public const int QueueUpCountFieldNumber = 1; + private int queueUpCount_; + /// + /// 排队人数 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int QueueUpCount { + get { return queueUpCount_; } + set { + queueUpCount_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as S2C_QueueUp); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(S2C_QueueUp other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (QueueUpCount != other.QueueUpCount) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (QueueUpCount != 0) hash ^= QueueUpCount.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (QueueUpCount != 0) { + output.WriteRawTag(8); + output.WriteInt32(QueueUpCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (QueueUpCount != 0) { + output.WriteRawTag(8); + output.WriteInt32(QueueUpCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (QueueUpCount != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(QueueUpCount); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(S2C_QueueUp other) { + if (other == null) { + return; + } + if (other.QueueUpCount != 0) { + QueueUpCount = other.QueueUpCount; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + QueueUpCount = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + QueueUpCount = input.ReadInt32(); + break; + } + } + } + } + #endif + +} + +/// +/// MESSAGE_ID_LOGIN_SUCCESS +/// +[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] +public sealed partial class S2C_LoginSuccess : pb::IMessage +#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage +#endif +{ + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new S2C_LoginSuccess()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ServiceReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_LoginSuccess() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_LoginSuccess(S2C_LoginSuccess other) : this() { + instanceID_ = other.instanceID_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public S2C_LoginSuccess Clone() { + return new S2C_LoginSuccess(this); + } + + /// Field number for the "InstanceID" field. + public const int InstanceIDFieldNumber = 1; + private int instanceID_; + /// + /// 副本ID + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int InstanceID { + get { return instanceID_; } + set { + instanceID_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as S2C_LoginSuccess); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(S2C_LoginSuccess other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (InstanceID != other.InstanceID) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (InstanceID != 0) hash ^= InstanceID.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (InstanceID != 0) { + output.WriteRawTag(8); + output.WriteInt32(InstanceID); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (InstanceID != 0) { + output.WriteRawTag(8); + output.WriteInt32(InstanceID); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (InstanceID != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(InstanceID); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(S2C_LoginSuccess other) { + if (other == null) { + return; + } + if (other.InstanceID != 0) { + InstanceID = other.InstanceID; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + InstanceID = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + InstanceID = input.ReadInt32(); + break; + } + } + } + } + #endif + +} + +#endregion + + +#endregion Designer generated code diff --git a/Proto/ServerClient/gen/common/proto/sc/sc_common/sc_common.pb.go b/Proto/ServerClient/gen/common/proto/sc/sc_common/sc_common.pb.go new file mode 100644 index 0000000..dccafd4 --- /dev/null +++ b/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/Proto/ServerClient/gen/common/proto/sc/sc_pb/action.pb.go b/Proto/ServerClient/gen/common/proto/sc/sc_pb/action.pb.go new file mode 100644 index 0000000..08ed345 --- /dev/null +++ b/Proto/ServerClient/gen/common/proto/sc/sc_pb/action.pb.go @@ -0,0 +1,525 @@ +// 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_INVALID ActionID = 0 + ActionID_ACTION_ID_MOVE ActionID = 1 // 移动 + ActionID_ACTION_ID_ATTACK ActionID = 2 // 攻击 +) + +// Enum value maps for ActionID. +var ( + ActionID_name = map[int32]string{ + 0: "ACTION_ID_INVALID", + 1: "ACTION_ID_MOVE", + 2: "ACTION_ID_ATTACK", + } + ActionID_value = map[string]int32{ + "ACTION_ID_INVALID": 0, + "ACTION_ID_MOVE": 1, + "ACTION_ID_ATTACK": 2, + } +) + +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 + + Sequence uint32 `protobuf:"varint,1,opt,name=Sequence,proto3" json:"Sequence,omitempty"` // 指令序号 + Timestamp int64 `protobuf:"varint,2,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` // 时间戳(毫秒) + Action ActionID `protobuf:"varint,3,opt,name=Action,proto3,enum=ActionID" json:"Action,omitempty"` // 指令ID + DirX int32 `protobuf:"zigzag32,4,opt,name=DirX,proto3" json:"DirX,omitempty"` // 移动-X方向(×100 缩放) + DirY int32 `protobuf:"zigzag32,5,opt,name=DirY,proto3" json:"DirY,omitempty"` // 移动-Y方向(×100 缩放) + SkillID int32 `protobuf:"varint,6,opt,name=SkillID,proto3" json:"SkillID,omitempty"` // 攻击-技能ID +} + +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) GetSequence() uint32 { + if x != nil { + return x.Sequence + } + return 0 +} + +func (x *C2S_Action) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *C2S_Action) GetAction() ActionID { + if x != nil { + return x.Action + } + return ActionID_ACTION_ID_INVALID +} + +func (x *C2S_Action) GetDirX() int32 { + if x != nil { + return x.DirX + } + return 0 +} + +func (x *C2S_Action) GetDirY() int32 { + if x != nil { + return x.DirY + } + return 0 +} + +func (x *C2S_Action) GetSkillID() int32 { + if x != nil { + return x.SkillID + } + return 0 +} + +// MESSAGE_ID_POSITION +type PositionInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` + X int32 `protobuf:"zigzag32,2,opt,name=X,proto3" json:"X,omitempty"` + Y int32 `protobuf:"zigzag32,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) GetUSN() int64 { + if x != nil { + return x.USN + } + return 0 +} + +func (x *PositionInfo) GetX() int32 { + if x != nil { + return x.X + } + return 0 +} + +func (x *PositionInfo) GetY() int32 { + 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, 0xab, 0x01, 0x0a, + 0x0a, 0x43, 0x32, 0x53, 0x5f, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x53, + 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x53, + 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x21, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, + 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x69, 0x72, 0x58, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x11, 0x52, 0x04, 0x44, 0x69, 0x72, 0x58, 0x12, 0x12, 0x0a, 0x04, + 0x44, 0x69, 0x72, 0x59, 0x18, 0x05, 0x20, 0x01, 0x28, 0x11, 0x52, 0x04, 0x44, 0x69, 0x72, 0x59, + 0x12, 0x18, 0x0a, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x3c, 0x0a, 0x0c, 0x50, 0x6f, + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, + 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x0c, 0x0a, 0x01, + 0x58, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x01, 0x58, 0x12, 0x0c, 0x0a, 0x01, 0x59, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x11, 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, 0x4b, 0x0a, 0x08, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x43, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x12, + 0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x4f, 0x56, 0x45, + 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, + 0x41, 0x54, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x02, 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/Proto/ServerClient/gen/common/proto/sc/sc_pb/define.pb.go b/Proto/ServerClient/gen/common/proto/sc/sc_pb/define.pb.go new file mode 100644 index 0000000..60b5b01 --- /dev/null +++ b/Proto/ServerClient/gen/common/proto/sc/sc_pb/define.pb.go @@ -0,0 +1,231 @@ +// 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_KICK_OUT MessageID = 1 // 服务器踢人 + MessageID_MESSAGE_ID_QUEUE_UP MessageID = 2 // 排队中 + MessageID_MESSAGE_ID_LOGIN_SUCCESS MessageID = 3 // 登录成功 + MessageID_MESSAGE_ID_ENTER_INSTANCE MessageID = 101 // 进入副本 + MessageID_MESSAGE_ID_ACTION MessageID = 102 // 指令 + MessageID_MESSAGE_ID_POSITION MessageID = 103 // 位置更新 +) + +// Enum value maps for MessageID. +var ( + MessageID_name = map[int32]string{ + 0: "MESSAGE_ID_INVALID", + 1: "MESSAGE_ID_KICK_OUT", + 2: "MESSAGE_ID_QUEUE_UP", + 3: "MESSAGE_ID_LOGIN_SUCCESS", + 101: "MESSAGE_ID_ENTER_INSTANCE", + 102: "MESSAGE_ID_ACTION", + 103: "MESSAGE_ID_POSITION", + } + MessageID_value = map[string]int32{ + "MESSAGE_ID_INVALID": 0, + "MESSAGE_ID_KICK_OUT": 1, + "MESSAGE_ID_QUEUE_UP": 2, + "MESSAGE_ID_LOGIN_SUCCESS": 3, + "MESSAGE_ID_ENTER_INSTANCE": 101, + "MESSAGE_ID_ACTION": 102, + "MESSAGE_ID_POSITION": 103, + } +) + +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, 0xc2, 0x01, 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, 0x17, 0x0a, 0x13, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, + 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x4b, 0x49, 0x43, 0x4b, 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x01, 0x12, + 0x17, 0x0a, 0x13, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x51, 0x55, + 0x45, 0x55, 0x45, 0x5f, 0x55, 0x50, 0x10, 0x02, 0x12, 0x1c, 0x0a, 0x18, 0x4d, 0x45, 0x53, 0x53, + 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x4c, 0x4f, 0x47, 0x49, 0x4e, 0x5f, 0x53, 0x55, 0x43, + 0x43, 0x45, 0x53, 0x53, 0x10, 0x03, 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, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, + 0x5f, 0x49, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x66, 0x12, 0x17, 0x0a, 0x13, + 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, + 0x49, 0x4f, 0x4e, 0x10, 0x67, 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/Proto/ServerClient/gen/common/proto/sc/sc_pb/service.pb.go b/Proto/ServerClient/gen/common/proto/sc/sc_pb/service.pb.go new file mode 100644 index 0000000..4ba8aff --- /dev/null +++ b/Proto/ServerClient/gen/common/proto/sc/sc_pb/service.pb.go @@ -0,0 +1,348 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: service.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_KICK_OUT +type KickOutID int32 + +const ( + KickOutID_KICK_OUT_ID_INVALID KickOutID = 0 + KickOutID_KICK_OUT_ID_DUPLICATE_LOGIN KickOutID = 1 // 重复登录 + KickOutID_KICK_OUT_ID_SERVER_BUSY KickOutID = 2 // 服务器繁忙 + KickOutID_KICK_OUT_ID_SERVER_CLOSE KickOutID = 3 // 服务器关闭 + KickOutID_KICK_OUT_ID_QUEUE_UP_FULL KickOutID = 4 // 排队上限 + KickOutID_KICK_OUT_ID_TOKEN_INVALID KickOutID = 5 // Token无效 +) + +// Enum value maps for KickOutID. +var ( + KickOutID_name = map[int32]string{ + 0: "KICK_OUT_ID_INVALID", + 1: "KICK_OUT_ID_DUPLICATE_LOGIN", + 2: "KICK_OUT_ID_SERVER_BUSY", + 3: "KICK_OUT_ID_SERVER_CLOSE", + 4: "KICK_OUT_ID_QUEUE_UP_FULL", + 5: "KICK_OUT_ID_TOKEN_INVALID", + } + KickOutID_value = map[string]int32{ + "KICK_OUT_ID_INVALID": 0, + "KICK_OUT_ID_DUPLICATE_LOGIN": 1, + "KICK_OUT_ID_SERVER_BUSY": 2, + "KICK_OUT_ID_SERVER_CLOSE": 3, + "KICK_OUT_ID_QUEUE_UP_FULL": 4, + "KICK_OUT_ID_TOKEN_INVALID": 5, + } +) + +func (x KickOutID) Enum() *KickOutID { + p := new(KickOutID) + *p = x + return p +} + +func (x KickOutID) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (KickOutID) Descriptor() protoreflect.EnumDescriptor { + return file_service_proto_enumTypes[0].Descriptor() +} + +func (KickOutID) Type() protoreflect.EnumType { + return &file_service_proto_enumTypes[0] +} + +func (x KickOutID) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use KickOutID.Descriptor instead. +func (KickOutID) EnumDescriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{0} +} + +type S2C_KickOut struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID KickOutID `protobuf:"varint,1,opt,name=ID,proto3,enum=KickOutID" json:"ID,omitempty"` +} + +func (x *S2C_KickOut) Reset() { + *x = S2C_KickOut{} + if protoimpl.UnsafeEnabled { + mi := &file_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *S2C_KickOut) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*S2C_KickOut) ProtoMessage() {} + +func (x *S2C_KickOut) ProtoReflect() protoreflect.Message { + mi := &file_service_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 S2C_KickOut.ProtoReflect.Descriptor instead. +func (*S2C_KickOut) Descriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{0} +} + +func (x *S2C_KickOut) GetID() KickOutID { + if x != nil { + return x.ID + } + return KickOutID_KICK_OUT_ID_INVALID +} + +// MESSAGE_ID_QUEUE_UP +type S2C_QueueUp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + QueueUpCount int32 `protobuf:"varint,1,opt,name=QueueUpCount,proto3" json:"QueueUpCount,omitempty"` // 排队人数 +} + +func (x *S2C_QueueUp) Reset() { + *x = S2C_QueueUp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *S2C_QueueUp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*S2C_QueueUp) ProtoMessage() {} + +func (x *S2C_QueueUp) ProtoReflect() protoreflect.Message { + mi := &file_service_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_QueueUp.ProtoReflect.Descriptor instead. +func (*S2C_QueueUp) Descriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{1} +} + +func (x *S2C_QueueUp) GetQueueUpCount() int32 { + if x != nil { + return x.QueueUpCount + } + return 0 +} + +// MESSAGE_ID_LOGIN_SUCCESS +type S2C_LoginSuccess struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InstanceID int32 `protobuf:"varint,1,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // 副本ID +} + +func (x *S2C_LoginSuccess) Reset() { + *x = S2C_LoginSuccess{} + if protoimpl.UnsafeEnabled { + mi := &file_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *S2C_LoginSuccess) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*S2C_LoginSuccess) ProtoMessage() {} + +func (x *S2C_LoginSuccess) ProtoReflect() protoreflect.Message { + mi := &file_service_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 S2C_LoginSuccess.ProtoReflect.Descriptor instead. +func (*S2C_LoginSuccess) Descriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{2} +} + +func (x *S2C_LoginSuccess) GetInstanceID() int32 { + if x != nil { + return x.InstanceID + } + return 0 +} + +var File_service_proto protoreflect.FileDescriptor + +var file_service_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 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, 0x29, 0x0a, 0x0b, 0x53, 0x32, 0x43, 0x5f, 0x4b, 0x69, 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x12, + 0x1a, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x4b, 0x69, + 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x49, 0x44, 0x52, 0x02, 0x49, 0x44, 0x22, 0x31, 0x0a, 0x0b, 0x53, + 0x32, 0x43, 0x5f, 0x51, 0x75, 0x65, 0x75, 0x65, 0x55, 0x70, 0x12, 0x22, 0x0a, 0x0c, 0x51, 0x75, + 0x65, 0x75, 0x65, 0x55, 0x70, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0c, 0x51, 0x75, 0x65, 0x75, 0x65, 0x55, 0x70, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x32, + 0x0a, 0x10, 0x53, 0x32, 0x43, 0x5f, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x75, 0x63, 0x63, 0x65, + 0x73, 0x73, 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, 0x2a, 0xbe, 0x01, 0x0a, 0x09, 0x4b, 0x69, 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x49, 0x44, + 0x12, 0x17, 0x0a, 0x13, 0x4b, 0x49, 0x43, 0x4b, 0x5f, 0x4f, 0x55, 0x54, 0x5f, 0x49, 0x44, 0x5f, + 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x1f, 0x0a, 0x1b, 0x4b, 0x49, 0x43, + 0x4b, 0x5f, 0x4f, 0x55, 0x54, 0x5f, 0x49, 0x44, 0x5f, 0x44, 0x55, 0x50, 0x4c, 0x49, 0x43, 0x41, + 0x54, 0x45, 0x5f, 0x4c, 0x4f, 0x47, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x4b, 0x49, + 0x43, 0x4b, 0x5f, 0x4f, 0x55, 0x54, 0x5f, 0x49, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, + 0x5f, 0x42, 0x55, 0x53, 0x59, 0x10, 0x02, 0x12, 0x1c, 0x0a, 0x18, 0x4b, 0x49, 0x43, 0x4b, 0x5f, + 0x4f, 0x55, 0x54, 0x5f, 0x49, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x43, 0x4c, + 0x4f, 0x53, 0x45, 0x10, 0x03, 0x12, 0x1d, 0x0a, 0x19, 0x4b, 0x49, 0x43, 0x4b, 0x5f, 0x4f, 0x55, + 0x54, 0x5f, 0x49, 0x44, 0x5f, 0x51, 0x55, 0x45, 0x55, 0x45, 0x5f, 0x55, 0x50, 0x5f, 0x46, 0x55, + 0x4c, 0x4c, 0x10, 0x04, 0x12, 0x1d, 0x0a, 0x19, 0x4b, 0x49, 0x43, 0x4b, 0x5f, 0x4f, 0x55, 0x54, + 0x5f, 0x49, 0x44, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, + 0x44, 0x10, 0x05, 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_service_proto_rawDescOnce sync.Once + file_service_proto_rawDescData = file_service_proto_rawDesc +) + +func file_service_proto_rawDescGZIP() []byte { + file_service_proto_rawDescOnce.Do(func() { + file_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_proto_rawDescData) + }) + return file_service_proto_rawDescData +} + +var file_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_service_proto_goTypes = []interface{}{ + (KickOutID)(0), // 0: KickOutID + (*S2C_KickOut)(nil), // 1: S2C_KickOut + (*S2C_QueueUp)(nil), // 2: S2C_QueueUp + (*S2C_LoginSuccess)(nil), // 3: S2C_LoginSuccess +} +var file_service_proto_depIdxs = []int32{ + 0, // 0: S2C_KickOut.ID:type_name -> KickOutID + 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_service_proto_init() } +func file_service_proto_init() { + if File_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*S2C_KickOut); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*S2C_QueueUp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*S2C_LoginSuccess); 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_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_service_proto_goTypes, + DependencyIndexes: file_service_proto_depIdxs, + EnumInfos: file_service_proto_enumTypes, + MessageInfos: file_service_proto_msgTypes, + }.Build() + File_service_proto = out.File + file_service_proto_rawDesc = nil + file_service_proto_goTypes = nil + file_service_proto_depIdxs = nil +} diff --git a/Proto/ServerClient/gen_proto.bat b/Proto/ServerClient/gen_proto.bat new file mode 100644 index 0000000..d845d91 --- /dev/null +++ b/Proto/ServerClient/gen_proto.bat @@ -0,0 +1,14 @@ +@echo off + +if not exist "./gen" ( + mkdir "./gen" +) + +protoc --proto_path=./sources --go_out=./gen ./sources/*.proto +@REM xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q + +if not exist "./gen/client" ( + mkdir "./gen/client" +) +protoc --proto_path=./sources --csharp_out=./gen/client ./sources/*.proto +@REM xcopy "./gen/client" "../../../Client/Point/Assets/Scripts/Proto" /E /I /Y /Q \ No newline at end of file diff --git a/Proto/ServerClient/sources/action.proto b/Proto/ServerClient/sources/action.proto new file mode 100644 index 0000000..590ce24 --- /dev/null +++ b/Proto/ServerClient/sources/action.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; + +option go_package = "common/proto/sc/sc_pb"; +import "sc_common.proto"; + +// MESSAGE_ID_ENTER_INSTANCE +message C2S_EnterInstance { + int32 InstanceID = 1; +} +message S2C_EnterInstance { + PositionInfo Info = 1; +} + +// MESSAGE_ID_ACTION +enum ActionID { + ACTION_ID_INVALID = 0; + ACTION_ID_MOVE = 1; // 移动 + ACTION_ID_ATTACK = 2; // 攻击 +} +message C2S_Action { + uint32 Sequence = 1; // 指令序号 + int64 Timestamp = 2; // 时间戳(毫秒) + ActionID Action = 3; // 指令ID + sint32 DirX = 4; // 移动-X方向(×100 缩放) + sint32 DirY = 5; // 移动-Y方向(×100 缩放) + int32 SkillID = 6; // 攻击-技能ID +} + +// MESSAGE_ID_POSITION +message PositionInfo { + int64 USN = 1; + sint32 X = 2; + sint32 Y = 3; +} +message S2C_Position { + repeated PositionInfo Info = 1; +} \ No newline at end of file diff --git a/Proto/ServerClient/sources/define.proto b/Proto/ServerClient/sources/define.proto new file mode 100644 index 0000000..d0fbc95 --- /dev/null +++ b/Proto/ServerClient/sources/define.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +option go_package = "common/proto/sc/sc_pb"; +import "sc_common.proto"; + +enum MessageID { + MESSAGE_ID_INVALID = 0; + MESSAGE_ID_KICK_OUT = 1; // 服务器踢人 + MESSAGE_ID_QUEUE_UP = 2; // 排队中 + MESSAGE_ID_LOGIN_SUCCESS = 3; // 登录成功 + MESSAGE_ID_ENTER_INSTANCE = 101; // 进入副本 + MESSAGE_ID_ACTION = 102; // 指令 + MESSAGE_ID_POSITION = 103; // 位置更新 +} + +message Message { + MessageID ID = 1; + bytes Payload = 2; +} \ No newline at end of file diff --git a/Proto/ServerClient/sources/sc_common.proto b/Proto/ServerClient/sources/sc_common.proto new file mode 100644 index 0000000..e496d95 --- /dev/null +++ b/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/Proto/ServerClient/sources/service.proto b/Proto/ServerClient/sources/service.proto new file mode 100644 index 0000000..021b15d --- /dev/null +++ b/Proto/ServerClient/sources/service.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; + +option go_package = "common/proto/sc/sc_pb"; +import "sc_common.proto"; + +// MESSAGE_ID_KICK_OUT +enum KickOutID { + KICK_OUT_ID_INVALID = 0; + KICK_OUT_ID_DUPLICATE_LOGIN = 1; // 重复登录 + KICK_OUT_ID_SERVER_BUSY = 2; // 服务器繁忙 + KICK_OUT_ID_SERVER_CLOSE = 3; // 服务器关闭 + KICK_OUT_ID_QUEUE_UP_FULL = 4; // 排队上限 + KICK_OUT_ID_TOKEN_INVALID = 5; // Token无效 +} +message S2C_KickOut { + KickOutID ID = 1; +} + +// MESSAGE_ID_QUEUE_UP +message S2C_QueueUp { + int32 QueueUpCount = 1; // 排队人数 +} + +// MESSAGE_ID_LOGIN_SUCCESS +message S2C_LoginSuccess { + int32 InstanceID = 1; // 副本ID +} \ No newline at end of file diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway.pb.go b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway.pb.go new file mode 100644 index 0000000..6562b52 --- /dev/null +++ b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway.pb.go @@ -0,0 +1,340 @@ +// 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 + + USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,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) GetUSN() int64 { + if x != nil { + return x.USN + } + 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} +} + +type KickUserReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` +} + +func (x *KickUserReq) Reset() { + *x = KickUserReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_gateway_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KickUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KickUserReq) ProtoMessage() {} + +func (x *KickUserReq) ProtoReflect() protoreflect.Message { + mi := &file_service_gateway_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 KickUserReq.ProtoReflect.Descriptor instead. +func (*KickUserReq) Descriptor() ([]byte, []int) { + return file_service_gateway_proto_rawDescGZIP(), []int{2} +} + +func (x *KickUserReq) GetUSN() int64 { + if x != nil { + return x.USN + } + return 0 +} + +type KickUserResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *KickUserResp) Reset() { + *x = KickUserResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_gateway_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KickUserResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KickUserResp) ProtoMessage() {} + +func (x *KickUserResp) ProtoReflect() protoreflect.Message { + mi := &file_service_gateway_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 KickUserResp.ProtoReflect.Descriptor instead. +func (*KickUserResp) Descriptor() ([]byte, []int) { + return file_service_gateway_proto_rawDescGZIP(), []int{3} +} + +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, 0x53, 0x4e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 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, 0x22, 0x1f, 0x0a, 0x0b, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, + 0x53, 0x4e, 0x22, 0x0e, 0x0a, 0x0c, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x32, 0x61, 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, 0x12, 0x29, 0x0a, 0x08, 0x4b, 0x69, + 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0c, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x22, 0x00, 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, 4) +var file_service_gateway_proto_goTypes = []interface{}{ + (*ToClientReq)(nil), // 0: ToClientReq + (*ToClientResp)(nil), // 1: ToClientResp + (*KickUserReq)(nil), // 2: KickUserReq + (*KickUserResp)(nil), // 3: KickUserResp +} +var file_service_gateway_proto_depIdxs = []int32{ + 0, // 0: Gateway.ToClient:input_type -> ToClientReq + 2, // 1: Gateway.KickUser:input_type -> KickUserReq + 1, // 2: Gateway.ToClient:output_type -> ToClientResp + 3, // 3: Gateway.KickUser:output_type -> KickUserResp + 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_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 + } + } + file_service_gateway_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KickUserReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_gateway_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KickUserResp); 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: 4, + 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/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go new file mode 100644 index 0000000..1b82b52 --- /dev/null +++ b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_gateway_grpc.pb.go @@ -0,0 +1,178 @@ +// 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) + KickUser(ctx context.Context, in *KickUserReq, opts ...grpc.CallOption) (*KickUserResp, 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 +} + +func (c *gatewayClient) KickUser(ctx context.Context, in *KickUserReq, opts ...grpc.CallOption) (*KickUserResp, error) { + out := new(KickUserResp) + err := c.cc.Invoke(ctx, "/Gateway/KickUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// GatewayServer is the server API for Gateway service. +// All implementations must embed UnimplementedGatewayServer +// for forward compatibility +type GatewayServer interface { + // 发送消息到客户端 + ToClient(Gateway_ToClientServer) error + KickUser(context.Context, *KickUserReq) (*KickUserResp, 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) KickUser(context.Context, *KickUserReq) (*KickUserResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method KickUser 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 +} + +func _Gateway_KickUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KickUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GatewayServer).KickUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Gateway/KickUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GatewayServer).KickUser(ctx, req.(*KickUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +// 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{ + { + MethodName: "KickUser", + Handler: _Gateway_KickUser_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ToClient", + Handler: _Gateway_ToClient_Handler, + ClientStreams: true, + }, + }, + Metadata: "service_gateway.proto", +} diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene.pb.go b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene.pb.go new file mode 100644 index 0000000..52bb24e --- /dev/null +++ b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene.pb.go @@ -0,0 +1,554 @@ +// 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 + + USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,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) GetUSN() int64 { + if x != nil { + return x.USN + } + 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"` // 副本唯一编号 + MessageID int32 `protobuf:"varint,3,opt,name=MessageID,proto3" json:"MessageID,omitempty"` // 发送给客户端的消息ID + Payload []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,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 +} + +func (x *EnterResp) GetMessageID() int32 { + if x != nil { + return x.MessageID + } + return 0 +} + +func (x *EnterResp) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type LeaveReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID + UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 +} + +func (x *LeaveReq) Reset() { + *x = LeaveReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LeaveReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaveReq) ProtoMessage() {} + +func (x *LeaveReq) 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 LeaveReq.ProtoReflect.Descriptor instead. +func (*LeaveReq) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{2} +} + +func (x *LeaveReq) GetUSN() int64 { + if x != nil { + return x.USN + } + return 0 +} + +func (x *LeaveReq) GetUniqueNo() int64 { + if x != nil { + return x.UniqueNo + } + return 0 +} + +type LeaveResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *LeaveResp) Reset() { + *x = LeaveResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LeaveResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaveResp) ProtoMessage() {} + +func (x *LeaveResp) 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 LeaveResp.ProtoReflect.Descriptor instead. +func (*LeaveResp) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{3} +} + +type ActionReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UniqueNo int64 `protobuf:"varint,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号 + USN int64 `protobuf:"varint,2,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID + Action int32 `protobuf:"varint,3,opt,name=Action,proto3" json:"Action,omitempty"` // 指令ID + DirX int32 `protobuf:"zigzag32,4,opt,name=DirX,proto3" json:"DirX,omitempty"` // 移动-X方向(×1000 缩放) + DirY int32 `protobuf:"zigzag32,5,opt,name=DirY,proto3" json:"DirY,omitempty"` // 移动-Y方向(×1000 缩放) + SkillID int32 `protobuf:"varint,6,opt,name=SkillID,proto3" json:"SkillID,omitempty"` // 攻击-技能ID +} + +func (x *ActionReq) Reset() { + *x = ActionReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_scene_proto_msgTypes[4] + 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[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 ActionReq.ProtoReflect.Descriptor instead. +func (*ActionReq) Descriptor() ([]byte, []int) { + return file_service_scene_proto_rawDescGZIP(), []int{4} +} + +func (x *ActionReq) GetUniqueNo() int64 { + if x != nil { + return x.UniqueNo + } + return 0 +} + +func (x *ActionReq) GetUSN() int64 { + if x != nil { + return x.USN + } + return 0 +} + +func (x *ActionReq) GetAction() int32 { + if x != nil { + return x.Action + } + return 0 +} + +func (x *ActionReq) GetDirX() int32 { + if x != nil { + return x.DirX + } + return 0 +} + +func (x *ActionReq) GetDirY() int32 { + if x != nil { + return x.DirY + } + return 0 +} + +func (x *ActionReq) GetSkillID() int32 { + if x != nil { + return x.SkillID + } + return 0 +} + +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[5] + 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[5] + 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{5} +} + +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, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x03, 0x55, 0x53, 0x4e, 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, 0x7b, 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, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x03, 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, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x22, 0x38, 0x0a, 0x08, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, + 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 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, 0x0b, 0x0a, 0x09, 0x4c, + 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x93, 0x01, 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, 0x53, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x03, 0x55, 0x53, 0x4e, 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, 0x12, 0x0a, 0x04, + 0x44, 0x69, 0x72, 0x58, 0x18, 0x04, 0x20, 0x01, 0x28, 0x11, 0x52, 0x04, 0x44, 0x69, 0x72, 0x58, + 0x12, 0x12, 0x0a, 0x04, 0x44, 0x69, 0x72, 0x59, 0x18, 0x05, 0x20, 0x01, 0x28, 0x11, 0x52, 0x04, + 0x44, 0x69, 0x72, 0x59, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x0c, + 0x0a, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x32, 0x72, 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, 0x05, 0x4c, 0x65, 0x61, 0x76, 0x65, + 0x12, 0x09, 0x2e, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x4c, 0x65, + 0x61, 0x76, 0x65, 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, 6) +var file_service_scene_proto_goTypes = []interface{}{ + (*EnterReq)(nil), // 0: EnterReq + (*EnterResp)(nil), // 1: EnterResp + (*LeaveReq)(nil), // 2: LeaveReq + (*LeaveResp)(nil), // 3: LeaveResp + (*ActionReq)(nil), // 4: ActionReq + (*ActionResp)(nil), // 5: ActionResp +} +var file_service_scene_proto_depIdxs = []int32{ + 0, // 0: Scene.Enter:input_type -> EnterReq + 2, // 1: Scene.Leave:input_type -> LeaveReq + 4, // 2: Scene.Action:input_type -> ActionReq + 1, // 3: Scene.Enter:output_type -> EnterResp + 3, // 4: Scene.Leave:output_type -> LeaveResp + 5, // 5: Scene.Action:output_type -> ActionResp + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] 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.(*LeaveReq); 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.(*LeaveResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_scene_proto_msgTypes[4].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[5].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: 6, + 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/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene_grpc.pb.go b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene_grpc.pb.go new file mode 100644 index 0000000..b2063a3 --- /dev/null +++ b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_scene_grpc.pb.go @@ -0,0 +1,212 @@ +// 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) + Leave(ctx context.Context, in *LeaveReq, opts ...grpc.CallOption) (*LeaveResp, 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) Leave(ctx context.Context, in *LeaveReq, opts ...grpc.CallOption) (*LeaveResp, error) { + out := new(LeaveResp) + err := c.cc.Invoke(ctx, "/Scene/Leave", 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) + Leave(context.Context, *LeaveReq) (*LeaveResp, 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) Leave(context.Context, *LeaveReq) (*LeaveResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Leave 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_Leave_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaveReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SceneServer).Leave(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Scene/Leave", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SceneServer).Leave(ctx, req.(*LeaveReq)) + } + 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, + }, + { + MethodName: "Leave", + Handler: _Scene_Leave_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Action", + Handler: _Scene_Action_Handler, + ClientStreams: true, + }, + }, + Metadata: "service_scene.proto", +} diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.go b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.go new file mode 100644 index 0000000..adfb2c2 --- /dev/null +++ b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.go @@ -0,0 +1,372 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.1 +// source: service_user.proto + +package grpc_pb + +import ( + _ "common/proto/ss/ss_common" + _ "google.golang.org/genproto/googleapis/api/annotations" + 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 LoginReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Phone string `protobuf:"bytes,1,opt,name=Phone,json=phone,proto3" json:"Phone,omitempty"` // 手机号 + Code string `protobuf:"bytes,2,opt,name=Code,json=code,proto3" json:"Code,omitempty"` // 验证码 +} + +func (x *LoginReq) Reset() { + *x = LoginReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginReq) ProtoMessage() {} + +func (x *LoginReq) ProtoReflect() protoreflect.Message { + mi := &file_service_user_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 LoginReq.ProtoReflect.Descriptor instead. +func (*LoginReq) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{0} +} + +func (x *LoginReq) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *LoginReq) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type LoginResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID + Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名 +} + +func (x *LoginResp) Reset() { + *x = LoginResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginResp) ProtoMessage() {} + +func (x *LoginResp) ProtoReflect() protoreflect.Message { + mi := &file_service_user_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 LoginResp.ProtoReflect.Descriptor instead. +func (*LoginResp) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{1} +} + +func (x *LoginResp) GetUSN() int64 { + if x != nil { + return x.USN + } + return 0 +} + +func (x *LoginResp) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetUserInfoReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` +} + +func (x *GetUserInfoReq) Reset() { + *x = GetUserInfoReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserInfoReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserInfoReq) ProtoMessage() {} + +func (x *GetUserInfoReq) ProtoReflect() protoreflect.Message { + mi := &file_service_user_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 GetUserInfoReq.ProtoReflect.Descriptor instead. +func (*GetUserInfoReq) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{2} +} + +func (x *GetUserInfoReq) GetUSN() int64 { + if x != nil { + return x.USN + } + return 0 +} + +type GetUserInfoResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` + Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` +} + +func (x *GetUserInfoResp) Reset() { + *x = GetUserInfoResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserInfoResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserInfoResp) ProtoMessage() {} + +func (x *GetUserInfoResp) ProtoReflect() protoreflect.Message { + mi := &file_service_user_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 GetUserInfoResp.ProtoReflect.Descriptor instead. +func (*GetUserInfoResp) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{3} +} + +func (x *GetUserInfoResp) GetUSN() int64 { + if x != nil { + return x.USN + } + return 0 +} + +func (x *GetUserInfoResp) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_service_user_proto protoreflect.FileDescriptor + +var file_service_user_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, + 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x31, 0x0a, 0x09, 0x4c, 0x6f, 0x67, + 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10, + 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, + 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x71, 0x0a, 0x04, 0x55, 0x73, 0x65, + 0x72, 0x12, 0x20, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x09, 0x2e, 0x4c, 0x6f, 0x67, + 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a, + 0x22, 0x0a, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 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_user_proto_rawDescOnce sync.Once + file_service_user_proto_rawDescData = file_service_user_proto_rawDesc +) + +func file_service_user_proto_rawDescGZIP() []byte { + file_service_user_proto_rawDescOnce.Do(func() { + file_service_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_user_proto_rawDescData) + }) + return file_service_user_proto_rawDescData +} + +var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_service_user_proto_goTypes = []interface{}{ + (*LoginReq)(nil), // 0: LoginReq + (*LoginResp)(nil), // 1: LoginResp + (*GetUserInfoReq)(nil), // 2: GetUserInfoReq + (*GetUserInfoResp)(nil), // 3: GetUserInfoResp +} +var file_service_user_proto_depIdxs = []int32{ + 0, // 0: User.Login:input_type -> LoginReq + 2, // 1: User.GetUserInfo:input_type -> GetUserInfoReq + 1, // 2: User.Login:output_type -> LoginResp + 3, // 3: User.GetUserInfo:output_type -> GetUserInfoResp + 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_user_proto_init() } +func file_service_user_proto_init() { + if File_service_user_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_service_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserInfoReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserInfoResp); 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_user_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_user_proto_goTypes, + DependencyIndexes: file_service_user_proto_depIdxs, + MessageInfos: file_service_user_proto_msgTypes, + }.Build() + File_service_user_proto = out.File + file_service_user_proto_rawDesc = nil + file_service_user_proto_goTypes = nil + file_service_user_proto_depIdxs = nil +} diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.gw.go b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.gw.go new file mode 100644 index 0000000..367d62d --- /dev/null +++ b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user.pb.gw.go @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: service_user.proto + +/* +Package grpc_pb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package grpc_pb + +import ( + "context" + "errors" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = errors.New + _ = runtime.String + _ = utilities.NewDoubleArray + _ = metadata.Join +) + +func request_User_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, client UserClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetUserInfoReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.GetUserInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_User_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, server UserServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetUserInfoReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.GetUserInfo(ctx, &protoReq) + return msg, metadata, err +} + +// RegisterUserHandlerServer registers the http handlers for service User to "mux". +// UnaryRPC :call UserServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServer) error { + mux.Handle(http.MethodPost, pattern_User_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/GetUserInfo", runtime.WithHTTPPathPattern("/user/info")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_User_GetUserInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + + return nil +} + +// RegisterUserHandlerFromEndpoint is same as RegisterUserHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterUserHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + return RegisterUserHandler(ctx, mux, conn) +} + +// RegisterUserHandler registers the http handlers for service User to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterUserHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterUserHandlerClient(ctx, mux, NewUserClient(conn)) +} + +// RegisterUserHandlerClient registers the http handlers for service User +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "UserClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserClient) error { + mux.Handle(http.MethodPost, pattern_User_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/GetUserInfo", runtime.WithHTTPPathPattern("/user/info")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_User_GetUserInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + return nil +} + +var ( + pattern_User_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "info"}, "")) +) + +var ( + forward_User_GetUserInfo_0 = runtime.ForwardResponseMessage +) diff --git a/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user_grpc.pb.go b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user_grpc.pb.go new file mode 100644 index 0000000..a539483 --- /dev/null +++ b/Proto/ServerInternal/gen/common/proto/ss/grpc_pb/service_user_grpc.pb.go @@ -0,0 +1,141 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.25.1 +// source: service_user.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 + +// UserClient is the client API for User 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 UserClient interface { + Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) + GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) +} + +type userClient struct { + cc grpc.ClientConnInterface +} + +func NewUserClient(cc grpc.ClientConnInterface) UserClient { + return &userClient{cc} +} + +func (c *userClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) { + out := new(LoginResp) + err := c.cc.Invoke(ctx, "/User/Login", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userClient) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) { + out := new(GetUserInfoResp) + err := c.cc.Invoke(ctx, "/User/GetUserInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UserServer is the server API for User service. +// All implementations must embed UnimplementedUserServer +// for forward compatibility +type UserServer interface { + Login(context.Context, *LoginReq) (*LoginResp, error) + GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) + mustEmbedUnimplementedUserServer() +} + +// UnimplementedUserServer must be embedded to have forward compatible implementations. +type UnimplementedUserServer struct { +} + +func (UnimplementedUserServer) Login(context.Context, *LoginReq) (*LoginResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") +} +func (UnimplementedUserServer) GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented") +} +func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {} + +// UnsafeUserServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to UserServer will +// result in compilation errors. +type UnsafeUserServer interface { + mustEmbedUnimplementedUserServer() +} + +func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer) { + s.RegisterService(&User_ServiceDesc, srv) +} + +func _User_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoginReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServer).Login(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/User/Login", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServer).Login(ctx, req.(*LoginReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _User_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserInfoReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServer).GetUserInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/User/GetUserInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServer).GetUserInfo(ctx, req.(*GetUserInfoReq)) + } + return interceptor(ctx, in, info, handler) +} + +// User_ServiceDesc is the grpc.ServiceDesc for User service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var User_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "User", + HandlerType: (*UserServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Login", + Handler: _User_Login_Handler, + }, + { + MethodName: "GetUserInfo", + Handler: _User_GetUserInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_user.proto", +} diff --git a/Proto/ServerInternal/gen/common/proto/ss/ss_common/ss_common.pb.go b/Proto/ServerInternal/gen/common/proto/ss/ss_common/ss_common.pb.go new file mode 100644 index 0000000..5881aae --- /dev/null +++ b/Proto/ServerInternal/gen/common/proto/ss/ss_common/ss_common.pb.go @@ -0,0 +1,151 @@ +// 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" + 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 ErrorInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"` +} + +func (x *ErrorInfo) Reset() { + *x = ErrorInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_ss_common_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ErrorInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ErrorInfo) ProtoMessage() {} + +func (x *ErrorInfo) ProtoReflect() protoreflect.Message { + mi := &file_ss_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 ErrorInfo.ProtoReflect.Descriptor instead. +func (*ErrorInfo) Descriptor() ([]byte, []int) { + return file_ss_common_proto_rawDescGZIP(), []int{0} +} + +func (x *ErrorInfo) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *ErrorInfo) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +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, 0x22, 0x31, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, + 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, + 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x4d, 0x73, 0x67, 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_rawDescOnce sync.Once + file_ss_common_proto_rawDescData = file_ss_common_proto_rawDesc +) + +func file_ss_common_proto_rawDescGZIP() []byte { + file_ss_common_proto_rawDescOnce.Do(func() { + file_ss_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_ss_common_proto_rawDescData) + }) + return file_ss_common_proto_rawDescData +} + +var file_ss_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_ss_common_proto_goTypes = []interface{}{ + (*ErrorInfo)(nil), // 0: ErrorInfo +} +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 + } + if !protoimpl.UnsafeEnabled { + file_ss_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ErrorInfo); 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_ss_common_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ss_common_proto_goTypes, + DependencyIndexes: file_ss_common_proto_depIdxs, + MessageInfos: file_ss_common_proto_msgTypes, + }.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/Proto/ServerInternal/gen/service_gateway.swagger.json b/Proto/ServerInternal/gen/service_gateway.swagger.json new file mode 100644 index 0000000..9efed40 --- /dev/null +++ b/Proto/ServerInternal/gen/service_gateway.swagger.json @@ -0,0 +1,55 @@ +{ + "swagger": "2.0", + "info": { + "title": "service_gateway.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "Gateway" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": {}, + "definitions": { + "KickUserResp": { + "type": "object" + }, + "ToClientResp": { + "type": "object" + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/Proto/ServerInternal/gen/service_scene.swagger.json b/Proto/ServerInternal/gen/service_scene.swagger.json new file mode 100644 index 0000000..0728fe0 --- /dev/null +++ b/Proto/ServerInternal/gen/service_scene.swagger.json @@ -0,0 +1,80 @@ +{ + "swagger": "2.0", + "info": { + "title": "service_scene.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "Scene" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": {}, + "definitions": { + "ActionResp": { + "type": "object" + }, + "EnterResp": { + "type": "object", + "properties": { + "SceneSID": { + "type": "string", + "format": "int64", + "title": "场景服务ID" + }, + "UniqueNo": { + "type": "string", + "format": "int64", + "title": "副本唯一编号" + }, + "MessageID": { + "type": "integer", + "format": "int32", + "title": "发送给客户端的消息ID" + }, + "Payload": { + "type": "string", + "format": "byte", + "title": "消息负载" + } + } + }, + "LeaveResp": { + "type": "object" + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/Proto/ServerInternal/gen/service_user.swagger.json b/Proto/ServerInternal/gen/service_user.swagger.json new file mode 100644 index 0000000..3e69baf --- /dev/null +++ b/Proto/ServerInternal/gen/service_user.swagger.json @@ -0,0 +1,117 @@ +{ + "swagger": "2.0", + "info": { + "title": "service_user.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "User" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/user/info": { + "post": { + "operationId": "User_GetUserInfo", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/GetUserInfoResp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/GetUserInfoReq" + } + } + ], + "tags": [ + "User" + ] + } + } + }, + "definitions": { + "GetUserInfoReq": { + "type": "object", + "properties": { + "usn": { + "type": "string", + "format": "int64" + } + } + }, + "GetUserInfoResp": { + "type": "object", + "properties": { + "usn": { + "type": "string", + "format": "int64" + }, + "name": { + "type": "string" + } + } + }, + "LoginResp": { + "type": "object", + "properties": { + "usn": { + "type": "string", + "format": "int64", + "title": "用户ID" + }, + "name": { + "type": "string", + "title": "用户名" + } + } + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/Proto/ServerInternal/gen/ss_common.swagger.json b/Proto/ServerInternal/gen/ss_common.swagger.json new file mode 100644 index 0000000..dfc1a16 --- /dev/null +++ b/Proto/ServerInternal/gen/ss_common.swagger.json @@ -0,0 +1,44 @@ +{ + "swagger": "2.0", + "info": { + "title": "ss_common.proto", + "version": "version not set" + }, + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": {}, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/Proto/ServerInternal/gen_proto.bat b/Proto/ServerInternal/gen_proto.bat new file mode 100644 index 0000000..9d38dfc --- /dev/null +++ b/Proto/ServerInternal/gen_proto.bat @@ -0,0 +1,14 @@ +@echo off + +if not exist "./gen" ( + mkdir "./gen" +) + +protoc ^ +--proto_path=./sources ^ +--go_out=./gen ^ +--go-grpc_out=./gen ^ +--grpc-gateway_out=./gen ^ +--openapiv2_out=./gen ^ +./sources/*.proto +@REM xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q \ No newline at end of file diff --git a/Proto/ServerInternal/sources/google/api/annotations.proto b/Proto/ServerInternal/sources/google/api/annotations.proto new file mode 100644 index 0000000..417edd8 --- /dev/null +++ b/Proto/ServerInternal/sources/google/api/annotations.proto @@ -0,0 +1,31 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +import "google/api/http.proto"; +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.MethodOptions { + // See `HttpRule`. + HttpRule http = 72295728; +} diff --git a/Proto/ServerInternal/sources/google/api/http.proto b/Proto/ServerInternal/sources/google/api/http.proto new file mode 100644 index 0000000..57621b5 --- /dev/null +++ b/Proto/ServerInternal/sources/google/api/http.proto @@ -0,0 +1,370 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "HttpProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Defines the HTTP configuration for an API service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +message Http { + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated HttpRule rules = 1; + + // When set to true, URL path parameters will be fully URI-decoded except in + // cases of single segment matches in reserved expansion, where "%2F" will be + // left encoded. + // + // The default behavior is to not decode RFC 6570 reserved characters in multi + // segment matches. + bool fully_decode_reserved_expansion = 2; +} + +// gRPC Transcoding +// +// gRPC Transcoding is a feature for mapping between a gRPC method and one or +// more HTTP REST endpoints. It allows developers to build a single API service +// that supports both gRPC APIs and REST APIs. Many systems, including [Google +// APIs](https://github.com/googleapis/googleapis), +// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC +// Gateway](https://github.com/grpc-ecosystem/grpc-gateway), +// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature +// and use it for large scale production services. +// +// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies +// how different portions of the gRPC request message are mapped to the URL +// path, URL query parameters, and HTTP request body. It also controls how the +// gRPC response message is mapped to the HTTP response body. `HttpRule` is +// typically specified as an `google.api.http` annotation on the gRPC method. +// +// Each mapping specifies a URL path template and an HTTP method. The path +// template may refer to one or more fields in the gRPC request message, as long +// as each field is a non-repeated field with a primitive (non-message) type. +// The path template controls how fields of the request message are mapped to +// the URL path. +// +// Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/{name=messages/*}" +// }; +// } +// } +// message GetMessageRequest { +// string name = 1; // Mapped to URL path. +// } +// message Message { +// string text = 1; // The resource content. +// } +// +// This enables an HTTP REST to gRPC mapping as below: +// +// - HTTP: `GET /v1/messages/123456` +// - gRPC: `GetMessage(name: "messages/123456")` +// +// Any fields in the request message which are not bound by the path template +// automatically become HTTP query parameters if there is no HTTP request body. +// For example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get:"/v1/messages/{message_id}" +// }; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // Mapped to URL path. +// int64 revision = 2; // Mapped to URL query parameter `revision`. +// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. +// } +// +// This enables a HTTP JSON to RPC mapping as below: +// +// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` +// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: +// SubMessage(subfield: "foo"))` +// +// Note that fields which are mapped to URL query parameters must have a +// primitive type or a repeated primitive type or a non-repeated message type. +// In the case of a repeated type, the parameter can be repeated in the URL +// as `...?param=A¶m=B`. In the case of a message type, each field of the +// message is mapped to a separate parameter, such as +// `...?foo.a=A&foo.b=B&foo.c=C`. +// +// For HTTP methods that allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: +// +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// patch: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } +// +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` +// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// patch: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// +// The following HTTP JSON to RPC mapping is enabled: +// +// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` +// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice when +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// This enables the following two alternative HTTP JSON to RPC mappings: +// +// - HTTP: `GET /v1/messages/123456` +// - gRPC: `GetMessage(message_id: "123456")` +// +// - HTTP: `GET /v1/users/me/messages/123456` +// - gRPC: `GetMessage(user_id: "me" message_id: "123456")` +// +// Rules for HTTP mapping +// +// 1. Leaf request fields (recursive expansion nested messages in the request +// message) are classified into three categories: +// - Fields referred by the path template. They are passed via the URL path. +// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They +// are passed via the HTTP +// request body. +// - All other fields are passed via the URL query parameters, and the +// parameter name is the field path in the request message. A repeated +// field can be represented as multiple query parameters under the same +// name. +// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL +// query parameter, all fields +// are passed via URL path and HTTP request body. +// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP +// request body, all +// fields are passed via URL path and URL query parameters. +// +// Path template syntax +// +// Template = "/" Segments [ Verb ] ; +// Segments = Segment { "/" Segment } ; +// Segment = "*" | "**" | LITERAL | Variable ; +// Variable = "{" FieldPath [ "=" Segments ] "}" ; +// FieldPath = IDENT { "." IDENT } ; +// Verb = ":" LITERAL ; +// +// The syntax `*` matches a single URL path segment. The syntax `**` matches +// zero or more URL path segments, which must be the last part of the URL path +// except the `Verb`. +// +// The syntax `Variable` matches part of the URL path as specified by its +// template. A variable template must not contain other variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` +// contains any reserved character, such characters should be percent-encoded +// before the matching. +// +// If a variable contains exactly one path segment, such as `"{var}"` or +// `"{var=*}"`, when such a variable is expanded into a URL path on the client +// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The +// server side does the reverse decoding. Such variables show up in the +// [Discovery +// Document](https://developers.google.com/discovery/v1/reference/apis) as +// `{var}`. +// +// If a variable contains multiple path segments, such as `"{var=foo/*}"` +// or `"{var=**}"`, when such a variable is expanded into a URL path on the +// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. +// The server side does the reverse decoding, except "%2F" and "%2f" are left +// unchanged. Such variables show up in the +// [Discovery +// Document](https://developers.google.com/discovery/v1/reference/apis) as +// `{+var}`. +// +// Using gRPC API Service Configuration +// +// gRPC API Service Configuration (service config) is a configuration language +// for configuring a gRPC service to become a user-facing product. The +// service config is simply the YAML representation of the `google.api.Service` +// proto message. +// +// As an alternative to annotating your proto file, you can configure gRPC +// transcoding in your service config YAML files. You do this by specifying a +// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same +// effect as the proto annotation. This can be particularly useful if you +// have a proto that is reused in multiple services. Note that any transcoding +// specified in the service config will override any matching transcoding +// configuration in the proto. +// +// The following example selects a gRPC method and applies an `HttpRule` to it: +// +// http: +// rules: +// - selector: example.v1.Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// Special notes +// +// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the +// proto to JSON conversion must follow the [proto3 +// specification](https://developers.google.com/protocol-buffers/docs/proto3#json). +// +// While the single segment variable follows the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String +// Expansion, the multi segment variable **does not** follow RFC 6570 Section +// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion +// does not expand special characters like `?` and `#`, which would lead +// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding +// for multi segment variables. +// +// The path variables **must not** refer to any repeated or mapped field, +// because client libraries are not capable of handling such variable expansion. +// +// The path variables **must not** capture the leading "/" character. The reason +// is that the most common use case "{var}" does not capture the leading "/" +// character. For consistency, all path variables must share the same behavior. +// +// Repeated message fields must not be mapped to URL query parameters, because +// no client library can support such complicated mapping. +// +// If an API needs to use a JSON array for request or response body, it can map +// the request or response body to a repeated field. However, some gRPC +// Transcoding implementations may not support this feature. +message HttpRule { + // Selects a method to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax + // details. + string selector = 1; + + // Determines the URL pattern is matched by this rules. This pattern can be + // used with any of the {get|put|post|delete|patch} methods. A custom method + // can be defined using the 'custom' field. + oneof pattern { + // Maps to HTTP GET. Used for listing and getting information about + // resources. + string get = 2; + + // Maps to HTTP PUT. Used for replacing a resource. + string put = 3; + + // Maps to HTTP POST. Used for creating a resource or performing an action. + string post = 4; + + // Maps to HTTP DELETE. Used for deleting a resource. + string delete = 5; + + // Maps to HTTP PATCH. Used for updating a resource. + string patch = 6; + + // The custom pattern is used for specifying an HTTP method that is not + // included in the `pattern` field, such as HEAD, or "*" to leave the + // HTTP method unspecified for this rule. The wild-card rule is useful + // for services that provide content to Web (HTML) clients. + CustomHttpPattern custom = 8; + } + + // The name of the request field whose value is mapped to the HTTP request + // body, or `*` for mapping all request fields not captured by the path + // pattern to the HTTP body, or omitted for not having any HTTP request body. + // + // NOTE: the referred field must be present at the top-level of the request + // message type. + string body = 7; + + // Optional. The name of the response field whose value is mapped to the HTTP + // response body. When omitted, the entire response message will be used + // as the HTTP response body. + // + // NOTE: The referred field must be present at the top-level of the response + // message type. + string response_body = 12; + + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + repeated HttpRule additional_bindings = 11; +} + +// A custom pattern is used for defining custom HTTP verb. +message CustomHttpPattern { + // The name of this custom HTTP verb. + string kind = 1; + + // The path matched by this custom verb. + string path = 2; +} diff --git a/Proto/ServerInternal/sources/google/protobuf/any.proto b/Proto/ServerInternal/sources/google/protobuf/any.proto new file mode 100644 index 0000000..eff44e5 --- /dev/null +++ b/Proto/ServerInternal/sources/google/protobuf/any.proto @@ -0,0 +1,162 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package google.protobuf; + +option go_package = "google.golang.org/protobuf/types/known/anypb"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "AnyProto"; +option java_multiple_files = true; +option objc_class_prefix = "GPB"; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; + +// `Any` contains an arbitrary serialized protocol buffer message along with a +// URL that describes the type of the serialized message. +// +// Protobuf library provides support to pack/unpack Any values in the form +// of utility functions or additional generated methods of the Any type. +// +// Example 1: Pack and unpack a message in C++. +// +// Foo foo = ...; +// Any any; +// any.PackFrom(foo); +// ... +// if (any.UnpackTo(&foo)) { +// ... +// } +// +// Example 2: Pack and unpack a message in Java. +// +// Foo foo = ...; +// Any any = Any.pack(foo); +// ... +// if (any.is(Foo.class)) { +// foo = any.unpack(Foo.class); +// } +// // or ... +// if (any.isSameTypeAs(Foo.getDefaultInstance())) { +// foo = any.unpack(Foo.getDefaultInstance()); +// } +// +// Example 3: Pack and unpack a message in Python. +// +// foo = Foo(...) +// any = Any() +// any.Pack(foo) +// ... +// if any.Is(Foo.DESCRIPTOR): +// any.Unpack(foo) +// ... +// +// Example 4: Pack and unpack a message in Go +// +// foo := &pb.Foo{...} +// any, err := anypb.New(foo) +// if err != nil { +// ... +// } +// ... +// foo := &pb.Foo{} +// if err := any.UnmarshalTo(foo); err != nil { +// ... +// } +// +// The pack methods provided by protobuf library will by default use +// 'type.googleapis.com/full.type.name' as the type URL and the unpack +// methods only use the fully qualified type name after the last '/' +// in the type URL, for example "foo.bar.com/x/y.z" will yield type +// name "y.z". +// +// JSON +// ==== +// The JSON representation of an `Any` value uses the regular +// representation of the deserialized, embedded message, with an +// additional field `@type` which contains the type URL. Example: +// +// package google.profile; +// message Person { +// string first_name = 1; +// string last_name = 2; +// } +// +// { +// "@type": "type.googleapis.com/google.profile.Person", +// "firstName": , +// "lastName": +// } +// +// If the embedded message type is well-known and has a custom JSON +// representation, that representation will be embedded adding a field +// `value` which holds the custom JSON in addition to the `@type` +// field. Example (for message [google.protobuf.Duration][]): +// +// { +// "@type": "type.googleapis.com/google.protobuf.Duration", +// "value": "1.212s" +// } +// +message Any { + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. This string must contain at least + // one "/" character. The last segment of the URL's path must represent + // the fully qualified name of the type (as in + // `path/google.protobuf.Duration`). The name should be in a canonical form + // (e.g., leading "." is not accepted). + // + // In practice, teams usually precompile into the binary all types that they + // expect it to use in the context of Any. However, for URLs which use the + // scheme `http`, `https`, or no scheme, one can optionally set up a type + // server that maps type URLs to message definitions as follows: + // + // * If no scheme is provided, `https` is assumed. + // * An HTTP GET on the URL must yield a [google.protobuf.Type][] + // value in binary format, or produce an error. + // * Applications are allowed to cache lookup results based on the + // URL, or have them precompiled into a binary to avoid any + // lookup. Therefore, binary compatibility needs to be preserved + // on changes to types. (Use versioned type names to manage + // breaking changes.) + // + // Note: this functionality is not currently available in the official + // protobuf release, and it is not used for type URLs beginning with + // type.googleapis.com. As of May 2023, there are no widely used type server + // implementations and no plans to implement one. + // + // Schemes other than `http`, `https` (or the empty scheme) might be + // used with implementation specific semantics. + // + string type_url = 1; + + // Must be a valid serialized protocol buffer of the above specified type. + bytes value = 2; +} diff --git a/Proto/ServerInternal/sources/google/protobuf/descriptor.proto b/Proto/ServerInternal/sources/google/protobuf/descriptor.proto new file mode 100644 index 0000000..e5683a2 --- /dev/null +++ b/Proto/ServerInternal/sources/google/protobuf/descriptor.proto @@ -0,0 +1,1448 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + +syntax = "proto2"; + +package google.protobuf; + +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; +option csharp_namespace = "Google.Protobuf.Reflection"; +option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; + + // Extensions for tooling. + extensions 536000000 [declaration = { + number: 536000000 + type: ".buf.descriptor.v1.FileDescriptorSetExtension" + full_name: ".buf.descriptor.v1.buf_file_descriptor_set_extension" + }]; +} + +// The full set of known editions. +enum Edition { + // A placeholder for an unknown edition value. + EDITION_UNKNOWN = 0; + + // A placeholder edition for specifying default behaviors *before* a feature + // was first introduced. This is effectively an "infinite past". + EDITION_LEGACY = 900; + + // Legacy syntax "editions". These pre-date editions, but behave much like + // distinct editions. These can't be used to specify the edition of proto + // files, but feature definitions must supply proto2/proto3 defaults for + // backwards compatibility. + EDITION_PROTO2 = 998; + EDITION_PROTO3 = 999; + + // Editions that have been released. The specific values are arbitrary and + // should not be depended on, but they will always be time-ordered for easy + // comparison. + EDITION_2023 = 1000; + EDITION_2024 = 1001; + + // A placeholder edition for developing and testing unscheduled features. + EDITION_UNSTABLE = 9999; + + // Placeholder editions for testing feature resolution. These should not be + // used or relied on outside of tests. + EDITION_1_TEST_ONLY = 1; + EDITION_2_TEST_ONLY = 2; + EDITION_99997_TEST_ONLY = 99997; + EDITION_99998_TEST_ONLY = 99998; + EDITION_99999_TEST_ONLY = 99999; + + // Placeholder for specifying unbounded edition support. This should only + // ever be used by plugins that can expect to never require any changes to + // support a new edition. + EDITION_MAX = 0x7FFFFFFF; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // Names of files imported by this file purely for the purpose of providing + // option extensions. These are excluded from the dependency list above. + repeated string option_dependency = 15; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; + + // The syntax of the proto file. + // The supported values are "proto2", "proto3", and "editions". + // + // If `edition` is present, this value must be "editions". + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + optional string syntax = 12; + + // The edition of the proto file. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + optional Edition edition = 14; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + + optional ExtensionRangeOptions options = 3; + } + repeated ExtensionRange extension_range = 5; + + repeated OneofDescriptorProto oneof_decl = 8; + + optional MessageOptions options = 7; + + // Range of reserved tag numbers. Reserved tag numbers may not be used by + // fields or extension ranges in the same message. Reserved ranges may + // not overlap. + message ReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + } + repeated ReservedRange reserved_range = 9; + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + repeated string reserved_name = 10; + + // Support for `export` and `local` keywords on enums. + optional SymbolVisibility visibility = 11; +} + +message ExtensionRangeOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + message Declaration { + // The extension number declared within the extension range. + optional int32 number = 1; + + // The fully-qualified name of the extension field. There must be a leading + // dot in front of the full name. + optional string full_name = 2; + + // The fully-qualified type name of the extension field. Unlike + // Metadata.type, Declaration.type must have a leading dot for messages + // and enums. + optional string type = 3; + + // If true, indicates that the number is reserved in the extension range, + // and any extension field with the number will fail to compile. Set this + // when a declared extension field is deleted. + optional bool reserved = 5; + + // If true, indicates that the extension must be defined as repeated. + // Otherwise the extension must be defined as optional. + optional bool repeated = 6; + + reserved 4; // removed is_repeated + } + + // For external users: DO NOT USE. We are in the process of open sourcing + // extension declaration and executing internal cleanups before it can be + // used externally. + repeated Declaration declaration = 2 [retention = RETENTION_SOURCE]; + + // Any features defined in the specific edition. + optional FeatureSet features = 50; + + // The verification state of the extension range. + enum VerificationState { + // All the extensions of the range must be declared. + DECLARATION = 0; + UNVERIFIED = 1; + } + + // The verification state of the range. + // TODO: flip the default to DECLARATION once all empty ranges + // are marked as UNVERIFIED. + optional VerificationState verification = 3 + [default = UNVERIFIED, retention = RETENTION_SOURCE]; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + // Tag-delimited aggregate. + // Group type is deprecated and not supported after google.protobuf. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. In Editions, the group wire format + // can be enabled via the `message_encoding` feature. + TYPE_GROUP = 10; + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + } + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REPEATED = 3; + // The required label is only allowed in google.protobuf. In proto3 and Editions + // it's explicitly prohibited. In Editions, the `field_presence` feature + // can be used to get this behavior. + LABEL_REQUIRED = 2; + } + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + optional string default_value = 7; + + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + optional int32 oneof_index = 9; + + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + optional string json_name = 10; + + optional FieldOptions options = 8; + + // If true, this is a proto3 "optional". When a proto3 field is optional, it + // tracks presence regardless of field type. + // + // When proto3_optional is true, this field must belong to a oneof to signal + // to old proto3 clients that presence is tracked for this field. This oneof + // is known as a "synthetic" oneof, and this field must be its sole member + // (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + // exist in the descriptor only, and do not generate any API. Synthetic oneofs + // must be ordered after all "real" oneofs. + // + // For message fields, proto3_optional doesn't create any semantic change, + // since non-repeated message fields always track presence. However it still + // indicates the semantic detail of whether the user wrote "optional" or not. + // This can be useful for round-tripping the .proto file. For consistency we + // give message fields a synthetic oneof also, even though it is not required + // to track presence. This is especially important because the parser can't + // tell if a field is a message or an enum, so it must always create a + // synthetic oneof. + // + // Proto2 optional fields do not set this flag, because they already indicate + // optional with `LABEL_OPTIONAL`. + optional bool proto3_optional = 17; +} + +// Describes a oneof. +message OneofDescriptorProto { + optional string name = 1; + optional OneofOptions options = 2; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; + + // Range of reserved numeric values. Reserved values may not be used by + // entries in the same enum. Reserved ranges may not overlap. + // + // Note that this is distinct from DescriptorProto.ReservedRange in that it + // is inclusive such that it can appropriately represent the entire int32 + // domain. + message EnumReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. + } + + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + repeated EnumReservedRange reserved_range = 4; + + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + repeated string reserved_name = 5; + + // Support for `export` and `local` keywords on enums. + optional SymbolVisibility visibility = 6; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; + + reserved 4; + reserved "stream"; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; + + // Identifies if client streams multiple client messages + optional bool client_streaming = 5 [default = false]; + // Identifies if server streams multiple server messages + optional bool server_streaming = 6 [default = false]; +} + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Objective-C plugin) and your project website (if available) -- there's no +// need to explain how you intend to use them. Usually you only need one +// extension number. You can declare multiple options with only one extension +// number by putting them in a sub-message. See the Custom Options section of +// the docs for examples: +// https://developers.google.com/protocol-buffers/docs/proto#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + // Controls the name of the wrapper Java class generated for the .proto file. + // That class will always contain the .proto file's getDescriptor() method as + // well as any top-level extensions defined in the .proto file. + // If java_multiple_files is disabled, then all the other classes from the + // .proto file will be nested inside the single wrapper outer class. + optional string java_outer_classname = 8; + + // If enabled, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the wrapper class + // named by java_outer_classname. However, the wrapper class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [ + default = false, + feature_support = { + edition_introduced: EDITION_PROTO2 + edition_removed: EDITION_2024 + removal_error: "This behavior is enabled by default in editions 2024 and above. " + "To disable it, you can set `features.(pb.java).nest_in_file_class = YES` " + "on individual messages, enums, or services." + + } + ]; + + // This option does nothing. + optional bool java_generate_equals_and_hash = 20 [deprecated=true]; + + // A proto2 file can set this to true to opt in to UTF-8 checking for Java, + // which will throw an exception if invalid UTF-8 is parsed from the wire or + // assigned to a string field. + // + // TODO: clarify exactly what kinds of field types this option + // applies to, and update these docs accordingly. + // + // Proto3 files already perform these checks. Setting the option explicitly to + // false has no effect: it cannot be used to opt proto3 files out of UTF-8 + // checks. + optional bool java_string_check_utf8 = 27 [default = false]; + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default = SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + optional string go_package = 11; + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + reserved 42; // removed php_generic_services + reserved "php_generic_services"; + + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + optional bool deprecated = 23 [default = false]; + + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + optional bool cc_enable_arenas = 31 [default = true]; + + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + optional string objc_class_prefix = 36; + + // Namespace for generated classes; defaults to the package. + optional string csharp_namespace = 37; + + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + optional string swift_prefix = 39; + + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + optional string php_class_prefix = 40; + + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + optional string php_namespace = 41; + + // Use this option to change the namespace of php generated metadata classes. + // Default is empty. When this option is empty, the proto file name will be + // used for determining the namespace. + optional string php_metadata_namespace = 44; + + // Use this option to change the package of ruby generated classes. Default + // is empty. When this option is not set, the package name will be used for + // determining the ruby package. + optional string ruby_package = 45; + + // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + optional FeatureSet features = 50; + + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. + // See the documentation for the "Options" section above. + extensions 1000 to max; + + reserved 38; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default = false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default = false]; + + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + optional bool deprecated = 3 [default = false]; + + reserved 4, 5, 6; + + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementations still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + optional bool map_entry = 7; + + reserved 8; // javalite_serializable + reserved 9; // javanano_as_lite + + // Enable the legacy handling of JSON field name conflicts. This lowercases + // and strips underscored from the fields before comparison in proto3 only. + // The new behavior takes `json_name` into account and applies to proto2 as + // well. + // + // This should only be used as a temporary measure against broken builds due + // to the change in behavior for JSON field name conflicts. + // + // TODO This is legacy behavior we plan to remove once downstream + // teams have had time to migrate. + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + + // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + optional FeatureSet features = 12; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is only implemented to support use of + // [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + // type "bytes" in the open source release. + // TODO: make ctype actually deprecated. + optional CType ctype = 1 [/*deprecated = true,*/ default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + // The option [ctype=CORD] may be applied to a non-repeated field of type + // "bytes". It indicates that in C++, the data should be stored in a Cord + // instead of a string. For very large strings, this may reduce memory + // fragmentation. It may also allow better performance when parsing from a + // Cord, or when parsing with aliasing enabled, as the parsed Cord may then + // alias the original buffer. + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. This option is prohibited in + // Editions, but the `repeated_field_encoding` feature can be used to control + // the behavior. + optional bool packed = 2; + + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + optional JSType jstype = 6 [default = JS_NORMAL]; + enum JSType { + // Use the default type. + JS_NORMAL = 0; + + // Use JavaScript strings. + JS_STRING = 1; + + // Use JavaScript numbers. + JS_NUMBER = 2; + } + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // Note that lazy message fields are still eagerly verified to check + // ill-formed wireformat or missing required fields. Calling IsInitialized() + // on the outer message would fail if the inner message has missing required + // fields. Failed verification would result in parsing failure (except when + // uninitialized messages are acceptable). + optional bool lazy = 5 [default = false]; + + // unverified_lazy does no correctness checks on the byte stream. This should + // only be used where lazy with verification is prohibitive for performance + // reasons. + optional bool unverified_lazy = 15 [default = false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default = false]; + + // DEPRECATED. DO NOT USE! + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default = false, deprecated = true]; + + // Indicate that the field value should not be printed out when using debug + // formats, e.g. when the field contains sensitive credentials. + optional bool debug_redact = 16 [default = false]; + + // If set to RETENTION_SOURCE, the option will be omitted from the binary. + enum OptionRetention { + RETENTION_UNKNOWN = 0; + RETENTION_RUNTIME = 1; + RETENTION_SOURCE = 2; + } + + optional OptionRetention retention = 17; + + // This indicates the types of entities that the field may apply to when used + // as an option. If it is unset, then the field may be freely used as an + // option on any kind of entity. + enum OptionTargetType { + TARGET_TYPE_UNKNOWN = 0; + TARGET_TYPE_FILE = 1; + TARGET_TYPE_EXTENSION_RANGE = 2; + TARGET_TYPE_MESSAGE = 3; + TARGET_TYPE_FIELD = 4; + TARGET_TYPE_ONEOF = 5; + TARGET_TYPE_ENUM = 6; + TARGET_TYPE_ENUM_ENTRY = 7; + TARGET_TYPE_SERVICE = 8; + TARGET_TYPE_METHOD = 9; + } + + repeated OptionTargetType targets = 19; + + message EditionDefault { + optional Edition edition = 3; + optional string value = 2; // Textproto value. + } + repeated EditionDefault edition_defaults = 20; + + // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + optional FeatureSet features = 21; + + // Information about the support window of a feature. + message FeatureSupport { + // The edition that this feature was first available in. In editions + // earlier than this one, the default assigned to EDITION_LEGACY will be + // used, and proto files will not be able to override it. + optional Edition edition_introduced = 1; + + // The edition this feature becomes deprecated in. Using this after this + // edition may trigger warnings. + optional Edition edition_deprecated = 2; + + // The deprecation warning text if this feature is used after the edition it + // was marked deprecated in. + optional string deprecation_warning = 3; + + // The edition this feature is no longer available in. In editions after + // this one, the last default assigned will be used, and proto files will + // not be able to override it. + optional Edition edition_removed = 4; + + // The removal error text if this feature is used after the edition it was + // removed in. + optional string removal_error = 5; + } + optional FeatureSupport feature_support = 22; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; + + reserved 4; // removed jtype + reserved 18; // reserve target, target_obsolete_do_not_use +} + +message OneofOptions { + // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + optional FeatureSet features = 1; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // Set this option to true to allow mapping different tag names to the same + // value. + optional bool allow_alias = 2; + + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + optional bool deprecated = 3 [default = false]; + + reserved 5; // javanano_as_lite + + // Enable the legacy handling of JSON field name conflicts. This lowercases + // and strips underscored from the fields before comparison in proto3 only. + // The new behavior takes `json_name` into account and applies to proto2 as + // well. + // TODO Remove this legacy behavior once downstream teams have + // had time to migrate. + optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + + // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + optional FeatureSet features = 7; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + optional bool deprecated = 1 [default = false]; + + // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + optional FeatureSet features = 2; + + // Indicate that fields annotated with this enum value should not be printed + // out when using debug formats, e.g. when the field contains sensitive + // credentials. + optional bool debug_redact = 3 [default = false]; + + // Information about the support window of a feature value. + optional FieldOptions.FeatureSupport feature_support = 4; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + optional FeatureSet features = 34; + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + optional bool deprecated = 33 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + optional bool deprecated = 33 [default = false]; + + // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + // or neither? HTTP based RPC implementation may choose GET verb for safe + // methods, and PUT verb for idempotent methods instead of the default POST. + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects + } + optional IdempotencyLevel idempotency_level = 34 + [default = IDEMPOTENCY_UNKNOWN]; + + // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. + optional FeatureSet features = 35; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + // "foo.(bar.baz).moo". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; +} + +// =================================================================== +// Features + +// TODO Enums in C++ gencode (and potentially other languages) are +// not well scoped. This means that each of the feature enums below can clash +// with each other. The short names we've chosen maximize call-site +// readability, but leave us very open to this scenario. A future feature will +// be designed and implemented to handle this, hopefully before we ever hit a +// conflict here. +message FeatureSet { + enum FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0; + EXPLICIT = 1; + IMPLICIT = 2; + LEGACY_REQUIRED = 3; + } + optional FieldPresence field_presence = 1 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_FILE, + feature_support = { + edition_introduced: EDITION_2023, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "EXPLICIT" }, + edition_defaults = { edition: EDITION_PROTO3, value: "IMPLICIT" }, + edition_defaults = { edition: EDITION_2023, value: "EXPLICIT" } + ]; + + enum EnumType { + ENUM_TYPE_UNKNOWN = 0; + OPEN = 1; + CLOSED = 2; + } + optional EnumType enum_type = 2 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_FILE, + feature_support = { + edition_introduced: EDITION_2023, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "CLOSED" }, + edition_defaults = { edition: EDITION_PROTO3, value: "OPEN" } + ]; + + enum RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0; + PACKED = 1; + EXPANDED = 2; + } + optional RepeatedFieldEncoding repeated_field_encoding = 3 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_FILE, + feature_support = { + edition_introduced: EDITION_2023, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "EXPANDED" }, + edition_defaults = { edition: EDITION_PROTO3, value: "PACKED" } + ]; + + enum Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0; + VERIFY = 2; + NONE = 3; + reserved 1; + } + optional Utf8Validation utf8_validation = 4 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_FILE, + feature_support = { + edition_introduced: EDITION_2023, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "NONE" }, + edition_defaults = { edition: EDITION_PROTO3, value: "VERIFY" } + ]; + + enum MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0; + LENGTH_PREFIXED = 1; + DELIMITED = 2; + } + optional MessageEncoding message_encoding = 5 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_FILE, + feature_support = { + edition_introduced: EDITION_2023, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "LENGTH_PREFIXED" } + ]; + + enum JsonFormat { + JSON_FORMAT_UNKNOWN = 0; + ALLOW = 1; + LEGACY_BEST_EFFORT = 2; + } + optional JsonFormat json_format = 6 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_MESSAGE, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_FILE, + feature_support = { + edition_introduced: EDITION_2023, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "LEGACY_BEST_EFFORT" }, + edition_defaults = { edition: EDITION_PROTO3, value: "ALLOW" } + ]; + + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0; + STYLE2024 = 1; + STYLE_LEGACY = 2; + } + optional EnforceNamingStyle enforce_naming_style = 7 [ + retention = RETENTION_SOURCE, + targets = TARGET_TYPE_FILE, + targets = TARGET_TYPE_EXTENSION_RANGE, + targets = TARGET_TYPE_MESSAGE, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_ONEOF, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_ENUM_ENTRY, + targets = TARGET_TYPE_SERVICE, + targets = TARGET_TYPE_METHOD, + feature_support = { + edition_introduced: EDITION_2024, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "STYLE_LEGACY" }, + edition_defaults = { edition: EDITION_2024, value: "STYLE2024" } + ]; + + message VisibilityFeature { + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0; + + // Default pre-EDITION_2024, all UNSET visibility are export. + EXPORT_ALL = 1; + + // All top-level symbols default to export, nested default to local. + EXPORT_TOP_LEVEL = 2; + + // All symbols default to local. + LOCAL_ALL = 3; + + // All symbols local by default. Nested types cannot be exported. + // With special case caveat for message { enum {} reserved 1 to max; } + // This is the recommended setting for new protos. + STRICT = 4; + } + reserved 1 to max; + } + optional VisibilityFeature.DefaultSymbolVisibility default_symbol_visibility = + 8 [ + retention = RETENTION_SOURCE, + targets = TARGET_TYPE_FILE, + feature_support = { + edition_introduced: EDITION_2024, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "EXPORT_ALL" }, + edition_defaults = { edition: EDITION_2024, value: "EXPORT_TOP_LEVEL" } + ]; + + reserved 999; + + extensions 1000 to 9994 [ + declaration = { + number: 1000, + full_name: ".pb.cpp", + type: ".pb.CppFeatures" + }, + declaration = { + number: 1001, + full_name: ".pb.java", + type: ".pb.JavaFeatures" + }, + declaration = { number: 1002, full_name: ".pb.go", type: ".pb.GoFeatures" }, + declaration = { + number: 1003, + full_name: ".pb.python", + type: ".pb.PythonFeatures" + }, + declaration = { + number: 1100, + full_name: ".imp.impress_feature_set", + type: ".imp.ImpressFeatureSet" + }, + declaration = { + number: 9989, + full_name: ".pb.java_mutable", + type: ".pb.JavaMutableFeatures" + }, + declaration = { + number: 9990, + full_name: ".pb.proto1", + type: ".pb.Proto1Features" + } + ]; + + extensions 9995 to 9999; // For internal testing + extensions 10000; // for https://github.com/bufbuild/protobuf-es +} + +// A compiled specification for the defaults of a set of features. These +// messages are generated from FeatureSet extensions and can be used to seed +// feature resolution. The resolution with this object becomes a simple search +// for the closest matching edition, followed by proto merges. +message FeatureSetDefaults { + // A map from every known edition with a unique set of defaults to its + // defaults. Not all editions may be contained here. For a given edition, + // the defaults at the closest matching edition ordered at or before it should + // be used. This field must be in strict ascending order by edition. + message FeatureSetEditionDefault { + optional Edition edition = 3; + + // Defaults of features that can be overridden in this edition. + optional FeatureSet overridable_features = 4; + + // Defaults of features that can't be overridden in this edition. + optional FeatureSet fixed_features = 5; + + reserved 1, 2; + reserved "features"; + } + repeated FeatureSetEditionDefault defaults = 1; + + // The minimum supported edition (inclusive) when this was constructed. + // Editions before this will not have defaults. + optional Edition minimum_edition = 4; + + // The maximum known edition (inclusive) when this was constructed. Editions + // after this will not have reliable defaults. + optional Edition maximum_edition = 5; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendant. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition appears. + // For example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed = true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed = true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to moo. + // // + // // Another line attached to moo. + // optional double moo = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to moo or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + optional string leading_comments = 3; + optional string trailing_comments = 4; + repeated string leading_detached_comments = 6; + } + + // Extensions for tooling. + extensions 536000000 [declaration = { + number: 536000000 + type: ".buf.descriptor.v1.SourceCodeInfoExtension" + full_name: ".buf.descriptor.v1.buf_source_code_info_extension" + }]; +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +message GeneratedCodeInfo { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + repeated Annotation annotation = 1; + message Annotation { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + repeated int32 path = 1 [packed = true]; + + // Identifies the filesystem path to the original source .proto. + optional string source_file = 2; + + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + optional int32 begin = 3; + + // Identifies the ending offset in bytes in the generated code that + // relates to the identified object. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + optional int32 end = 4; + + // Represents the identified object's effect on the element in the original + // .proto file. + enum Semantic { + // There is no effect or the effect is indescribable. + NONE = 0; + // The element is set or otherwise mutated. + SET = 1; + // An alias to the element is returned. + ALIAS = 2; + } + optional Semantic semantic = 5; + } +} + +// Describes the 'visibility' of a symbol with respect to the proto import +// system. Symbols can only be imported when the visibility rules do not prevent +// it (ex: local symbols cannot be imported). Visibility modifiers can only set +// on `message` and `enum` as they are the only types available to be referenced +// from other files. +enum SymbolVisibility { + VISIBILITY_UNSET = 0; + VISIBILITY_LOCAL = 1; + VISIBILITY_EXPORT = 2; +} diff --git a/Proto/ServerInternal/sources/service_gateway.proto b/Proto/ServerInternal/sources/service_gateway.proto new file mode 100644 index 0000000..ab6fa53 --- /dev/null +++ b/Proto/ServerInternal/sources/service_gateway.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +option go_package = "common/proto/ss/grpc_pb"; +import "ss_common.proto"; + +service Gateway { + // 发送消息到客户端 + rpc ToClient(stream ToClientReq) returns (ToClientResp) {} + rpc KickUser(KickUserReq) returns (KickUserResp) {} +} + +message ToClientReq { + int64 USN = 1; + int32 MessageID = 2; + bytes Payload = 3; +} + +message ToClientResp { +} + +message KickUserReq { + int64 USN = 1; +} + +message KickUserResp { +} \ No newline at end of file diff --git a/Proto/ServerInternal/sources/service_scene.proto b/Proto/ServerInternal/sources/service_scene.proto new file mode 100644 index 0000000..c2433df --- /dev/null +++ b/Proto/ServerInternal/sources/service_scene.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; + +option go_package = "common/proto/ss/grpc_pb"; +import "ss_common.proto"; + +service Scene { + rpc Enter(EnterReq) returns (EnterResp) {} + rpc Leave(LeaveReq) returns (LeaveResp) {} + rpc Action(stream ActionReq) returns (ActionResp) {} +} + +message EnterReq { + int64 USN = 1; // 用户ID + int64 GatewaySID = 2; // 网关服务ID + int32 InstanceID = 3; // 副本ID +} + +message EnterResp { + int64 SceneSID = 1; // 场景服务ID + int64 UniqueNo = 2; // 副本唯一编号 + int32 MessageID = 3; // 发送给客户端的消息ID + bytes Payload = 4; // 消息负载 +} + +message LeaveReq { + int64 USN = 1; // 用户ID + int64 UniqueNo = 2; // 副本唯一编号 +} + +message LeaveResp { +} + +message ActionReq { + int64 UniqueNo = 1; // 副本唯一编号 + int64 USN = 2; // 用户ID + int32 Action = 3; // 指令ID + sint32 DirX = 4; // 移动-X方向(×1000 缩放) + sint32 DirY = 5; // 移动-Y方向(×1000 缩放) + int32 SkillID = 6; // 攻击-技能ID +} + +message ActionResp { +} \ No newline at end of file diff --git a/Proto/ServerInternal/sources/service_user.proto b/Proto/ServerInternal/sources/service_user.proto new file mode 100644 index 0000000..0734a20 --- /dev/null +++ b/Proto/ServerInternal/sources/service_user.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +option go_package = "common/proto/ss/grpc_pb"; +import "ss_common.proto"; +import "google/api/annotations.proto"; + +service User { + rpc Login(LoginReq) returns (LoginResp) {} + rpc GetUserInfo(GetUserInfoReq) returns (GetUserInfoResp) { + option (google.api.http) = { + post: "/user/info" + body: "*" + }; + } +} + +message LoginReq { + string Phone = 1 [json_name = "phone"]; // 手机号 + string Code = 2 [json_name = "code"]; // 验证码 +} + +message LoginResp { + int64 USN = 1 [json_name = "usn"]; // 用户ID + string Name = 2 [json_name = "name"]; // 用户名 +} + +message GetUserInfoReq { + int64 USN = 1 [json_name = "usn"]; +} + +message GetUserInfoResp { + int64 USN = 1 [json_name = "usn"]; + string Name = 2 [json_name = "name"]; +} \ No newline at end of file diff --git a/Proto/ServerInternal/sources/ss_common.proto b/Proto/ServerInternal/sources/ss_common.proto new file mode 100644 index 0000000..d3b542a --- /dev/null +++ b/Proto/ServerInternal/sources/ss_common.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +option go_package = "common/proto/ss/ss_common"; + +message ErrorInfo { + int32 Code = 1; + string Msg = 2; +} \ No newline at end of file diff --git a/Publish/doc.txt b/Publish/doc.txt new file mode 100644 index 0000000..3cea4b1 --- /dev/null +++ b/Publish/doc.txt @@ -0,0 +1,64 @@ +这是部署文档,记录部署需要做哪些东西 + + +frps、frpc: +git - https://github.com/fatedier/frp +frps启动命令(没有做成服务):nohup ./frps -c ./frps.toml & +frpc设置成服务,开机自启: +1. 配置文件:/etc/systemd/system/frpc.service +[Unit] +Description=FRP Client +After=network.target + +[Service] +ExecStart=/home/pi/Desktop/frp_0.65.0_linux_arm64/frpc -c /home/pi/Desktop/frp_0.65.0_linux_arm64/frpc.toml +Restart=always + +[Install] +WantedBy=multi-user.target +2. 启动命令: +sudo systemctl daemon-reload +sudo systemctl enable frpc # 开机自启 +sudo systemctl start frpc # 立即启动 +3. 查看日志 +sudo journalctl -u frpc + + +安装Docker +curl -fsSL https://get.docker.com -o get-docker.sh +sudo sh get-docker.sh + +Docker代理(Docker不管全局代理,必须在这里设置): +1. 配置文件:/etc/systemd/system/docker.service.d/proxy.conf +[Service] +Environment="HTTP_PROXY=http://192.168.31.150:7890" +Environment="HTTPS_PROXY=http://192.168.31.150:7890" +Environment="NO_PROXY=localhost,127.0.0.1,.local,192.168.0.0/16" +2. 启动命令: +sudo systemctl daemon-reload +sudo systemctl restart docker + +以下服务需要给存档权限 +sudo chown -R 1000:1000 jenkins/ +sudo chown -R 472:472 grafana/ +sudo chown -R 65534:65534 prometheus/ +sudo chown -R 1000:1000 gitea/ + +nginx auth: +nginx验证:printf "admin:$(openssl passwd -crypt uF8uY4eM0nS9dA4iZ1bV4hE6)\n" >>./prometheus_passwd +registry验证:htpasswd -Bbn admin pD4hC1jY1bB0pY4kF4tC > ./registry_passwd +↑没有工具安装这个:sudo yum install -y httpd-tools + +Jenkins账密:admin 4f848ffe54ef45eda56eebd62bc90ea0 +Grafana账密:admin pT1rA0yL0mK3iA8tJ4kE + +ssh -L 2379:localhost:2379 root@47.108.184.184 yT1vU8fH5mP0rQ6h + + +registry命令: +curl -XGET -u admin:pD4hC1jY1bB0pY4kF4tC http://127.0.0.1:5000/v2/_catalog +curl -XGET -u admin:pD4hC1jY1bB0pY4kF4tC http://127.0.0.1:5000/v2/server-gateway/tags/list + +ssh-keygen -t rsa -b 4096 -C "jenkins-to-aliyun" -f ~/.ssh/jenkins -N "" + +mockgen -source ./proto/ss/grpc_pb/service_user_grpc.pb.go -destination ./proto/ss/grpc_pb/mocks/service_user_grpc.pb.go -package mocks diff --git a/Publish/docker-compose-db.yml b/Publish/docker-compose-db.yml new file mode 100644 index 0000000..43558d5 --- /dev/null +++ b/Publish/docker-compose-db.yml @@ -0,0 +1,33 @@ +services: + mysql: + image: mysql:9.5.0 + container_name: mysql + restart: unless-stopped + environment: + MYSQL_ROOT_PASSWORD: gR9pV4tY7zR6qL3e + TZ: Asia/Shanghai + ports: + - "3306:3306" + volumes: + - ./db/mysql:/var/lib/mysql + + redis: + image: redis:8.4.0 + container_name: redis + restart: unless-stopped + ports: + - "6379:6379" + volumes: + - ./db/redis:/data + command: redis-server --requirepass lQ7aM8oB6lK0iD5k + + etcd: + image: bitnami/etcd:latest + container_name: etcd + restart: unless-stopped + ports: + - "2379:2379" + environment: + ALLOW_NONE_AUTHENTICATION: "yes" + ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379" + ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379" diff --git a/Publish/docker-compose-gitea.yml b/Publish/docker-compose-gitea.yml new file mode 100644 index 0000000..dbb4438 --- /dev/null +++ b/Publish/docker-compose-gitea.yml @@ -0,0 +1,14 @@ +services: + gitea: + image: docker.gitea.com/gitea:1.25.3-rootless + container_name: gitea + restart: unless-stopped + ports: + - "3001:3000" + volumes: + - ./gitea/data:/var/lib/gitea + - ./gitea/config:/etc/gitea + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + environment: + - GITEA__server__ROOT_URL=http://47.108.184.184/gitea/ \ No newline at end of file diff --git a/Publish/docker-compose-metric.yml b/Publish/docker-compose-metric.yml new file mode 100644 index 0000000..e59b05b --- /dev/null +++ b/Publish/docker-compose-metric.yml @@ -0,0 +1,35 @@ +services: + prometheus: + image: prom/prometheus:v3.8.1 + container_name: prometheus + restart: unless-stopped + ports: + - "9090:9090" + command: + - '--config.file=/etc/prometheus/prometheus.yml' + volumes: + - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro + - ./prometheus:/prometheus + + node_exporter: + image: quay.io/prometheus/node-exporter:v1.10.2 + container_name: node_exporter + command: + - '--path.rootfs=/host' + network_mode: host + pid: host + restart: unless-stopped + volumes: + - '/:/host:ro,rslave' + + grafana: + image: grafana/grafana:12.3.1 + container_name: grafana + restart: unless-stopped + ports: + - "3000:3000" + environment: + - GF_SERVER_ROOT_URL=https://www.hlsq.asia/grafana/ + - GF_SECURITY_ADMIN_PASSWORD=admin + volumes: + - ./grafana:/var/lib/grafana \ No newline at end of file diff --git a/Publish/docker-compose-registry.yml b/Publish/docker-compose-registry.yml new file mode 100644 index 0000000..5d5f72c --- /dev/null +++ b/Publish/docker-compose-registry.yml @@ -0,0 +1,28 @@ +services: + registry: + image: registry:3.0.0 + container_name: registry + restart: unless-stopped + ports: + - "5000:5000" + environment: + REGISTRY_AUTH: htpasswd + REGISTRY_AUTH_HTPASSWD_REALM: "Registry Realm" + REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd + REGISTRY_STORAGE_DELETE_ENABLED: true + volumes: + - ./registry/data:/var/lib/registry + - ./registry/auth:/auth + + registry-browser: + image: klausmeyer/docker-registry-browser:1.9.0 + container_name: registry-browser + restart: unless-stopped + ports: + - "8081:8080" + environment: + SECRET_KEY_BASE: "b8464de925141ff42cf99c702e1ff54f1997edc2761a7236a981954e0c2cd7f95bf00c77647f234e393db16b039e9ed6afc41c44ddae2d8745458c19c4ff1aa1" + ENABLE_DELETE_IMAGES: true + DOCKER_REGISTRY_URL: http://192.168.31.10:5000 + SCRIPT_NAME: "/browser" + RAILS_RELATIVE_URL_ROOT: "/browser" \ No newline at end of file diff --git a/Publish/docker-compose-tool.yml b/Publish/docker-compose-tool.yml new file mode 100644 index 0000000..29a9dc6 --- /dev/null +++ b/Publish/docker-compose-tool.yml @@ -0,0 +1,28 @@ +services: + jenkins: + image: jenkins/jenkins:2.543 + container_name: jenkins + user: "1000:984" + command: "--prefix=/jenkins" + restart: unless-stopped + ports: + - "8080:8080" + volumes: + - ./jenkins:/var/jenkins_home + - /var/run/docker.sock:/var/run/docker.sock + - /usr/bin/docker:/usr/bin/docker + environment: + - TZ=Asia/Shanghai + + nginx: + image: nginx:1.29.4 + container_name: nginx + restart: unless-stopped + ports: + - "80:80" + - "443:443" + volumes: + - ./nginx/conf.d:/etc/nginx/conf.d:ro + - ./nginx/html:/var/www/html + - ./nginx/certs:/etc/nginx/certs:ro + - ./nginx/logs:/var/log/nginx \ No newline at end of file diff --git a/Tools/mysql_model/gen.ps1 b/Tools/mysql_model/gen.ps1 new file mode 100644 index 0000000..a3a76c1 --- /dev/null +++ b/Tools/mysql_model/gen.ps1 @@ -0,0 +1,16 @@ +# gen.ps1 - 极简版 +& .\gentool.exe ` +-dsn "root:gR9pV4tY7zR6qL3e@tcp(47.108.184.184:3306)/user_db?charset=utf8mb4&parseTime=True&loc=Local" ` +-fieldSignable ` +-outPath "./user_db/query" + +Get-ChildItem ./user_db/model/*.gen.go | ForEach-Object { + $c = Get-Content $_.FullName -Raw -Encoding UTF8 + if ($c -match '\bSn\s+int64\b' -and $c -notmatch 'BeforeCreate') { + $c -match 'type\s+(\w+)\s+struct' | Out-Null + $n = $matches[1] + $c = $c -replace '(?s)(import\s*\([^)]*)', "`$1`t`"common/utils`"`n" + $hook = "`n`n// auto sn`nfunc (m *$n) BeforeCreate(_ *gorm.DB) error {`n`tif m.Sn == 0 {`n`t`tm.Sn = utils.SnowflakeInstance().Generate().Int64()`n`t}`n`treturn nil`n}" + Set-Content $_.FullName ($c.TrimEnd() + $hook) -Encoding UTF8 + } +} \ No newline at end of file diff --git a/Tools/mysql_model/gentool.exe b/Tools/mysql_model/gentool.exe new file mode 100644 index 0000000..df7ef2e Binary files /dev/null and b/Tools/mysql_model/gentool.exe differ diff --git a/Tools/mysql_model/user_db/model/users.gen.go b/Tools/mysql_model/user_db/model/users.gen.go new file mode 100644 index 0000000..548d913 --- /dev/null +++ b/Tools/mysql_model/user_db/model/users.gen.go @@ -0,0 +1,38 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" + + "gorm.io/gorm" + "common/utils" +) + +const TableNameUser = "users" + +// User mapped from table +type User struct { + ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"` + Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号 + Name string `gorm:"column:name;not null" json:"name"` + Phone string `gorm:"column:phone;not null" json:"phone"` + CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"` + UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"` + DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"` +} + +// TableName User's table name +func (*User) TableName() string { + return TableNameUser +} + +// auto sn +func (m *User) BeforeCreate(_ *gorm.DB) error { + if m.Sn == 0 { + m.Sn = utils.SnowflakeInstance().Generate().Int64() + } + return nil +} diff --git a/Tools/mysql_model/user_db/query/gen.go b/Tools/mysql_model/user_db/query/gen.go new file mode 100644 index 0000000..d067772 --- /dev/null +++ b/Tools/mysql_model/user_db/query/gen.go @@ -0,0 +1,93 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package query + +import ( + "context" + "database/sql" + + "gorm.io/gorm" + + "gorm.io/gen" + + "gorm.io/plugin/dbresolver" +) + +func Use(db *gorm.DB, opts ...gen.DOOption) *Query { + return &Query{ + db: db, + User: newUser(db, opts...), + } +} + +type Query struct { + db *gorm.DB + + User user +} + +func (q *Query) Available() bool { return q.db != nil } + +func (q *Query) clone(db *gorm.DB) *Query { + return &Query{ + db: db, + User: q.User.clone(db), + } +} + +func (q *Query) ReadDB() *Query { + return q.ReplaceDB(q.db.Clauses(dbresolver.Read)) +} + +func (q *Query) WriteDB() *Query { + return q.ReplaceDB(q.db.Clauses(dbresolver.Write)) +} + +func (q *Query) ReplaceDB(db *gorm.DB) *Query { + return &Query{ + db: db, + User: q.User.replaceDB(db), + } +} + +type queryCtx struct { + User *userDo +} + +func (q *Query) WithContext(ctx context.Context) *queryCtx { + return &queryCtx{ + User: q.User.WithContext(ctx), + } +} + +func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error { + return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...) +} + +func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx { + tx := q.db.Begin(opts...) + return &QueryTx{Query: q.clone(tx), Error: tx.Error} +} + +type QueryTx struct { + *Query + Error error +} + +func (q *QueryTx) Commit() error { + return q.db.Commit().Error +} + +func (q *QueryTx) Rollback() error { + return q.db.Rollback().Error +} + +func (q *QueryTx) SavePoint(name string) error { + return q.db.SavePoint(name).Error +} + +func (q *QueryTx) RollbackTo(name string) error { + return q.db.RollbackTo(name).Error +} diff --git a/Tools/mysql_model/user_db/query/users.gen.go b/Tools/mysql_model/user_db/query/users.gen.go new file mode 100644 index 0000000..eba891f --- /dev/null +++ b/Tools/mysql_model/user_db/query/users.gen.go @@ -0,0 +1,349 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package query + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" +) + +func newUser(db *gorm.DB, opts ...gen.DOOption) user { + _user := user{} + + _user.userDo.UseDB(db, opts...) + _user.userDo.UseModel(&model.User{}) + + tableName := _user.userDo.TableName() + _user.ALL = field.NewAsterisk(tableName) + _user.ID = field.NewUint64(tableName, "id") + _user.Sn = field.NewInt64(tableName, "sn") + _user.Name = field.NewString(tableName, "name") + _user.Phone = field.NewString(tableName, "phone") + _user.CreatedAt = field.NewTime(tableName, "created_at") + _user.UpdatedAt = field.NewTime(tableName, "updated_at") + _user.DeletedAt = field.NewField(tableName, "deleted_at") + + _user.fillFieldMap() + + return _user +} + +type user struct { + userDo userDo + + ALL field.Asterisk + ID field.Uint64 + Sn field.Int64 // 业务唯一编号 + Name field.String + Phone field.String + CreatedAt field.Time + UpdatedAt field.Time + DeletedAt field.Field + + fieldMap map[string]field.Expr +} + +func (u user) Table(newTableName string) *user { + u.userDo.UseTable(newTableName) + return u.updateTableName(newTableName) +} + +func (u user) As(alias string) *user { + u.userDo.DO = *(u.userDo.As(alias).(*gen.DO)) + return u.updateTableName(alias) +} + +func (u *user) updateTableName(table string) *user { + u.ALL = field.NewAsterisk(table) + u.ID = field.NewUint64(table, "id") + u.Sn = field.NewInt64(table, "sn") + u.Name = field.NewString(table, "name") + u.Phone = field.NewString(table, "phone") + u.CreatedAt = field.NewTime(table, "created_at") + u.UpdatedAt = field.NewTime(table, "updated_at") + u.DeletedAt = field.NewField(table, "deleted_at") + + u.fillFieldMap() + + return u +} + +func (u *user) WithContext(ctx context.Context) *userDo { return u.userDo.WithContext(ctx) } + +func (u user) TableName() string { return u.userDo.TableName() } + +func (u user) Alias() string { return u.userDo.Alias() } + +func (u user) Columns(cols ...field.Expr) gen.Columns { return u.userDo.Columns(cols...) } + +func (u *user) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := u.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (u *user) fillFieldMap() { + u.fieldMap = make(map[string]field.Expr, 7) + u.fieldMap["id"] = u.ID + u.fieldMap["sn"] = u.Sn + u.fieldMap["name"] = u.Name + u.fieldMap["phone"] = u.Phone + u.fieldMap["created_at"] = u.CreatedAt + u.fieldMap["updated_at"] = u.UpdatedAt + u.fieldMap["deleted_at"] = u.DeletedAt +} + +func (u user) clone(db *gorm.DB) user { + u.userDo.ReplaceConnPool(db.Statement.ConnPool) + return u +} + +func (u user) replaceDB(db *gorm.DB) user { + u.userDo.ReplaceDB(db) + return u +} + +type userDo struct{ gen.DO } + +func (u userDo) Debug() *userDo { + return u.withDO(u.DO.Debug()) +} + +func (u userDo) WithContext(ctx context.Context) *userDo { + return u.withDO(u.DO.WithContext(ctx)) +} + +func (u userDo) ReadDB() *userDo { + return u.Clauses(dbresolver.Read) +} + +func (u userDo) WriteDB() *userDo { + return u.Clauses(dbresolver.Write) +} + +func (u userDo) Session(config *gorm.Session) *userDo { + return u.withDO(u.DO.Session(config)) +} + +func (u userDo) Clauses(conds ...clause.Expression) *userDo { + return u.withDO(u.DO.Clauses(conds...)) +} + +func (u userDo) Returning(value interface{}, columns ...string) *userDo { + return u.withDO(u.DO.Returning(value, columns...)) +} + +func (u userDo) Not(conds ...gen.Condition) *userDo { + return u.withDO(u.DO.Not(conds...)) +} + +func (u userDo) Or(conds ...gen.Condition) *userDo { + return u.withDO(u.DO.Or(conds...)) +} + +func (u userDo) Select(conds ...field.Expr) *userDo { + return u.withDO(u.DO.Select(conds...)) +} + +func (u userDo) Where(conds ...gen.Condition) *userDo { + return u.withDO(u.DO.Where(conds...)) +} + +func (u userDo) Order(conds ...field.Expr) *userDo { + return u.withDO(u.DO.Order(conds...)) +} + +func (u userDo) Distinct(cols ...field.Expr) *userDo { + return u.withDO(u.DO.Distinct(cols...)) +} + +func (u userDo) Omit(cols ...field.Expr) *userDo { + return u.withDO(u.DO.Omit(cols...)) +} + +func (u userDo) Join(table schema.Tabler, on ...field.Expr) *userDo { + return u.withDO(u.DO.Join(table, on...)) +} + +func (u userDo) LeftJoin(table schema.Tabler, on ...field.Expr) *userDo { + return u.withDO(u.DO.LeftJoin(table, on...)) +} + +func (u userDo) RightJoin(table schema.Tabler, on ...field.Expr) *userDo { + return u.withDO(u.DO.RightJoin(table, on...)) +} + +func (u userDo) Group(cols ...field.Expr) *userDo { + return u.withDO(u.DO.Group(cols...)) +} + +func (u userDo) Having(conds ...gen.Condition) *userDo { + return u.withDO(u.DO.Having(conds...)) +} + +func (u userDo) Limit(limit int) *userDo { + return u.withDO(u.DO.Limit(limit)) +} + +func (u userDo) Offset(offset int) *userDo { + return u.withDO(u.DO.Offset(offset)) +} + +func (u userDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *userDo { + return u.withDO(u.DO.Scopes(funcs...)) +} + +func (u userDo) Unscoped() *userDo { + return u.withDO(u.DO.Unscoped()) +} + +func (u userDo) Create(values ...*model.User) error { + if len(values) == 0 { + return nil + } + return u.DO.Create(values) +} + +func (u userDo) CreateInBatches(values []*model.User, batchSize int) error { + return u.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (u userDo) Save(values ...*model.User) error { + if len(values) == 0 { + return nil + } + return u.DO.Save(values) +} + +func (u userDo) First() (*model.User, error) { + if result, err := u.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) Take() (*model.User, error) { + if result, err := u.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) Last() (*model.User, error) { + if result, err := u.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) Find() ([]*model.User, error) { + result, err := u.DO.Find() + return result.([]*model.User), err +} + +func (u userDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.User, err error) { + buf := make([]*model.User, 0, batchSize) + err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (u userDo) FindInBatches(result *[]*model.User, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return u.DO.FindInBatches(result, batchSize, fc) +} + +func (u userDo) Attrs(attrs ...field.AssignExpr) *userDo { + return u.withDO(u.DO.Attrs(attrs...)) +} + +func (u userDo) Assign(attrs ...field.AssignExpr) *userDo { + return u.withDO(u.DO.Assign(attrs...)) +} + +func (u userDo) Joins(fields ...field.RelationField) *userDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Joins(_f)) + } + return &u +} + +func (u userDo) Preload(fields ...field.RelationField) *userDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Preload(_f)) + } + return &u +} + +func (u userDo) FirstOrInit() (*model.User, error) { + if result, err := u.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) FirstOrCreate() (*model.User, error) { + if result, err := u.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) FindByPage(offset int, limit int) (result []*model.User, count int64, err error) { + result, err = u.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = u.Offset(-1).Limit(-1).Count() + return +} + +func (u userDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = u.Count() + if err != nil { + return + } + + err = u.Offset(offset).Limit(limit).Scan(result) + return +} + +func (u userDo) Scan(result interface{}) (err error) { + return u.DO.Scan(result) +} + +func (u userDo) Delete(models ...*model.User) (result gen.ResultInfo, err error) { + return u.DO.Delete(models) +} + +func (u *userDo) withDO(do gen.Dao) *userDo { + u.DO = *do.(*gen.DO) + return u +} diff --git a/Tools/tidy.bat b/Tools/tidy.bat new file mode 100644 index 0000000..79a6e68 --- /dev/null +++ b/Tools/tidy.bat @@ -0,0 +1,16 @@ +cd ../../Server/common +go mod tidy + +cd ../gateway +go mod tidy + +cd ../robot +go mod tidy + +cd ../scene +go mod tidy + +cd ../user +go mod tidy + +Pause \ No newline at end of file