diff --git a/Assets/ManagedResources/~Lua/Common/Language.lua b/Assets/ManagedResources/~Lua/Common/Language.lua index d99801dfd6..7a4d101780 100644 --- a/Assets/ManagedResources/~Lua/Common/Language.lua +++ b/Assets/ManagedResources/~Lua/Common/Language.lua @@ -2389,25 +2389,147 @@ [12388] = "该神将在巅峰战阵容中已上阵", [12389] = "包含4星或更高星级的神将", [12390] = "挑战关卡快速升级", - [12391] = "免疫", - [12392] = "放生灵兽", - [12393] = "无可放生灵兽", - [12394] = "请选择灵兽或灵兽碎片", - [12395] = "无法同时选择灵兽与灵兽碎片!", - [12396] = "最多选择%s个灵兽", - [12397] = "已提升至最高星级", - [12398] = "今日妖晶召唤次数不足!", - [12399] = " 免费召唤", - [12400] = "剩余%s次", - [12411] = "去激活", - [12412] = "重置时间:%s", - [12413] = "妖晶召唤次数:%s", - [12414] = "无法召唤,将超出今日召唤上限!", - [12415] = "每天增加3次免费召唤,妖晶召唤8折优惠", - [12416] = "今日召唤上限: %s/%s", - [12417] = "剩余:%s", - [12418] = "每次", - [12419] = "抢夺成功,获得%s积分!", - [12420] = "次数:", - [12421] = "积分:", + [12391] = "抢夺成功,获得%s积分!", + [12392] = "次数:", + [12393] = "积分:", + [12394] = "排名:", + [12395] = "每日奖励: ", + [12396] = "赛季奖励: ", + [12397] = "每日奖励: 暂无排名", + [12398] = "赛季奖励: 暂无排名", + [12399] = "积分: ", + [12400] = "赛季挑战:", + [12401] = "无可出售装备", + [12402] = "无可分解魂印", + [12403] = "灵兽", + [12404] = "无尽副本轮换前5分钟无法进入", + [12405] = "金币不足,无法合成", + [12406] = "虚位以待", + [12407] = "距离活动结束:", + [12408] = "每日累计充值金额达到条件,即可领取限时豪礼", + [12409] = "(购买礼包或者充值妖晶均计算在内)", + [12410] = "活动期间,累计充值金额达到条件,即可领取限时豪礼", + [12411] = "本活动需玩家等级达到五十级!", + [12412] = "请先加入公会!", + [12413] = "成功献出", + [12414] = "点贡献!", + [12415] = "保持排名可获得", + [12416] = "%)\n/分钟", + [12417] = "为获取到玩家信息!", + [12418] = "日常奖励", + [12419] = "个人奖励", + [12420] = "公会奖励", + [12421] = "排行奖励将在活动结束后通过邮件发放", + [12422] = "没有可申请的好友!", + [12423] = "已发送集结公告!", + [12424] = "距开始\n", + [12425] = "鏖战中", + [12426] = "距闯阵结束\n", + [12427] = "星激活", + [12428] = "(当前等级)", + [12429] = "升星", + [12430] = "出战灵兽无法进行涅槃!", + [12431] = "未培养灵兽无法进行涅槃!", + [12432] = "涅槃成功!", + [12433] = "当前无出战灵兽!", + [12434] = "当前等级", + [12435] = "下一等级", + [12436] = "今日妖晶召唤次数不足!", + [12437] = "免费召唤", + [12438] = "再来1次", + [12439] = "妖晶召唤次数:%s/%s", + [12440] = "赠送%s个%s", + [12441] = "去激活", + [12442] = "每天增加3次免费召唤,妖晶召唤8折优惠", + [12443] = "剩余%s次", + [12444] = "重置时间:%s", + [12445] = "再来10次", + [12446] = "已提升至最高星级", + [12447] = "技能", + [12448] = "灵兽属性会平分给上阵的所有神将", + [12449] = "查看详情", + [12450] = "】不足!", + [12451] = "灵兽提升", + [12452] = "升星要求", + [12453] = "属性加成:", + [12454] = "技能:", + [12455] = "灵兽羁绊", + [12456] = "获得下方所有灵兽后激活图鉴属性", + [12457] = "羁绊属性[已激活]", + [12458] = "羁绊属性[未激活]", + [12459] = "成功激活羁绊【%s】!", + [12460] = "灵兽列表", + [12461] = "未获得灵兽", + [12462] = "未获得灵兽碎片", + [12463] = "已出战", + [12464] = "休息中", + [12465] = "碎片数量不足!", + [12466] = "选择出战灵兽", + [12467] = "无可出战灵兽!", + [12468] = "领取条件未达成~", + [12469] = "上阵灵兽:", + [12470] = "灵兽涅槃", + [12471] = "涅槃", + [12472] = "确认花费  %s将%s涅槃为初始状态,并100%s返还养成消耗", + [12473] = "确认花费  %s将%s涅槃为初始状态,并100%s返还养成消耗", + [12474] = "确认放生", + [12475] = "放生后获得", + [12476] = "放生", + [12477] = "确认要放生所选的灵兽或灵兽碎片?", + [12478] = "出战加成", + [12479] = "出战灵兽对神将加成", + [12480] = "每次普通召唤获得1点仙缘积分\n每次友情召唤获得2点仙缘积分\n每次神将召唤获得20点仙缘积分", + [12481] = "确认花费%s妖晶进行1次灵兽召唤?", + [12482] = "确认花费%s妖晶进行10次灵兽召唤?", + [12483] = "恭送神将会获得仙缘余尘,若神将已升级,突破或进阶,还会返还%s%s消耗的金币、成长护符和九转金丹,是否确定恭送所选神将?\n\n\t\t\t\t\t\t\t送神后获得:", + [12484] = "归元神将会返还所有的升级材料,神将重置为1级,此操作不可逆,是否确认归元?\n\n\t\t\t\t\t\t\t归元后获得:", + [12485] = "%s的法宝会重置为1阶,并返还进阶时消耗的金币和陨铁,是否确认归元?\n\n\t\t\t\t\t\t\t归元后获得:", + [12486] = "当前不可使用炸弹!", + [12487] = "恢复50点云游值!", + [12488] = "云游宝玉不足", + [12489] = "试炼层数", + [12490] = "幻境层数", + [12491] = "贡献度", + [12492] = "贡献度:", + [12493] = "15日限购", + [12494] = "0分", + [12495] = "金色灵兽", + [12496] = "紫色灵兽", + [12497] = "蓝色灵兽", + [12498] = "灵兽材料", + [12499] = "放生灵兽", + [12500] = "无可放生灵兽", + [12501] = "请选择灵兽或灵兽碎片", + [12502] = "最多选择%s个灵兽", + [12503] = "无法同时选择灵兽与灵兽碎片!", + [12504] = "第\n%s\n天", + [12505] = "明\n日\n开\n启", + [12506] = "未\n开\n启", + [12507] = "恭喜您通关", + [12508] = ",我们为您准备了超值礼包,帮助您快速通关", + [12509] = "恭喜您通过心魔试炼", + [12510] = "层,我们为您准备了超值礼包,帮助您快速通关", + [12511] = "确定花费", + [12512] = "招募[", + [12513] = "是否确认", + [12514] = "东海寻仙", + [12515] = "幻魔入侵", + [12516] = "幸运转盘", + [12517] = "剩余次数:", + [12518] = "退出后将停止自动游历,确定离开?", + [12519] = "云游值不足,休息一会吧!", + [12520] = "已到达终点,是否重新云游!", + [12521] = "游历进度:%d%%", + [12522] = "奖励翻倍!", + [12523] = "本轮获得疾如闪电效果", + [12524] = "触发仙缘★%s★", + [12525] = "地图尚未开启!", + [12526] = "云\n游\n进\n度", + [12527] = "敬\n请\n期\n待", + [12528] = "玩\n家\n等\n级", + [12529] = "解\n锁", + [12530] = "请\n完\n成\n上\n一\n地\n图", + [12531] = "寻宝排行", + [12532] = "天宫排行", + [12533] = "森罗幻境", } diff --git a/Assets/Scripts/Editor/LanguageTool/LanguageTool.cs b/Assets/Scripts/Editor/LanguageTool/LanguageTool.cs index e7b6fe04e3..694e941246 100644 --- a/Assets/Scripts/Editor/LanguageTool/LanguageTool.cs +++ b/Assets/Scripts/Editor/LanguageTool/LanguageTool.cs @@ -49,7 +49,7 @@ namespace Assets.Scripts.Editor.LanguageTool { File.Create(CSVPath).Dispose(); } - + // time.Start(); string[] filestr = File.ReadAllLines(CSVPath, System.Text.Encoding.Default); @@ -108,7 +108,7 @@ namespace Assets.Scripts.Editor.LanguageTool time.Start(); // 构建数据 int keyCount = ID2L.Keys.Count; - string[] strList = new string[keyCount+2]; + string[] strList = new string[keyCount + 2]; strList[0] = "Language = {"; int i = 1; foreach (int id in ID2L.Keys) @@ -234,7 +234,7 @@ namespace Assets.Scripts.Editor.LanguageTool int resizeTextMinSize = t.resizeTextMinSize; int resizeTextMaxSize = t.resizeTextMaxSize; bool raycastTarget = t.raycastTarget; - + UnityEngine.Object.DestroyImmediate(t, true); try @@ -255,7 +255,7 @@ namespace Assets.Scripts.Editor.LanguageTool lt.resizeTextMaxSize = resizeTextMaxSize; lt.raycastTarget = raycastTarget; } - catch(Exception e) + catch (Exception e) { Debug.LogWarning(e.Message); } @@ -268,12 +268,12 @@ namespace Assets.Scripts.Editor.LanguageTool { if (EditorUtility.DisplayDialog("转换提示", "此操作会将所有Prefrab中的包含中文字符的Text组件转换为LanguageText组件,是否继续?", "是", "否")) //显示对话框 { - + string[] allPath = AssetDatabase.FindAssets("t:Prefab", PrefrabPath); - + time.Start(); for (int i = 0; i < allPath.Length; i++) - { + { string path = AssetDatabase.GUIDToAssetPath(allPath[i]); EditorUtility.DisplayProgressBar(string.Format("({0}/{1})", i, allPath.Length), "正在转换:" + path, (float)i / allPath.Length); @@ -422,7 +422,8 @@ namespace Assets.Scripts.Editor.LanguageTool private static void CheckLuaPath(string path) { string[] lines = File.ReadAllLines(path, System.Text.Encoding.UTF8); - if(lines.Length <=0){ + if (lines.Length <= 0) + { return; } string[] wlines = new string[lines.Length - 1]; @@ -444,10 +445,50 @@ namespace Assets.Scripts.Editor.LanguageTool } } - if(lIndex == lines.Length - 1) + if (lIndex == lines.Length - 1) { lastLine = lines[lIndex]; - }else + } + else + { + wlines[lIndex] = lines[lIndex]; + } + } + File.WriteAllLines(path, wlines, System.Text.Encoding.UTF8); + File.AppendAllText(path, lastLine, System.Text.Encoding.UTF8); + } + // 遍历lua文件的每一行找到 中文数据并替换 + private static void RevertLuaPath(string path, Dictionary o) + { + string[] lines = File.ReadAllLines(path, System.Text.Encoding.UTF8); + if (lines.Length <= 0) + { + return; + } + string[] wlines = new string[lines.Length - 1]; + string lastLine = ""; + for (int lIndex = 0; lIndex < lines.Length; lIndex++) + { + string line = lines[lIndex].Trim(); + Regex reg = new Regex("Language\\[[^Language\\[]*?[0-9][^\\]]*?\\]");//正则表达式,判断是否包含中文字符 + if (reg.IsMatch(line)) + { + MatchCollection mc = reg.Matches(line); + for (int mi = 0; mi < mc.Count; mi++) + { + string r = mc[mi].Value.Trim(); + int id = Convert.ToInt32(r.Substring(9, 5)); + Debug.Log(id); + string t = o[id]; + lines[lIndex] = lines[lIndex].Replace(r, t); + } + } + + if (lIndex == lines.Length - 1) + { + lastLine = lines[lIndex]; + } + else { wlines[lIndex] = lines[lIndex]; } @@ -512,6 +553,69 @@ namespace Assets.Scripts.Editor.LanguageTool } + // 将language.lua中的中文还原到代码中 + [MenuItem("LanguageTool/lua/Revert Language To Code")] + private static void RevertLanguage() + { + Dictionary o = ReadFromLanguage(); + + // 检索 + for (int i = 0; i < LuaPath.Length; i++) + { + string folderPath = LuaPath[i]; + string[] pathList = Directory.GetFiles(folderPath, "*.lua", SearchOption.AllDirectories); + for (int pIndex = 0; pIndex < pathList.Length; pIndex++) + { + EditorUtility.DisplayProgressBar(string.Format(folderPath + "({0}/{1})", pIndex, pathList.Length), "正在还原数据:", (float)pIndex / pathList.Length); + RevertLuaPath(pathList[pIndex], o); + } + } + // 特殊lua文件 + for (int pIndex = 0; pIndex < SpecialLuaPath.Length; pIndex++) + { + EditorUtility.DisplayProgressBar(SpecialLuaPath[pIndex], "正在还原数据:", (float)pIndex / SpecialLuaPath.Length); + RevertLuaPath(SpecialLuaPath[pIndex], o); + } + + + EditorUtility.ClearProgressBar(); + + + } + + // 从language.lua中读取数据 + [MenuItem("LanguageTool/lua/读取language.lua")] + private static Dictionary ReadFromLanguage() + { + + Dictionary o = new Dictionary(); + // + if (!File.Exists(LuaDataPath)) + { + Debug.LogError("未找到language.lua"); + return o; + } + // + string[] lines = File.ReadAllLines(LuaDataPath, System.Text.Encoding.UTF8); + if (lines.Length <= 0) + { + return o; + } + // + for (int i = 0; i < lines.Length; i++) + { + string str = lines[i].Trim(); + if (str.StartsWith("[")) + { + int num = Convert.ToInt32(str.Substring(1, 5)); + string content = str.Substring(10, str.Length - 11); + o.Add(num, content); + } + } + return o; + } + + // 遍历lua文件的每一行找到 log打印并删除