修复快速设置语言产生大量内存垃圾并在返回主菜单时卡顿 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
|
LANG.init,LANG.setLangList,LANG.setPublicText=nil
|
||||||
|
|
||||||
function LANG.set(l)
|
function LANG.set(l)
|
||||||
text=langList[l]
|
if text~=langList[l]then
|
||||||
WIDGET.setLang(text.WidgetText)
|
text=langList[l]
|
||||||
for k,v in next,drawableText do
|
WIDGET.setLang(text.WidgetText)
|
||||||
if text[k]then
|
for k,v in next,drawableText do
|
||||||
v:set(text[k])
|
if text[k]then
|
||||||
|
v:set(text[k])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,12 +15,14 @@ function scene.sceneBack()
|
|||||||
FILE.save(SETTING,'conf/settings')
|
FILE.save(SETTING,'conf/settings')
|
||||||
end
|
end
|
||||||
|
|
||||||
local function setLang(n)
|
local function _setLang(n)
|
||||||
SETTING.lang=n
|
return function()
|
||||||
LANG.set(n)
|
SETTING.lang=n
|
||||||
TEXT.show(langList[n],640,500,100,'appear',.626)
|
LANG.set(n)
|
||||||
|
TEXT.show(langList[n],640,500,100,'appear',.626)
|
||||||
|
collectgarbage()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local function _setLang(n)return function()setLang(n)end end
|
|
||||||
scene.widgetList={
|
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=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)},
|
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