【本地化】GM界面不再翻译
parent
e55e8b51ee
commit
8e677abe4e
|
@ -23,26 +23,7 @@ local function createPanel(uiConfig, parent)
|
|||
recTransform.anchoredPosition3D = Vector3.New(0, 0, 0)
|
||||
recTransform.sizeDelta = Vector2.New(0, 0)
|
||||
transform.localRotation = Quaternion.identity
|
||||
if GetCurLanguage()~=0 then
|
||||
local textArr=gameObject:GetComponentsInChildren(typeof(UnityEngine.UI.Text),true);
|
||||
for i = 0, textArr.Length-1 do
|
||||
local textStr=textArr[i].text
|
||||
textArr[i].text=GetLanguageStrById(textStr)
|
||||
if GetCurLanguage() == 2 and textArr[i].font and (string.find(textArr[i].font.name,"kaiu",1) or string.find(textArr[i].font.name,"FZJinLS",1)) then
|
||||
textArr[i].font = Util.LoadFont()
|
||||
end
|
||||
end
|
||||
local imageArr=gameObject:GetComponentsInChildren(typeof(UnityEngine.UI.Image),true);
|
||||
for i = 0, imageArr.Length-1 do
|
||||
if imageArr[i].sprite then
|
||||
local imgStr=imageArr[i].sprite.name
|
||||
if string.sub(imgStr,-3)=="_zh" then
|
||||
imageArr[i].sprite=Util.LoadSprite(imgStr)
|
||||
Log("资源名称:"..imgStr)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
UIManager.DoLanguageCheck(gameObject)
|
||||
return gameObject
|
||||
end
|
||||
|
||||
|
|
|
@ -612,27 +612,8 @@ function UIManager.CreatePanel(uiConfig, parent)
|
|||
recTransform.anchoredPosition3D = Vector3.New(0, 0, 0)
|
||||
recTransform.sizeDelta = Vector2.New(0, 0)
|
||||
transform.localRotation = Quaternion.identity
|
||||
if GetCurLanguage()~=0 then
|
||||
local textArr=gameObject:GetComponentsInChildren(typeof(UnityEngine.UI.Text),true);
|
||||
for i = 0, textArr.Length-1 do
|
||||
local textStr=textArr[i].text
|
||||
textArr[i].text=GetLanguageStrById(textStr)
|
||||
if GetCurLanguage() == 2 and textArr[i].font and (string.find(textArr[i].font.name,"kaiu",1) or string.find(textArr[i].font.name,"FZJinLS",1)) then
|
||||
textArr[i].font = Util.LoadFont()
|
||||
end
|
||||
end
|
||||
local imageArr=gameObject:GetComponentsInChildren(typeof(UnityEngine.UI.Image),true);
|
||||
for i = 0, imageArr.Length-1 do
|
||||
if imageArr[i].sprite then
|
||||
local imgStr=imageArr[i].sprite.name
|
||||
if string.sub(imgStr,-3)=="_zh" then
|
||||
imageArr[i].sprite=Util.LoadSprite(imgStr)
|
||||
Log("资源名称:"..imgStr)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 多语言处理
|
||||
this.DoLanguageCheck(gameObject)
|
||||
return gameObject
|
||||
end
|
||||
|
||||
|
@ -664,10 +645,19 @@ function UIManager.CreatePanelAsync(uiConfig, parent, func)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
-- 不翻译的界面
|
||||
local ExceptPrefabList = {
|
||||
"GMPanel"
|
||||
}
|
||||
-- 根据语言对界面显示进行修改
|
||||
function UIManager.DoLanguageCheck(gameObject)
|
||||
-- 判断是否需要翻译
|
||||
if table.indexof(ExceptPrefabList, gameObject.name) then
|
||||
return
|
||||
end
|
||||
if GetCurLanguage()~=0 then
|
||||
local textArr=gameObject:GetComponentsInChildren(typeof(LanguageText),true);
|
||||
local textArr=gameObject:GetComponentsInChildren(typeof(UnityEngine.UI.Text),true);
|
||||
for i = 0, textArr.Length-1 do
|
||||
local textStr=textArr[i].text
|
||||
textArr[i].text=GetLanguageStrById(textStr)
|
||||
|
|
Loading…
Reference in New Issue