整 理 代 码
(应该没有改到字符串里面的东西吧…)起码不直接影响运行
This commit is contained in:
@@ -26,14 +26,14 @@ local scene={}
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set()
|
||||
mapCam.zoomK=SCN.prev=='main'and 5 or 1
|
||||
mapCam.zoomK=SCN.prev=='main' and 5 or 1
|
||||
visibleModes={}--1=unlocked, 2=locked but visible
|
||||
for name,M in next,MODES do
|
||||
if RANKS[name]and M.x then
|
||||
if RANKS[name] and M.x then
|
||||
visibleModes[name]=1
|
||||
if M.unlock then
|
||||
for i=1,#M.unlock do
|
||||
visibleModes[M.unlock[i]]=visibleModes[M.unlock[i]]or 2
|
||||
visibleModes[M.unlock[i]]=visibleModes[M.unlock[i]] or 2
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -49,14 +49,14 @@ end
|
||||
|
||||
local function _onModeRaw(x,y)
|
||||
for name,M in next,MODES do
|
||||
if visibleModes[name]and M.x then
|
||||
if visibleModes[name] and M.x then
|
||||
local s=M.size
|
||||
if M.shape==1 then
|
||||
if x>M.x-s and x<M.x+s and y>M.y-s and y<M.y+s then return name end
|
||||
elseif M.shape==2 then
|
||||
if abs(x-M.x)+abs(y-M.y)<s+12 then return name end
|
||||
elseif M.shape==3 then
|
||||
if(x-M.x)^2+(y-M.y)^2<(s+6)^2 then return name end
|
||||
if (x-M.x)^2+(y-M.y)^2<(s+6)^2 then return name end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -78,7 +78,7 @@ function scene.wheelMoved(_,dy)
|
||||
mapCam.xOy:translate(x*(1-k),y*(1-k))
|
||||
end
|
||||
function scene.mouseMove(_,_,dx,dy)
|
||||
if ms.isDown(1)then
|
||||
if ms.isDown(1) then
|
||||
_moveMap(dx,dy)
|
||||
end
|
||||
mapCam.keyCtrl=false
|
||||
@@ -109,9 +109,9 @@ function scene.touchDown()
|
||||
end
|
||||
function scene.touchMove(x,y,dx,dy)
|
||||
local L=tc.getTouches()
|
||||
if not L[2]then
|
||||
if not L[2] then
|
||||
_moveMap(dx,dy)
|
||||
elseif not L[3]then
|
||||
elseif not L[3] then
|
||||
x,y=SCR.xOy:inverseTransformPoint(tc.getPosition(L[1]))
|
||||
dx,dy=SCR.xOy:inverseTransformPoint(tc.getPosition(L[2]))--Not delta!!!
|
||||
local d=(x-dx)^2+(y-dy)^2
|
||||
@@ -130,7 +130,7 @@ function scene.touchClick(x,y)
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=='return'then
|
||||
if key=='return' then
|
||||
if mapCam.sel then
|
||||
if visibleModes[mapCam.sel]==2 then
|
||||
MES.new('info',text.unlockHint)
|
||||
@@ -139,9 +139,9 @@ function scene.keyDown(key,isRep)
|
||||
loadGame(mapCam.sel)
|
||||
end
|
||||
end
|
||||
elseif key=='f1'then
|
||||
elseif key=='f1' then
|
||||
SCN.go('mod')
|
||||
elseif key=='escape'then
|
||||
elseif key=='escape' then
|
||||
if mapCam.sel then
|
||||
mapCam.sel=false
|
||||
else
|
||||
@@ -154,10 +154,10 @@ function scene.update()
|
||||
local dx,dy=0,0
|
||||
local F
|
||||
if not SCN.swapping then
|
||||
if kb.isDown('up', 'w')then dy=dy+10 F=true end
|
||||
if kb.isDown('down', 's')then dy=dy-10 F=true end
|
||||
if kb.isDown('left', 'a')then dx=dx+10 F=true end
|
||||
if kb.isDown('right','d')then dx=dx-10 F=true end
|
||||
if kb.isDown('up', 'w') then dy=dy+10 F=true end
|
||||
if kb.isDown('down', 's') then dy=dy-10 F=true end
|
||||
if kb.isDown('left', 'a') then dx=dx+10 F=true end
|
||||
if kb.isDown('right','d') then dx=dx-10 F=true end
|
||||
local js=Z.getJsState()[1]
|
||||
if js then
|
||||
local sx,sy=js._jsObj:getGamepadAxis('leftx'),js._jsObj:getGamepadAxis('lefty')
|
||||
@@ -172,7 +172,7 @@ function scene.update()
|
||||
end
|
||||
if F then
|
||||
mapCam.keyCtrl=true
|
||||
if kb.isDown('lctrl','rctrl','lalt','ralt')then
|
||||
if kb.isDown('lctrl','rctrl','lalt','ralt') then
|
||||
scene.wheelMoved(nil,(dy-dx)*.026)
|
||||
else
|
||||
_moveMap(dx,dy)
|
||||
@@ -186,7 +186,7 @@ function scene.update()
|
||||
end
|
||||
|
||||
local _=SCN.stat.tar
|
||||
mapCam.zoomMethod=_=="game"and 1 or _=="mode"and 2
|
||||
mapCam.zoomMethod=_=="game" and 1 or _=="mode" and 2
|
||||
if mapCam.zoomMethod==1 then
|
||||
_=mapCam.zoomK
|
||||
if _<.8 then _=_*1.05 end
|
||||
@@ -230,7 +230,7 @@ function scene.draw()
|
||||
gc_setLineWidth(8)
|
||||
gc_setColor(1,1,1,.2)
|
||||
for name,M in next,MODES do
|
||||
if R[name]and M.unlock and M.x then
|
||||
if R[name] and M.unlock and M.x then
|
||||
for _=1,#M.unlock do
|
||||
local m=MODES[M.unlock[_]]
|
||||
gc_line(M.x,M.y,m.x,m.y)
|
||||
@@ -297,7 +297,7 @@ function scene.draw()
|
||||
gc_setColor(1,1,1)
|
||||
if visibleModes[sel]==2 then
|
||||
mText(TEXTOBJ.modeLocked,1100,370)
|
||||
elseif L[1]then
|
||||
elseif L[1] then
|
||||
for i=1,#L do
|
||||
local t=M.scoreDisp(L[i])
|
||||
local f=int((30-#t*.5)/5)*5
|
||||
@@ -326,7 +326,7 @@ end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name='mod', x=140,y=655,w=220,h=80,font=35,code=goScene'mod'},
|
||||
WIDGET.newButton{name='start',x=1040,y=655,w=180,h=80,font=40,code=pressKey'return',hideF=function()return not mapCam.sel end},
|
||||
WIDGET.newButton{name='start',x=1040,y=655,w=180,h=80,font=40,code=pressKey'return',hideF=function() return not mapCam.sel end},
|
||||
WIDGET.newButton{name='back', x=1200,y=655,w=120,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user