选择模式后右侧显示排行榜等信息
This commit is contained in:
1
main.lua
1
main.lua
@@ -113,7 +113,6 @@ RSlist= require'parts.RSlist'DSCP=RSlist.TRS.centerPos
|
||||
PLY= require'parts.player'
|
||||
NETPLY= require'parts.netPlayer'
|
||||
MODETREE= require'parts.modeTree'
|
||||
MODES={}--Loaded modes and information
|
||||
|
||||
setmetatable(TEXTURE,{__index=function(self,k)
|
||||
MES.new('warn',"No texture called: "..k)
|
||||
|
||||
@@ -492,20 +492,9 @@ end
|
||||
function loadGame(mode,ifQuickPlay,ifNet)--Load a mode and go to game scene
|
||||
freshDate()
|
||||
if legalGameTime()then
|
||||
if not MODES[mode]then
|
||||
if love.filesystem.getInfo('parts/modes/'..mode..'.lua')and love.filesystem.getRealDirectory('parts/modes/'..mode..'.lua')~=SAVEDIR then
|
||||
MODES[mode]=require('parts.modes.'..mode)
|
||||
MODES[mode].name=mode
|
||||
if MODES[mode].score then
|
||||
MODES[mode].records=loadFile("record/"..mode..".rec",'-luaon -canSkip')or{}
|
||||
end
|
||||
else
|
||||
MES.new('error',"No mode called "..mode)
|
||||
return
|
||||
end
|
||||
end
|
||||
if MODES[mode].score then
|
||||
STAT.lastPlay=mode
|
||||
if not MODES[mode].available then
|
||||
MES.new('error',"Unavailable mode: "..mode)
|
||||
return
|
||||
end
|
||||
GAME.playing=true
|
||||
GAME.init=true
|
||||
|
||||
@@ -723,7 +723,37 @@ do--Userdata tables
|
||||
todayTime=0,
|
||||
}
|
||||
end
|
||||
do
|
||||
do--Mode data tables
|
||||
MODES=setmetatable({},{__index=function(self,name)
|
||||
local M
|
||||
if love.filesystem.getInfo('parts/modes/'..name..'.lua')and love.filesystem.getRealDirectory('parts/modes/'..name..'.lua')~=SAVEDIR then
|
||||
M=require('parts.modes.'..name)
|
||||
M.available=true
|
||||
M.name=name
|
||||
do--Check if need slowmark
|
||||
for k in next,M.env do
|
||||
if
|
||||
k=='mindas'or k=='minarr'or
|
||||
k=='das'or k=='arr'or
|
||||
k=='minsdarr'
|
||||
then
|
||||
M.slowMark=true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if M.score then
|
||||
M.records=loadFile("record/"..name..".rec",'-luaon -canSkip')or{}
|
||||
end
|
||||
else
|
||||
M={
|
||||
available=false,
|
||||
}
|
||||
MES.new('error',"Failed to load mode file: "..name)
|
||||
end
|
||||
self[name]=M
|
||||
return M
|
||||
end})
|
||||
MODEICON=setmetatable({},{__index=function(self,k)
|
||||
if isSafeFile('media/image/modeicon/'..k..'.png')then
|
||||
local img=love.graphics.newImage('media/image/modeicon/'..k..'.png')
|
||||
|
||||
@@ -6,7 +6,6 @@ return{
|
||||
eventSet='classic_e',
|
||||
bg='rgb',bgm='1980s',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.stat.score,P.stat.row}end,
|
||||
scoreDisp=function(D)return D[1].." "..D[2].." Lines"end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -6,7 +6,6 @@ return{
|
||||
eventSet='classic_h',
|
||||
bg='rgb',bgm='1980s',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.stat.score,P.stat.row}end,
|
||||
scoreDisp=function(D)return D[1].." "..D[2].." Lines"end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -6,7 +6,6 @@ return{
|
||||
eventSet='classic_u',
|
||||
bg='rgb',bgm='1980s',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.stat.score,P.stat.row}end,
|
||||
scoreDisp=function(D)return D[1].." "..D[2].." Lines"end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -5,7 +5,6 @@ return{
|
||||
eventSet='marathon_bfmax',
|
||||
bg='bg2',bgm='blank',
|
||||
},
|
||||
slowMark=true,
|
||||
getRank=function(P)
|
||||
local L=P.stat.row
|
||||
if L>=200 then
|
||||
|
||||
@@ -6,7 +6,6 @@ return{
|
||||
eventSet='marathon_h',
|
||||
bg='cubes',bgm='push',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{math.min(P.stat.row,200),P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -6,7 +6,6 @@ return{
|
||||
eventSet='marathon_inf',
|
||||
bg='bg2',bgm='push',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.stat.score,P.stat.row,P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].."P "..D[2].."L "..STRING.time(D[3])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -6,7 +6,6 @@ return{
|
||||
eventSet='marathon_n',
|
||||
bg='bg2',bgm='push',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{math.min(P.stat.row,200),P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -5,7 +5,6 @@ return{
|
||||
eventSet='master_ex',
|
||||
bg='blockspace',bgm='hope',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.modeData.rankPoint,P.stat.score}end,
|
||||
scoreDisp=function(D)return sectionName[math.floor(D[1]/10)+1].." "..D[2]end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]>b[2]end,
|
||||
|
||||
@@ -4,7 +4,6 @@ return{
|
||||
eventSet='master_final',
|
||||
bg='lightning',bgm='rectification',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.modeData.pt,P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].."P "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -5,7 +5,6 @@ return{
|
||||
eventSet='master_h',
|
||||
bg='bg2',bgm='secret7th',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.modeData.pt,P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].."P "..STRING.time(D[2])end,
|
||||
comp=function(a,b)
|
||||
|
||||
@@ -4,7 +4,6 @@ return{
|
||||
eventSet='master_m',
|
||||
bg='bg2',bgm='super7th',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{math.min(P.stat.row,200),P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -5,7 +5,6 @@ return{
|
||||
eventSet='master_n',
|
||||
bg='bg1',bgm='secret8th',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.modeData.pt,P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].."P "..STRING.time(D[2])end,
|
||||
comp=function(a,b)
|
||||
|
||||
@@ -3,7 +3,6 @@ return{
|
||||
eventSet='master_ph',
|
||||
bg='blockspace',bgm='race remix',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.result=='win'and 260 or P.modeData.pt,P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].."P "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -4,7 +4,6 @@ return{
|
||||
eventSet='strategy_e',
|
||||
bg='bg2',bgm='push',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{math.min(P.stat.row,200),P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -4,7 +4,6 @@ return{
|
||||
eventSet='strategy_e_plus',
|
||||
bg='bg2',bgm='push',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{math.min(P.stat.row,200),P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -4,7 +4,6 @@ return{
|
||||
eventSet='strategy_h',
|
||||
bg='bg2',bgm='secret8th',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{math.min(P.stat.row,200),P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -4,7 +4,6 @@ return{
|
||||
eventSet='strategy_h_plus',
|
||||
bg='bg2',bgm='secret8th',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{math.min(P.stat.row,200),P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -4,7 +4,6 @@ return{
|
||||
eventSet='strategy_u',
|
||||
bg='bg2',bgm='secret7th',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{math.min(P.stat.row,200),P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -4,7 +4,6 @@ return{
|
||||
eventSet='strategy_u_plus',
|
||||
bg='bg2',bgm='secret7th',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{math.min(P.stat.row,200),P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -7,7 +7,6 @@ return{
|
||||
eventSet='checkAttack_100',
|
||||
bg='flink',bgm='infinite',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.stat.atk<=100 and math.floor(P.stat.atk)or 100,P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -20,7 +20,6 @@ return{
|
||||
hook_drop=tech_check_hard,
|
||||
bg='flink',bgm='infinite',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.stat.atk<=100 and math.floor(P.stat.atk)or 100,P.stat.time}end,
|
||||
scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end,
|
||||
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
|
||||
|
||||
@@ -7,7 +7,6 @@ return{
|
||||
eventSet='ultra',
|
||||
bg='fan',bgm='sakura',
|
||||
},
|
||||
slowMark=true,
|
||||
score=function(P)return{P.stat.score}end,
|
||||
scoreDisp=function(D)return tostring(D[1])end,
|
||||
comp=function(a,b)return a[1]>b[1]end,
|
||||
|
||||
@@ -3,7 +3,7 @@ local gc_push,gc_pop=gc.push,gc.pop
|
||||
local gc_translate=gc.translate
|
||||
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
|
||||
local gc_line,gc_rectangle,gc_circle=gc.line,gc.rectangle,gc.circle
|
||||
local gc_print=gc.print
|
||||
local gc_print,gc_printf=gc.print,gc.printf
|
||||
local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest
|
||||
|
||||
local max,min=math.max,math.min
|
||||
@@ -181,7 +181,7 @@ function scene.keyDown(key,isRep)
|
||||
end
|
||||
elseif key=='f1'then
|
||||
SCN.go('mod')
|
||||
elseif key=='return'then
|
||||
elseif key=='space'or key=='return'then
|
||||
if isRep then return end
|
||||
if selectedItem then
|
||||
if selectedItem.type=='mode'then
|
||||
@@ -243,20 +243,22 @@ function scene.update(dt)
|
||||
end
|
||||
|
||||
local function _modePannelStencil()
|
||||
gc_rectangle('fill',0,0,805,610)
|
||||
gc_rectangle('fill',0,0,810,610)
|
||||
end
|
||||
local _unknownModeText={'???','?','?????'}
|
||||
function scene.draw()
|
||||
gc_setLineWidth(2)
|
||||
|
||||
--Gray background
|
||||
gc_setColor(COLOR.dX)
|
||||
gc_rectangle('fill',0,0,1280,110)
|
||||
gc_rectangle('fill',0,110,805,610)
|
||||
gc_rectangle('fill',0,110,810,610)
|
||||
gc_setColor(COLOR.X)
|
||||
gc_rectangle('fill',805,110,475,610)
|
||||
gc_rectangle('fill',810,110,475,610)
|
||||
|
||||
--Seperating line
|
||||
gc_setLineWidth(2)
|
||||
gc_setColor(COLOR.Z)
|
||||
gc_line(0,110,1280,110)
|
||||
gc_line(805,110,805,720)
|
||||
gc_line(810,110,810,720)
|
||||
|
||||
--Path
|
||||
setFont(35)
|
||||
@@ -266,6 +268,7 @@ function scene.draw()
|
||||
gc_print(CHAR.key.right,800,40)
|
||||
gc_print(searchText,840,40)
|
||||
|
||||
--Items
|
||||
gc_push('transform')
|
||||
gc_translate(0,110)
|
||||
gc_stencil(_modePannelStencil,'replace',1)
|
||||
@@ -275,11 +278,13 @@ function scene.draw()
|
||||
for i=1,#results do
|
||||
local item=results[i]
|
||||
if item.type=='folder'then
|
||||
local r,g,b
|
||||
if item.name=='_back'then
|
||||
gc_setColor(.3,.2,0,item.alpha*.3)
|
||||
r,g,b=.3,.2,0
|
||||
else
|
||||
gc_setColor(1,.8,.5,item.alpha*.3)
|
||||
r,g,b=1,.8,.5
|
||||
end
|
||||
gc_setColor(r,g,b,item.alpha*.3)
|
||||
gc_rectangle('fill',item.x,item.y,item.w,item.h)
|
||||
end
|
||||
gc_setColor(1,1,1,item.alpha)
|
||||
@@ -296,6 +301,50 @@ function scene.draw()
|
||||
end
|
||||
gc_setStencilTest()
|
||||
gc_pop()
|
||||
|
||||
--Selected item info
|
||||
if selectedItem then
|
||||
if selectedItem.type=='folder'then
|
||||
setFont(50)
|
||||
gc_setColor(1,1,1,selectedItem.alpha)
|
||||
mStr(selectedItem.name,1043,200)
|
||||
elseif selectedItem.type=='mode'then
|
||||
local M=MODES[selectedItem.name]
|
||||
|
||||
--Slowmark
|
||||
if M.slowMark then
|
||||
gc_setColor(.6,.9,1,(1-3*TIME()%1*.8)*selectedItem.alpha)
|
||||
setFont(20)
|
||||
gc_print("CTRL",815,155)
|
||||
end
|
||||
|
||||
--Mode title & info
|
||||
gc_setColor(1,1,1,selectedItem.alpha)
|
||||
local t=text.modes[M.name]or _unknownModeText
|
||||
setFont(40)mStr(t[1],1043,110)
|
||||
setFont(30)mStr(t[2],1043,153)
|
||||
setFont(25)mStr(t[3],1043,200)
|
||||
|
||||
--High scores
|
||||
if M.score then
|
||||
mText(TEXTOBJ.highScore,1043,293)
|
||||
gc_setColor(COLOR.dX)
|
||||
gc_rectangle('fill',825,335,440,260,3)
|
||||
local L=M.records
|
||||
gc_setColor(1,1,1)
|
||||
setFont(20)
|
||||
if false and L[1]then
|
||||
for i=1,#L do
|
||||
local res=M.scoreDisp(L[i])
|
||||
gc_print(res,830,310+25*i,0,min(35/#res,1),1)
|
||||
gc_printf(L[i].date or"-/-/-",1100,310+25*i,200,'right',nil,.8,1)
|
||||
end
|
||||
else
|
||||
mText(TEXTOBJ.noScore,1043,433)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
|
||||
Reference in New Issue
Block a user