显示即将解锁的关卡 closes #194 (#198)

* 显示即将解锁的关卡, closes #194

除了中文和英文之外的语言我还没处理。

* 成绩从Grade改为Rank
This commit is contained in:
Trebor Huang
2021-08-12 19:06:45 +08:00
committed by GitHub
parent d7fe8bfeee
commit c81850cb36
4 changed files with 44 additions and 34 deletions

View File

@@ -77,6 +77,8 @@ return{
VKCurW="Current. Pos. Weight", VKCurW="Current. Pos. Weight",
noScore="No Scores Yet", noScore="No Scores Yet",
modeLocked="Locked",
unlockHint="Achieve Rank D or above in prerequisite modes to unlock.",
highScore="Personal Bests", highScore="Personal Bests",
newRecord="New Record!", newRecord="New Record!",

View File

@@ -77,6 +77,8 @@ return{
VKCurW="当前点权重", VKCurW="当前点权重",
noScore="暂无成绩", noScore="暂无成绩",
modeLocked="暂未解锁",
unlockHint="前一模式达到成绩D或以上即可解锁",
highScore="最佳成绩", highScore="最佳成绩",
newRecord="打破纪录", newRecord="打破纪录",

View File

@@ -175,7 +175,7 @@ do--drawableText
combo=T(20),maxcmb=T(20), combo=T(20),maxcmb=T(20),
pc=T(20),ko=T(25), pc=T(20),ko=T(25),
noScore=T(45),highScore=T(30), noScore=T(45),highScore=T(30),modeLocked=T(45),
} }
end end
do--BLOCKS do--BLOCKS

View File

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