Add confirmation choice for passing
This commit is contained in:
parent
e0fe22e9ce
commit
6c7a90c421
1 changed files with 7 additions and 5 deletions
|
@ -389,12 +389,14 @@ export function Game(props: {
|
|||
trayDispatch({action: TileDispatchActionType.RETURN});
|
||||
}}>Return Tiles</button>
|
||||
<button className="pass" onClick={() => {
|
||||
const result = props.wasm.skip_turn() as MyResult<string>;
|
||||
handlePlayerAction({type: "Pass"}, props.settings.playerName);
|
||||
setTurnCount(turnCount + 1);
|
||||
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);
|
||||
setTurnCount(turnCount + 1);
|
||||
|
||||
if(result.game_state.type === "Ended") {
|
||||
endGame(result.game_state);
|
||||
if (result.game_state.type === "Ended") {
|
||||
endGame(result.game_state);
|
||||
}
|
||||
}
|
||||
}}>Pass</button>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue