整理词典代码,添加触屏可用的翻页按钮
This commit is contained in:
@@ -505,8 +505,8 @@ return{
|
||||
dict={
|
||||
title="TetroDictionary",
|
||||
link="Open URL",
|
||||
up="↑",
|
||||
down="↓",
|
||||
up="↑",down="↓",
|
||||
pageup="↑↑",pagedown="↓↓",
|
||||
},
|
||||
stat={
|
||||
path="Open Data Folder",
|
||||
|
||||
@@ -461,8 +461,6 @@ return{
|
||||
dict={
|
||||
title="TetroDictionary",
|
||||
link="Ouvrir URL",
|
||||
up="↑",
|
||||
down="↓",
|
||||
},
|
||||
stat={
|
||||
path="Ouvrir dossier des données",
|
||||
|
||||
@@ -505,8 +505,6 @@ return{
|
||||
dict={
|
||||
title="TetroDictionary",
|
||||
link="Abrir URL",
|
||||
up="↑",
|
||||
down="↓",
|
||||
},
|
||||
stat={
|
||||
path="Abrir Pasta De Data",
|
||||
|
||||
@@ -466,8 +466,6 @@ return{
|
||||
dict={
|
||||
title="TetroDictionary",
|
||||
link="Abrir URL",
|
||||
up="↑",
|
||||
down="↓",
|
||||
},
|
||||
stat={
|
||||
path="Abrir carpeta del juego",
|
||||
|
||||
@@ -346,8 +346,6 @@ return{
|
||||
dict={
|
||||
title="TetroDictionary",
|
||||
link="~~e>>",
|
||||
up="↑",
|
||||
down="↓",
|
||||
},
|
||||
stat={
|
||||
path="%$%",
|
||||
|
||||
@@ -582,8 +582,8 @@ return{
|
||||
dict={
|
||||
title="小Z方块词典",
|
||||
link="打开链接",
|
||||
up="↑",
|
||||
down="↓",
|
||||
up="↑",down="↓",
|
||||
pageup="↑↑",pagedown="↓↓",
|
||||
},
|
||||
stat={
|
||||
path="打开存储目录",
|
||||
|
||||
@@ -19,22 +19,17 @@ local scrollPos--Scroll down length
|
||||
|
||||
local lastSearch--Last searched string
|
||||
|
||||
function scene.sceneInit()
|
||||
dict=require("parts.language.dict_"..({"zh","zh","zh","en","en","en","en","en"})[SETTING.lang])
|
||||
|
||||
inputBox:clear()
|
||||
result={}
|
||||
url=dict[1][5]
|
||||
|
||||
waiting=0
|
||||
selected=1
|
||||
scrollPos=0
|
||||
|
||||
lastSearch=false
|
||||
TASK.new(function()YIELD()WIDGET.sel=inputBox end)
|
||||
BG.set("rainbow")
|
||||
end
|
||||
|
||||
local typeColor={
|
||||
help=COLOR.Y,
|
||||
other=COLOR.lOrange,
|
||||
game=COLOR.lC,
|
||||
term=COLOR.lR,
|
||||
setup=COLOR.lY,
|
||||
pattern=COLOR.lGrass,
|
||||
english=COLOR.B,
|
||||
name=COLOR.lPurple,
|
||||
}
|
||||
local function getList()return result[1]and result or dict end
|
||||
local function clearResult()
|
||||
TABLE.clear(result)
|
||||
selected,scrollPos=1,0
|
||||
@@ -56,10 +51,26 @@ local function search()
|
||||
if #result>0 then
|
||||
SFX.play("reach")
|
||||
end
|
||||
url=(result[1]and result or dict)[selected][5]
|
||||
url=getList()[selected][5]
|
||||
lastSearch=input
|
||||
end
|
||||
|
||||
function scene.sceneInit()
|
||||
dict=require("parts.language.dict_"..({"zh","zh","zh","en","en","en","en","en"})[SETTING.lang])
|
||||
|
||||
inputBox:clear()
|
||||
result={}
|
||||
url=dict[1][5]
|
||||
|
||||
waiting=0
|
||||
selected=1
|
||||
scrollPos=0
|
||||
|
||||
lastSearch=false
|
||||
TASK.new(function()YIELD()WIDGET.sel=inputBox end)
|
||||
BG.set("rainbow")
|
||||
end
|
||||
|
||||
function scene.wheelMoved(_,y)
|
||||
WHEELMOV(y)
|
||||
end
|
||||
@@ -72,7 +83,7 @@ function scene.keyDown(key)
|
||||
end
|
||||
end
|
||||
elseif key=="down"then
|
||||
if selected and selected<#(result[1]and result or dict)then
|
||||
if selected and selected<#getList()then
|
||||
selected=selected+1
|
||||
if selected>scrollPos+15 then
|
||||
scrollPos=selected-15
|
||||
@@ -99,7 +110,7 @@ function scene.keyDown(key)
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
url=(result[1]and result or dict)[selected][5]
|
||||
url=getList()[selected][5]
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
@@ -122,18 +133,8 @@ function scene.update(dt)
|
||||
end
|
||||
end
|
||||
|
||||
local typeColor={
|
||||
help=COLOR.yellow,
|
||||
other=COLOR.lOrange,
|
||||
game=COLOR.lCyan,
|
||||
term=COLOR.lRed,
|
||||
setup=COLOR.lYellow,
|
||||
pattern=COLOR.lGrass,
|
||||
english=COLOR.blue,
|
||||
name=COLOR.lPurple,
|
||||
}
|
||||
function scene.draw()
|
||||
local list=result[1]and result or dict
|
||||
local list=getList()
|
||||
gc.setColor(1,1,1)
|
||||
local t=list[selected][4]
|
||||
if #t>900 then
|
||||
@@ -181,9 +182,11 @@ end
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=20, y=5,font=70,align="L"},
|
||||
inputBox,
|
||||
WIDGET.newKey{name="link", x=1140, y=650,w=200,h=80,font=35,code=pressKey"link",hide=function()return not url end},
|
||||
WIDGET.newKey{name="up", x=1190, y=440,w=100,h=100,font=35,code=pressKey"up",hide=not MOBILE},
|
||||
WIDGET.newKey{name="down", x=1190, y=550,w=100,h=100,font=35,code=pressKey"down",hide=not MOBILE},
|
||||
WIDGET.newKey{name="link", x=1150, y=655,w=200,h=80,font=35,code=pressKey"link",hide=function()return not url end},
|
||||
WIDGET.newKey{name="up", x=1130, y=460,w=60,h=90,font=35,code=pressKey"up",hide=not MOBILE},
|
||||
WIDGET.newKey{name="down", x=1130, y=560,w=60,h=90,font=35,code=pressKey"down",hide=not MOBILE},
|
||||
WIDGET.newKey{name="pageup", x=1210, y=460,w=80,h=90,font=35,code=pressKey"pageup",hide=not MOBILE},
|
||||
WIDGET.newKey{name="pagedown", x=1210, y=560,w=80,h=90,font=35,code=pressKey"pagedown",hide=not MOBILE},
|
||||
WIDGET.newButton{name="back", x=1165, y=60,w=170,h=80,font=40,code=backScene},
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ return SPLITSTR([=[
|
||||
修改硬降音效
|
||||
词典修改部分词条,调整词条顺序(意见来自群友 库德里尔)
|
||||
移除词典中两个不必要的个人词条
|
||||
词典支持左右键翻页
|
||||
词典支持左右键翻页,添加触屏可用的翻页按钮
|
||||
"命令行"改名控制台
|
||||
代码:
|
||||
file模块升级
|
||||
|
||||
Reference in New Issue
Block a user