From a43a2d78138612102819d1e767b96fb374b698f3 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 18 三月 2021 15:33:27 +0800
Subject: [PATCH] 0312 IL表代码生成优化,foreach改for;增加快捷创建红点;IL绑定常用表

---
 Assets/Editor/Tool/ConfigClassGenerate.cs |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Assets/Editor/Tool/ConfigClassGenerate.cs b/Assets/Editor/Tool/ConfigClassGenerate.cs
index da1f053..0efc865 100644
--- a/Assets/Editor/Tool/ConfigClassGenerate.cs
+++ b/Assets/Editor/Tool/ConfigClassGenerate.cs
@@ -267,11 +267,11 @@
             newConfigPath = configClassPath + string.Format("/{0}Config.cs", _name);
         } 
         AssetDatabase.DeleteAsset(newConfigPath);
-        UnityEngine.Object o = CreateScriptAssetFromTemplate(newConfigPath, templatePath);
+        UnityEngine.Object o = CreateScriptAssetFromTemplate(newConfigPath, templatePath, isIL);
         ProjectWindowUtil.ShowCreatedAsset(o);
     }
 
-    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile)
+    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile, bool isIL)
     {
         string fullPath = Path.GetFullPath(pathName);
 
@@ -283,7 +283,14 @@
         text = Regex.Replace(text, "#DateTime#", System.DateTime.Now.ToLongDateString());
         text = Regex.Replace(text, "#Field#", CreateConfigClassFile.filedContent);
         text = Regex.Replace(text, "#Read#", CreateConfigClassFile.readContent);
-        text = Regex.Replace(text, "#FileName#", fileNameWithoutExtension.Substring(0, fileNameWithoutExtension.Length - 6));
+        if (isIL)
+        {
+            text = Regex.Replace(text, "#FileName#", fileNameWithoutExtension.Substring(2, fileNameWithoutExtension.Length - 8));
+        }
+        else
+        { 
+            text = Regex.Replace(text, "#FileName#", fileNameWithoutExtension.Substring(0, fileNameWithoutExtension.Length - 6));
+        }
 
         bool encoderShouldEmitUTF8Identifier = true;
         bool throwOnInvalidBytes = false;

--
Gitblit v1.8.0