优化关卡评级显示相关代码
This commit is contained in:
1
main.lua
1
main.lua
@@ -92,6 +92,7 @@ GAME={
|
|||||||
seed=math.random(2e6),--Game seed
|
seed=math.random(2e6),--Game seed
|
||||||
setting={}, --Game settings
|
setting={}, --Game settings
|
||||||
rec={}, --Recording list, key,time,key,time...
|
rec={}, --Recording list, key,time,key,time...
|
||||||
|
rank=nil, --Rank reached
|
||||||
|
|
||||||
--Data for royale mode
|
--Data for royale mode
|
||||||
stage=nil, --Game stage
|
stage=nil, --Game stage
|
||||||
|
|||||||
@@ -436,6 +436,7 @@ function resetGameData()
|
|||||||
GAME.replaying=false
|
GAME.replaying=false
|
||||||
GAME.setting=copyGameSetting()
|
GAME.setting=copyGameSetting()
|
||||||
GAME.rec={}
|
GAME.rec={}
|
||||||
|
GAME.rank=0
|
||||||
math.randomseed(tm.getTime())
|
math.randomseed(tm.getTime())
|
||||||
GAME.seed=rnd(261046101471026)
|
GAME.seed=rnd(261046101471026)
|
||||||
|
|
||||||
@@ -491,6 +492,7 @@ function resetPartGameData(replaying)
|
|||||||
GAME.replaying=false
|
GAME.replaying=false
|
||||||
GAME.setting=copyGameSetting()
|
GAME.setting=copyGameSetting()
|
||||||
GAME.rec={}
|
GAME.rec={}
|
||||||
|
GAME.rank=0
|
||||||
math.randomseed(tm.getTime())
|
math.randomseed(tm.getTime())
|
||||||
GAME.seed=rnd(1046101471,2662622626)
|
GAME.seed=rnd(1046101471,2662622626)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -178,6 +178,15 @@ local _={}
|
|||||||
for k,v in next,missionEnum do _[v]=k end
|
for k,v in next,missionEnum do _[v]=k end
|
||||||
for k,v in next,_ do missionEnum[k]=v end
|
for k,v in next,_ do missionEnum[k]=v end
|
||||||
|
|
||||||
|
rankColor={
|
||||||
|
color.dRed, --D
|
||||||
|
color.dOrange, --C
|
||||||
|
color.lYellow, --B
|
||||||
|
color.lBlue, --A
|
||||||
|
color.lCyan, --S
|
||||||
|
color.lGreen, --Special
|
||||||
|
}
|
||||||
|
|
||||||
local function T(s,t)return love.graphics.newText(getFont(s),t)end
|
local function T(s,t)return love.graphics.newText(getFont(s),t)end
|
||||||
drawableText={
|
drawableText={
|
||||||
question=T(100,"?"),
|
question=T(100,"?"),
|
||||||
|
|||||||
@@ -2563,7 +2563,7 @@ local function gameOver()--Save record
|
|||||||
needSave=true
|
needSave=true
|
||||||
end
|
end
|
||||||
if R>0 then
|
if R>0 then
|
||||||
GAME.rank=text.ranks[R]
|
GAME.rank=R
|
||||||
if M.unlock then
|
if M.unlock then
|
||||||
for i=1,#M.unlock do
|
for i=1,#M.unlock do
|
||||||
local m=M.unlock[i]
|
local m=M.unlock[i]
|
||||||
|
|||||||
@@ -697,14 +697,6 @@ do--mode
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local modeRankColor={
|
|
||||||
color.dRed, --D
|
|
||||||
color.dOrange, --C
|
|
||||||
color.lYellow, --B
|
|
||||||
color.lBlue, --A
|
|
||||||
color.lCyan, --S
|
|
||||||
color.lGreen, --Special
|
|
||||||
}
|
|
||||||
function Pnt.mode()
|
function Pnt.mode()
|
||||||
local _
|
local _
|
||||||
local cam=mapCam
|
local cam=mapCam
|
||||||
@@ -734,7 +726,7 @@ do--mode
|
|||||||
local S=M.size
|
local S=M.size
|
||||||
local d=((M.x-(cam.x1+(sel and -180 or 0))/cam.k1)^2+(M.y-cam.y1/cam.k1)^2)^.55
|
local d=((M.x-(cam.x1+(sel and -180 or 0))/cam.k1)^2+(M.y-cam.y1/cam.k1)^2)^.55
|
||||||
if d<500 then S=S*(1.25-d*0.0005) end
|
if d<500 then S=S*(1.25-d*0.0005) end
|
||||||
local c=modeRankColor[R[M.name]]
|
local c=rankColor[R[M.name]]
|
||||||
if c then
|
if c then
|
||||||
gc.setColor(c)
|
gc.setColor(c)
|
||||||
else
|
else
|
||||||
@@ -1180,7 +1172,7 @@ do--play
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
do--pause
|
do--pause
|
||||||
local rankColor={
|
local fnsRankColor={
|
||||||
Z=color.lYellow,
|
Z=color.lYellow,
|
||||||
S=color.lGrey,
|
S=color.lGrey,
|
||||||
A=color.sky,
|
A=color.sky,
|
||||||
@@ -1273,7 +1265,7 @@ do--pause
|
|||||||
acc>.50 and"D"or
|
acc>.50 and"D"or
|
||||||
acc>.30 and"E"or
|
acc>.30 and"E"or
|
||||||
"F"
|
"F"
|
||||||
S.rankColor=rankColor[S.rank]
|
S.fnsRankColor=fnsRankColor[S.rank]
|
||||||
if acc==1 then
|
if acc==1 then
|
||||||
S.trophy=text.finesse_ap
|
S.trophy=text.finesse_ap
|
||||||
S.trophyColor=color.yellow
|
S.trophyColor=color.yellow
|
||||||
@@ -1363,15 +1355,31 @@ do--pause
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Level rank
|
--Level rank
|
||||||
if GAME.rank then
|
if GAME.rank>0 then
|
||||||
|
local str=text.ranks[GAME.rank]
|
||||||
setFont(80)
|
setFont(80)
|
||||||
gc.print(GAME.rank,50,10,nil,1.6)
|
|
||||||
|
gc.setColor(0,0,0,T*.3)
|
||||||
|
gc.print(str,46,-14,nil,1.8)
|
||||||
|
gc.print(str,46,-6,nil,1.8)
|
||||||
|
gc.print(str,54,-14,nil,1.8)
|
||||||
|
gc.print(str,54,-6,nil,1.8)
|
||||||
|
|
||||||
|
gc.setColor(0,0,0,T*.15)
|
||||||
|
gc.print(str,46,-10,nil,1.8)
|
||||||
|
gc.print(str,54,-10,nil,1.8)
|
||||||
|
gc.print(str,50,-14,nil,1.8)
|
||||||
|
gc.print(str,50,-6,nil,1.8)
|
||||||
|
|
||||||
|
local L=rankColor[GAME.rank]
|
||||||
|
gc.setColor(L[1],L[2],L[3],T)
|
||||||
|
gc.print(str,50,-10,nil,1.8)
|
||||||
end
|
end
|
||||||
|
|
||||||
--Finesse rank & trophy
|
--Finesse rank & trophy
|
||||||
if S.rank then
|
if S.rank then
|
||||||
setFont(60)
|
setFont(60)
|
||||||
gc.setColor(S.rankColor[1],S.rankColor[2],S.rankColor[3],T)
|
gc.setColor(S.fnsRankColor[1],S.fnsRankColor[2],S.fnsRankColor[3],T)
|
||||||
gc.print(S.rank,420,635)
|
gc.print(S.rank,420,635)
|
||||||
if S.trophy then
|
if S.trophy then
|
||||||
setFont(40)
|
setFont(40)
|
||||||
|
|||||||
Reference in New Issue
Block a user