|
|
|
|
@@ -30,6 +30,15 @@ local scene={}
|
|
|
|
|
function scene.sceneInit(org)
|
|
|
|
|
BG.set()
|
|
|
|
|
mapCam.zoomK=org=='main'and 5 or 1
|
|
|
|
|
VisibleModes = {} -- 1 for unlocked, 2 for locked but visible
|
|
|
|
|
for name,M in next,MODES do
|
|
|
|
|
if RANKS[name]and M.unlock and M.x then
|
|
|
|
|
VisibleModes[name] = 1
|
|
|
|
|
for _=1,#M.unlock do
|
|
|
|
|
VisibleModes[M.unlock[_]] = VisibleModes[M.unlock[_]] or 2
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function getK()
|
|
|
|
|
@@ -39,11 +48,9 @@ local function getPos()
|
|
|
|
|
return mapCam.xOy:inverseTransformPoint(0,0)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function onMode(x,y)
|
|
|
|
|
x,y=x-640,y-360
|
|
|
|
|
x,y=mapCam.xOy:inverseTransformPoint(x,y)
|
|
|
|
|
local function onModeRaw(x,y)
|
|
|
|
|
for name,M in next,MODES do
|
|
|
|
|
if RANKS[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
|
|
|
|
|
@@ -80,7 +87,9 @@ end
|
|
|
|
|
function scene.mouseClick(x,y)
|
|
|
|
|
local _=mapCam.sel
|
|
|
|
|
if not _ or x<920 then
|
|
|
|
|
local SEL=onMode(x,y)
|
|
|
|
|
x,y=x-640,y-360
|
|
|
|
|
x,y=mapCam.xOy:inverseTransformPoint(x,y)
|
|
|
|
|
local SEL=onModeRaw(x,y)
|
|
|
|
|
if _~=SEL then
|
|
|
|
|
if SEL then
|
|
|
|
|
mapCam.moving=true
|
|
|
|
|
@@ -124,8 +133,12 @@ function scene.keyDown(key,isRep)
|
|
|
|
|
if isRep then return end
|
|
|
|
|
if key=="return"then
|
|
|
|
|
if mapCam.sel then
|
|
|
|
|
mapCam.keyCtrl=false
|
|
|
|
|
loadGame(mapCam.sel)
|
|
|
|
|
if VisibleModes[mapCam.sel] == 2 then
|
|
|
|
|
MES.new('info', text.unlockHint)
|
|
|
|
|
else
|
|
|
|
|
mapCam.keyCtrl=false
|
|
|
|
|
loadGame(mapCam.sel)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif key=="f1"then
|
|
|
|
|
SCN.go('mod')
|
|
|
|
|
@@ -164,22 +177,10 @@ function scene.update()
|
|
|
|
|
else
|
|
|
|
|
moveMap(dx,dy)
|
|
|
|
|
local x,y=getPos()
|
|
|
|
|
for name,M in next,MODES do
|
|
|
|
|
if RANKS[name]and M.x then
|
|
|
|
|
local SEL
|
|
|
|
|
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 SEL=name end
|
|
|
|
|
elseif M.shape==2 then
|
|
|
|
|
if abs(x-M.x)+abs(y-M.y)<s then SEL=name end
|
|
|
|
|
elseif M.shape==3 then
|
|
|
|
|
if(x-M.x)^2+(y-M.y)^2<s^2 then SEL=name end
|
|
|
|
|
end
|
|
|
|
|
if SEL and mapCam.sel~=SEL then
|
|
|
|
|
mapCam.sel=SEL
|
|
|
|
|
SFX.play('click')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local SEL = onModeRaw(x,y)
|
|
|
|
|
if SEL and mapCam.sel~=SEL then
|
|
|
|
|
mapCam.sel=SEL
|
|
|
|
|
SFX.play('click')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
@@ -196,7 +197,7 @@ function scene.update()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--D/C/B/A/S/special
|
|
|
|
|
--No Rank/D/C/B/A/S/special/locked
|
|
|
|
|
local baseRankColor={
|
|
|
|
|
[0]={0,0,0,.3},
|
|
|
|
|
{.4,.1,.1,.3},
|
|
|
|
|
@@ -205,6 +206,7 @@ local baseRankColor={
|
|
|
|
|
{.7,.75,.85,.3},
|
|
|
|
|
{.85,.8,.3,.3},
|
|
|
|
|
{.4,.7,.4,.3},
|
|
|
|
|
locked={.5,.5,.5,.9}
|
|
|
|
|
}
|
|
|
|
|
local rankColor=rankColor
|
|
|
|
|
local function drawModeShape(M,S,drawType)
|
|
|
|
|
@@ -243,12 +245,12 @@ function scene.draw()
|
|
|
|
|
setFont(80)
|
|
|
|
|
gc_setLineWidth(4)
|
|
|
|
|
for name,M in next,MODES do
|
|
|
|
|
if R[name]then
|
|
|
|
|
if VisibleModes[name]then
|
|
|
|
|
local rank=R[name]
|
|
|
|
|
local S=M.size
|
|
|
|
|
|
|
|
|
|
--Draw shapes on map
|
|
|
|
|
gc_setColor(baseRankColor[rank])
|
|
|
|
|
gc_setColor(baseRankColor[rank or "locked"])
|
|
|
|
|
drawModeShape(M,S,'fill')
|
|
|
|
|
gc_setColor(1,1,sel==name and 0 or 1)
|
|
|
|
|
drawModeShape(M,S,'line')
|
|
|
|
|
@@ -262,12 +264,14 @@ function scene.draw()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--Rank
|
|
|
|
|
name=text.ranks[rank]
|
|
|
|
|
if name then
|
|
|
|
|
gc_setColor(0,0,0,.8)
|
|
|
|
|
mStr(name,M.x+M.size*.7,M.y-50-M.size*.7)
|
|
|
|
|
gc_setColor(rankColor[rank])
|
|
|
|
|
mStr(name,M.x+M.size*.7+4,M.y-50-M.size*.7-4)
|
|
|
|
|
if VisibleModes[name]==1 then
|
|
|
|
|
name=text.ranks[rank]
|
|
|
|
|
if name then
|
|
|
|
|
gc_setColor(0,0,0,.8)
|
|
|
|
|
mStr(name,M.x+M.size*.7,M.y-50-M.size*.7)
|
|
|
|
|
gc_setColor(rankColor[rank])
|
|
|
|
|
mStr(name,M.x+M.size*.7+4,M.y-50-M.size*.7-4)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
@@ -292,7 +296,9 @@ function scene.draw()
|
|
|
|
|
gc_rectangle('fill',940,290,320,280,5)--Highscore board
|
|
|
|
|
local L=M.records
|
|
|
|
|
gc_setColor(1,1,1)
|
|
|
|
|
if L[1]then
|
|
|
|
|
if VisibleModes[sel] == 2 then
|
|
|
|
|
mText(drawableText.modeLocked,1100,370)
|
|
|
|
|
elseif L[1]then
|
|
|
|
|
for i=1,#L do
|
|
|
|
|
local t=M.scoreDisp(L[i])
|
|
|
|
|
local f=int((30-#t*.4)/5)*5
|
|
|
|
|
|