越南语变音字母简化函数改为全unicode版本

限制自定义菜单背景选择范围
微调自定义背景设置ui
整理代码
This commit is contained in:
MrZ_26
2023-12-31 23:32:19 +08:00
parent 19ea76dc4c
commit 3a4fcf6d7b
16 changed files with 140 additions and 133 deletions

View File

@@ -174,7 +174,7 @@ local levels={
local b=STRING.toBin(a)
local l=floor(math.log(a,2)+1)
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,440-100*(l-i),410,480-100*(l-i)})
drawChar(2,430,420-100*(l-i),.5)
@@ -193,7 +193,7 @@ local levels={
local b=STRING.toOct(a)
local l=floor(math.log(a,8)+1)
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,440-100*(l-i),410,480-100*(l-i)})
drawChar(8,430,420-100*(l-i),.5)
@@ -212,7 +212,7 @@ local levels={
local b=STRING.toHex(a)
local l=floor(math.log(a,16)+1)
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
c=tonumber(c)
else

View File

@@ -214,7 +214,7 @@ generateVKey=function()
-- activateState: 0=off, 1=on then off, 2=on
local activationTime=self.ATV or 0
local maxTime=6.2
if activateState~=nil then self.activateState=activateState
elseif (self.activateState==1 and activationTime==maxTime) or not self.activateState then self.activateState=0 end
-- LIKELY NOT POSSIBLE TO DO

View File

@@ -17,8 +17,7 @@ local lastSearch -- Last searched string
local lastSelected -- Last selected item
local currentFontSize=25 -- Current font size, default: 25
local needLowerUTF8
local isLangVi -- There are special handlings that only for Vietnamese --SweetSea--
local utf8postProcess
local typeColor={
help=COLOR.Y,
@@ -45,11 +44,11 @@ local function _scanDict(D)
for i=1,#D do
local O=D[i]
O.title,O.title_Org=_filter(O[1])
O.titleLowered=needLowerUTF8 and STRING.lowerUTF8(O.title) or O.title:lower()
O.titleNoDiaratics=isLangVi and STRING.viRemoveDiacritics(O.titleLowered)
O.titleLowered=utf8postProcess and STRING.lowerUTF8(O.title) or O.title:lower()
O.titleNoDiaratics=utf8postProcess and STRING.remDiacritics(O.titleLowered)
O.keywords=O[2]
O.keywordsLowered=needLowerUTF8 and STRING.lowerUTF8(O.keywords) or O.keywords:lower()
O.keywordsNoDiaratics=isLangVi and STRING.viRemoveDiacritics(O.keywordsLowered)
O.keywordsLowered=utf8postProcess and STRING.lowerUTF8(O.keywords) or O.keywords:lower()
O.keywordsNoDiaratics=utf8postProcess and STRING.remDiacritics(O.keywordsLowered)
O.type=O[3]
O.content,O.content_Org=_filter(O[4])
O.url=O[5]
@@ -93,9 +92,9 @@ local function _search()
local pos
local first
_clearResult()
input=needLowerUTF8 and STRING.lowerUTF8(input) or input:lower()
input=utf8postProcess and STRING.lowerUTF8(input) or input:lower()
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
ins(result,1,dict[i])
first=true
@@ -147,9 +146,8 @@ function scene.enter()
SETTING.locale:find'vi' and 'vi' or
'en'
)
needLowerUTF8=SETTING.locale:find'vi'
isLangVi=SETTING.locale:find'vi' -- DO NOT CHANGE THIS! --SweetSea--
utf8postProcess=SETTING.locale:find'vi'
dict=require(localeFile)
_scanDict(dict)

View File

@@ -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.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=900,y=1290,w=200,h=60,code=function() SETTING.bg='on' ; 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_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,
code=function()
if love.filesystem.getInfo('conf/customBG') then
@@ -102,7 +102,7 @@ scene.widgetList={
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'),
code=function(v)
SETTING.bgAlpha=v
@@ -114,9 +114,8 @@ scene.widgetList={
end,
hideF=function() return SETTING.bg=='on' end
},
WIDGET.newSelector{name='defaultBG', x=1120,y=1365,w=200,color='G',
limit=370,
list=BG.getList(),
WIDGET.newSelector{name='defaultBG', x=680,y=1365,w=200,color='G',
list={'space','bg1','bg2','rainbow','rainbow2','aura','rgb','glow','matrix','cubes','tunnel','galaxy','quarks','blockfall','blockrain','blockhole','blockspace'},
disp=SETval('defaultBG'),
code=function(v)
SETTING.defaultBG=v
@@ -124,7 +123,7 @@ scene.widgetList={
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()
SETTING.defaultBG='space'
scene.widgetList.defaultBG:reset()
@@ -132,7 +131,7 @@ scene.widgetList={
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'),
code=function()
SETTING.lockBG=not SETTING.lockBG
@@ -141,18 +140,18 @@ scene.widgetList={
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'),
code=function()
SETTING.noTheme=not SETTING.noTheme
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
MES.new('warn',text.settingWarn2,6.26)
end
else
THEME.set(THEME.calculate())
ChangeButtonColorIfThemeUsed()
WIDGET.setWidgetList(scene.widgetList)
end
end
},