修复快速设置语言产生大量内存垃圾并在返回主菜单时卡顿 close #118
This commit is contained in:
@@ -34,11 +34,13 @@ function LANG.init(langList,publicText)--Attention, calling this will destory al
|
||||
LANG.init,LANG.setLangList,LANG.setPublicText=nil
|
||||
|
||||
function LANG.set(l)
|
||||
text=langList[l]
|
||||
WIDGET.setLang(text.WidgetText)
|
||||
for k,v in next,drawableText do
|
||||
if text[k]then
|
||||
v:set(text[k])
|
||||
if text~=langList[l]then
|
||||
text=langList[l]
|
||||
WIDGET.setLang(text.WidgetText)
|
||||
for k,v in next,drawableText do
|
||||
if text[k]then
|
||||
v:set(text[k])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,12 +15,14 @@ function scene.sceneBack()
|
||||
FILE.save(SETTING,'conf/settings')
|
||||
end
|
||||
|
||||
local function setLang(n)
|
||||
SETTING.lang=n
|
||||
LANG.set(n)
|
||||
TEXT.show(langList[n],640,500,100,'appear',.626)
|
||||
local function _setLang(n)
|
||||
return function()
|
||||
SETTING.lang=n
|
||||
LANG.set(n)
|
||||
TEXT.show(langList[n],640,500,100,'appear',.626)
|
||||
collectgarbage()
|
||||
end
|
||||
end
|
||||
local function _setLang(n)return function()setLang(n)end end
|
||||
scene.widgetList={
|
||||
WIDGET.newButton{x=200,y=100,w=200,h=120,fText=langList[1],color='R',font=35,code=_setLang(1)},
|
||||
WIDGET.newButton{x=420,y=100,w=200,h=120,fText=langList[2],color='dR',font=35,code=_setLang(2)},
|
||||
|
||||
Reference in New Issue
Block a user