Update ProtoGenTools.cs

This commit is contained in:
ALEXTANG
2023-04-23 15:54:20 +08:00
parent c9016bf72e
commit 77af3ac457

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using UnityEngine;
#if UNITY_EDITOR #if UNITY_EDITOR
using UnityEditor; using UnityEditor;
#endif #endif
@@ -16,7 +17,7 @@ namespace TEngine.Editor
public static void Export() public static void Export()
{ {
InnerProto2CS.Proto2CS(); InnerProto2CS.Proto2CS();
Log.Info("proto2cs succeed!"); Debug.Log("proto2cs succeed!");
} }
} }
@@ -47,10 +48,19 @@ namespace TEngine.Editor
string s = File.ReadAllText(proto); string s = File.ReadAllText(proto);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append("//------------------------------------------------------------------------------\n");
sb.Append("// <auto-generated>\n");
sb.Append("// This code was generated by a tool.\n");
sb.Append("// Changes to this file may cause incorrect behavior and will be lost if\n");
sb.Append("// the code is regenerated.\n");
sb.Append("// </auto-generated>\n");
sb.Append("//------------------------------------------------------------------------------\n");
sb.Append("\n");
sb.Append("using System;\n"); sb.Append("using System;\n");
sb.Append("using ProtoBuf;\n"); sb.Append("using ProtoBuf;\n");
sb.Append("using TEngine;\n"); sb.Append("using TEngine;\n");
sb.Append("using System.Collections.Generic;\n"); sb.Append("using System.Collections.Generic;\n");
sb.Append("\n");
sb.Append($"namespace {nameSpace}\n"); sb.Append($"namespace {nameSpace}\n");
sb.Append("{\n"); sb.Append("{\n");
@@ -189,7 +199,7 @@ namespace TEngine.Editor
{ {
using (StreamWriter sw = new StreamWriter(txt)) using (StreamWriter sw = new StreamWriter(txt))
{ {
Log.Debug(sb.ToString()); Debug.Log(sb.ToString());
sw.Write(sb.ToString()); sw.Write(sb.ToString());
} }
} }