|
|
@@ -189,7 +189,7 @@ public class CheckHotUpdateRes : EditorWindow
|
|
|
|
|
|
if (GUILayout.Button("Tolua"))
|
|
|
{
|
|
|
- AddLuaWrapBenginClassType("");
|
|
|
+ ChangeLuaWrapCs();
|
|
|
}
|
|
|
GUILayout.Box("", GUILayout.Width(790));
|
|
|
GUILayout.BeginHorizontal();
|
|
|
@@ -451,9 +451,27 @@ public class CheckHotUpdateRes : EditorWindow
|
|
|
string datapath = $"{Application.dataPath}/Content/Icons/";
|
|
|
FileHelper.CopyDir(datapath, info.OutputPath, "meta");
|
|
|
}
|
|
|
+ private void ChangeLuaWrapCs()
|
|
|
+ {
|
|
|
+ //ChangeLuaWrapCs("ToLua/BaseType");
|
|
|
+ ChangeLuaWrapCs("ToLua/Source/Generate");
|
|
|
+ }
|
|
|
+ private void ChangeLuaWrapCs(string path)
|
|
|
+ {
|
|
|
+ string luapath = $"{Application.dataPath}/{path}";//ToLua/BaseType//ToLua/Source/Generate
|
|
|
+ string[] files1 = FileHelper.GetAllFileNmae(luapath, "meta");
|
|
|
+ int size = files1.Length;
|
|
|
+ string datapath = $"{luapath}/";
|
|
|
+ for (int i = 0; i < size; i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ //AddLuaWrapBenginClassType(datapath + files1[i]);
|
|
|
+ AddLuaWrapBenginClassType(datapath + files1[i], "BeginEnum");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//L.BeginClass(typeof(SingletonMono<LuaMgr>), typeof(MonoBase), \"SingletonMono_LuaMgr\");
|
|
|
- private void AddLuaWrapBenginClassType(string path)
|
|
|
+ private void AddLuaWrapBenginClassType(string path,string ckStr = "BeginClass")
|
|
|
{
|
|
|
if (String.IsNullOrEmpty(path)) return;
|
|
|
string[] fdatas = File.ReadAllLines(path); //new string[] { "L.BeginClass(typeof(SingletonMono<LuaMgr>), typeof(MonoBase), \"SingletonMono_LuaMgr\");" };//
|
|
|
@@ -461,18 +479,41 @@ public class CheckHotUpdateRes : EditorWindow
|
|
|
string newstr = "";
|
|
|
for (int i = 0; i < length; i++)
|
|
|
{
|
|
|
- if (fdatas[i].Contains("BeginClass"))
|
|
|
+ if (fdatas[i].Contains(ckStr))
|
|
|
{
|
|
|
string[] strarr = fdatas[i].Split("typeof(",StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
|
string classname = strarr[1].Substring(0, strarr[1].IndexOf(")"));
|
|
|
+ if (classname.Contains("."))
|
|
|
+ {
|
|
|
+ int stid = classname.LastIndexOf('.');
|
|
|
+ classname = classname.Substring(stid+1);
|
|
|
+ }
|
|
|
|
|
|
if (classname.Contains("<"))
|
|
|
{
|
|
|
string[] names = classname.Split(new char[]{ '<','>'},StringSplitOptions.RemoveEmptyEntries);
|
|
|
+ if (names.Length == 1)
|
|
|
+ {
|
|
|
+ classname = names[0];
|
|
|
+ }
|
|
|
+ else if (names[1].Contains(','))
|
|
|
+ {
|
|
|
+ string[] subNames = names[1].Split(',',StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
|
+ classname = names[0];
|
|
|
|
|
|
- classname = $"{names[0]}_{names[1]}";
|
|
|
+ foreach (var item in subNames)
|
|
|
+ {
|
|
|
+ classname = $"{classname}_{item}";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ classname = $"{names[0]}_{names[1]}";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
Debug.Log($"Class Name = {classname}");
|
|
|
string nameStr = $"\"{classname}\"";
|