越南语变音字母简化函数改为全unicode版本
限制自定义菜单背景选择范围 微调自定义背景设置ui 整理代码
This commit is contained in:
48
Zframework/diacritics.txt
Normal file
48
Zframework/diacritics.txt
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
Á=A,Ă=A,Ắ=A,Ặ=A,Ằ=A,Ẳ=A,Ẵ=A,Ǎ=A,Â=A,Ấ=A,Ậ=A,Ầ=A,Ẩ=A,Ẫ=A,Ä=A,Ạ=A,À=A,Ả=A,Ā=A,Ą=A,Å=A,Ǻ=A,Ã=A,Æ=AE,Ǽ=AE
|
||||||
|
Ḅ=B,Ɓ=B,ʚ=B,ɞ=B
|
||||||
|
Ć=C,Č=C,Ç=C,Ĉ=C,Ċ=C,Ɔ=C,ʗ=C
|
||||||
|
Ď=D,Ḓ=D,Ḍ=D,Ɗ=D,Ḏ=D,Dz=DZ,Dž=DZ,Đ=D,Ð=D,DZ=DZ,DŽ=DZ
|
||||||
|
É=E,Ĕ=E,Ě=E,Ê=E,Ế=E,Ệ=E,Ề=E,Ể=E,Ễ=E,Ë=E,Ė=E,Ẹ=E,È=E,Ẻ=E,Ē=E,Ę=E,Ẽ=E,Ɛ=E,Ə=E
|
||||||
|
Ƒ=F
|
||||||
|
Ǵ=G,Ğ=G,Ǧ=G,Ģ=G,Ĝ=G,Ġ=G,Ḡ=G,ʛ=G
|
||||||
|
Ḫ=H,Ĥ=H,Ḥ=H,Ħ=H
|
||||||
|
Í=I,Ĭ=I,Ǐ=I,Î=I,Ï=I,İ=I,Ị=I,Ì=I,Ỉ=I,Ī=I,Į=I,Ĩ=I,IJ=IJ
|
||||||
|
Ĵ=J
|
||||||
|
Ķ=K,Ḳ=K,Ƙ=K,Ḵ=K
|
||||||
|
Ĺ=L,Ƚ=L,Ľ=L,Ļ=L,Ḽ=L,Ḷ=L,Ḹ=L,Ḻ=L,Ŀ=L,Lj=Lj,Ł=L,LJ=LJ
|
||||||
|
Ḿ=M,Ṁ=M,Ṃ=M
|
||||||
|
Ń=N,Ň=N,Ņ=N,Ṋ=N,Ṅ=N,Ṇ=N,Ǹ=N,Ɲ=N,Ṉ=N,Nj=Nj,Ñ=N,NJ=NJ
|
||||||
|
Ó=O,Ŏ=O,Ǒ=O,Ô=O,Ố=O,Ộ=O,Ồ=O,Ổ=O,Ỗ=O,Ö=O,Ọ=O,Ő=O,Ò=O,Ỏ=O,Ơ=O,Ớ=O,Ợ=O,Ờ=O,Ở=O,Ỡ=O,Ō=O,Ɵ=O,Ǫ=O,Ø=O,Ǿ=O,Õ=O,Œ=OE,ɶ=Oe
|
||||||
|
Þ=P
|
||||||
|
Ŕ=R,Ř=R,Ŗ=R,Ṙ=R,Ṛ=R,Ṝ=R,Ṟ=R,ʁ=R
|
||||||
|
Ś=S,Š=S,Ş=S,Ŝ=S,Ș=S,Ṡ=S,Ṣ=S,ẞ=S
|
||||||
|
Ť=T,Ţ=T,Ṱ=T,Ț=T,Ṭ=T,Ṯ=T,Ŧ=T,Þ=T,Ð=T
|
||||||
|
Ú=U,Ŭ=U,Ǔ=U,Û=U,Ü=U,Ǘ=U,Ǚ=U,Ǜ=U,Ǖ=U,Ụ=U,Ű=U,Ù=U,Ủ=U,Ư=U,Ứ=U,Ự=U,Ừ=U,Ử=U,Ữ=U,Ū=U,Ų=U,Ů=U,Ũ=U
|
||||||
|
Ẃ=W,Ŵ=W,Ẅ=W,Ẁ=W,ʬ=W
|
||||||
|
Ý=Y,Ŷ=Y,Ÿ=Y,Ẏ=Y,Ỵ=Y,Ỳ=Y,Ƴ=Y,Ỷ=Y,Ȳ=Y,Ỹ=Y
|
||||||
|
Ź=Z,Ž=Z,Ż=Z,Ẓ=Z,Ẕ=Z,Ƶ=Z
|
||||||
|
á=a,ă=a,ắ=a,ặ=a,ằ=a,ẳ=a,ẵ=a,ǎ=a,â=a,ấ=a,ậ=a,ầ=a,ẩ=a,ẫ=a,ä=a,ạ=a,à=a,ả=a,ā=a,ą=a,å=a,ǻ=a,ã=a,æ=a,ǽ=a,ɑ=a,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Data,lowerData,VIdiaData
|
local upperData,lowerData,diaData
|
||||||
function STRING.upperUTF8(str)
|
function STRING.upperUTF8(str)
|
||||||
for _,pair in next,upperData do
|
for _,pair in next,upperData do
|
||||||
str=str:gsub(pair[1],pair[2])
|
str=str:gsub(pair[1],pair[2])
|
||||||
@@ -50,12 +50,8 @@ function STRING.lowerUTF8(str)
|
|||||||
end
|
end
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
--[[
|
function STRING.remDiacritics(str)
|
||||||
[FOR VIETNAMESE ONLY]
|
for _,pair in next,diaData do
|
||||||
Remove all diacritics in strings written in Vietnamese
|
|
||||||
]]
|
|
||||||
function STRING.viRemoveDiacritics(str)
|
|
||||||
for _,pair in next,VIdiaData do
|
|
||||||
str=str:gsub(pair[1],pair[2])
|
str=str:gsub(pair[1],pair[2])
|
||||||
end
|
end
|
||||||
return str
|
return str
|
||||||
@@ -402,43 +398,31 @@ function STRING.unpackTable(t)
|
|||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
local function readF(fname)
|
local function parseFile(fname)
|
||||||
|
local d
|
||||||
if love and love.filesystem and type(love.filesystem.read)=='function' then
|
if love and love.filesystem and type(love.filesystem.read)=='function' then
|
||||||
f=love.filesystem.read(fname)
|
d=love.filesystem.read(fname)
|
||||||
else
|
else
|
||||||
local f=io.open(fname,'r')
|
local f=io.open(fname,'r')
|
||||||
local d=f:read('a')
|
if f then
|
||||||
|
d=f:read('a')
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
return f
|
|
||||||
end
|
|
||||||
upperData=readF('Zframework/upcaser.txt')
|
|
||||||
lowerData=readF('Zframework/lowcaser.txt')
|
|
||||||
VIdiaData=readF('Zframework/vi_diaractics.txt')
|
|
||||||
|
|
||||||
local function splitData(data)
|
|
||||||
for i=1,#data do
|
|
||||||
local pair=STRING.split(data[i],'=')
|
|
||||||
data[i]=pair
|
|
||||||
end
|
|
||||||
return data
|
|
||||||
end
|
|
||||||
if upperData then upperData=splitData(STRING.split(gsub(upperData,'\n',','),','))
|
|
||||||
else
|
|
||||||
upperData={}
|
|
||||||
LOG('ERROR: Failed to read the data from Zframework/upcaser.txt')
|
|
||||||
end
|
|
||||||
if lowerData then lowerData=splitData(STRING.split(gsub(lowerData,'\n',','),','))
|
|
||||||
else
|
|
||||||
lowerData={}
|
|
||||||
LOG('ERROR: Failed to read the data from Zframework/lowcaser.txt')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if VIdiaData then VIdiaData=splitData(STRING.split(gsub(VIdiaData,'\n',','),','))
|
if not d then
|
||||||
else
|
print("ERROR: Failed to read the data from "..fname)
|
||||||
VIdiaData={}
|
return {}
|
||||||
LOG('ERROR: Failed to read the data from Zframework/vi_diaractics.txt')
|
|
||||||
end
|
end
|
||||||
|
d=STRING.split(gsub(d,'\n',','),',')
|
||||||
|
for i=1,#d do
|
||||||
|
d[i]=STRING.split(d[i],'=')
|
||||||
|
end
|
||||||
|
return d
|
||||||
|
end
|
||||||
|
upperData=parseFile('Zframework/upcaser.txt')
|
||||||
|
lowerData=parseFile('Zframework/lowcaser.txt')
|
||||||
|
diaData=parseFile('Zframework/diacritics.txt')
|
||||||
end
|
end
|
||||||
|
|
||||||
return STRING
|
return STRING
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
Á=A,À=A,Ả=A,Ã=A,Ạ=A,Ă=A,Ắ=A,Ằ=A,Ẳ=A,Ẵ=A,Ặ=A,Â=A,Ấ=A,Ầ=A,Ẩ=A,Ẫ=A,Ậ=A
|
|
||||||
á=a,à=a,ả=a,ã=a,ạ=a,ă=a,ắ=a,ằ=a,ẳ=a,ẵ=a,ặ=a,â=a,ấ=a,ầ=a,ẩ=a,ẫ=a,ậ=a
|
|
||||||
Đ=D,đ=d
|
|
||||||
É=E,È=E,Ẻ=E,Ẽ=E,Ẹ=E,Ê=E,Ế=E,Ề=E,Ể=E,Ễ=E,Ệ=E
|
|
||||||
é=e,è=e,ẻ=e,ẽ=e,ẹ=e,ê=e,ế=e,ề=e,ể=e,ễ=e,ệ=e
|
|
||||||
Í=I,Ì=I,Ỉ=I,Ĩ=I,Ị=I
|
|
||||||
í=i,ì=i,ỉ=i,ĩ=i,ị=i
|
|
||||||
Ó=O,Ò=O,Ỏ=O,Õ=O,Ọ=O,Ô=O,Ố=O,Ồ=O,Ổ=O,Ỗ=O,Ộ=O,Ơ=O,Ớ=O,Ờ=O,Ở=O,Ỡ=O,Ợ=O
|
|
||||||
ó=o,ò=o,ỏ=o,õ=o,ọ=o,ô=o,ố=o,ồ=o,ổ=o,ỗ=o,ộ=o,ơ=o,ớ=o,ờ=o,ở=o,ỡ=o,ợ=o
|
|
||||||
Ú=U,Ù=U,Ủ=U,Ũ=U,Ụ=U,Ư=U,Ứ=U,Ừ=U,Ử=U,Ữ=U,Ự=U
|
|
||||||
ú=u,ù=u,ủ=u,ũ=u,ụ=u,ư=u,ứ=u,ừ=u,ử=u,ữ=u,ự=u
|
|
||||||
Ý=Y,Ỳ=Y,Ỷ=Y,Ỹ=Y,Ỵ=Y,ý=y,ỳ=y,ỷ=y,ỹ=y,ỵ=y
|
|
||||||
12
main.lua
12
main.lua
@@ -49,19 +49,15 @@ SCR.setSize(1280,720) -- Initialize Screen size
|
|||||||
BGM.setMaxSources(5)
|
BGM.setMaxSources(5)
|
||||||
VOC.setDiversion(.62)
|
VOC.setDiversion(.62)
|
||||||
|
|
||||||
ChangeButtonColorIfThemeUsed=function()
|
WIDGET.setOnChange(function()
|
||||||
if SCN.cur~='net_game' and SCN.cur~='custom_field' then
|
if SCN.cur=='net_game' or SCN.cur=='custom_field' then return end
|
||||||
local colorList=THEME.getThemeColor()
|
local colorList=THEME.getThemeColor()
|
||||||
if colorList then
|
if colorList then
|
||||||
for _,W in next,SCN.scenes[SCN.cur].widgetList do
|
for _,W in next,SCN.scenes[SCN.cur].widgetList do
|
||||||
if W.color then
|
W.color=W.color and colorList[math.random(#colorList)]
|
||||||
W.color=colorList[math.random(#colorList)]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end)
|
||||||
end
|
|
||||||
end
|
|
||||||
WIDGET.setOnChange(ChangeButtonColorIfThemeUsed)
|
|
||||||
|
|
||||||
-- Create shortcuts
|
-- Create shortcuts
|
||||||
setFont=FONT.set
|
setFont=FONT.set
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ do-- function applySettings()
|
|||||||
light={.2,.8},
|
light={.2,.8},
|
||||||
color={-.2,1.2},
|
color={-.2,1.2},
|
||||||
}
|
}
|
||||||
function applySettings(arg)
|
function applySettings(reason)
|
||||||
-- Apply language
|
-- Apply language
|
||||||
text=LANG.get(SETTING.locale)
|
text=LANG.get(SETTING.locale)
|
||||||
WIDGET.setLang(text.WidgetText)
|
WIDGET.setLang(text.WidgetText)
|
||||||
@@ -157,7 +157,7 @@ do-- function applySettings()
|
|||||||
SHADER.fieldSatur:send('k',m[2])
|
SHADER.fieldSatur:send('k',m[2])
|
||||||
|
|
||||||
-- Apply BG
|
-- Apply BG
|
||||||
if not (arg and arg=='fullscreen') then
|
if reason=='fullscreen' then return end
|
||||||
if SETTING.bg=='on' then
|
if SETTING.bg=='on' then
|
||||||
BG.unlock()
|
BG.unlock()
|
||||||
BG.setDefault(SETTING.defaultBG)
|
BG.setDefault(SETTING.defaultBG)
|
||||||
@@ -188,7 +188,6 @@ do-- function applySettings()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
------------------------------[Generate Grades]------------------------------
|
------------------------------[Generate Grades]------------------------------
|
||||||
local smallDigits={[0]="₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"}
|
local smallDigits={[0]="₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"}
|
||||||
@@ -196,7 +195,7 @@ local function getSmallNum(num)
|
|||||||
local str=tostring(num)
|
local str=tostring(num)
|
||||||
local out=""
|
local out=""
|
||||||
for i=1,#str do
|
for i=1,#str do
|
||||||
out=out..smallDigits[tonumber(string.sub(str,i,i))]
|
out=out..smallDigits[tonumber(str:sub(i,i))]
|
||||||
end
|
end
|
||||||
return out
|
return out
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ C. Gamepad
|
|||||||
bg_off="No B.G.",
|
bg_off="No B.G.",
|
||||||
bg_custom="Custom B.G.",
|
bg_custom="Custom B.G.",
|
||||||
defaultBG="Default B.G.",
|
defaultBG="Default B.G.",
|
||||||
resetDbg="Reset default B.G.",
|
resetDbg="Reset to default",
|
||||||
lockBG="Lock B.G.",
|
lockBG="Lock B.G.",
|
||||||
noTheme="Disable theme",
|
noTheme="Disable theme",
|
||||||
|
|
||||||
|
|||||||
@@ -600,8 +600,7 @@ C. Tay cầm chơi game (Gamepad):
|
|||||||
bg_off="Không ảnh nền",
|
bg_off="Không ảnh nền",
|
||||||
bg_custom="Ảnh nền tự chọn",
|
bg_custom="Ảnh nền tự chọn",
|
||||||
defaultBG="Nền mặc định",
|
defaultBG="Nền mặc định",
|
||||||
-- resetDbg='Đặt lại →',
|
resetDbg='Đặt lại',
|
||||||
resetDbg="Đặt lại ảnh nền mặc định",
|
|
||||||
lockBG="Khóa ảnh nền",
|
lockBG="Khóa ảnh nền",
|
||||||
noTheme="Tắt theme",
|
noTheme="Tắt theme",
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ local levels={
|
|||||||
local b=STRING.toBin(a)
|
local b=STRING.toBin(a)
|
||||||
local l=floor(math.log(a,2)+1)
|
local l=floor(math.log(a,2)+1)
|
||||||
for i=1,l do
|
for i=1,l do
|
||||||
drawChar(tonumber(string.sub(b,i,i)),320,420-100*(l-i),.5)
|
drawChar(tonumber(b:sub(i,i)),320,420-100*(l-i),.5)
|
||||||
ins(drawLines,{370,480-100*(l-i),410,440-100*(l-i)})
|
ins(drawLines,{370,480-100*(l-i),410,440-100*(l-i)})
|
||||||
ins(drawLines,{370,440-100*(l-i),410,480-100*(l-i)})
|
ins(drawLines,{370,440-100*(l-i),410,480-100*(l-i)})
|
||||||
drawChar(2,430,420-100*(l-i),.5)
|
drawChar(2,430,420-100*(l-i),.5)
|
||||||
@@ -193,7 +193,7 @@ local levels={
|
|||||||
local b=STRING.toOct(a)
|
local b=STRING.toOct(a)
|
||||||
local l=floor(math.log(a,8)+1)
|
local l=floor(math.log(a,8)+1)
|
||||||
for i=1,l do
|
for i=1,l do
|
||||||
drawChar(tonumber(string.sub(b,i,i)),320,420-100*(l-i),.5)
|
drawChar(tonumber(b:sub(i,i)),320,420-100*(l-i),.5)
|
||||||
ins(drawLines,{370,480-100*(l-i),410,440-100*(l-i)})
|
ins(drawLines,{370,480-100*(l-i),410,440-100*(l-i)})
|
||||||
ins(drawLines,{370,440-100*(l-i),410,480-100*(l-i)})
|
ins(drawLines,{370,440-100*(l-i),410,480-100*(l-i)})
|
||||||
drawChar(8,430,420-100*(l-i),.5)
|
drawChar(8,430,420-100*(l-i),.5)
|
||||||
@@ -212,7 +212,7 @@ local levels={
|
|||||||
local b=STRING.toHex(a)
|
local b=STRING.toHex(a)
|
||||||
local l=floor(math.log(a,16)+1)
|
local l=floor(math.log(a,16)+1)
|
||||||
for i=1,l do
|
for i=1,l do
|
||||||
local c=string.sub(b,i,i)
|
local c=b:sub(i,i)
|
||||||
if ("0123456789"):find(c,nil,true) then
|
if ("0123456789"):find(c,nil,true) then
|
||||||
c=tonumber(c)
|
c=tonumber(c)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ local lastSearch -- Last searched string
|
|||||||
local lastSelected -- Last selected item
|
local lastSelected -- Last selected item
|
||||||
|
|
||||||
local currentFontSize=25 -- Current font size, default: 25
|
local currentFontSize=25 -- Current font size, default: 25
|
||||||
local needLowerUTF8
|
local utf8postProcess
|
||||||
local isLangVi -- There are special handlings that only for Vietnamese --SweetSea--
|
|
||||||
|
|
||||||
local typeColor={
|
local typeColor={
|
||||||
help=COLOR.Y,
|
help=COLOR.Y,
|
||||||
@@ -45,11 +44,11 @@ local function _scanDict(D)
|
|||||||
for i=1,#D do
|
for i=1,#D do
|
||||||
local O=D[i]
|
local O=D[i]
|
||||||
O.title,O.title_Org=_filter(O[1])
|
O.title,O.title_Org=_filter(O[1])
|
||||||
O.titleLowered=needLowerUTF8 and STRING.lowerUTF8(O.title) or O.title:lower()
|
O.titleLowered=utf8postProcess and STRING.lowerUTF8(O.title) or O.title:lower()
|
||||||
O.titleNoDiaratics=isLangVi and STRING.viRemoveDiacritics(O.titleLowered)
|
O.titleNoDiaratics=utf8postProcess and STRING.remDiacritics(O.titleLowered)
|
||||||
O.keywords=O[2]
|
O.keywords=O[2]
|
||||||
O.keywordsLowered=needLowerUTF8 and STRING.lowerUTF8(O.keywords) or O.keywords:lower()
|
O.keywordsLowered=utf8postProcess and STRING.lowerUTF8(O.keywords) or O.keywords:lower()
|
||||||
O.keywordsNoDiaratics=isLangVi and STRING.viRemoveDiacritics(O.keywordsLowered)
|
O.keywordsNoDiaratics=utf8postProcess and STRING.remDiacritics(O.keywordsLowered)
|
||||||
O.type=O[3]
|
O.type=O[3]
|
||||||
O.content,O.content_Org=_filter(O[4])
|
O.content,O.content_Org=_filter(O[4])
|
||||||
O.url=O[5]
|
O.url=O[5]
|
||||||
@@ -93,9 +92,9 @@ local function _search()
|
|||||||
local pos
|
local pos
|
||||||
local first
|
local first
|
||||||
_clearResult()
|
_clearResult()
|
||||||
input=needLowerUTF8 and STRING.lowerUTF8(input) or input:lower()
|
input=utf8postProcess and STRING.lowerUTF8(input) or input:lower()
|
||||||
for i=1,#dict do
|
for i=1,#dict do
|
||||||
pos=find(dict[i].titleLowered,input,nil,true) or find(dict[i].keywordsLowered,input,nil,true) or isLangVi and (find(dict[i].titleNoDiaratics,input,nil,true) or find(dict[i].keywordsNoDiaratics,input,nil,true))
|
pos=find(dict[i].titleLowered,input,nil,true) or find(dict[i].keywordsLowered,input,nil,true) or utf8postProcess and (find(dict[i].titleNoDiaratics,input,nil,true) or find(dict[i].keywordsNoDiaratics,input,nil,true))
|
||||||
if pos==1 and not first then
|
if pos==1 and not first then
|
||||||
ins(result,1,dict[i])
|
ins(result,1,dict[i])
|
||||||
first=true
|
first=true
|
||||||
@@ -147,8 +146,7 @@ function scene.enter()
|
|||||||
SETTING.locale:find'vi' and 'vi' or
|
SETTING.locale:find'vi' and 'vi' or
|
||||||
'en'
|
'en'
|
||||||
)
|
)
|
||||||
needLowerUTF8=SETTING.locale:find'vi'
|
utf8postProcess=SETTING.locale:find'vi'
|
||||||
isLangVi=SETTING.locale:find'vi' -- DO NOT CHANGE THIS! --SweetSea--
|
|
||||||
|
|
||||||
dict=require(localeFile)
|
dict=require(localeFile)
|
||||||
_scanDict(dict)
|
_scanDict(dict)
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ scene.widgetList={
|
|||||||
WIDGET.newSwitch{name='portrait', x=950,y=1150,lim=360,disp=SETval('portrait'), code=function() SETTING.portrait=not SETTING.portrait; saveSettings(); MES.new('warn',text.settingWarn2,6.26) end,hideF=function() return not MOBILE end},
|
WIDGET.newSwitch{name='portrait', x=950,y=1150,lim=360,disp=SETval('portrait'), code=function() SETTING.portrait=not SETTING.portrait; saveSettings(); MES.new('warn',text.settingWarn2,6.26) end,hideF=function() return not MOBILE end},
|
||||||
WIDGET.newSlider{name='msaa', x=950,y=1220,lim=360,w=200,axis={0,4,1},show=_msaaShow,disp=function() return SETTING.msaa==0 and 0 or math.log(SETTING.msaa,2) end,code=function(v) SETTING.msaa=v==0 and 0 or 2^v; saveSettings(); if TASK.lock('warnMessage',6.26) then MES.new('warn',text.settingWarn2,6.26) end end},
|
WIDGET.newSlider{name='msaa', x=950,y=1220,lim=360,w=200,axis={0,4,1},show=_msaaShow,disp=function() return SETTING.msaa==0 and 0 or math.log(SETTING.msaa,2) end,code=function(v) SETTING.msaa=v==0 and 0 or 2^v; saveSettings(); if TASK.lock('warnMessage',6.26) then MES.new('warn',text.settingWarn2,6.26) end end},
|
||||||
|
|
||||||
WIDGET.newKey{name='bg_off', x=680,y=1290,w=200,h=60,code=function() SETTING.bg='off'; applySettings() end},
|
WIDGET.newKey{name='bg_on', x=680,y=1290,w=200,h=60,code=function() SETTING.bg='on' ; applySettings() end},
|
||||||
WIDGET.newKey{name='bg_on', x=900,y=1290,w=200,h=60,code=function() SETTING.bg='on' ; applySettings() end},
|
WIDGET.newKey{name='bg_off', x=900,y=1290,w=200,h=60,code=function() SETTING.bg='off'; applySettings() end},
|
||||||
WIDGET.newKey{name='bg_custom', x=1120,y=1290,w=200,h=60,
|
WIDGET.newKey{name='bg_custom', x=1120,y=1290,w=200,h=60,
|
||||||
code=function()
|
code=function()
|
||||||
if love.filesystem.getInfo('conf/customBG') then
|
if love.filesystem.getInfo('conf/customBG') then
|
||||||
@@ -102,7 +102,7 @@ scene.widgetList={
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
WIDGET.newSlider{name='bgAlpha', x=1020,y=1365,w=200,
|
WIDGET.newSlider{name='bgAlpha', x=800,y=1365,w=420,
|
||||||
axis={0,.8},disp=SETval('bgAlpha'),
|
axis={0,.8},disp=SETval('bgAlpha'),
|
||||||
code=function(v)
|
code=function(v)
|
||||||
SETTING.bgAlpha=v
|
SETTING.bgAlpha=v
|
||||||
@@ -114,9 +114,8 @@ scene.widgetList={
|
|||||||
end,
|
end,
|
||||||
hideF=function() return SETTING.bg=='on' end
|
hideF=function() return SETTING.bg=='on' end
|
||||||
},
|
},
|
||||||
WIDGET.newSelector{name='defaultBG', x=1120,y=1365,w=200,color='G',
|
WIDGET.newSelector{name='defaultBG', x=680,y=1365,w=200,color='G',
|
||||||
limit=370,
|
list={'space','bg1','bg2','rainbow','rainbow2','aura','rgb','glow','matrix','cubes','tunnel','galaxy','quarks','blockfall','blockrain','blockhole','blockspace'},
|
||||||
list=BG.getList(),
|
|
||||||
disp=SETval('defaultBG'),
|
disp=SETval('defaultBG'),
|
||||||
code=function(v)
|
code=function(v)
|
||||||
SETTING.defaultBG=v
|
SETTING.defaultBG=v
|
||||||
@@ -124,7 +123,7 @@ scene.widgetList={
|
|||||||
end,
|
end,
|
||||||
hideF=function() return SETTING.bg~='on' end
|
hideF=function() return SETTING.bg~='on' end
|
||||||
},
|
},
|
||||||
WIDGET.newKey{name='resetDbg',x=900,y=1365,w=200,h=60,font=25,
|
WIDGET.newKey{name='resetDbg',x=870,y=1365,w=140,h=60,font=15,
|
||||||
code=function()
|
code=function()
|
||||||
SETTING.defaultBG='space'
|
SETTING.defaultBG='space'
|
||||||
scene.widgetList.defaultBG:reset()
|
scene.widgetList.defaultBG:reset()
|
||||||
@@ -132,7 +131,7 @@ scene.widgetList={
|
|||||||
end,
|
end,
|
||||||
hideF=function() return SETTING.bg~='on' or SETTING.defaultBG=='space' end
|
hideF=function() return SETTING.bg~='on' or SETTING.defaultBG=='space' end
|
||||||
},
|
},
|
||||||
WIDGET.newSwitch{name='lockBG',x=1170,y=1485,
|
WIDGET.newSwitch{name='lockBG',x=1170,y=1365,lim=200,
|
||||||
disp=SETval('lockBG'),
|
disp=SETval('lockBG'),
|
||||||
code=function()
|
code=function()
|
||||||
SETTING.lockBG=not SETTING.lockBG
|
SETTING.lockBG=not SETTING.lockBG
|
||||||
@@ -141,18 +140,18 @@ scene.widgetList={
|
|||||||
hideF=function() return SETTING.bg~='on' end
|
hideF=function() return SETTING.bg~='on' end
|
||||||
},
|
},
|
||||||
|
|
||||||
WIDGET.newSwitch{name='noTheme',x=1170,y=1545,
|
WIDGET.newSwitch{name='noTheme',x=1170,y=1435,
|
||||||
disp=SETval('noTheme'),
|
disp=SETval('noTheme'),
|
||||||
code=function()
|
code=function()
|
||||||
SETTING.noTheme=not SETTING.noTheme
|
SETTING.noTheme=not SETTING.noTheme
|
||||||
local ct=THEME.calculate()
|
local ct=THEME.calculate()
|
||||||
if SETTING.noTheme and type(ct)=='string' and string.sub(ct,1,6)~='season' then
|
if SETTING.noTheme and type(ct)=='string' and ct:sub(1,6)~='season' then
|
||||||
if TASK.lock('warnMessage',6.26) then
|
if TASK.lock('warnMessage',6.26) then
|
||||||
MES.new('warn',text.settingWarn2,6.26)
|
MES.new('warn',text.settingWarn2,6.26)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
THEME.set(THEME.calculate())
|
THEME.set(THEME.calculate())
|
||||||
ChangeButtonColorIfThemeUsed()
|
WIDGET.setWidgetList(scene.widgetList)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -59,15 +59,9 @@ function THEME.calculate(Y,M,D)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function THEME.set(theme)
|
function THEME.set(theme)
|
||||||
local seasonT={'null','nil','vaccum','space'}
|
if type(theme)=='string' and theme:sub(1,6)=='season' then
|
||||||
-- Note: by default, the background will be 'space' unless user changed
|
|
||||||
-- Because 4 seasonal themes are basically the normal theme, not special like others
|
|
||||||
if type(theme)=='string' and string.sub(theme,1,6)=='season' then
|
|
||||||
local n=tonumber(string.sub(theme,7))
|
|
||||||
if 0<n and n<5 then
|
|
||||||
BG.setDefault(SETTING.defaultBG)
|
BG.setDefault(SETTING.defaultBG)
|
||||||
BGM.setDefault(seasonT[n])
|
BGM.setDefault(({season1='null',season2='nil',season3='vaccum',season4='space'})[theme])
|
||||||
end
|
|
||||||
elseif not SETTING.noTheme then
|
elseif not SETTING.noTheme then
|
||||||
if theme=='xmas' then
|
if theme=='xmas' then
|
||||||
BG.setDefault('snow')
|
BG.setDefault('snow')
|
||||||
@@ -99,7 +93,9 @@ function THEME.set(theme)
|
|||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else THEME.set(THEME.calculate('0',os.date('%m'),'0')) return end
|
else
|
||||||
|
return THEME.set(THEME.calculate('0',os.date('%m'),'0'))
|
||||||
|
end
|
||||||
|
|
||||||
THEME.cur=theme
|
THEME.cur=theme
|
||||||
BG.set()
|
BG.set()
|
||||||
|
|||||||
Reference in New Issue
Block a user