显示即将解锁的关卡 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",
noScore="No Scores Yet",
modeLocked="Locked",
unlockHint="Achieve Rank D or above in prerequisite modes to unlock.",
highScore="Personal Bests",
newRecord="New Record!",

View File

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

View File

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

View File

@@ -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