Show time improvement on the level tally
This commit is contained in:
parent
d21bfd4601
commit
652e7e8108
51
js/main.js
51
js/main.js
@ -1759,44 +1759,55 @@ class Player extends PrimaryView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
overlay_middle = mk('dl.score-chart',
|
overlay_middle = mk('dl.score-chart',
|
||||||
mk('dt', "base score"),
|
mk('dt.-component', "base score"),
|
||||||
mk('dd', base.toLocaleString()),
|
mk('dd.-component', base.toLocaleString()),
|
||||||
mk('dt', "time bonus"),
|
mk('dt.-component', "time bonus"),
|
||||||
mk('dd', `+ ${time.toLocaleString()}`),
|
mk('dd.-component', `+ ${time.toLocaleString()}`),
|
||||||
);
|
);
|
||||||
// It should be impossible to ever have a bonus and then drop back to 0 with CC2
|
|
||||||
// rules; thieves can halve it, but the amount taken is rounded down.
|
|
||||||
// That is to say, I don't need to track whether we ever got a score bonus
|
|
||||||
if (this.level.bonus_points) {
|
if (this.level.bonus_points) {
|
||||||
overlay_middle.append(
|
overlay_middle.append(
|
||||||
mk('dt', "score bonus"),
|
mk('dt.-component', "score bonus"),
|
||||||
mk('dd', `+ ${this.level.bonus_points.toLocaleString()}`),
|
mk('dd.-component', `+ ${this.level.bonus_points.toLocaleString()}`),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
overlay_middle.append(mk('dt', ""), mk('dd', ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO show your time, bold time...?
|
// TODO show your time, time improvement...?
|
||||||
|
let score_dd = mk('dd.-sum', scorecard.score.toLocaleString());
|
||||||
|
if (scorecard.aid === 0) {
|
||||||
|
score_dd.append(mk('span.-star', "★"));
|
||||||
|
}
|
||||||
|
overlay_middle.append(mk('dt.-sum', "level score"), score_dd);
|
||||||
|
|
||||||
overlay_middle.append(
|
overlay_middle.append(
|
||||||
mk('dt.-sum', "level score"),
|
mk('dt.-total', "total score"),
|
||||||
mk('dd.-sum', `${scorecard.score.toLocaleString()} ${scorecard.aid === 0 ? '★' : ''}`),
|
mk('dd.-total', savefile.total_score.toLocaleString()),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (old_scorecard && old_scorecard.score < scorecard.score) {
|
if (old_scorecard && old_scorecard.score < scorecard.score) {
|
||||||
overlay_middle.append(
|
overlay_middle.append(
|
||||||
mk('dt', "improvement"),
|
mk('dd.-total', `(+ ${(scorecard.score - old_scorecard.score).toLocaleString()})`),
|
||||||
mk('dd', `+ ${(scorecard.score - old_scorecard.score).toLocaleString()}`),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
overlay_middle.append(mk('dt', ""), mk('dd', ""));
|
overlay_middle.append(mk('dd', ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay_middle.append(
|
overlay_middle.append(
|
||||||
mk('dt', "total score"),
|
mk('dd', ""),
|
||||||
mk('dd', savefile.total_score.toLocaleString()),
|
mk('dt', "real time"),
|
||||||
|
mk('dd', util.format_duration(scorecard.abstime / TICS_PER_SECOND, 2)),
|
||||||
|
mk('dt.-total', "total time"),
|
||||||
|
mk('dd.-total', util.format_duration(savefile.total_abstime / TICS_PER_SECOND, 2)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (old_scorecard && old_scorecard.abstime > scorecard.abstime) {
|
||||||
|
overlay_middle.append(
|
||||||
|
mk('dd.-total', `(− ${util.format_duration((old_scorecard.abstime - scorecard.abstime) / TICS_PER_SECOND, 2)})`),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
overlay_middle.append(mk('dd', ""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.state === 'ended') {
|
else if (this.state === 'ended') {
|
||||||
|
|||||||
10
style.css
10
style.css
@ -1244,6 +1244,7 @@ body.--debug .overlay-message {
|
|||||||
dl.score-chart {
|
dl.score-chart {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-auto-columns: 1fr 1fr;
|
grid-auto-columns: 1fr 1fr;
|
||||||
|
grid-auto-rows: 1.33em;
|
||||||
margin: auto 10%;
|
margin: auto 10%;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
@ -1256,11 +1257,18 @@ dl.score-chart dd {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
dl.score-chart .-component {
|
||||||
|
color: #d8d8d8;
|
||||||
|
}
|
||||||
dl.score-chart .-sum {
|
dl.score-chart .-sum {
|
||||||
margin-bottom: 0.5em;
|
|
||||||
border-top: 1px solid white;
|
border-top: 1px solid white;
|
||||||
|
}
|
||||||
|
dl.score-chart .-total {
|
||||||
color: hsl(40, 75%, 80%);
|
color: hsl(40, 75%, 80%);
|
||||||
}
|
}
|
||||||
|
dl.score-chart .-star {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
.chips {
|
.chips {
|
||||||
grid-area: chips;
|
grid-area: chips;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user