整理代码,使用TABLE.find
This commit is contained in:
@@ -585,13 +585,12 @@ do--commands.applet(name)
|
||||
log(appList[i]..": "..appDescription[i])
|
||||
end
|
||||
elseif name~=""then
|
||||
for i=1,#appList do
|
||||
if appList[i]==name then
|
||||
SCN.go(appScene[i])
|
||||
return
|
||||
end
|
||||
local i=TABLE.find(appList,name)
|
||||
if i then
|
||||
SCN.go(appScene[i])
|
||||
else
|
||||
log{C.aqua,"No this applet"}
|
||||
end
|
||||
log{C.aqua,"No this applet"}
|
||||
else
|
||||
log{C.aqua,"Usage:"}
|
||||
log{C.aqua,"applet -list"}
|
||||
@@ -766,9 +765,7 @@ function scene.keyDown(k)
|
||||
if #res>1 then
|
||||
log(">Commands start with '"..str.."' :")
|
||||
table.sort(res)
|
||||
for i=1,#res do
|
||||
log{COLOR.lH,res[i]}
|
||||
end
|
||||
for i=1,#res do log{COLOR.lH,res[i]}end
|
||||
elseif #res==1 then
|
||||
inputBox.value=res[1]
|
||||
end
|
||||
|
||||
@@ -61,9 +61,7 @@ function scene.keyDown(key)
|
||||
end
|
||||
elseif key=="delete"then
|
||||
if sure>20 then
|
||||
for _=1,#MISSION do
|
||||
rem(MISSION)
|
||||
end
|
||||
TABLE.cut(MISSION)
|
||||
cur=0
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
|
||||
@@ -65,9 +65,7 @@ function scene.keyDown(key)
|
||||
end
|
||||
elseif key=="delete"then
|
||||
if sure>20 then
|
||||
for _=1,#BAG do
|
||||
rem(BAG)
|
||||
end
|
||||
TABLE.cut(BAG)
|
||||
cur=0
|
||||
sure=0
|
||||
SFX.play('finesseError',.7)
|
||||
|
||||
@@ -6,12 +6,8 @@ local function modComp(a,b)
|
||||
return a.no<b.no
|
||||
end
|
||||
local function remMod(M)
|
||||
for i=1,#GAME.mod do
|
||||
if GAME.mod[i]==M then
|
||||
rem(GAME.mod,i)
|
||||
return
|
||||
end
|
||||
end
|
||||
local i=TABLE.find(GAME.mod,M)
|
||||
if i then rem(GAME.mod,i)end
|
||||
end
|
||||
local function toggleMod(M,back)
|
||||
if M.sel==0 then
|
||||
|
||||
@@ -12,19 +12,9 @@ local scene={}
|
||||
local selected--Music selected
|
||||
|
||||
local bgmList=BGM.getList()
|
||||
if #bgmList==0 then
|
||||
bgmList={"[NO BGM]"}
|
||||
end
|
||||
if #bgmList==0 then bgmList={"[NO BGM]"}end
|
||||
function scene.sceneInit()
|
||||
if BGM.nowPlay then
|
||||
for i=1,BGM.getCount()do
|
||||
if bgmList[i]==BGM.nowPlay then
|
||||
selected=i
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
selected=1
|
||||
selected=TABLE.find(bgmList,BGM.nowPlay)or 1
|
||||
end
|
||||
|
||||
function scene.wheelMoved(_,y)
|
||||
@@ -33,7 +23,7 @@ end
|
||||
function scene.keyDown(key)
|
||||
local S=selected
|
||||
if key=="down"then
|
||||
if S<BGM.getCount()then
|
||||
if S<#bgmList then
|
||||
selected=S+1
|
||||
SFX.play('move',.7)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user