From ffeb65ba6b807cb1846b5db9e1e4c418dac9aa91 Mon Sep 17 00:00:00 2001 From: zzdxxz <2079238449@qq.com> Date: Wed, 16 Jul 2025 13:05:04 +0800 Subject: [PATCH] =?UTF-8?q?(client)=20feat:=E6=B7=BB=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=8F=E5=88=97=E5=8C=96=E7=9B=B8=E5=85=B3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=20(#37)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: zzdxxz <2079238449@qq.com> Co-committed-by: zzdxxz <2079238449@qq.com> --- Client/Assets/Scripts/Base/Attributes.cs | 13 + Client/Assets/Scripts/Base/Attributes.cs.meta | 3 + Client/Assets/Scripts/Data/DefinePack.cs | 17 - Client/Assets/Scripts/Entity/Monster.cs | 18 + Client/Assets/Scripts/Entity/Monster.cs.meta | 3 + .../Assets/Scripts/Managers/ArchiveManager.cs | 10 + .../Scripts/Managers/ArchiveManager.cs.meta | 3 + Client/Assets/Scripts/Managers/Buffer.cs | 163 ++ Client/Assets/Scripts/Managers/Buffer.cs.meta | 3 + Client/Assets/Scripts/Protocol/Message.cs | 2146 ++++++++++++++++- Tools/ProtoBuf/proto/message.proto | 53 + 11 files changed, 2407 insertions(+), 25 deletions(-) create mode 100644 Client/Assets/Scripts/Base/Attributes.cs create mode 100644 Client/Assets/Scripts/Base/Attributes.cs.meta create mode 100644 Client/Assets/Scripts/Entity/Monster.cs create mode 100644 Client/Assets/Scripts/Entity/Monster.cs.meta create mode 100644 Client/Assets/Scripts/Managers/ArchiveManager.cs create mode 100644 Client/Assets/Scripts/Managers/ArchiveManager.cs.meta create mode 100644 Client/Assets/Scripts/Managers/Buffer.cs create mode 100644 Client/Assets/Scripts/Managers/Buffer.cs.meta diff --git a/Client/Assets/Scripts/Base/Attributes.cs b/Client/Assets/Scripts/Base/Attributes.cs new file mode 100644 index 0000000..32722df --- /dev/null +++ b/Client/Assets/Scripts/Base/Attributes.cs @@ -0,0 +1,13 @@ +using System; + +namespace Base +{ + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class NeedSaveAttribute : Attribute + { + } + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class UnSaveAttribute : Attribute + { + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Base/Attributes.cs.meta b/Client/Assets/Scripts/Base/Attributes.cs.meta new file mode 100644 index 0000000..3c3b2a7 --- /dev/null +++ b/Client/Assets/Scripts/Base/Attributes.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bb4eb0442fc54e27955bb860d6dc2fd3 +timeCreated: 1752635644 \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/DefinePack.cs b/Client/Assets/Scripts/Data/DefinePack.cs index 32b6e85..b729adf 100644 --- a/Client/Assets/Scripts/Data/DefinePack.cs +++ b/Client/Assets/Scripts/Data/DefinePack.cs @@ -343,23 +343,6 @@ namespace Data // 如果字段的类型直接是基类或其派生类,则返回 true return fieldType != baseType && baseType.IsAssignableFrom(fieldType); } - - /// - /// 检查字段的类型是否继承自指定的类 - /// - /// 字段信息 - /// 要检查的基类类型 - /// 如果字段的类型是基类或其派生类,则返回 true - public static bool IsFieldTypeInheritedFrom(FieldInfo field, Type baseType) - { - // 获取字段的类型 - var fieldType = field.FieldType; - // 如果字段的类型为 null 或不是基类的派生类,则返回 false - if (!baseType.IsAssignableFrom(fieldType)) - return false; - // 如果字段的类型直接是基类或其派生类,则返回 true - return fieldType != baseType && baseType.IsAssignableFrom(fieldType); - } } } \ No newline at end of file diff --git a/Client/Assets/Scripts/Entity/Monster.cs b/Client/Assets/Scripts/Entity/Monster.cs new file mode 100644 index 0000000..33af0b8 --- /dev/null +++ b/Client/Assets/Scripts/Entity/Monster.cs @@ -0,0 +1,18 @@ +namespace Entity +{ + public class Monster + { + + } + + public class MonsterAttributes + { + public int health = 10; + public int moveSpeed = 1; + public int attack = 1; + public int defense = 0; + public int attackSpeed = 2; + public int attackRange = 3; + public int attackTargetCount = 1; + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Entity/Monster.cs.meta b/Client/Assets/Scripts/Entity/Monster.cs.meta new file mode 100644 index 0000000..a50f3bd --- /dev/null +++ b/Client/Assets/Scripts/Entity/Monster.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 32995e4c8e0d40dfa39990f0671a3733 +timeCreated: 1752576973 \ No newline at end of file diff --git a/Client/Assets/Scripts/Managers/ArchiveManager.cs b/Client/Assets/Scripts/Managers/ArchiveManager.cs new file mode 100644 index 0000000..2b4280b --- /dev/null +++ b/Client/Assets/Scripts/Managers/ArchiveManager.cs @@ -0,0 +1,10 @@ +namespace Managers +{ + public class ArchiveManager + { + public bool Save(string filename) + { + return false; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Managers/ArchiveManager.cs.meta b/Client/Assets/Scripts/Managers/ArchiveManager.cs.meta new file mode 100644 index 0000000..cbe3506 --- /dev/null +++ b/Client/Assets/Scripts/Managers/ArchiveManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a6952f5a135a4809bdeb721b4761aa6f +timeCreated: 1752635779 \ No newline at end of file diff --git a/Client/Assets/Scripts/Managers/Buffer.cs b/Client/Assets/Scripts/Managers/Buffer.cs new file mode 100644 index 0000000..e6613e9 --- /dev/null +++ b/Client/Assets/Scripts/Managers/Buffer.cs @@ -0,0 +1,163 @@ +using System; +using System.Collections.Concurrent; +using System.Threading; + +namespace Managers +{ + + /// + /// 双缓冲静态类,用于逻辑计算线程与主线程之间的数据同步。 + /// + /// 要同步的数据类型。 + public static class DoubleBuffer + { + /// + /// 当前用于写入的缓冲区。 + /// + private static T _writeBuffer; + + /// + /// 当前用于读取的缓冲区。 + /// + private static T _readBuffer; + + /// + /// 用于同步缓冲区交换的锁对象。 + /// + private static readonly object _lock = new object(); + + /// + /// 初始化双缓冲类。 + /// + /// 初始值,用于初始化两个缓冲区。 + public static void Initialize(T initialValue) + { + _writeBuffer = initialValue; + _readBuffer = initialValue; + } + + /// + /// 写入数据到当前写缓冲区。 + /// + /// 要写入的数据。 + public static void Write(T data) + { + lock (_lock) + { + _writeBuffer = data; // 将数据写入写缓冲区 + } + } + + /// + /// 交换读写缓冲区,使主线程可以读取最新的数据。 + /// + public static void SwapBuffers() + { + lock (_lock) + { + // 交换读写缓冲区 + T temp = _readBuffer; + _readBuffer = _writeBuffer; + _writeBuffer = temp; + } + } + + /// + /// 从当前读缓冲区读取数据。 + /// + /// 当前读缓冲区中的数据。 + public static T Read() + { + lock (_lock) + { + return _readBuffer; // 返回读缓冲区中的数据 + } + } + } + + /// + /// 网络消息缓冲区类,用于在网络线程和主线程之间进行线程安全的消息传递。 + /// + public static class NetworkMessageBuffer + { + /// + /// 缓冲区的最大消息数量。 + /// + private static readonly int MaxMessageCount; + + /// + /// 存储消息的线程安全队列。 + /// + private static readonly ConcurrentQueue MessageQueue; + + /// + /// 用于控制缓冲区是否已满的信号量。 + /// + private static readonly SemaphoreSlim BufferSemaphore; + + /// + /// 初始化网络消息缓冲区类。 + /// + static NetworkMessageBuffer() + { + MaxMessageCount = 100; + MessageQueue = new ConcurrentQueue(); + BufferSemaphore = new SemaphoreSlim(MaxMessageCount, MaxMessageCount); + } + + /// + /// 向缓冲区添加一条消息。 + /// 如果缓冲区已满,则等待直到有空间可用。 + /// + /// 要添加的消息内容。 + public static async void AddMessageAsync(string message) + { + // 等待缓冲区有可用空间 + await BufferSemaphore.WaitAsync(); + + try + { + // 将消息添加到队列中 + MessageQueue.Enqueue(message); + } + catch (Exception ex) + { + Console.WriteLine($"AddMessageAsync Error: {ex.Message}"); + } + } + + /// + /// 从缓冲区中读取一条消息。 + /// 如果缓冲区为空,则返回 null。 + /// + /// 缓冲区中的第一条消息,如果缓冲区为空则返回 null。 + public static string ReadMessage() + { + if (MessageQueue.TryDequeue(out string message)) + { + // 释放一个缓冲区空间 + BufferSemaphore.Release(); + return message; + } + + return null; + } + + /// + /// 获取当前缓冲区中的消息数量。 + /// + /// 当前缓冲区中的消息数量。 + public static int GetMessageCount() + { + return MessageQueue.Count; + } + + /// + /// 清空缓冲区中的所有消息。 + /// + public static void ClearBuffer() + { + while (MessageQueue.TryDequeue(out _)) { } + } + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Managers/Buffer.cs.meta b/Client/Assets/Scripts/Managers/Buffer.cs.meta new file mode 100644 index 0000000..8852415 --- /dev/null +++ b/Client/Assets/Scripts/Managers/Buffer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 44d2ac59153c45a4bdab4c6eef6ddcec +timeCreated: 1752585193 \ No newline at end of file diff --git a/Client/Assets/Scripts/Protocol/Message.cs b/Client/Assets/Scripts/Protocol/Message.cs index a4897d5..eb76daa 100644 --- a/Client/Assets/Scripts/Protocol/Message.cs +++ b/Client/Assets/Scripts/Protocol/Message.cs @@ -31,13 +31,28 @@ namespace Protocol { "ZXN1bHQSDwoHbWVzc2FnZRgCIAEoCSIzCg1TaWdudXBSZXF1ZXN0EhAKCFVz", "ZXJuYW1lGAEgASgJEhAKCFBhc3N3b3JkGAIgASgJIkoKDlNpZ251cFJlc3Bv", "bnNlEicKBnJlc3VsdBgBIAEoDjIXLnByb3RvY29sLlJlcXVlc3RSZXN1bHQS", - "DwoHbWVzc2FnZRgCIAEoCSomCg1SZXF1ZXN0UmVzdWx0EgsKB1N1Y2Nlc3MQ", - "ABIICgRGYWlsEAEySAoOR2VuZXJhbFNlcnZpY2USNgoNR2V0U2VydmVySW5m", - "bxIPLnByb3RvY29sLkVtcHR5GhQucHJvdG9jb2wuU2VydmVySW5mbzKEAQoL", - "R2FtZVNlcnZpY2USOAoFTG9naW4SFi5wcm90b2NvbC5Mb2dpblJlcXVlc3Qa", - "Fy5wcm90b2NvbC5Mb2dpblJlc3BvbnNlEjsKBlNpZ251cBIXLnByb3RvY29s", - "LlNpZ251cFJlcXVlc3QaGC5wcm90b2NvbC5TaWdudXBSZXNwb25zZWIGcHJv", - "dG8z")); + "DwoHbWVzc2FnZRgCIAEoCSItCghGaWxlUGFjaxIQCghmaWxlUGF0aBgBIAEo", + "CRIPCgdjb250ZW50GAIgASgMInEKEERhdGFQYWNrTGlzdFBhY2sSOQoQcGFj", + "a0lEQW5kVmVyc2lvbhgBIAMoCzIfLnByb3RvY29sLkRhdGFQYWNrTGlzdFBh", + "Y2suUGFpchoiCgRQYWlyEgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCSKF", + "AQoQVGlsZU1hcFRhYmxlUGFjaxI+Cgp0aWxlTWFwS2V5GAEgAygLMioucHJv", + "dG9jb2wuVGlsZU1hcFRhYmxlUGFjay5UaWxlTWFwS2V5RW50cnkaMQoPVGls", + "ZU1hcEtleUVudHJ5EgsKA2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoCToCOAEi", + "aAoLTWFwRGF0YVBhY2sSIwoIcG9zaXRpb24YASABKAsyES5wcm90b2NvbC5W", + "ZWN0b3IyEh8KBHNpemUYAiABKAsyES5wcm90b2NvbC5WZWN0b3IyEhMKC3Rp", + "bGVNYXBUeXBlGAMgAygFIpwBChFNb25zdGVyQXR0cmlidXRlcxIOCgZoZWFs", + "dGgYASABKAUSEQoJbW92ZVNwZWVkGAIgASgFEg4KBmF0dGFjaxgDIAEoBRIP", + "CgdkZWZlbnNlGAQgASgFEhMKC2F0dGFja1NwZWVkGAUgASgFEhMKC2F0dGFj", + "a1JhbmdlGAYgASgFEhkKEWF0dGFja1RhcmdldENvdW50GAcgASgFInYKC01v", + "bnN0ZXJQYWNrEhEKCW1vbnN0ZXJJRBgBIAEoBRIjCghwb3NpdGlvbhgCIAEo", + "CzIRLnByb3RvY29sLlZlY3RvcjISLwoKYXR0cmlidXRlcxgDIAEoCzIbLnBy", + "b3RvY29sLk1vbnN0ZXJBdHRyaWJ1dGVzIh8KB1ZlY3RvcjISCQoBeBgBIAEo", + "AhIJCgF5GAIgASgCKiYKDVJlcXVlc3RSZXN1bHQSCwoHU3VjY2VzcxAAEggK", + "BEZhaWwQATJICg5HZW5lcmFsU2VydmljZRI2Cg1HZXRTZXJ2ZXJJbmZvEg8u", + "cHJvdG9jb2wuRW1wdHkaFC5wcm90b2NvbC5TZXJ2ZXJJbmZvMoQBCgtHYW1l", + "U2VydmljZRI4CgVMb2dpbhIWLnByb3RvY29sLkxvZ2luUmVxdWVzdBoXLnBy", + "b3RvY29sLkxvZ2luUmVzcG9uc2USOwoGU2lnbnVwEhcucHJvdG9jb2wuU2ln", + "bnVwUmVxdWVzdBoYLnByb3RvY29sLlNpZ251cFJlc3BvbnNlYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Protocol.RequestResult), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -46,7 +61,14 @@ namespace Protocol { 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) + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.SignupResponse), global::Protocol.SignupResponse.Parser, new[]{ "Result", "Message" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.FilePack), global::Protocol.FilePack.Parser, new[]{ "FilePath", "Content" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.DataPackListPack), global::Protocol.DataPackListPack.Parser, new[]{ "PackIDAndVersion" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.DataPackListPack.Types.Pair), global::Protocol.DataPackListPack.Types.Pair.Parser, new[]{ "Key", "Value" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.TileMapTablePack), global::Protocol.TileMapTablePack.Parser, new[]{ "TileMapKey" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.MapDataPack), global::Protocol.MapDataPack.Parser, new[]{ "Position", "Size", "TileMapType" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.MonsterAttributes), global::Protocol.MonsterAttributes.Parser, new[]{ "Health", "MoveSpeed", "Attack", "Defense", "AttackSpeed", "AttackRange", "AttackTargetCount" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.MonsterPack), global::Protocol.MonsterPack.Parser, new[]{ "MonsterID", "Position", "Attributes" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Protocol.Vector2), global::Protocol.Vector2.Parser, new[]{ "X", "Y" }, null, null, null, null) })); } #endregion @@ -1397,6 +1419,2114 @@ namespace Protocol { } + /// + /// 定义 FilePack 消息 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class FilePack : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FilePack()); + 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[6]; } + } + + [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 FilePack() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FilePack(FilePack other) : this() { + filePath_ = other.filePath_; + content_ = other.content_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FilePack Clone() { + return new FilePack(this); + } + + /// Field number for the "filePath" field. + public const int FilePathFieldNumber = 1; + private string filePath_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string FilePath { + get { return filePath_; } + set { + filePath_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "content" field. + public const int ContentFieldNumber = 2; + private pb::ByteString content_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString Content { + get { return content_; } + set { + content_ = 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 FilePack); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(FilePack other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (FilePath != other.FilePath) return false; + if (Content != other.Content) 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 (FilePath.Length != 0) hash ^= FilePath.GetHashCode(); + if (Content.Length != 0) hash ^= Content.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 (FilePath.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FilePath); + } + if (Content.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Content); + } + 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 (FilePath.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FilePath); + } + if (Content.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Content); + } + 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 (FilePath.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FilePath); + } + if (Content.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Content); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(FilePack other) { + if (other == null) { + return; + } + if (other.FilePath.Length != 0) { + FilePath = other.FilePath; + } + if (other.Content.Length != 0) { + Content = other.Content; + } + _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: { + FilePath = input.ReadString(); + break; + } + case 18: { + Content = 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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + FilePath = input.ReadString(); + break; + } + case 18: { + Content = input.ReadBytes(); + break; + } + } + } + } + #endif + + } + + /// + /// 定义 DataPackListPack 消息 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class DataPackListPack : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DataPackListPack()); + 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[7]; } + } + + [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 DataPackListPack() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DataPackListPack(DataPackListPack other) : this() { + packIDAndVersion_ = other.packIDAndVersion_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DataPackListPack Clone() { + return new DataPackListPack(this); + } + + /// Field number for the "packIDAndVersion" field. + public const int PackIDAndVersionFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_packIDAndVersion_codec + = pb::FieldCodec.ForMessage(10, global::Protocol.DataPackListPack.Types.Pair.Parser); + private readonly pbc::RepeatedField packIDAndVersion_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField PackIDAndVersion { + get { return packIDAndVersion_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DataPackListPack); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DataPackListPack other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!packIDAndVersion_.Equals(other.packIDAndVersion_)) 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 ^= packIDAndVersion_.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 + packIDAndVersion_.WriteTo(output, _repeated_packIDAndVersion_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) { + packIDAndVersion_.WriteTo(ref output, _repeated_packIDAndVersion_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 += packIDAndVersion_.CalculateSize(_repeated_packIDAndVersion_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DataPackListPack other) { + if (other == null) { + return; + } + packIDAndVersion_.Add(other.packIDAndVersion_); + _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: { + packIDAndVersion_.AddEntriesFrom(input, _repeated_packIDAndVersion_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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + packIDAndVersion_.AddEntriesFrom(ref input, _repeated_packIDAndVersion_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the DataPackListPack message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// 定义内部的 Pair 消息(用于替代 Tuple<string, string>) + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class Pair : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Pair()); + 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.DataPackListPack.Descriptor.NestedTypes[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 Pair() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Pair(Pair other) : this() { + key_ = other.key_; + value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Pair Clone() { + return new Pair(this); + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 1; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "value" field. + public const int ValueFieldNumber = 2; + private string value_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Value { + get { return value_; } + set { + value_ = 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 Pair); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Pair other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Key != other.Key) return false; + if (Value != other.Value) 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 (Key.Length != 0) hash ^= Key.GetHashCode(); + if (Value.Length != 0) hash ^= Value.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 (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (Value.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Value); + } + 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 (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (Value.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Value); + } + 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 (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (Value.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Value); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Pair other) { + if (other == null) { + return; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.Value.Length != 0) { + Value = other.Value; + } + _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: { + Key = input.ReadString(); + break; + } + case 18: { + Value = 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: { + Key = input.ReadString(); + break; + } + case 18: { + Value = input.ReadString(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// 定义 TileMapTablePack 消息 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TileMapTablePack : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TileMapTablePack()); + 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[8]; } + } + + [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 TileMapTablePack() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TileMapTablePack(TileMapTablePack other) : this() { + tileMapKey_ = other.tileMapKey_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TileMapTablePack Clone() { + return new TileMapTablePack(this); + } + + /// Field number for the "tileMapKey" field. + public const int TileMapKeyFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_tileMapKey_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8, 0), pb::FieldCodec.ForString(18, ""), 10); + private readonly pbc::MapField tileMapKey_ = new pbc::MapField(); + /// + /// 使用 int32 替代 int + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::MapField TileMapKey { + get { return tileMapKey_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TileMapTablePack); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TileMapTablePack other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!TileMapKey.Equals(other.TileMapKey)) 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 ^= TileMapKey.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 + tileMapKey_.WriteTo(output, _map_tileMapKey_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) { + tileMapKey_.WriteTo(ref output, _map_tileMapKey_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 += tileMapKey_.CalculateSize(_map_tileMapKey_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TileMapTablePack other) { + if (other == null) { + return; + } + tileMapKey_.MergeFrom(other.tileMapKey_); + _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: { + tileMapKey_.AddEntriesFrom(input, _map_tileMapKey_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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + tileMapKey_.AddEntriesFrom(ref input, _map_tileMapKey_codec); + break; + } + } + } + } + #endif + + } + + /// + /// 定义 MapDataPack 消息 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class MapDataPack : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MapDataPack()); + 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[9]; } + } + + [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 MapDataPack() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MapDataPack(MapDataPack other) : this() { + position_ = other.position_ != null ? other.position_.Clone() : null; + size_ = other.size_ != null ? other.size_.Clone() : null; + tileMapType_ = other.tileMapType_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MapDataPack Clone() { + return new MapDataPack(this); + } + + /// Field number for the "position" field. + public const int PositionFieldNumber = 1; + private global::Protocol.Vector2 position_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Protocol.Vector2 Position { + get { return position_; } + set { + position_ = value; + } + } + + /// Field number for the "size" field. + public const int SizeFieldNumber = 2; + private global::Protocol.Vector2 size_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Protocol.Vector2 Size { + get { return size_; } + set { + size_ = value; + } + } + + /// Field number for the "tileMapType" field. + public const int TileMapTypeFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_tileMapType_codec + = pb::FieldCodec.ForInt32(26); + private readonly pbc::RepeatedField tileMapType_ = new pbc::RepeatedField(); + /// + /// 使用 int32 替代 int + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField TileMapType { + get { return tileMapType_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as MapDataPack); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(MapDataPack other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Position, other.Position)) return false; + if (!object.Equals(Size, other.Size)) return false; + if(!tileMapType_.Equals(other.tileMapType_)) 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 (position_ != null) hash ^= Position.GetHashCode(); + if (size_ != null) hash ^= Size.GetHashCode(); + hash ^= tileMapType_.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 (position_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Position); + } + if (size_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Size); + } + tileMapType_.WriteTo(output, _repeated_tileMapType_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) { + if (position_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Position); + } + if (size_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Size); + } + tileMapType_.WriteTo(ref output, _repeated_tileMapType_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; + if (position_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Position); + } + if (size_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Size); + } + size += tileMapType_.CalculateSize(_repeated_tileMapType_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(MapDataPack other) { + if (other == null) { + return; + } + if (other.position_ != null) { + if (position_ == null) { + Position = new global::Protocol.Vector2(); + } + Position.MergeFrom(other.Position); + } + if (other.size_ != null) { + if (size_ == null) { + Size = new global::Protocol.Vector2(); + } + Size.MergeFrom(other.Size); + } + tileMapType_.Add(other.tileMapType_); + _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: { + if (position_ == null) { + Position = new global::Protocol.Vector2(); + } + input.ReadMessage(Position); + break; + } + case 18: { + if (size_ == null) { + Size = new global::Protocol.Vector2(); + } + input.ReadMessage(Size); + break; + } + case 26: + case 24: { + tileMapType_.AddEntriesFrom(input, _repeated_tileMapType_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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (position_ == null) { + Position = new global::Protocol.Vector2(); + } + input.ReadMessage(Position); + break; + } + case 18: { + if (size_ == null) { + Size = new global::Protocol.Vector2(); + } + input.ReadMessage(Size); + break; + } + case 26: + case 24: { + tileMapType_.AddEntriesFrom(ref input, _repeated_tileMapType_codec); + break; + } + } + } + } + #endif + + } + + /// + /// 定义 MonsterAttributes 消息 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class MonsterAttributes : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MonsterAttributes()); + 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[10]; } + } + + [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 MonsterAttributes() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MonsterAttributes(MonsterAttributes other) : this() { + health_ = other.health_; + moveSpeed_ = other.moveSpeed_; + attack_ = other.attack_; + defense_ = other.defense_; + attackSpeed_ = other.attackSpeed_; + attackRange_ = other.attackRange_; + attackTargetCount_ = other.attackTargetCount_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MonsterAttributes Clone() { + return new MonsterAttributes(this); + } + + /// Field number for the "health" field. + public const int HealthFieldNumber = 1; + private int health_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Health { + get { return health_; } + set { + health_ = value; + } + } + + /// Field number for the "moveSpeed" field. + public const int MoveSpeedFieldNumber = 2; + private int moveSpeed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int MoveSpeed { + get { return moveSpeed_; } + set { + moveSpeed_ = value; + } + } + + /// Field number for the "attack" field. + public const int AttackFieldNumber = 3; + private int attack_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Attack { + get { return attack_; } + set { + attack_ = value; + } + } + + /// Field number for the "defense" field. + public const int DefenseFieldNumber = 4; + private int defense_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Defense { + get { return defense_; } + set { + defense_ = value; + } + } + + /// Field number for the "attackSpeed" field. + public const int AttackSpeedFieldNumber = 5; + private int attackSpeed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int AttackSpeed { + get { return attackSpeed_; } + set { + attackSpeed_ = value; + } + } + + /// Field number for the "attackRange" field. + public const int AttackRangeFieldNumber = 6; + private int attackRange_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int AttackRange { + get { return attackRange_; } + set { + attackRange_ = value; + } + } + + /// Field number for the "attackTargetCount" field. + public const int AttackTargetCountFieldNumber = 7; + private int attackTargetCount_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int AttackTargetCount { + get { return attackTargetCount_; } + set { + attackTargetCount_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as MonsterAttributes); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(MonsterAttributes other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Health != other.Health) return false; + if (MoveSpeed != other.MoveSpeed) return false; + if (Attack != other.Attack) return false; + if (Defense != other.Defense) return false; + if (AttackSpeed != other.AttackSpeed) return false; + if (AttackRange != other.AttackRange) return false; + if (AttackTargetCount != other.AttackTargetCount) 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 (Health != 0) hash ^= Health.GetHashCode(); + if (MoveSpeed != 0) hash ^= MoveSpeed.GetHashCode(); + if (Attack != 0) hash ^= Attack.GetHashCode(); + if (Defense != 0) hash ^= Defense.GetHashCode(); + if (AttackSpeed != 0) hash ^= AttackSpeed.GetHashCode(); + if (AttackRange != 0) hash ^= AttackRange.GetHashCode(); + if (AttackTargetCount != 0) hash ^= AttackTargetCount.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 (Health != 0) { + output.WriteRawTag(8); + output.WriteInt32(Health); + } + if (MoveSpeed != 0) { + output.WriteRawTag(16); + output.WriteInt32(MoveSpeed); + } + if (Attack != 0) { + output.WriteRawTag(24); + output.WriteInt32(Attack); + } + if (Defense != 0) { + output.WriteRawTag(32); + output.WriteInt32(Defense); + } + if (AttackSpeed != 0) { + output.WriteRawTag(40); + output.WriteInt32(AttackSpeed); + } + if (AttackRange != 0) { + output.WriteRawTag(48); + output.WriteInt32(AttackRange); + } + if (AttackTargetCount != 0) { + output.WriteRawTag(56); + output.WriteInt32(AttackTargetCount); + } + 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 (Health != 0) { + output.WriteRawTag(8); + output.WriteInt32(Health); + } + if (MoveSpeed != 0) { + output.WriteRawTag(16); + output.WriteInt32(MoveSpeed); + } + if (Attack != 0) { + output.WriteRawTag(24); + output.WriteInt32(Attack); + } + if (Defense != 0) { + output.WriteRawTag(32); + output.WriteInt32(Defense); + } + if (AttackSpeed != 0) { + output.WriteRawTag(40); + output.WriteInt32(AttackSpeed); + } + if (AttackRange != 0) { + output.WriteRawTag(48); + output.WriteInt32(AttackRange); + } + if (AttackTargetCount != 0) { + output.WriteRawTag(56); + output.WriteInt32(AttackTargetCount); + } + 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 (Health != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Health); + } + if (MoveSpeed != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(MoveSpeed); + } + if (Attack != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Attack); + } + if (Defense != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Defense); + } + if (AttackSpeed != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(AttackSpeed); + } + if (AttackRange != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(AttackRange); + } + if (AttackTargetCount != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(AttackTargetCount); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(MonsterAttributes other) { + if (other == null) { + return; + } + if (other.Health != 0) { + Health = other.Health; + } + if (other.MoveSpeed != 0) { + MoveSpeed = other.MoveSpeed; + } + if (other.Attack != 0) { + Attack = other.Attack; + } + if (other.Defense != 0) { + Defense = other.Defense; + } + if (other.AttackSpeed != 0) { + AttackSpeed = other.AttackSpeed; + } + if (other.AttackRange != 0) { + AttackRange = other.AttackRange; + } + if (other.AttackTargetCount != 0) { + AttackTargetCount = other.AttackTargetCount; + } + _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: { + Health = input.ReadInt32(); + break; + } + case 16: { + MoveSpeed = input.ReadInt32(); + break; + } + case 24: { + Attack = input.ReadInt32(); + break; + } + case 32: { + Defense = input.ReadInt32(); + break; + } + case 40: { + AttackSpeed = input.ReadInt32(); + break; + } + case 48: { + AttackRange = input.ReadInt32(); + break; + } + case 56: { + AttackTargetCount = 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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Health = input.ReadInt32(); + break; + } + case 16: { + MoveSpeed = input.ReadInt32(); + break; + } + case 24: { + Attack = input.ReadInt32(); + break; + } + case 32: { + Defense = input.ReadInt32(); + break; + } + case 40: { + AttackSpeed = input.ReadInt32(); + break; + } + case 48: { + AttackRange = input.ReadInt32(); + break; + } + case 56: { + AttackTargetCount = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// 定义 MonsterPack 消息 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class MonsterPack : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MonsterPack()); + 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[11]; } + } + + [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 MonsterPack() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MonsterPack(MonsterPack other) : this() { + monsterID_ = other.monsterID_; + position_ = other.position_ != null ? other.position_.Clone() : null; + attributes_ = other.attributes_ != null ? other.attributes_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MonsterPack Clone() { + return new MonsterPack(this); + } + + /// Field number for the "monsterID" field. + public const int MonsterIDFieldNumber = 1; + private int monsterID_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int MonsterID { + get { return monsterID_; } + set { + monsterID_ = value; + } + } + + /// Field number for the "position" field. + public const int PositionFieldNumber = 2; + private global::Protocol.Vector2 position_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Protocol.Vector2 Position { + get { return position_; } + set { + position_ = value; + } + } + + /// Field number for the "attributes" field. + public const int AttributesFieldNumber = 3; + private global::Protocol.MonsterAttributes attributes_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Protocol.MonsterAttributes Attributes { + get { return attributes_; } + set { + attributes_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as MonsterPack); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(MonsterPack other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (MonsterID != other.MonsterID) return false; + if (!object.Equals(Position, other.Position)) return false; + if (!object.Equals(Attributes, other.Attributes)) 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 (MonsterID != 0) hash ^= MonsterID.GetHashCode(); + if (position_ != null) hash ^= Position.GetHashCode(); + if (attributes_ != null) hash ^= Attributes.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 (MonsterID != 0) { + output.WriteRawTag(8); + output.WriteInt32(MonsterID); + } + if (position_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Position); + } + if (attributes_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Attributes); + } + 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 (MonsterID != 0) { + output.WriteRawTag(8); + output.WriteInt32(MonsterID); + } + if (position_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Position); + } + if (attributes_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Attributes); + } + 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 (MonsterID != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(MonsterID); + } + if (position_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Position); + } + if (attributes_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Attributes); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(MonsterPack other) { + if (other == null) { + return; + } + if (other.MonsterID != 0) { + MonsterID = other.MonsterID; + } + if (other.position_ != null) { + if (position_ == null) { + Position = new global::Protocol.Vector2(); + } + Position.MergeFrom(other.Position); + } + if (other.attributes_ != null) { + if (attributes_ == null) { + Attributes = new global::Protocol.MonsterAttributes(); + } + Attributes.MergeFrom(other.Attributes); + } + _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: { + MonsterID = input.ReadInt32(); + break; + } + case 18: { + if (position_ == null) { + Position = new global::Protocol.Vector2(); + } + input.ReadMessage(Position); + break; + } + case 26: { + if (attributes_ == null) { + Attributes = new global::Protocol.MonsterAttributes(); + } + input.ReadMessage(Attributes); + 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: { + MonsterID = input.ReadInt32(); + break; + } + case 18: { + if (position_ == null) { + Position = new global::Protocol.Vector2(); + } + input.ReadMessage(Position); + break; + } + case 26: { + if (attributes_ == null) { + Attributes = new global::Protocol.MonsterAttributes(); + } + input.ReadMessage(Attributes); + break; + } + } + } + } + #endif + + } + + /// + /// 定义 Vector2 消息 + /// + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class Vector2 : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Vector2()); + 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[12]; } + } + + [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 Vector2() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Vector2(Vector2 other) : this() { + x_ = other.x_; + y_ = other.y_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Vector2 Clone() { + return new Vector2(this); + } + + /// Field number for the "x" field. + public const int XFieldNumber = 1; + private float x_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public float X { + get { return x_; } + set { + x_ = value; + } + } + + /// Field number for the "y" field. + public const int YFieldNumber = 2; + private float y_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public float 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 Vector2); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Vector2 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(X, other.X)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(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 (X != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(X); + if (Y != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Y); + 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 (X != 0F) { + output.WriteRawTag(13); + output.WriteFloat(X); + } + if (Y != 0F) { + output.WriteRawTag(21); + output.WriteFloat(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 (X != 0F) { + output.WriteRawTag(13); + output.WriteFloat(X); + } + if (Y != 0F) { + output.WriteRawTag(21); + output.WriteFloat(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 (X != 0F) { + size += 1 + 4; + } + if (Y != 0F) { + size += 1 + 4; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Vector2 other) { + if (other == null) { + return; + } + if (other.X != 0F) { + X = other.X; + } + if (other.Y != 0F) { + 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) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 13: { + X = input.ReadFloat(); + break; + } + case 21: { + Y = input.ReadFloat(); + 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 13: { + X = input.ReadFloat(); + break; + } + case 21: { + Y = input.ReadFloat(); + break; + } + } + } + } + #endif + + } + #endregion } diff --git a/Tools/ProtoBuf/proto/message.proto b/Tools/ProtoBuf/proto/message.proto index 2df54f8..f278d79 100644 --- a/Tools/ProtoBuf/proto/message.proto +++ b/Tools/ProtoBuf/proto/message.proto @@ -49,4 +49,57 @@ message SignupRequest { message SignupResponse { RequestResult result = 1; string message = 2; +} + +// 定义 FilePack 消息 +message FilePack { + string filePath = 1; + bytes content = 2; +} + +// 定义 DataPackListPack 消息 +message DataPackListPack { + repeated Pair packIDAndVersion = 1; + + // 定义内部的 Pair 消息(用于替代 Tuple) + message Pair { + string key = 1; + string value = 2; + } +} + +// 定义 TileMapTablePack 消息 +message TileMapTablePack { + map tileMapKey = 1; // 使用 int32 替代 int +} + +// 定义 MapDataPack 消息 +message MapDataPack { + Vector2 position = 1; + Vector2 size = 2; + repeated int32 tileMapType = 3; // 使用 int32 替代 int +} + +// 定义 MonsterAttributes 消息 +message MonsterAttributes { + int32 health = 1; + int32 moveSpeed = 2; + int32 attack = 3; + int32 defense = 4; + int32 attackSpeed = 5; + int32 attackRange = 6; + int32 attackTargetCount = 7; +} + +// 定义 MonsterPack 消息 +message MonsterPack { + int32 monsterID = 1; + Vector2 position = 2; + MonsterAttributes attributes = 3; +} + +// 定义 Vector2 消息 +message Vector2 { + float x = 1; + float y = 2; } \ No newline at end of file