整 理 代 码

(应该没有改到字符串里面的东西吧…)起码不直接影响运行
This commit is contained in:
MrZ_26
2022-10-01 11:32:11 +08:00
parent 6e00ff96ec
commit 06f4bb4e1a
236 changed files with 2087 additions and 2114 deletions

View File

@@ -20,7 +20,7 @@ end
local ENUM_MISSION=ENUM_MISSION
local legalInput={Z=true,S=true,J=true,L=true,T=true,O=true,I=true,A=true,_=true,P=true}
function scene.keyDown(key)
if key=='left'then
if key=='left' then
local p=cur
if p==0 then
cur=#MISSION
@@ -30,7 +30,7 @@ function scene.keyDown(key)
until MISSION[p]~=MISSION[cur]
cur=p
end
elseif key=='right'then
elseif key=='right' then
local p=cur
if p==#MISSION then
cur=0
@@ -40,7 +40,7 @@ function scene.keyDown(key)
until MISSION[p+1]~=MISSION[cur+1]
cur=p
end
elseif key=='ten'then
elseif key=='ten' then
for _=1,10 do
local p=cur
if p==#MISSION then break end
@@ -49,63 +49,63 @@ function scene.keyDown(key)
until MISSION[p+1]~=MISSION[cur+1]
cur=p
end
elseif key=='backspace'then
elseif key=='backspace' then
if #input>0 then
input=""
elseif cur>0 then
rem(MISSION,cur)
cur=cur-1
if cur>0 and MISSION[cur]==MISSION[cur+1]then
if cur>0 and MISSION[cur]==MISSION[cur+1] then
scene.keyDown('right')
end
end
elseif key=='delete'then
if tryReset()then
elseif key=='delete' then
if tryReset() then
TABLE.cut(MISSION)
cur=0
SFX.play('finesseError',.7)
end
elseif key=='c'and kb.isDown('lctrl','rctrl')or key=='cC'then
elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then
if #MISSION>0 then
sys.setClipboardText("Techmino Target:"..DATA.copyMission())
MES.new('check',text.exportSuccess)
end
elseif key=='v'and kb.isDown('lctrl','rctrl')or key=='cV'then
elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then
local str=sys.getClipboardText()
local p=str:find(":")--ptr*
if p then
if not str:sub(1,p-1):find("Target")then
if not str:sub(1,p-1):find("Target") then
MES.new('error',text.pasteWrongPlace)
end
str=str:sub(p+1)
end
if DATA.pasteMission(str)then
if DATA.pasteMission(str) then
MES.new('check',text.importSuccess)
cur=#MISSION
else
MES.new('error',text.dataCorrupted)
end
elseif key=='escape'then
elseif key=='escape' then
SCN.back()
elseif type(key)=='number'then
elseif type(key)=='number' then
local p=cur+1
while MISSION[p]==key do p=p+1 end
ins(MISSION,p,key)
cur=p
else
if key=='space'then
if key=='space' then
key="_"
else
key=string.upper(key)
end
input=input..key
if ENUM_MISSION[input]then
if ENUM_MISSION[input] then
cur=cur+1
ins(MISSION,cur,ENUM_MISSION[input])
SFX.play('lock')
input=""
elseif #input>1 or not legalInput[input]then
elseif #input>1 or not legalInput[input] then
input=""
end
end
@@ -131,7 +131,7 @@ function scene.draw()
local i,j=1,#L
local count=1
repeat
if L[i]==L[i-1]then
if L[i]==L[i-1] then
count=count+1
else
if count>1 then
@@ -220,7 +220,7 @@ scene.widgetList={
WIDGET.newKey{name='ten', x=1000,y=440,w=90, color='lG',font=55,code=pressKey'ten', fText=CHAR.key.macTab},
WIDGET.newKey{name='backsp', x=1000,y=540,w=90, color='lY',font=55,code=pressKey'backspace',fText=CHAR.key.backspace},
WIDGET.newKey{name='reset', x=1000,y=640,w=90, color='lY',font=50,code=pressKey'delete', fText=CHAR.icon.trash},
WIDGET.newButton{name='copy', x=1140,y=440,w=170,h=80,color='lR',font=50,code=pressKey'cC', fText=CHAR.icon.export,hideF=function()return #MISSION==0 end},
WIDGET.newButton{name='copy', x=1140,y=440,w=170,h=80,color='lR',font=50,code=pressKey'cC', fText=CHAR.icon.export,hideF=function() return #MISSION==0 end},
WIDGET.newButton{name='paste', x=1140,y=540,w=170,h=80,color='lB',font=50,code=pressKey'cV', fText=CHAR.icon.import},
WIDGET.newSwitch{name='mission',x=1150,y=340,lim=280,disp=CUSval('missionKill'),code=CUSrev('missionKill')},