From 95dfac52944cf27d7c9124942959efaadc9f88ce Mon Sep 17 00:00:00 2001 From: ALEXTANGXIAO <574809918@qq.com> Date: Wed, 6 Sep 2023 00:13:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=99=AE=E9=80=9A=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E5=AF=B9=E8=B1=A1=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=B8=8D=E5=8A=A0=E5=85=A5opcode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持普通协议对象数据结构不加入opcode --- .../Core/Exporter/ProtoBuf/ProtoBufExporter.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Assets/GameScripts/DotNet/Core/Exporter/ProtoBuf/ProtoBufExporter.cs b/Assets/GameScripts/DotNet/Core/Exporter/ProtoBuf/ProtoBufExporter.cs index 1b5f5f24..975cc8be 100644 --- a/Assets/GameScripts/DotNet/Core/Exporter/ProtoBuf/ProtoBufExporter.cs +++ b/Assets/GameScripts/DotNet/Core/Exporter/ProtoBuf/ProtoBufExporter.cs @@ -179,6 +179,8 @@ public sealed class ProtoBufExporter foreach (var line in protoFileText.Split('\n')) { + bool hadOpCode = true; + var currentLine = line.Trim(); if (string.IsNullOrWhiteSpace(currentLine)) @@ -249,7 +251,11 @@ public sealed class ProtoBufExporter { file.AppendLine("\n\t{"); - if (string.IsNullOrWhiteSpace(parameter) || parameter == "IMessage") + if (string.IsNullOrWhiteSpace(parameter)) + { + hadOpCode = false; + } + else if(parameter == "IMessage") { opcodeInfo.Code = _opCodeCache.GetOpcodeCache(className, ref _aMessage); file.AppendLine($"\t\tpublic uint OpCode() {{ return {opCodeName}.{className}; }}"); @@ -328,7 +334,10 @@ public sealed class ProtoBufExporter } } - _opcodes.Add(opcodeInfo); + if (hadOpCode) + { + _opcodes.Add(opcodeInfo); + } continue; } case "}":