Fix end-of-game UI bugs
This commit is contained in:
parent
7bca436012
commit
79610b958b
1 changed files with 16 additions and 7 deletions
|
@ -370,11 +370,11 @@ export function Game(props: {
|
|||
}
|
||||
|
||||
useEffect(() => {
|
||||
trayDispatch({action: TileDispatchActionType.RETRIEVE});
|
||||
setConfirmedScorePoints(-1);
|
||||
if(!isGameOver){
|
||||
logDispatch(<h4>Turn {turnCount}</h4>);
|
||||
logDispatch(<div>{playerTurnName}'s turn</div>)
|
||||
setConfirmedScorePoints(-1);
|
||||
trayDispatch({action: TileDispatchActionType.RETRIEVE});
|
||||
logDispatch(<div>{playerTurnName}'s turn</div>);
|
||||
if(playerTurnName != props.settings.playerName && !isGameOver) {
|
||||
runAI();
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ export function Game(props: {
|
|||
{props.settings.aiName} has {remainingAITiles} tiles
|
||||
</div>
|
||||
<button
|
||||
disabled={remainingTiles == 0}
|
||||
disabled={remainingTiles == 0 || isGameOver}
|
||||
onClick={() => {
|
||||
trayDispatch({action: TileDispatchActionType.RETURN}); // want all tiles back on tray for tile exchange
|
||||
setIsTileExchangeOpen(true);
|
||||
|
@ -430,7 +430,10 @@ export function Game(props: {
|
|||
|
||||
<TileTray letters={playerLetters} trayLength={props.settings.trayLength} trayDispatch={trayDispatch}/>
|
||||
<div className="player-controls">
|
||||
<button className="check" onClick={() => {
|
||||
<button
|
||||
className="check"
|
||||
disabled={isGameOver}
|
||||
onClick={() => {
|
||||
const playedTiles = playerLetters.map((i) => {
|
||||
if (i === undefined) {
|
||||
return null;
|
||||
|
@ -485,10 +488,16 @@ export function Game(props: {
|
|||
|
||||
|
||||
}}>{confirmedScorePoints > -1 ? `Score ${confirmedScorePoints} points` : "Check"}</button>
|
||||
<button className="return" onClick={() => {
|
||||
<button
|
||||
className="return"
|
||||
disabled={isGameOver}
|
||||
onClick={() => {
|
||||
trayDispatch({action: TileDispatchActionType.RETURN});
|
||||
}}>Return Tiles</button>
|
||||
<button className="pass" onClick={() => {
|
||||
<button
|
||||
className="pass"
|
||||
disabled={isGameOver}
|
||||
onClick={() => {
|
||||
if (window.confirm("Are you sure you want to pass?")) {
|
||||
const result = props.wasm.skip_turn() as MyResult<string>;
|
||||
handlePlayerAction({type: "Pass"}, props.settings.playerName);
|
||||
|
|
Loading…
Reference in a new issue