diff --git a/Client/Assets/Plugins/Google.Protobuf.dll b/Client/Assets/Plugins/Google.Protobuf.dll new file mode 100644 index 0000000..b7b721e Binary files /dev/null and b/Client/Assets/Plugins/Google.Protobuf.dll differ diff --git a/Client/Assets/Plugins/Google.Protobuf.dll.meta b/Client/Assets/Plugins/Google.Protobuf.dll.meta new file mode 100644 index 0000000..7dae75a --- /dev/null +++ b/Client/Assets/Plugins/Google.Protobuf.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 58793fbd79d5dc64fb809643ce24f665 \ No newline at end of file diff --git a/Client/Assets/Plugins/Grpc.Core.Api.dll b/Client/Assets/Plugins/Grpc.Core.Api.dll new file mode 100644 index 0000000..6c4e826 Binary files /dev/null and b/Client/Assets/Plugins/Grpc.Core.Api.dll differ diff --git a/Client/Assets/Plugins/Grpc.Core.Api.dll.meta b/Client/Assets/Plugins/Grpc.Core.Api.dll.meta new file mode 100644 index 0000000..5deceea --- /dev/null +++ b/Client/Assets/Plugins/Grpc.Core.Api.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b1e08ff72cdd6064883254a020cad051 \ No newline at end of file diff --git a/Client/Assets/Plugins/Grpc.Net.Client.Web.dll b/Client/Assets/Plugins/Grpc.Net.Client.Web.dll new file mode 100644 index 0000000..571492d Binary files /dev/null and b/Client/Assets/Plugins/Grpc.Net.Client.Web.dll differ diff --git a/Client/Assets/Plugins/Grpc.Net.Client.Web.dll.meta b/Client/Assets/Plugins/Grpc.Net.Client.Web.dll.meta new file mode 100644 index 0000000..60a565d --- /dev/null +++ b/Client/Assets/Plugins/Grpc.Net.Client.Web.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d7e4bcae5efb0b14bad366d9e2cbfc3d \ No newline at end of file diff --git a/Client/Assets/Plugins/Grpc.Net.Client.dll b/Client/Assets/Plugins/Grpc.Net.Client.dll new file mode 100644 index 0000000..b7994f4 Binary files /dev/null and b/Client/Assets/Plugins/Grpc.Net.Client.dll differ diff --git a/Client/Assets/Plugins/Grpc.Net.Client.dll.meta b/Client/Assets/Plugins/Grpc.Net.Client.dll.meta new file mode 100644 index 0000000..5b4511f --- /dev/null +++ b/Client/Assets/Plugins/Grpc.Net.Client.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c61f603b1eefa51489d220166ce921ba \ No newline at end of file diff --git a/Client/Assets/Plugins/Grpc.Net.Common.dll b/Client/Assets/Plugins/Grpc.Net.Common.dll new file mode 100644 index 0000000..ca1b060 Binary files /dev/null and b/Client/Assets/Plugins/Grpc.Net.Common.dll differ diff --git a/Client/Assets/Plugins/Grpc.Net.Common.dll.meta b/Client/Assets/Plugins/Grpc.Net.Common.dll.meta new file mode 100644 index 0000000..7d11662 --- /dev/null +++ b/Client/Assets/Plugins/Grpc.Net.Common.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 992230fc9ae81744aa9c6d6f1998273f \ No newline at end of file diff --git a/Client/Assets/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll b/Client/Assets/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll new file mode 100644 index 0000000..2d78e6d Binary files /dev/null and b/Client/Assets/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll differ diff --git a/Client/Assets/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll.meta b/Client/Assets/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll.meta new file mode 100644 index 0000000..2000199 --- /dev/null +++ b/Client/Assets/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b719d2506760e4e43954921863684f40 \ No newline at end of file diff --git a/Client/Assets/Plugins/Microsoft.Extensions.Logging.Abstractions.dll b/Client/Assets/Plugins/Microsoft.Extensions.Logging.Abstractions.dll new file mode 100644 index 0000000..bea3897 Binary files /dev/null and b/Client/Assets/Plugins/Microsoft.Extensions.Logging.Abstractions.dll differ diff --git a/Client/Assets/Plugins/Microsoft.Extensions.Logging.Abstractions.dll.meta b/Client/Assets/Plugins/Microsoft.Extensions.Logging.Abstractions.dll.meta new file mode 100644 index 0000000..34a9c8c --- /dev/null +++ b/Client/Assets/Plugins/Microsoft.Extensions.Logging.Abstractions.dll.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 081ac1838dc3211419aad66a1ea6a883 \ No newline at end of file diff --git a/Client/Assets/Scenes/Test.unity b/Client/Assets/Scenes/Test.unity index cdafdf0..ebaa11f 100644 --- a/Client/Assets/Scenes/Test.unity +++ b/Client/Assets/Scenes/Test.unity @@ -303,50 +303,6 @@ Transform: - {fileID: 9462743} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &912467177 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 912467178} - - component: {fileID: 912467179} - m_Layer: 0 - m_Name: NetworkConnectionTest - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 0 ---- !u!4 &912467178 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 912467177} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &912467179 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 912467177} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 289a7efc822fe7347adfbf218522e8a2, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &1057087086 GameObject: m_ObjectHideFlags: 0 @@ -479,7 +435,6 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: -10} - m_LocalPosition: {x: 0, y: 0, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -696,6 +651,50 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 757576bb4354ac54da09868e1be02eec, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &2104915506 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2104915508} + - component: {fileID: 2104915507} + m_Layer: 0 + m_Name: GrpcClientTest + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2104915507 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2104915506} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98c1b145899d4d97bd981b177b5c45a9, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &2104915508 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2104915506} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 @@ -703,6 +702,5 @@ SceneRoots: - {fileID: 1371068282} - {fileID: 1057087090} - {fileID: 613797070} - - {fileID: 912467178} - - {fileID: 1485465861} - {fileID: 1485465861} + - {fileID: 2104915508} diff --git a/Client/Assets/Scripts/Network.meta b/Client/Assets/Scripts/Network.meta index ec7e1d2..386e0e1 100644 --- a/Client/Assets/Scripts/Network.meta +++ b/Client/Assets/Scripts/Network.meta @@ -1,8 +1,3 @@ fileFormatVersion: 2 -guid: 36bb272d9a70ff347965919811a887de -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: +guid: 178450a3675642d799764a426bcb236f +timeCreated: 1752480692 \ No newline at end of file diff --git a/Client/Assets/Scripts/Network/GrpcClient.cs b/Client/Assets/Scripts/Network/GrpcClient.cs new file mode 100644 index 0000000..02556ab --- /dev/null +++ b/Client/Assets/Scripts/Network/GrpcClient.cs @@ -0,0 +1,48 @@ +using System.Net.Http; +using System.Threading.Tasks; +using Grpc.Net.Client; +using Grpc.Net.Client.Web; +using Protocol; +using Utils; + +namespace Network +{ + public class GrpcClient : Singleton + { + // The address must adopt HTTP. + private const string ServerAddress = "http://127.0.0.1:12345"; + + private readonly GrpcChannel _channel; + private readonly GameService.GameServiceClient _game; + private readonly GeneralService.GeneralServiceClient _general; + + public GrpcClient() + { + var httpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler()); + var channelOptions = new GrpcChannelOptions + { + HttpHandler = httpHandler + }; + + _channel = GrpcChannel.ForAddress(ServerAddress, channelOptions); + + _general = new GeneralService.GeneralServiceClient(_channel); + _game = new GameService.GameServiceClient(_channel); + } + + ~GrpcClient() + { + _channel.ShutdownAsync().Wait(); + } + + public async Task GetServerInfo() + { + return await _general.GetServerInfoAsync(new Empty()); + } + + public async Task Login(string username, string password) + { + return await _game.LoginAsync(new LoginRequest { Username = username, Password = password }); + } + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Network/GrpcClient.cs.meta b/Client/Assets/Scripts/Network/GrpcClient.cs.meta new file mode 100644 index 0000000..eab447d --- /dev/null +++ b/Client/Assets/Scripts/Network/GrpcClient.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bd54dd152e0e4bbda802e9aa04078197 +timeCreated: 1752480707 \ No newline at end of file diff --git a/Client/Assets/Scripts/Network/UnityTcpClient.cs b/Client/Assets/Scripts/Network/UnityTcpClient.cs deleted file mode 100644 index be2977b..0000000 --- a/Client/Assets/Scripts/Network/UnityTcpClient.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Net.Sockets; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Utils; - -namespace Network -{ - public class UnityTcpClient : Singleton - { - private TcpClient _tcpClient; - public bool IsConnected => _tcpClient?.Connected ?? false; - - /// - /// 尝试连接到指定的地址和端口 - /// - /// 服务器地址 - /// 端口号 - /// 连接是否成功 - public async Task Connect(string address, int port) - { - if (IsConnected) - { - Debug.LogWarning("Already connected to a server."); - return true; - } - - try - { - // 创建一个新的 TcpClient 实例 - _tcpClient = new TcpClient(); - - // 尝试连接到指定的地址和端口 - await _tcpClient.ConnectAsync(address, port); - - // 如果连接成功 - if (IsConnected) - { - Debug.Log($"Successfully connected to server at {address}:{port}"); - return true; - } - } - catch (SocketException ex) - { - Debug.LogError($"Failed to connect to server at {address}:{port}. Error: {ex.Message}"); - } - catch (Exception ex) - { - Debug.LogError($"An unexpected error occurred: {ex.Message}"); - } - - // 如果发生任何错误或连接失败 - Disconnect(); - return false; - } - - /// - /// 断开与服务器的连接 - /// - public void Disconnect() - { - if (!IsConnected) - { - Debug.LogWarning("Not currently connected to any server."); - return; - } - - try - { - // 关闭 TcpClient 连接 - _tcpClient?.Close(); - - Debug.Log("Disconnected from the server."); - } - catch (Exception ex) - { - Debug.LogError($"Error while disconnecting: {ex.Message}"); - } - } - - /// - /// 发送数据到服务器 - /// - /// 要发送的消息 - public async Task Send(string message) - { - if (!IsConnected) - { - Debug.LogError("Cannot send data. Not connected to any server."); - return; - } - - try - { - // 获取网络流 - var stream = _tcpClient.GetStream(); - - // 将消息转换为字节数组 - var data = Encoding.UTF8.GetBytes(message); - - // 发送数据 - await stream.WriteAsync(data, 0, data.Length); - - Debug.Log($"Sent message to server: {message}"); - } - catch (Exception ex) - { - Debug.LogError($"Error while sending: {ex.Message}"); - } - } - - /// - /// 接收来自服务器的数据 - /// - /// 接收到的消息 - public async Task Receive() - { - if (!IsConnected) - { - Debug.LogError("Cannot receive data. Not connected to any server."); - return null; - } - - try - { - // 获取网络流 - var stream = _tcpClient.GetStream(); - - // 检查是否有可用数据 - if (stream.DataAvailable) - { - // 读取数据 - var buffer = new byte[1024]; - var bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length); - - // 将字节数组转换为字符串 - var message = Encoding.UTF8.GetString(buffer, 0, bytesRead); - - Debug.Log($"Received message from server: {message}"); - return message; - } - } - catch (Exception ex) - { - Debug.LogError($"Error while receiving: {ex.Message}"); - } - - return null; - } - } -} \ No newline at end of file diff --git a/Client/Assets/Scripts/Network/UnityTcpClient.cs.meta b/Client/Assets/Scripts/Network/UnityTcpClient.cs.meta deleted file mode 100644 index a153c7c..0000000 --- a/Client/Assets/Scripts/Network/UnityTcpClient.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 3cfed6461b8d6714bbc44fdac509c880 \ No newline at end of file diff --git a/Client/Assets/Scripts/Protocol.meta b/Client/Assets/Scripts/Protocol.meta new file mode 100644 index 0000000..62734a9 --- /dev/null +++ b/Client/Assets/Scripts/Protocol.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0aabb2c54fff484382fda9415503276b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/Protocol/Message.cs b/Client/Assets/Scripts/Protocol/Message.cs new file mode 100644 index 0000000..a4897d5 --- /dev/null +++ b/Client/Assets/Scripts/Protocol/Message.cs @@ -0,0 +1,1404 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: message.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; +namespace Protocol { + + /// Holder for reflection information generated from message.proto + public static partial class MessageReflection { + + #region Descriptor + /// File descriptor for message.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static MessageReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg1tZXNzYWdlLnByb3RvEghwcm90b2NvbCIHCgVFbXB0eSInCgpTZXJ2ZXJJ", + "bmZvEgwKBExhbmcYASABKAkSCwoDdmVyGAIgASgJIjIKDExvZ2luUmVxdWVz", + "dBIQCghVc2VybmFtZRgBIAEoCRIQCghQYXNzd29yZBgCIAEoCSJJCg1Mb2dp", + "blJlc3BvbnNlEicKBnJlc3VsdBgBIAEoDjIXLnByb3RvY29sLlJlcXVlc3RS", + "ZXN1bHQSDwoHbWVzc2FnZRgCIAEoCSIzCg1TaWdudXBSZXF1ZXN0EhAKCFVz", + "ZXJuYW1lGAEgASgJEhAKCFBhc3N3b3JkGAIgASgJIkoKDlNpZ251cFJlc3Bv", + "bnNlEicKBnJlc3VsdBgBIAEoDjIXLnByb3RvY29sLlJlcXVlc3RSZXN1bHQS", + "DwoHbWVzc2FnZRgCIAEoCSomCg1SZXF1ZXN0UmVzdWx0EgsKB1N1Y2Nlc3MQ", + "ABIICgRGYWlsEAEySAoOR2VuZXJhbFNlcnZpY2USNgoNR2V0U2VydmVySW5m", + "bxIPLnByb3RvY29sLkVtcHR5GhQucHJvdG9jb2wuU2VydmVySW5mbzKEAQoL", + "R2FtZVNlcnZpY2USOAoFTG9naW4SFi5wcm90b2NvbC5Mb2dpblJlcXVlc3Qa", + "Fy5wcm90b2NvbC5Mb2dpblJlc3BvbnNlEjsKBlNpZ251cBIXLnByb3RvY29s", + "LlNpZ251cFJlcXVlc3QaGC5wcm90b2NvbC5TaWdudXBSZXNwb25zZWIGcHJv", + "dG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Protocol.RequestResult), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.Empty), global::Protocol.Empty.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.ServerInfo), global::Protocol.ServerInfo.Parser, new[]{ "Lang", "Ver" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.LoginRequest), global::Protocol.LoginRequest.Parser, new[]{ "Username", "Password" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.LoginResponse), global::Protocol.LoginResponse.Parser, new[]{ "Result", "Message" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.SignupRequest), global::Protocol.SignupRequest.Parser, new[]{ "Username", "Password" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.SignupResponse), global::Protocol.SignupResponse.Parser, new[]{ "Result", "Message" }, null, null, null, null) + })); + } + #endregion + + } + #region Enums + public enum RequestResult { + [pbr::OriginalName("Success")] Success = 0, + [pbr::OriginalName("Fail")] Fail = 1, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class Empty : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Empty()); + 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::Protocol.MessageReflection.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 Empty() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Empty(Empty other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Empty Clone() { + return new Empty(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Empty); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Empty other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + 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 (_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 (_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 (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Empty other) { + if (other == null) { + return; + } + _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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + 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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class ServerInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServerInfo()); + 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::Protocol.MessageReflection.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 ServerInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ServerInfo(ServerInfo other) : this() { + lang_ = other.lang_; + ver_ = other.ver_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ServerInfo Clone() { + return new ServerInfo(this); + } + + /// Field number for the "Lang" field. + public const int LangFieldNumber = 1; + private string lang_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Lang { + get { return lang_; } + set { + lang_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "ver" field. + public const int VerFieldNumber = 2; + private string ver_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Ver { + get { return ver_; } + set { + ver_ = 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 ServerInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ServerInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Lang != other.Lang) return false; + if (Ver != other.Ver) 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 (Lang.Length != 0) hash ^= Lang.GetHashCode(); + if (Ver.Length != 0) hash ^= Ver.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 (Lang.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Lang); + } + if (Ver.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Ver); + } + 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 (Lang.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Lang); + } + if (Ver.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Ver); + } + 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 (Lang.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Lang); + } + if (Ver.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Ver); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ServerInfo other) { + if (other == null) { + return; + } + if (other.Lang.Length != 0) { + Lang = other.Lang; + } + if (other.Ver.Length != 0) { + Ver = other.Ver; + } + _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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Lang = input.ReadString(); + break; + } + case 18: { + Ver = input.ReadString(); + 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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Lang = input.ReadString(); + break; + } + case 18: { + Ver = input.ReadString(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class LoginRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LoginRequest()); + 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::Protocol.MessageReflection.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 LoginRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LoginRequest(LoginRequest other) : this() { + username_ = other.username_; + password_ = other.password_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LoginRequest Clone() { + return new LoginRequest(this); + } + + /// Field number for the "Username" field. + public const int UsernameFieldNumber = 1; + private string username_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Username { + get { return username_; } + set { + username_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Password" field. + public const int PasswordFieldNumber = 2; + private string password_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Password { + get { return password_; } + set { + password_ = 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 LoginRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(LoginRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Username != other.Username) return false; + if (Password != other.Password) 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 (Username.Length != 0) hash ^= Username.GetHashCode(); + if (Password.Length != 0) hash ^= Password.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 (Username.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Username); + } + if (Password.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Password); + } + 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 (Username.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Username); + } + if (Password.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Password); + } + 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 (Username.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Username); + } + if (Password.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Password); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(LoginRequest other) { + if (other == null) { + return; + } + if (other.Username.Length != 0) { + Username = other.Username; + } + if (other.Password.Length != 0) { + Password = other.Password; + } + _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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Username = input.ReadString(); + break; + } + case 18: { + Password = input.ReadString(); + 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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Username = input.ReadString(); + break; + } + case 18: { + Password = input.ReadString(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class LoginResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LoginResponse()); + 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::Protocol.MessageReflection.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 LoginResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LoginResponse(LoginResponse other) : this() { + result_ = other.result_; + message_ = other.message_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LoginResponse Clone() { + return new LoginResponse(this); + } + + /// Field number for the "result" field. + public const int ResultFieldNumber = 1; + private global::Protocol.RequestResult result_ = global::Protocol.RequestResult.Success; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Protocol.RequestResult Result { + get { return result_; } + set { + result_ = value; + } + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 2; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Message { + get { return message_; } + set { + message_ = 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 LoginResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(LoginResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Result != other.Result) return false; + if (Message != other.Message) 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 (Result != global::Protocol.RequestResult.Success) hash ^= Result.GetHashCode(); + if (Message.Length != 0) hash ^= Message.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 (Result != global::Protocol.RequestResult.Success) { + output.WriteRawTag(8); + output.WriteEnum((int) Result); + } + if (Message.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Message); + } + 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 (Result != global::Protocol.RequestResult.Success) { + output.WriteRawTag(8); + output.WriteEnum((int) Result); + } + if (Message.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Message); + } + 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 (Result != global::Protocol.RequestResult.Success) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Result); + } + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(LoginResponse other) { + if (other == null) { + return; + } + if (other.Result != global::Protocol.RequestResult.Success) { + Result = other.Result; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + _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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Result = (global::Protocol.RequestResult) input.ReadEnum(); + break; + } + case 18: { + Message = input.ReadString(); + 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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Result = (global::Protocol.RequestResult) input.ReadEnum(); + break; + } + case 18: { + Message = input.ReadString(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class SignupRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SignupRequest()); + 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::Protocol.MessageReflection.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 SignupRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SignupRequest(SignupRequest other) : this() { + username_ = other.username_; + password_ = other.password_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SignupRequest Clone() { + return new SignupRequest(this); + } + + /// Field number for the "Username" field. + public const int UsernameFieldNumber = 1; + private string username_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Username { + get { return username_; } + set { + username_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Password" field. + public const int PasswordFieldNumber = 2; + private string password_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Password { + get { return password_; } + set { + password_ = 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 SignupRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(SignupRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Username != other.Username) return false; + if (Password != other.Password) 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 (Username.Length != 0) hash ^= Username.GetHashCode(); + if (Password.Length != 0) hash ^= Password.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 (Username.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Username); + } + if (Password.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Password); + } + 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 (Username.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Username); + } + if (Password.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Password); + } + 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 (Username.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Username); + } + if (Password.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Password); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(SignupRequest other) { + if (other == null) { + return; + } + if (other.Username.Length != 0) { + Username = other.Username; + } + if (other.Password.Length != 0) { + Password = other.Password; + } + _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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Username = input.ReadString(); + break; + } + case 18: { + Password = input.ReadString(); + 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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Username = input.ReadString(); + break; + } + case 18: { + Password = input.ReadString(); + break; + } + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class SignupResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SignupResponse()); + 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::Protocol.MessageReflection.Descriptor.MessageTypes[5]; } + } + + [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 SignupResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SignupResponse(SignupResponse other) : this() { + result_ = other.result_; + message_ = other.message_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SignupResponse Clone() { + return new SignupResponse(this); + } + + /// Field number for the "result" field. + public const int ResultFieldNumber = 1; + private global::Protocol.RequestResult result_ = global::Protocol.RequestResult.Success; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Protocol.RequestResult Result { + get { return result_; } + set { + result_ = value; + } + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 2; + private string message_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Message { + get { return message_; } + set { + message_ = 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 SignupResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(SignupResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Result != other.Result) return false; + if (Message != other.Message) 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 (Result != global::Protocol.RequestResult.Success) hash ^= Result.GetHashCode(); + if (Message.Length != 0) hash ^= Message.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 (Result != global::Protocol.RequestResult.Success) { + output.WriteRawTag(8); + output.WriteEnum((int) Result); + } + if (Message.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Message); + } + 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 (Result != global::Protocol.RequestResult.Success) { + output.WriteRawTag(8); + output.WriteEnum((int) Result); + } + if (Message.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Message); + } + 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 (Result != global::Protocol.RequestResult.Success) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Result); + } + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(SignupResponse other) { + if (other == null) { + return; + } + if (other.Result != global::Protocol.RequestResult.Success) { + Result = other.Result; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + _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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Result = (global::Protocol.RequestResult) input.ReadEnum(); + break; + } + case 18: { + Message = input.ReadString(); + 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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Result = (global::Protocol.RequestResult) input.ReadEnum(); + break; + } + case 18: { + Message = input.ReadString(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Client/Assets/Scripts/Protocol/Message.cs.meta b/Client/Assets/Scripts/Protocol/Message.cs.meta new file mode 100644 index 0000000..3560bf6 --- /dev/null +++ b/Client/Assets/Scripts/Protocol/Message.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8afd87f1b9f31bb44be8c224d8fc7270 \ No newline at end of file diff --git a/Client/Assets/Scripts/Protocol/MessageGrpc.cs b/Client/Assets/Scripts/Protocol/MessageGrpc.cs new file mode 100644 index 0000000..e0c7755 --- /dev/null +++ b/Client/Assets/Scripts/Protocol/MessageGrpc.cs @@ -0,0 +1,387 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: message.proto +// +#pragma warning disable 0414, 1591, 8981, 0612 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Protocol { + public static partial class GeneralService + { + static readonly string __ServiceName = "protocol.GeneralService"; + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static readonly grpc::Marshaller __Marshaller_protocol_Empty = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.Empty.Parser)); + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static readonly grpc::Marshaller __Marshaller_protocol_ServerInfo = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.ServerInfo.Parser)); + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static readonly grpc::Method __Method_GetServerInfo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetServerInfo", + __Marshaller_protocol_Empty, + __Marshaller_protocol_ServerInfo); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Protocol.MessageReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of GeneralService + [grpc::BindServiceMethod(typeof(GeneralService), "BindService")] + public abstract partial class GeneralServiceBase + { + /// + /// Get server info from server. + /// + /// This parameter actually doesn't accept any arguments, + /// but it is still required owing to Protobuf grammar. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual global::System.Threading.Tasks.Task GetServerInfo(global::Protocol.Empty request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for GeneralService + public partial class GeneralServiceClient : grpc::ClientBase + { + /// Creates a new client for GeneralService + /// The channel to use to make remote calls. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public GeneralServiceClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for GeneralService that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public GeneralServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + protected GeneralServiceClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + protected GeneralServiceClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Get server info from server. + /// + /// This parameter actually doesn't accept any arguments, + /// but it is still required owing to Protobuf grammar. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual global::Protocol.ServerInfo GetServerInfo(global::Protocol.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetServerInfo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Get server info from server. + /// + /// This parameter actually doesn't accept any arguments, + /// but it is still required owing to Protobuf grammar. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual global::Protocol.ServerInfo GetServerInfo(global::Protocol.Empty request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetServerInfo, null, options, request); + } + /// + /// Get server info from server. + /// + /// This parameter actually doesn't accept any arguments, + /// but it is still required owing to Protobuf grammar. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual grpc::AsyncUnaryCall GetServerInfoAsync(global::Protocol.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetServerInfoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Get server info from server. + /// + /// This parameter actually doesn't accept any arguments, + /// but it is still required owing to Protobuf grammar. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual grpc::AsyncUnaryCall GetServerInfoAsync(global::Protocol.Empty request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetServerInfo, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + protected override GeneralServiceClient NewInstance(ClientBaseConfiguration configuration) + { + return new GeneralServiceClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public static grpc::ServerServiceDefinition BindService(GeneralServiceBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_GetServerInfo, serviceImpl.GetServerInfo).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public static void BindService(grpc::ServiceBinderBase serviceBinder, GeneralServiceBase serviceImpl) + { + serviceBinder.AddMethod(__Method_GetServerInfo, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.GetServerInfo)); + } + + } + public static partial class GameService + { + static readonly string __ServiceName = "protocol.GameService"; + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (message is global::Google.Protobuf.IBufferMessage) + { + context.SetPayloadLength(message.CalculateSize()); + global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); + context.Complete(); + return; + } + #endif + context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); + } + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static class __Helper_MessageCache + { + public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); + } + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage + { + #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION + if (__Helper_MessageCache.IsBufferMessage) + { + return parser.ParseFrom(context.PayloadAsReadOnlySequence()); + } + #endif + return parser.ParseFrom(context.PayloadAsNewBuffer()); + } + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static readonly grpc::Marshaller __Marshaller_protocol_LoginRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.LoginRequest.Parser)); + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static readonly grpc::Marshaller __Marshaller_protocol_LoginResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.LoginResponse.Parser)); + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static readonly grpc::Marshaller __Marshaller_protocol_SignupRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.SignupRequest.Parser)); + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static readonly grpc::Marshaller __Marshaller_protocol_SignupResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.SignupResponse.Parser)); + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static readonly grpc::Method __Method_Login = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Login", + __Marshaller_protocol_LoginRequest, + __Marshaller_protocol_LoginResponse); + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + static readonly grpc::Method __Method_Signup = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Signup", + __Marshaller_protocol_SignupRequest, + __Marshaller_protocol_SignupResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Protocol.MessageReflection.Descriptor.Services[1]; } + } + + /// Base class for server-side implementations of GameService + [grpc::BindServiceMethod(typeof(GameService), "BindService")] + public abstract partial class GameServiceBase + { + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual global::System.Threading.Tasks.Task Login(global::Protocol.LoginRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual global::System.Threading.Tasks.Task Signup(global::Protocol.SignupRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for GameService + public partial class GameServiceClient : grpc::ClientBase + { + /// Creates a new client for GameService + /// The channel to use to make remote calls. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public GameServiceClient(grpc::ChannelBase channel) : base(channel) + { + } + /// Creates a new client for GameService that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public GameServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + protected GameServiceClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + protected GameServiceClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual global::Protocol.LoginResponse Login(global::Protocol.LoginRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Login(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual global::Protocol.LoginResponse Login(global::Protocol.LoginRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Login, null, options, request); + } + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual grpc::AsyncUnaryCall LoginAsync(global::Protocol.LoginRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return LoginAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual grpc::AsyncUnaryCall LoginAsync(global::Protocol.LoginRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Login, null, options, request); + } + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual global::Protocol.SignupResponse Signup(global::Protocol.SignupRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return Signup(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual global::Protocol.SignupResponse Signup(global::Protocol.SignupRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Signup, null, options, request); + } + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual grpc::AsyncUnaryCall SignupAsync(global::Protocol.SignupRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return SignupAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public virtual grpc::AsyncUnaryCall SignupAsync(global::Protocol.SignupRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Signup, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + protected override GameServiceClient NewInstance(ClientBaseConfiguration configuration) + { + return new GameServiceClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public static grpc::ServerServiceDefinition BindService(GameServiceBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Login, serviceImpl.Login) + .AddMethod(__Method_Signup, serviceImpl.Signup).Build(); + } + + /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. + /// Note: this method is part of an experimental API that can change or be removed without any prior notice. + /// Service methods will be bound by calling AddMethod on this object. + /// An object implementing the server-side handling logic. + [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)] + public static void BindService(grpc::ServiceBinderBase serviceBinder, GameServiceBase serviceImpl) + { + serviceBinder.AddMethod(__Method_Login, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Login)); + serviceBinder.AddMethod(__Method_Signup, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Signup)); + } + + } +} +#endregion diff --git a/Client/Assets/Scripts/Protocol/MessageGrpc.cs.meta b/Client/Assets/Scripts/Protocol/MessageGrpc.cs.meta new file mode 100644 index 0000000..cdba154 --- /dev/null +++ b/Client/Assets/Scripts/Protocol/MessageGrpc.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f2f787a1d94a6ae48b5586f040f0cf1b \ No newline at end of file diff --git a/Client/Assets/Scripts/Test/GrpcClientTest.cs b/Client/Assets/Scripts/Test/GrpcClientTest.cs new file mode 100644 index 0000000..8b44366 --- /dev/null +++ b/Client/Assets/Scripts/Test/GrpcClientTest.cs @@ -0,0 +1,19 @@ +using Network; +using UnityEngine; + +namespace Test +{ + public class GrpcClientTest : MonoBehaviour + { + private async void Start() + { + var serverInfo = await GrpcClient.Instance.GetServerInfo(); + + Debug.Log($"Received info from server: {serverInfo}"); + + var loginResult = await GrpcClient.Instance.Login("野兽先辈", "114514"); + + Debug.Log($"Received login result: {loginResult.Result}"); + } + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Test/GrpcClientTest.cs.meta b/Client/Assets/Scripts/Test/GrpcClientTest.cs.meta new file mode 100644 index 0000000..934631d --- /dev/null +++ b/Client/Assets/Scripts/Test/GrpcClientTest.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 98c1b145899d4d97bd981b177b5c45a9 +timeCreated: 1752478138 \ No newline at end of file diff --git a/Client/Assets/Scripts/Test/NetworkConnectionTest.cs b/Client/Assets/Scripts/Test/NetworkConnectionTest.cs deleted file mode 100644 index 3ea60b8..0000000 --- a/Client/Assets/Scripts/Test/NetworkConnectionTest.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Threading.Tasks; -using Network; -using UnityEngine; - -namespace Test -{ - public class NetworkConnectionTest : MonoBehaviour - { - private async void Start() - { - await BasicTest(); - } - - private static async Task BasicTest() - { - var result = await UnityTcpClient.Instance.Connect("127.0.0.1", 12345); - if (result) Debug.Log("Connected to server!"); - else Debug.LogError("Failed to connect to server!"); - - string buffer = null; - while (buffer is null) buffer = await UnityTcpClient.Instance.Receive(); - - Debug.Log($"Received contents: {buffer}"); - } - } -} \ No newline at end of file diff --git a/Client/Assets/Scripts/Test/NetworkConnectionTest.cs.meta b/Client/Assets/Scripts/Test/NetworkConnectionTest.cs.meta deleted file mode 100644 index e6418ad..0000000 --- a/Client/Assets/Scripts/Test/NetworkConnectionTest.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 289a7efc822fe7347adfbf218522e8a2 \ No newline at end of file