整 理 代 码
(应该没有改到字符串里面的东西吧…)起码不直接影响运行
This commit is contained in:
@@ -32,11 +32,11 @@ local typeColor={
|
||||
local function _filter(word_org)
|
||||
local word=word_org
|
||||
word=word:gsub("[Tt]etris",CHAR.zChan.thinking)
|
||||
if FNNS then word=word:gsub("[Pp]\97\116\114\101\111\110",CHAR.zChan.qualified)end
|
||||
if FNNS then word=word:gsub("[Pp]\97\116\114\101\111\110",CHAR.zChan.qualified) end
|
||||
return word,word_org
|
||||
end
|
||||
local function _scanDict(D)
|
||||
if not D[1][1]then return end
|
||||
if not D[1][1] then return end
|
||||
local cut=TABLE.cut
|
||||
for i=1,#D do
|
||||
local O=D[i]
|
||||
@@ -48,7 +48,7 @@ local function _scanDict(D)
|
||||
cut(O)
|
||||
end
|
||||
end
|
||||
local function _getList()return result[1]and result or dict end
|
||||
local function _getList() return result[1] and result or dict end
|
||||
local function _clearResult()
|
||||
TABLE.cut(result)
|
||||
selected=1
|
||||
@@ -61,7 +61,7 @@ local function _search()
|
||||
_clearResult()
|
||||
local first
|
||||
for i=1,#dict do
|
||||
local pos=find(dict[i].title:lower(),input,nil,true)or find(dict[i].keywords,input,nil,true)
|
||||
local pos=find(dict[i].title:lower(),input,nil,true) or find(dict[i].keywords,input,nil,true)
|
||||
if pos==1 and not first then
|
||||
ins(result,1,dict[i])
|
||||
first=true
|
||||
@@ -76,7 +76,7 @@ local function _search()
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
dict=require("parts.language.dict_"..(SETTING.locale:find'zh'and'zh'or SETTING.locale:find'ja'and'ja'or'en'))
|
||||
dict=require("parts.language.dict_"..(SETTING.locale:find'zh' and 'zh' or SETTING.locale:find'ja' and 'ja' or 'en'))
|
||||
_scanDict(dict)
|
||||
|
||||
inputBox:clear()
|
||||
@@ -95,7 +95,7 @@ function scene.wheelMoved(_,y)
|
||||
WHEELMOV(y)
|
||||
end
|
||||
function scene.keyDown(key)
|
||||
if key=='up'then
|
||||
if key=='up' then
|
||||
if selected and selected>1 then
|
||||
selected=selected-1
|
||||
if selected<scrollPos+1 then
|
||||
@@ -103,42 +103,42 @@ function scene.keyDown(key)
|
||||
end
|
||||
scene.widgetList.copy.hide=false
|
||||
end
|
||||
elseif key=='down'then
|
||||
if selected and selected<#_getList()then
|
||||
elseif key=='down' then
|
||||
if selected and selected<#_getList() then
|
||||
selected=selected+1
|
||||
if selected>scrollPos+15 then
|
||||
scrollPos=selected-15
|
||||
end
|
||||
scene.widgetList.copy.hide=false
|
||||
end
|
||||
elseif key=='left'or key=='pageup'then
|
||||
for _=1,12 do scene.keyDown('up')end
|
||||
elseif key=='right'or key=='pagedown'then
|
||||
for _=1,12 do scene.keyDown('down')end
|
||||
elseif key=='application'then
|
||||
elseif key=='left' or key=='pageup' then
|
||||
for _=1,12 do scene.keyDown('up') end
|
||||
elseif key=='right' or key=='pagedown' then
|
||||
for _=1,12 do scene.keyDown('down') end
|
||||
elseif key=='application' then
|
||||
local url=_getList()[selected].url
|
||||
if url then love.system.openURL(url)end
|
||||
elseif key=='delete'then
|
||||
if inputBox:hasText()then
|
||||
if url then love.system.openURL(url) end
|
||||
elseif key=='delete' then
|
||||
if inputBox:hasText() then
|
||||
_clearResult()
|
||||
inputBox:clear()
|
||||
SFX.play('hold')
|
||||
end
|
||||
elseif key=='escape'then
|
||||
if inputBox:hasText()then
|
||||
elseif key=='escape' then
|
||||
if inputBox:hasText() then
|
||||
scene.keyDown('delete')
|
||||
else
|
||||
SCN.back()
|
||||
end
|
||||
elseif key=='c'and love.keyboard.isDown('lctrl','rctrl')or key=='cC'then
|
||||
elseif key=='c' and love.keyboard.isDown('lctrl','rctrl') or key=='cC' then
|
||||
local t=_getList()[selected]
|
||||
t=t.title_Org..":\n"..t.content_Org..(t.url and"\n[ "..t.url.." ]\n"or"\n")..text.dictNote
|
||||
t=t.title_Org..":\n"..t.content_Org..(t.url and "\n[ "..t.url.." ]\n" or "\n")..text.dictNote
|
||||
love.system.setClipboardText(t)
|
||||
scene.widgetList.copy.hide=true
|
||||
MES.new('info',text.copyDone)
|
||||
return
|
||||
else
|
||||
if not WIDGET.isFocus(inputBox)then
|
||||
if not WIDGET.isFocus(inputBox) then
|
||||
WIDGET.focus(inputBox)
|
||||
end
|
||||
return true
|
||||
@@ -190,7 +190,7 @@ function scene.draw()
|
||||
gc.rectangle('fill',20,143+35*(selected-scrollPos),280,35)
|
||||
|
||||
setFont(30)
|
||||
for i=1,min(#list,15)do
|
||||
for i=1,min(#list,15) do
|
||||
local y=142+35*i
|
||||
i=i+scrollPos
|
||||
local item=list[i]
|
||||
@@ -215,7 +215,7 @@ scene.widgetList={
|
||||
WIDGET.newText{name='book', x=20,y=15,font=70,align='L',fText=CHAR.icon.zBook},
|
||||
WIDGET.newText{name='title', x=100,y=15,font=70,align='L'},
|
||||
inputBox,
|
||||
WIDGET.newKey{name='link', x=1120,y=655,w=80,font=55,fText=CHAR.icon.globe, code=pressKey'application',hideF=function()return not _getList()[selected].url end},
|
||||
WIDGET.newKey{name='link', x=1120,y=655,w=80,font=55,fText=CHAR.icon.globe, code=pressKey'application',hideF=function() return not _getList()[selected].url end},
|
||||
WIDGET.newKey{name='copy', x=1210,y=655,w=80,font=50,fText=CHAR.icon.copy, code=pressKey'cC'},
|
||||
WIDGET.newKey{name='up', x=1120,y=475,w=80,font=50,fText=CHAR.key.up, code=pressKey'up',hide=not MOBILE},
|
||||
WIDGET.newKey{name='down', x=1120,y=565,w=80,font=50,fText=CHAR.key.down, code=pressKey'down',hide=not MOBILE},
|
||||
|
||||
Reference in New Issue
Block a user