Update - 1.4.0.73
EN: 1.4.0.73 CN: 1.4.0.74 JP: 1.4.0.77 KR: 1.4.0.80
This commit is contained in:
@@ -838,7 +838,7 @@ function AvgEditorCtrl:OnDD_VoLan(dd)
|
||||
end
|
||||
end
|
||||
function AvgEditorCtrl:OnBtn_Back()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ExeEditor)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.AvgEditor)
|
||||
end
|
||||
function AvgEditorCtrl:OnBtnClick_PreviewShake(btn)
|
||||
local node = self._mapNode
|
||||
|
||||
@@ -19,6 +19,15 @@ AvgEditorMultiLanTool._mapNodeConfig = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_SellectNone_InCurLuaGroup"
|
||||
},
|
||||
tog_SortByMergeTime = {
|
||||
sComponentName = "Toggle",
|
||||
callback = "OnToggle_SortByMergeTime"
|
||||
},
|
||||
input_Search = {
|
||||
sComponentName = "InputField",
|
||||
callback = "OnInput_Search"
|
||||
},
|
||||
toggles = {sComponentName = "Transform"},
|
||||
tbTog = {
|
||||
nCount = 9,
|
||||
sNodeName = "tog_",
|
||||
@@ -36,7 +45,9 @@ AvgEditorMultiLanTool._mapNodeConfig = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_ProcMultiLanguage"
|
||||
},
|
||||
procContent = {sComponentName = "Transform"}
|
||||
procContent = {sComponentName = "Transform"},
|
||||
goProcResult = {},
|
||||
txtProcResult = {sComponentName = "Text"}
|
||||
}
|
||||
AvgEditorMultiLanTool._mapEventConfig = {}
|
||||
function AvgEditorMultiLanTool:Awake()
|
||||
@@ -54,8 +65,9 @@ function AvgEditorMultiLanTool:Awake()
|
||||
self.nToLanIdx = 2
|
||||
NovaAPI.SetDropDownValue(self._mapNode.dd_MultiLanFrom, self.nFromLanIdx - 1)
|
||||
NovaAPI.SetDropDownValue(self._mapNode.dd_MultiLanTo, self.nToLanIdx - 1)
|
||||
self.bSortByTime = false
|
||||
end
|
||||
function AvgEditorMultiLanTool:OnBtn_Refresh()
|
||||
function AvgEditorMultiLanTool:OnBtn_Refresh(sSearchKeyWord)
|
||||
if self.nFromLanIdx == self.nToLanIdx then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
@@ -71,18 +83,71 @@ function AvgEditorMultiLanTool:OnBtn_Refresh()
|
||||
sWriteFileRoot = sWriteFileRoot .. sRequireRoot
|
||||
local sRootConfig = sWriteFileRoot .. "Config/"
|
||||
local sRootPreset = sWriteFileRoot .. "Preset/"
|
||||
local func_CollectLuaFileName = function(sRoot, sPattern)
|
||||
local func_CollectLuaFileName = function(sRoot, sPattern, sAdd)
|
||||
local files = CS_SYS_IO.Directory.GetFiles(sRoot, sPattern, CS_SYS_IO.SearchOption.TopDirectoryOnly)
|
||||
local nFileCount = files.Length - 1
|
||||
local tbFileName = {}
|
||||
for i = 0, nFileCount do
|
||||
local sFileName = string.gsub(CS_SYS_IO.Path.GetFileName(files[i]), ".lua", "")
|
||||
table.insert(tbFileName, {sName = sFileName, bSelected = false})
|
||||
if type(sSearchKeyWord) == "string" and sSearchKeyWord ~= "" then
|
||||
if string.find(string.lower(sFileName), string.lower(sSearchKeyWord), 1, true) ~= nil then
|
||||
local mt = NovaAPI.FileGetLastWriteTime(files[i])
|
||||
table.insert(tbFileName, {
|
||||
sName = sFileName,
|
||||
bSelected = false,
|
||||
nModifyTime = mt,
|
||||
nDefaultIdx = i + 1
|
||||
})
|
||||
end
|
||||
else
|
||||
local mt = NovaAPI.FileGetLastWriteTime(files[i])
|
||||
table.insert(tbFileName, {
|
||||
sName = sFileName,
|
||||
bSelected = false,
|
||||
nModifyTime = mt,
|
||||
nDefaultIdx = i + 1
|
||||
})
|
||||
end
|
||||
end
|
||||
if sAdd ~= nil then
|
||||
local files = CS_SYS_IO.Directory.GetFiles(sAdd, sPattern, CS_SYS_IO.SearchOption.TopDirectoryOnly)
|
||||
local nFileCount = files.Length - 1
|
||||
for i = 0, nFileCount do
|
||||
local sFileName = string.gsub(CS_SYS_IO.Path.GetFileName(files[i]), ".lua", "")
|
||||
if type(sSearchKeyWord) == "string" and sSearchKeyWord ~= "" then
|
||||
if string.find(string.lower(sFileName), string.lower(sSearchKeyWord), 1, true) ~= nil then
|
||||
local mt = NovaAPI.FileGetLastWriteTime(files[i])
|
||||
table.insert(tbFileName, {
|
||||
sName = sFileName,
|
||||
bSelected = false,
|
||||
nModifyTime = mt,
|
||||
nDefaultIdx = i + 1
|
||||
})
|
||||
end
|
||||
else
|
||||
local mt = NovaAPI.FileGetLastWriteTime(files[i])
|
||||
table.insert(tbFileName, {
|
||||
sName = sFileName,
|
||||
bSelected = false,
|
||||
nModifyTime = mt,
|
||||
nDefaultIdx = i + 1
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.bSortByTime == true then
|
||||
table.sort(tbFileName, function(a, b)
|
||||
if a.nModifyTime == b.nModifyTime then
|
||||
return a.nDefaultIdx < b.nDefaultIdx
|
||||
else
|
||||
return a.nModifyTime > b.nModifyTime
|
||||
end
|
||||
end)
|
||||
end
|
||||
return tbFileName
|
||||
end
|
||||
self.tbLuaFileName = {}
|
||||
self.tbLuaFileName[1] = 0
|
||||
self.tbLuaFileName[1] = func_CollectLuaFileName(sRootConfig, "*.lua", sRootPreset)
|
||||
self.tbLuaFileName[2] = func_CollectLuaFileName(sRootConfig, "BB*.lua")
|
||||
self.tbLuaFileName[3] = func_CollectLuaFileName(sRootConfig, "BT*.lua")
|
||||
self.tbLuaFileName[4] = func_CollectLuaFileName(sRootConfig, "CG*.lua")
|
||||
@@ -105,35 +170,50 @@ function AvgEditorMultiLanTool:OnDD_LanTo()
|
||||
self.nToLanIdx = NovaAPI.GetDropDownValue(self._mapNode.dd_MultiLanTo) + 1
|
||||
end
|
||||
function AvgEditorMultiLanTool:OnBtn_SelectAll_InCurLuaGroup()
|
||||
if self.nCurTogIdx == 1 then
|
||||
local nTogCount = #self.tbLuaFileName
|
||||
for i = 2, nTogCount do
|
||||
for ii, vv in ipairs(self.tbLuaFileName[i]) do
|
||||
local tbNames = {}
|
||||
for i, v in ipairs(self.tbLuaFileName[self.nCurTogIdx]) do
|
||||
v.bSelected = true
|
||||
table.insert(tbNames, v.sName)
|
||||
end
|
||||
local nFrom = self.nCurTogIdx == 1 and 2 or 1
|
||||
local nTo = self.nCurTogIdx == 1 and #self.tbLuaFileName or 1
|
||||
for i = nFrom, nTo do
|
||||
local tb = self.tbLuaFileName[i]
|
||||
for ii, vv in ipairs(tb) do
|
||||
if table.indexof(tbNames, vv.sName) > 0 then
|
||||
vv.bSelected = true
|
||||
end
|
||||
end
|
||||
else
|
||||
for i, v in ipairs(self.tbLuaFileName[self.nCurTogIdx]) do
|
||||
v.bSelected = true
|
||||
end
|
||||
end
|
||||
self._mapNode.lsv_multi_lan:ForceRefresh()
|
||||
end
|
||||
function AvgEditorMultiLanTool:OnBtn_SellectNone_InCurLuaGroup()
|
||||
if self.nCurTogIdx == 1 then
|
||||
local nTogCount = #self.tbLuaFileName
|
||||
for i = 2, nTogCount do
|
||||
for ii, vv in ipairs(self.tbLuaFileName[i]) do
|
||||
local tbNames = {}
|
||||
for i, v in ipairs(self.tbLuaFileName[self.nCurTogIdx]) do
|
||||
v.bSelected = false
|
||||
table.insert(tbNames, v.sName)
|
||||
end
|
||||
local nFrom = self.nCurTogIdx == 1 and 2 or 1
|
||||
local nTo = self.nCurTogIdx == 1 and #self.tbLuaFileName or 1
|
||||
for i = nFrom, nTo do
|
||||
local tb = self.tbLuaFileName[i]
|
||||
for ii, vv in ipairs(tb) do
|
||||
if table.indexof(tbNames, vv.sName) > 0 then
|
||||
vv.bSelected = false
|
||||
end
|
||||
end
|
||||
else
|
||||
for i, v in ipairs(self.tbLuaFileName[self.nCurTogIdx]) do
|
||||
v.bSelected = false
|
||||
end
|
||||
end
|
||||
self._mapNode.lsv_multi_lan:ForceRefresh()
|
||||
end
|
||||
function AvgEditorMultiLanTool:OnToggle_SortByMergeTime()
|
||||
self.bSortByTime = NovaAPI.GetToggleIsOn(self._mapNode.tog_SortByMergeTime)
|
||||
self:OnBtn_Refresh()
|
||||
end
|
||||
function AvgEditorMultiLanTool:OnInput_Search()
|
||||
local sSearchKeyWord = NovaAPI.GetInputFieldText(self._mapNode.input_Search)
|
||||
self._mapNode.toggles.localScale = sSearchKeyWord == "" and Vector3.one or Vector3.zero
|
||||
self:OnBtn_Refresh(sSearchKeyWord)
|
||||
end
|
||||
function AvgEditorMultiLanTool:onToggle_LuaGroup(toggle, nIndex, bIsOn)
|
||||
if bIsOn == false then
|
||||
return
|
||||
@@ -157,6 +237,10 @@ function AvgEditorMultiLanTool:InitLSV()
|
||||
for i = 2, nTogCount do
|
||||
nCount = nCount + #self.tbLuaFileName[i]
|
||||
end
|
||||
if nCount ~= #self.tbLuaFileName[1] then
|
||||
printError("演出配置文件数量统计有误!")
|
||||
nCount = 0
|
||||
end
|
||||
else
|
||||
nCount = #self.tbLuaFileName[self.nCurTogIdx]
|
||||
end
|
||||
@@ -184,24 +268,23 @@ function AvgEditorMultiLanTool:OnGridBtnClick(go)
|
||||
end
|
||||
tbGridData.bSelected = not tbGridData.bSelected
|
||||
NovaAPI.SetImageColor(go:GetComponent("Image"), tbGridData.bSelected == true and Color.green or Color.white)
|
||||
end
|
||||
function AvgEditorMultiLanTool:GetGridData(nIndex)
|
||||
if self.nCurTogIdx == 1 then
|
||||
local nTogCount = #self.tbLuaFileName
|
||||
local n = 0
|
||||
for i = 2, nTogCount do
|
||||
for ii, vv in ipairs(self.tbLuaFileName[i]) do
|
||||
n = n + 1
|
||||
if n == nIndex then
|
||||
return self.tbLuaFileName[i][ii]
|
||||
end
|
||||
local sName = tbGridData.sName
|
||||
local bSelected = tbGridData.bSelected
|
||||
local nFrom = self.nCurTogIdx == 1 and 2 or 1
|
||||
local nTo = self.nCurTogIdx == 1 and #self.tbLuaFileName or 1
|
||||
for i = nFrom, nTo do
|
||||
local tb = self.tbLuaFileName[i]
|
||||
for ii, vv in ipairs(tb) do
|
||||
if vv.sName == sName then
|
||||
vv.bSelected = bSelected
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
local tb = self.tbLuaFileName[self.nCurTogIdx]
|
||||
return tb[nIndex]
|
||||
end
|
||||
return nil
|
||||
end
|
||||
function AvgEditorMultiLanTool:GetGridData(nIndex)
|
||||
local tb = self.tbLuaFileName[self.nCurTogIdx]
|
||||
return tb[nIndex]
|
||||
end
|
||||
function AvgEditorMultiLanTool:OnBtnClick_ProcMultiLanguage()
|
||||
local tbSelected = {}
|
||||
@@ -261,13 +344,12 @@ function AvgEditorMultiLanTool:OnBtnClick_ProcMultiLanguage()
|
||||
local sFromLan = AllEnum.LanguageInfo[nLanguageIndex_From][2]
|
||||
local sToLan = AllEnum.LanguageInfo[nLanguageIndex_To][2]
|
||||
local sLogTitle = string.format("----------【本地化处理日志】From:%s To:%s date:%s----------\n", sFromLan, sToLan, timeString)
|
||||
sw:Write(sLogTitle .. sProcLog)
|
||||
local sCurLog = sLogTitle .. sProcLog
|
||||
sw:Write(sCurLog)
|
||||
sw:Close()
|
||||
fs:Close()
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = "多语言处理已完成,详见处理日志。\n" .. sProcLogPath
|
||||
})
|
||||
NovaAPI.SetText(self._mapNode.txtProcResult, sCurLog)
|
||||
self._mapNode.goProcResult:SetActive(true)
|
||||
end
|
||||
function AvgEditorMultiLanTool:_ProcSingleLuaFile(sLuaFolder, sLuaFileName, tbLuaData, sWriteTo)
|
||||
local sExcelPath_1 = sWriteTo .. "Excel_1_ToBeTranslate/" .. sLuaFileName .. ".xlsx"
|
||||
@@ -278,7 +360,7 @@ function AvgEditorMultiLanTool:_ProcSingleLuaFile(sLuaFolder, sLuaFileName, tbLu
|
||||
func_Export = self._Export_Text
|
||||
end
|
||||
local tbExportData = func_Export(self, tbLuaData)
|
||||
NovaAPI.WriteDataToExcel(tbExportData, sExcelPath_1)
|
||||
NovaAPI.WriteDataToExcel(tbExportData, sExcelPath_1, true)
|
||||
if CS_SYS_IO.File.Exists(sExcelPath_2) == true then
|
||||
CS_SYS_IO.File.Delete(sExcelPath_1)
|
||||
return sLuaFileName .. " 正在翻译中需稍后处理。\n"
|
||||
@@ -293,7 +375,7 @@ function AvgEditorMultiLanTool:_ProcSingleLuaFile(sLuaFolder, sLuaFileName, tbLu
|
||||
end
|
||||
local bSame, tbOverwriteTranslatedData = func_Compare(self, tbTranslatedData, tbExportData)
|
||||
if bSame == false then
|
||||
return sLuaFileName .. " 文本有变动,需要更新已翻译完的 excel 数据。\n"
|
||||
return sLuaFileName .. " <color=red>文本有变动,需要更新已翻译完的 excel 数据。</color>\n"
|
||||
else
|
||||
if tbOverwriteTranslatedData ~= nil then
|
||||
NovaAPI.WriteDataToExcel(tbOverwriteTranslatedData, sExcelPath_3)
|
||||
@@ -304,6 +386,9 @@ function AvgEditorMultiLanTool:_ProcSingleLuaFile(sLuaFolder, sLuaFileName, tbLu
|
||||
func_Import = self._Import_Text
|
||||
end
|
||||
tbLuaData = func_Import(self, tbTranslatedData, tbLuaData)
|
||||
if tbLuaData == nil then
|
||||
return sLuaFileName .. " <color=red>由于路人角色名未翻译,跳过处理。</color>\n"
|
||||
end
|
||||
local sWriteLuaPath = sWriteTo .. sLuaFolder .. sLuaFileName .. ".lua"
|
||||
if sLuaFolder == "Preset/" then
|
||||
local tbLineData = {}
|
||||
@@ -360,7 +445,7 @@ function AvgEditorMultiLanTool:_ProcSingleLuaFile(sLuaFolder, sLuaFileName, tbLu
|
||||
else
|
||||
EventManager.Hit("AvgMultiLanTool_SAVE_AVG_CONFIG", tbLuaData, sWriteLuaPath)
|
||||
end
|
||||
return sLuaFileName .. " 已完成本地化,应与 excel 一起提交至P4。\n"
|
||||
return sLuaFileName .. " <color=green>已完成本地化,应与 excel 一起提交至P4。</color>\n"
|
||||
end
|
||||
end
|
||||
function AvgEditorMultiLanTool:_GetAvgCharName(sAvgCharId)
|
||||
@@ -1353,6 +1438,9 @@ function AvgEditorMultiLanTool:_Import_Text(tbTranslatedData, tbLuaData)
|
||||
local bExist, sCharName = self:_GetAvgCharName(sAvgCharId)
|
||||
if bExist == false then
|
||||
v.param[2] = rowData[1]
|
||||
if v.param[2] == nil or v.param[2] == "" then
|
||||
return nil
|
||||
end
|
||||
end
|
||||
v.param[3] = self:_ProcText(rowData[3], false)
|
||||
v.param[7] = self:_ProcText(rowData[5], false)
|
||||
|
||||
Reference in New Issue
Block a user