词典支持跳转超链接
This commit is contained in:
@@ -442,7 +442,8 @@ local langList={
|
|||||||
back="返回",
|
back="返回",
|
||||||
},
|
},
|
||||||
dict={
|
dict={
|
||||||
hideKB="键盘",
|
link="打开链接",
|
||||||
|
keyboard="键盘",
|
||||||
back="返回",
|
back="返回",
|
||||||
},
|
},
|
||||||
staff={
|
staff={
|
||||||
@@ -991,7 +992,8 @@ local langList={
|
|||||||
back="返回",
|
back="返回",
|
||||||
},
|
},
|
||||||
dict={
|
dict={
|
||||||
hideKB="键盘",
|
link="打开链接",
|
||||||
|
keyboard="键盘",
|
||||||
back="返回",
|
back="返回",
|
||||||
},
|
},
|
||||||
staff={
|
staff={
|
||||||
@@ -1537,7 +1539,8 @@ local langList={
|
|||||||
back="Back",
|
back="Back",
|
||||||
},
|
},
|
||||||
dict={
|
dict={
|
||||||
hideKB="Keyboard",
|
link="Open URL",
|
||||||
|
keyboard="Keyboard",
|
||||||
back="Back",
|
back="Back",
|
||||||
},
|
},
|
||||||
staff={
|
staff={
|
||||||
@@ -2082,7 +2085,8 @@ local langList={
|
|||||||
back="X",
|
back="X",
|
||||||
},
|
},
|
||||||
dict={
|
dict={
|
||||||
hideKB="□□□",
|
link="~~e>>",
|
||||||
|
keyboard="□□□",
|
||||||
back="X",
|
back="X",
|
||||||
},
|
},
|
||||||
staff={
|
staff={
|
||||||
@@ -2628,7 +2632,8 @@ local langList={
|
|||||||
back="返回",
|
back="返回",
|
||||||
},
|
},
|
||||||
dict={
|
dict={
|
||||||
hideKB="键盘",
|
link="看链接",
|
||||||
|
keyboard="键盘",
|
||||||
back="返回",
|
back="返回",
|
||||||
},
|
},
|
||||||
staff={
|
staff={
|
||||||
|
|||||||
@@ -621,8 +621,9 @@ local Widgets={
|
|||||||
newButton({name="back", x=640, y=600,w=170,h=80,color="white",font=35,code=BACK}),
|
newButton({name="back", x=640, y=600,w=170,h=80,color="white",font=35,code=BACK}),
|
||||||
},
|
},
|
||||||
dict={
|
dict={
|
||||||
newKey({name="hideKB", x=940,y=70,w=240,h=80,color="white",font=40,code=pressKey("kb"),hide=function()return not sceneTemp.select end}),
|
newKey({name="link", x=740,y=60,w=200,h=80,color="white",font=35,code=pressKey("link")}),
|
||||||
newButton({name="back", x=1165,y=70,w=170,h=80,color="white",font=40,code=BACK}),
|
newKey({name="keyboard", x=960,y=60,w=200,h=80,color="white",font=35,code=pressKey("kb"),hide=function()return not sceneTemp.select end}),
|
||||||
|
newButton({name="back", x=1165,y=60,w=170,h=80,color="white",font=40,code=BACK}),
|
||||||
newKeyboard({name="kb", x=310,y=325,w=940,h=370,hide=function()return sceneTemp.hideKB end}),
|
newKeyboard({name="kb", x=310,y=325,w=940,h=370,hide=function()return sceneTemp.hideKB end}),
|
||||||
},
|
},
|
||||||
staff={
|
staff={
|
||||||
|
|||||||
1254
document/dict.lua
1254
document/dict.lua
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@ local Timer=love.timer.getTime
|
|||||||
local setFont=setFont
|
local setFont=setFont
|
||||||
local mStr=mStr
|
local mStr=mStr
|
||||||
|
|
||||||
local int,ceil,rnd,abs=math.floor,math.ceil,math.random,math.abs
|
local int,ceil,abs=math.floor,math.ceil,math.abs
|
||||||
local max,min,sin,cos=math.max,math.min,math.sin,math.cos
|
local max,min,sin,cos=math.max,math.min,math.sin,math.cos
|
||||||
local log,rnd=math.log,math.random
|
local log,rnd=math.log,math.random
|
||||||
local format=string.format
|
local format=string.format
|
||||||
@@ -3166,7 +3166,7 @@ do--dict
|
|||||||
local result=S.result
|
local result=S.result
|
||||||
local first
|
local first
|
||||||
for i=1,#dict do
|
for i=1,#dict do
|
||||||
local pos=find(dict[i][1],S.input,nil,true)
|
local pos=find(dict[i][2],S.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
|
||||||
@@ -3199,6 +3199,12 @@ do--dict
|
|||||||
S.scroll=S.select-15
|
S.scroll=S.select-15
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif key=="link"then
|
||||||
|
local url=(S.result[1]and S.result or S.dict)[S.select][5]
|
||||||
|
LOG.print(url)
|
||||||
|
if url then
|
||||||
|
love.system.openURL(url)
|
||||||
|
end
|
||||||
elseif key=="kb"then
|
elseif key=="kb"then
|
||||||
S.hideKB=not S.hideKB
|
S.hideKB=not S.hideKB
|
||||||
elseif key=="delete"then
|
elseif key=="delete"then
|
||||||
@@ -3271,12 +3277,12 @@ do--dict
|
|||||||
i=i+S.scroll
|
i=i+S.scroll
|
||||||
local S=list[i]
|
local S=list[i]
|
||||||
gc.setColor(0,0,0)
|
gc.setColor(0,0,0)
|
||||||
gc.print(S[3],29,y-1)
|
gc.print(S[1],29,y-1)
|
||||||
gc.print(S[3],29,y+1)
|
gc.print(S[1],29,y+1)
|
||||||
gc.print(S[3],31,y-1)
|
gc.print(S[1],31,y-1)
|
||||||
gc.print(S[3],31,y+1)
|
gc.print(S[1],31,y+1)
|
||||||
gc.setColor(typeColor[S[2]])
|
gc.setColor(typeColor[S[3]])
|
||||||
gc.print(S[3],30,y)
|
gc.print(S[1],30,y)
|
||||||
end
|
end
|
||||||
|
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
|
|||||||
Reference in New Issue
Block a user