语言选择菜单会轮流显示不同语言的“语言”

This commit is contained in:
MrZ626
2021-12-02 22:06:06 +08:00
parent 86d9265ff9
commit 5c524e138c
2 changed files with 32 additions and 11 deletions

View File

@@ -340,8 +340,8 @@ VOC.init{
LANG.init('zh',
{
zh=require'parts.language.lang_zh',
zh_full=require'parts.language.lang_zh_full',
zh_trad=require'parts.language.lang_zh_trad',
zh_full=require'parts.language.lang_zh_full',
en=require'parts.language.lang_en',
fr=require'parts.language.lang_fr',
es=require'parts.language.lang_es',

View File

@@ -11,6 +11,12 @@ local langList={
zh_yygq="就这?",
symbol="?????",
}
local languages={
"语言",
"Language",
--TODO: add more languaes here
}
local curLang=1
local scene={}
@@ -18,6 +24,21 @@ function scene.sceneBack()
saveSettings()
end
function scene.update(dt)
curLang=curLang+dt*1.626
if curLang>=#languages+1 then
curLang=1
end
end
function scene.draw()
setFont(60)
love.graphics.setColor(1,1,1,1-curLang%1)
GC.mStr(languages[curLang-curLang%1],640,20)
love.graphics.setColor(1,1,1,curLang%1)
GC.mStr(languages[curLang-curLang%1+1]or languages[1],640,20)
end
local function _setLang(lid)
SETTING.locale=lid
applyLanguage()
@@ -27,18 +48,18 @@ local function _setLang(lid)
end
scene.widgetList={
WIDGET.newButton{x=271,y=190,w=346,h=120,font=40, fText=langList.zh, color='O',code=function()_setLang('zh')end},
WIDGET.newButton{x=637,y=190,w=346,h=120,font=40, fText=langList.zh_trad, color='F',code=function()_setLang('zh_trad')end},
WIDGET.newButton{x=1003,y=190,w=346,h=120,font=40, fText=langList.zh_full, color='R',code=function()_setLang('zh_full')end},
WIDGET.newButton{x=271,y=190,w=346,h=120,font=40, fText=langList.zh, color='O',code=function()_setLang('zh')end},
WIDGET.newButton{x=637,y=190,w=346,h=120,font=40, fText=langList.zh_trad, color='F',code=function()_setLang('zh_trad')end},
WIDGET.newButton{x=1003,y=190,w=346,h=120,font=40,fText=langList.zh_full, color='R',code=function()_setLang('zh_full')end},
WIDGET.newButton{x=225,y=331,w=255,h=120,font=40, fText=langList.en, color='L',code=function()_setLang('en')end},
WIDGET.newButton{x=500,y=331,w=255,h=120,font=40, fText=langList.fr, color='J',code=function()_setLang('fr')end},
WIDGET.newButton{x=775,y=331,w=255,h=120,font=35, fText=langList.es, color='G',code=function()_setLang('es')end},
WIDGET.newButton{x=1050,y=331,w=255,h=120,font=40, fText=langList.pt, color='dG',code=function()_setLang('pt')end},
WIDGET.newButton{x=225,y=331,w=255,h=120,font=40, fText=langList.en, color='L',code=function()_setLang('en')end},
WIDGET.newButton{x=500,y=331,w=255,h=120,font=40, fText=langList.fr, color='J',code=function()_setLang('fr')end},
WIDGET.newButton{x=775,y=331,w=255,h=120,font=35, fText=langList.es, color='G',code=function()_setLang('es')end},
WIDGET.newButton{x=1050,y=331,w=255,h=120,font=40,fText=langList.pt, color='dG',code=function()_setLang('pt')end},
WIDGET.newButton{x=271,y=472,w=346,h=120,font=45, fText=langList.zh_grass,color='N',code=function()_setLang('zh_grass')end},
WIDGET.newButton{x=637,y=472,w=346,h=120,font=45, fText=langList.zh_yygq, color='S',code=function()_setLang('zh_yygq')end},
WIDGET.newButton{x=1003,y=472,w=346,h=120,font=45, fText=langList.symbol, color='B',code=function()_setLang('symbol')end},
WIDGET.newButton{x=271,y=472,w=346,h=120,font=45, fText=langList.zh_grass,color='N',code=function()_setLang('zh_grass')end},
WIDGET.newButton{x=637,y=472,w=346,h=120,font=45, fText=langList.zh_yygq, color='S',code=function()_setLang('zh_yygq')end},
WIDGET.newButton{x=1003,y=472,w=346,h=120,font=45,fText=langList.symbol, color='B',code=function()_setLang('symbol')end},
WIDGET.newButton{name='back',x=1140,y=640,w=170,h=80,font=60,fText=CHAR.icon.back,code=backScene},
}