Skip to content

Commit

Permalink
添加统计界面
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Jan 8, 2022
1 parent 308021e commit 8f779ea
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 50 deletions.
16 changes: 8 additions & 8 deletions parts/language/lang_en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ return{

errorMsg="Quatrack ran into a problem and needs to restart.\nYou can send the error log to the developers.",

stat={
"Game run:",
"Game played:",
"Time played:",
"Total score:",
},
staff={
"Author: MrZ Email: [email protected]",
"Powered by LÖVE",
Expand All @@ -75,14 +81,8 @@ return{
setting="Setting",
editor="Editor",
},
pause={
setting="Settings (S)",
replay="Replay (P)",
save="Save (O)",
resume="Resume (esc)",
restart="Retry (R)",
quit="Quit (Q)",
tas="TAS (T)",
stat={
path="Open save directory",
},
setting={
mainVol="Main Volume",
Expand Down
16 changes: 8 additions & 8 deletions parts/language/lang_zh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ return{

errorMsg="Quatrack遭受了雷击,需要重新启动.\n我们已收集了一些错误信息,你可以向作者进行反馈.",

stat={
"启动次数:",
"游玩曲数:",
"游玩时间:",
"总分数:",
},
staff={
"作者: MrZ 邮箱: [email protected]",
"使用LÖVE引擎",
Expand All @@ -75,14 +81,8 @@ return{
setting="设置",
editor="编辑器",
},
pause={
setting="设置(S)",
replay="回放(P)",
save="保存(O)",
resume="继续(esc)",
restart="重新开始(R)",
quit="退出(Q)",
tas="TAS (T)",
stat={
path="打开存档文件夹",
},
setting={
mainVol="总音量",
Expand Down
14 changes: 7 additions & 7 deletions parts/scenes/game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ local function _tryGoResult()
accText=accText,
averageDeviate=("%.2fms"):format(hitCount>0 and totalDeviateTime/hitCount*1000 or 0),
hits={
[-1]=hits[-1],
[0]=hits[0],
[1]=hits[1],
[2]=hits[2],
[3]=hits[3],
[4]=hits[4],
[5]=hits[5],
miss=hits[-1],
bad=hits[0],
well=hits[1],
good=hits[2],
perf=hits[3],
prec=hits[4],
marv=hits[5],
},
bestChain=bestChain,
})
Expand Down
7 changes: 4 additions & 3 deletions parts/scenes/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ function scene.draw()
end

scene.widgetList={
WIDGET.newButton{name='lang', x=240,y=80,w=100, color='lN',code=goScene'lang',font=70,fText=CHAR.icon.language},
WIDGET.newButton{name='lang', x=240,y=80,w=100, color='lN',font=70,code=goScene'lang',fText=CHAR.icon.language},
WIDGET.newButton{name="play", x=240,y=450,w=280,h=120, color="lR",font=45,code=goScene'mapSelect'},
WIDGET.newButton{name="setting",x=640,y=450,w=280,h=120, color="lB",font=45,code=goScene'setting'},
WIDGET.newButton{name="editor", x=1040,y=450,w=280,h=120,color="D",font=45,code=function()MES.new('warn',"Coming soon")end},
WIDGET.newButton{name="manual", x=1040,y=600,w=95,color="G",font=60,fText=CHAR.icon.zBook,code=function()love.system.openURL("https://github.com/26F-Studio/Quatrack/wiki/beatmap")end},
WIDGET.newButton{name="stat", x=240,y=600,w=95, color="lY",font=70,code=goScene'stat',fText=CHAR.key.winMenu},
WIDGET.newButton{name="editor", x=1040,y=450,w=280,h=120,color="D",font=45,code=function()MES.new('info',"Coming soon")end},
WIDGET.newButton{name="manual", x=1040,y=600,w=95, color="G",font=60,fText=CHAR.icon.zBook,code=function()love.system.openURL("https://github.com/26F-Studio/Quatrack/wiki/beatmap")end},
}

return scene
50 changes: 26 additions & 24 deletions parts/scenes/result.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ function scene.sceneInit()
accText="96.20%",
averageDeviate='26.26ms',
hits={
[-1]=4,
[0]=4,
[1]=4,
[2]=62,
[3]=62,
[4]=62,
[5]=62,
miss=4,
bad=4,
well=4,
good=62,
perf=62,
prec=62,
marv=62,
},
bestChain=math.random(5),
}
Expand Down Expand Up @@ -158,41 +158,43 @@ function scene.draw()

--Draw hits
local hits=results.hits
gc.translate(480,240)
setFont(100)
gc.setColor(.92,.82,.65)
gc.printf(hits[3]+hits[4]+hits[5],0,240,960,'right')
gc.printf(hits.perf+hits.prec+hits.marv,-140,0,600,'right')

setFont(80)
gc.setColor(.58,.65,.96)
gc.printf(hits[1]+hits[2],0,340,960,'right')
gc.printf(hits.well+hits.good,-140,100,600,'right')

gc.setColor(.6,.1,.1)
gc.printf(hits[-1]+hits[0],0,420,960,'right')
gc.printf(hits.miss+hits.bad,-140,180,600,'right')

setFont(25)
gc.setColor(hitColors[5])
gc.printf(hitTexts[5],0,267,1045,'right')
gc.print(hits[5],1055,267)
gc.printf(hitTexts[5],-55,27,600,'right')
gc.print(hits.marv,555,27)
gc.setColor(hitColors[4])
gc.printf(hitTexts[4],0,292,1045,'right')
gc.print(hits[4],1055,292)
gc.printf(hitTexts[4],-55,52,600,'right')
gc.print(hits.prec,555,52)
gc.setColor(hitColors[3])
gc.printf(hitTexts[3],0,317,1045,'right')
gc.print(hits[3],1055,317)
gc.printf(hitTexts[3],-55,77,600,'right')
gc.print(hits.perf,555,77)

gc.setColor(hitColors[2])
gc.printf(hitTexts[2],0,360+3,1045,'right')
gc.print(hits[2],1055,363)
gc.printf(hitTexts[2],-55,123,600,'right')
gc.print(hits.good,555,123)
gc.setColor(hitColors[1])
gc.printf(hitTexts[1],0,390+3,1045,'right')
gc.print(hits[1],1055,393)
gc.printf(hitTexts[1],-55,153,600,'right')
gc.print(hits.well,555,153)

gc.setColor(hitColors[0])
gc.printf(hitTexts[0],0,440+3,1045,'right')
gc.print(hits[0],1055,443)
gc.printf(hitTexts[0],-55,203,600,'right')
gc.print(hits.bad,555,203)
gc.setColor(hitColors[-1])
gc.printf(hitTexts[-1],0,470+3,1045,'right')
gc.print(hits[-1],1055,473)
gc.printf(hitTexts[-1],-55,233,600,'right')
gc.print(hits.miss,555,233)
gc.translate(-480,-240)
end

scene.widgetList={
Expand Down
79 changes: 79 additions & 0 deletions parts/scenes/stat.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
local gc=love.graphics

local scene={}

local item

function scene.sceneInit()
BG.set()
item={
STAT.run,
STAT.game,
STRING.time(STAT.time),
STAT.score,
}
end

function scene.draw()
gc.setColor(COLOR.Z)
setFont(30)
for i=1,#item do
gc.print(item[i],300,i*50)
gc.print(text.stat[i],100,i*50)
end

--Draw hits
local hits=STAT.hits
gc.translate(0,260)
setFont(100)
gc.setColor(.92,.82,.65)
gc.printf(hits.perf+hits.prec+hits.marv,-140,0,600,'right')

setFont(80)
gc.setColor(.58,.65,.96)
gc.printf(hits.well+hits.good,-140,100,600,'right')

gc.setColor(.6,.1,.1)
gc.printf(hits.miss+hits.bad,-140,180,600,'right')

setFont(25)
gc.setColor(hitColors[5])
gc.printf(hitTexts[5],-55,27,600,'right')
gc.print(hits.marv,555,27)
gc.setColor(hitColors[4])
gc.printf(hitTexts[4],-55,52,600,'right')
gc.print(hits.prec,555,52)
gc.setColor(hitColors[3])
gc.printf(hitTexts[3],-55,77,600,'right')
gc.print(hits.perf,555,77)

gc.setColor(hitColors[2])
gc.printf(hitTexts[2],-55,123,600,'right')
gc.print(hits.good,555,123)
gc.setColor(hitColors[1])
gc.printf(hitTexts[1],-55,153,600,'right')
gc.print(hits.well,555,153)

gc.setColor(hitColors[0])
gc.printf(hitTexts[0],-55,203,600,'right')
gc.print(hits.bad,555,203)
gc.setColor(hitColors[-1])
gc.printf(hitTexts[-1],-55,233,600,'right')
gc.print(hits.miss,555,233)
gc.translate(0,-260)
end

scene.widgetList={
WIDGET.newButton{name='path',x=860,y=640,w=250,h=80,font=25,
code=function()
if SYSTEM=="Windows"or SYSTEM=="Linux"then
love.system.openURL(SAVEDIR)
else
MES.new('info',SAVEDIR)
end
end
},
WIDGET.newButton{name='back',x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
}

return scene

0 comments on commit 8f779ea

Please sign in to comment.