display done/total pieces
This commit is contained in:
parent
bbe0d03a49
commit
681c8375d5
2 changed files with 13 additions and 0 deletions
|
|
@ -27,4 +27,6 @@ export default {
|
||||||
getTileDrawSize: GameCommon.getTileDrawSize,
|
getTileDrawSize: GameCommon.getTileDrawSize,
|
||||||
getStartTs: GameCommon.getStartTs,
|
getStartTs: GameCommon.getStartTs,
|
||||||
getFinishTs: GameCommon.getFinishTs,
|
getFinishTs: GameCommon.getFinishTs,
|
||||||
|
getFinishedTileCount: GameCommon.getFinishedTileCount,
|
||||||
|
getTileCount: GameCommon.getTileCount,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
game/game.js
11
game/game.js
|
|
@ -216,9 +216,16 @@ function addMenuToDom(gameId) {
|
||||||
const updateTimer = () => {
|
const updateTimer = () => {
|
||||||
timerCountdownEl.innerText = timerStr()
|
timerCountdownEl.innerText = timerStr()
|
||||||
}
|
}
|
||||||
|
const tilesDoneEl = ELEMENTS.DIV.cloneNode(true)
|
||||||
|
const udateTilesDone = () => {
|
||||||
|
const tilesFinished = Game.getFinishedTileCount(gameId)
|
||||||
|
const tilesTotal = Game.getTileCount(gameId)
|
||||||
|
tilesDoneEl.innerText = `🧩 ${tilesFinished}/${tilesTotal}`
|
||||||
|
}
|
||||||
|
|
||||||
const timerEl = ELEMENTS.DIV.cloneNode(true)
|
const timerEl = ELEMENTS.DIV.cloneNode(true)
|
||||||
timerEl.classList.add('timer')
|
timerEl.classList.add('timer')
|
||||||
|
timerEl.appendChild(tilesDoneEl)
|
||||||
timerEl.appendChild(timerCountdownEl)
|
timerEl.appendChild(timerCountdownEl)
|
||||||
|
|
||||||
let replayControl = null
|
let replayControl = null
|
||||||
|
|
@ -253,6 +260,7 @@ function addMenuToDom(gameId) {
|
||||||
nameChangeEl,
|
nameChangeEl,
|
||||||
updateScoreBoard,
|
updateScoreBoard,
|
||||||
updateTimer,
|
updateTimer,
|
||||||
|
udateTilesDone,
|
||||||
togglePreview,
|
togglePreview,
|
||||||
replayControl,
|
replayControl,
|
||||||
}
|
}
|
||||||
|
|
@ -451,10 +459,12 @@ async function main() {
|
||||||
nameChangeEl,
|
nameChangeEl,
|
||||||
updateScoreBoard,
|
updateScoreBoard,
|
||||||
updateTimer,
|
updateTimer,
|
||||||
|
udateTilesDone,
|
||||||
togglePreview,
|
togglePreview,
|
||||||
replayControl,
|
replayControl,
|
||||||
} = addMenuToDom(gameId)
|
} = addMenuToDom(gameId)
|
||||||
updateTimer()
|
updateTimer()
|
||||||
|
udateTilesDone()
|
||||||
updateScoreBoard(TIME())
|
updateScoreBoard(TIME())
|
||||||
|
|
||||||
const longFinished = !! Game.getFinishTs(gameId)
|
const longFinished = !! Game.getFinishTs(gameId)
|
||||||
|
|
@ -816,6 +826,7 @@ async function main() {
|
||||||
// DRAW PLAYERS
|
// DRAW PLAYERS
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
updateScoreBoard(ts)
|
updateScoreBoard(ts)
|
||||||
|
udateTilesDone()
|
||||||
if (DEBUG) Debug.checkpoint('scores done')
|
if (DEBUG) Debug.checkpoint('scores done')
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue