简化LANG模块的初始化方法
This commit is contained in:
@@ -1,11 +1,5 @@
|
|||||||
local langList,publicText={},{}
|
|
||||||
local LANG={}
|
local LANG={}
|
||||||
|
function LANG.init(langList,publicText)--Attention, calling this will destory all initializing methods, create a LANG.set()!
|
||||||
--Call these before call LANG.init()
|
|
||||||
function LANG.setLangList(list)langList=list end
|
|
||||||
function LANG.setPublicText(L)publicText=L end
|
|
||||||
|
|
||||||
function LANG.init()--Attention, calling this will destory all initializing methods, create a LANG.set()!
|
|
||||||
local function langFallback(T0,T)
|
local function langFallback(T0,T)
|
||||||
for k,v in next,T0 do
|
for k,v in next,T0 do
|
||||||
if type(v)=="table"and not v.refuseCopy then--refuseCopy: just copy pointer, not contents
|
if type(v)=="table"and not v.refuseCopy then--refuseCopy: just copy pointer, not contents
|
||||||
@@ -62,5 +56,4 @@ function LANG.init()--Attention, calling this will destory all initializing meth
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return LANG
|
return LANG
|
||||||
47
main.lua
47
main.lua
@@ -227,7 +227,6 @@ BGM.init((function()
|
|||||||
end
|
end
|
||||||
return L
|
return L
|
||||||
end)())
|
end)())
|
||||||
|
|
||||||
VOC.init{
|
VOC.init{
|
||||||
"zspin","sspin","lspin","jspin","tspin","ospin","ispin",
|
"zspin","sspin","lspin","jspin","tspin","ospin","ispin",
|
||||||
"single","double","triple","techrash",
|
"single","double","triple","techrash",
|
||||||
@@ -237,31 +236,31 @@ VOC.init{
|
|||||||
"test","happy","doubt","sad","egg",
|
"test","happy","doubt","sad","egg",
|
||||||
"welcome_voc",
|
"welcome_voc",
|
||||||
}
|
}
|
||||||
|
|
||||||
--Initialize language lib
|
--Initialize language lib
|
||||||
LANG.setLangList{
|
LANG.init(
|
||||||
require"parts/language/lang_zh",
|
{
|
||||||
require"parts/language/lang_zh2",
|
require"parts/language/lang_zh",
|
||||||
require"parts/language/lang_yygq",
|
require"parts/language/lang_zh2",
|
||||||
require"parts/language/lang_en",
|
require"parts/language/lang_yygq",
|
||||||
require"parts/language/lang_fr",
|
require"parts/language/lang_en",
|
||||||
require"parts/language/lang_sp",
|
require"parts/language/lang_fr",
|
||||||
require"parts/language/lang_pt",
|
require"parts/language/lang_sp",
|
||||||
require"parts/language/lang_symbol",
|
require"parts/language/lang_pt",
|
||||||
--1. Add language file to LANG folder;
|
require"parts/language/lang_symbol",
|
||||||
--2. Require it;
|
--1. Add language file to LANG folder;
|
||||||
--3. Add a button in parts/scenes/setting_lang.lua;
|
--2. Require it;
|
||||||
}
|
--3. Add a button in parts/scenes/setting_lang.lua;
|
||||||
LANG.setPublicText{
|
|
||||||
block={
|
|
||||||
"Z","S","J","L","T","O","I",
|
|
||||||
"Z5","S5","Q","P","F","E",
|
|
||||||
"T5","U","V","W","X",
|
|
||||||
"J5","L5","R","Y","N","H","I5",
|
|
||||||
"I3","C","I2","O1"
|
|
||||||
},
|
},
|
||||||
}
|
{
|
||||||
LANG.init()
|
block={
|
||||||
|
"Z","S","J","L","T","O","I",
|
||||||
|
"Z5","S5","Q","P","F","E",
|
||||||
|
"T5","U","V","W","X",
|
||||||
|
"J5","L5","R","Y","N","H","I5",
|
||||||
|
"I3","C","I2","O1"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
--Load shader files from SOURCE ONLY
|
--Load shader files from SOURCE ONLY
|
||||||
SHADER={}
|
SHADER={}
|
||||||
|
|||||||
Reference in New Issue
Block a user