diff --git a/TableturfBattleClient/index.html b/TableturfBattleClient/index.html index 0322934..555f107 100644 --- a/TableturfBattleClient/index.html +++ b/TableturfBattleClient/index.html @@ -68,7 +68,7 @@
diff --git a/TableturfBattleClient/src/Pages/GamePage.ts b/TableturfBattleClient/src/Pages/GamePage.ts index 7814430..1e2b3e1 100644 --- a/TableturfBattleClient/src/Pages/GamePage.ts +++ b/TableturfBattleClient/src/Pages/GamePage.ts @@ -140,6 +140,7 @@ function showResult() { if (currentGame == null) return; midGameContainer.hidden = true; resultContainer.hidden = false; + turnNumberLabel.setTurnNumber(null); let winners = [ 0 ]; let maxPoints = playerBars[0].points; for (let i = 1; i < currentGame.players.length; i++) { @@ -158,18 +159,18 @@ function showResult() { el.classList.add('win'); el.classList.remove('lose'); el.classList.remove('draw'); - el.innerText = 'Win!'; + el.innerText = 'Victory'; } else { el.classList.remove('win'); el.classList.remove('lose'); el.classList.add('draw'); - el.innerText = 'Draw!'; + el.innerText = 'Draw'; } } else { el.classList.remove('win'); el.classList.add('lose'); el.classList.remove('draw'); - el.innerText = 'Lose...'; + el.innerText = 'Defeat'; } } } @@ -306,3 +307,14 @@ board.onclick = (x, y) => { board.autoHighlight = false; } }; + +document.getElementById('resultLeaveButton')!.addEventListener('click', e => { + e.preventDefault(); + document.getElementById('preGameDefaultSection')!.hidden = false; + document.getElementById('preGameJoinSection')!.hidden = true; + window.location.hash = '#'; + currentGame = null; + gameIDBox.value = ''; + showSection('preGame'); + newGameButton.focus(); +}); diff --git a/TableturfBattleClient/src/Pages/PreGamePage.ts b/TableturfBattleClient/src/Pages/PreGamePage.ts index 1a60ace..027c6be 100644 --- a/TableturfBattleClient/src/Pages/PreGamePage.ts +++ b/TableturfBattleClient/src/Pages/PreGamePage.ts @@ -1,14 +1,16 @@ const newGameButton = document.getElementById('newGameButton')!; const joinGameButton = document.getElementById('joinGameButton')!; +const nameBox = document.getElementById('nameBox') as HTMLInputElement; +const gameIDBox = document.getElementById('gameIDBox') as HTMLInputElement; (document.getElementById('preGameForm') as HTMLFormElement).addEventListener('submit', e => { e.preventDefault(); if (e.submitter?.id == 'joinGameButton') { - const name = (document.getElementById('nameBox') as HTMLInputElement).value; + const name = nameBox.value; window.localStorage.setItem('name', name); - tryJoinGame(name, (document.getElementById('gameIDBox') as HTMLInputElement).value); + tryJoinGame(name, gameIDBox.value); } else { - const name = (document.getElementById('nameBox') as HTMLInputElement).value; + const name = nameBox.value; window.localStorage.setItem('name', name); let request = new XMLHttpRequest(); diff --git a/TableturfBattleClient/tableturf.css b/TableturfBattleClient/tableturf.css index 0bc6596..05b9ea3 100644 --- a/TableturfBattleClient/tableturf.css +++ b/TableturfBattleClient/tableturf.css @@ -322,10 +322,6 @@ footer { height: 28em; } -#resultContainer { - display: none; -} - /* Score bar */ #scoreSection {