diff options
| author | lonkaars <l.leblansch@gmail.com> | 2021-02-21 16:59:55 +0100 | 
|---|---|---|
| committer | lonkaars <l.leblansch@gmail.com> | 2021-02-21 16:59:55 +0100 | 
| commit | ae4e74ccde82388cca5e874539bb132e23fc1e92 (patch) | |
| tree | 61e9119aec938973d47e79d93ef92702ef2167a9 | |
| parent | 52a5fad7bf6887e29937bd5cbe54837cd4f9eba7 (diff) | |
game outcome working for both players
| -rw-r--r-- | pages/game.tsx | 11 | 
1 files changed, 6 insertions, 5 deletions
diff --git a/pages/game.tsx b/pages/game.tsx index 481d7bd..f401bfa 100644 --- a/pages/game.tsx +++ b/pages/game.tsx @@ -92,13 +92,14 @@ class VoerGame extends Component<VoerGameProps> {  		}}>  			<VoerBord width={this.width} height={this.height} onMove={m => this.move(m % this.width + 1)} active={this.props.active == true && this.state.outcome == -1}/>  			<GameBar turn={this.state.turn} player1={this.props.player1}/> -			<GameOutcomeDialog outcome={this.state.outcome} visible={this.state.outcome != -1}/> +			<GameOutcomeDialog outcome={this.state.outcome} player={this.props.player1 ? 1 : 2} visible={this.state.outcome != -1}/>  		</div>  	}  }  function GameOutcomeDialog(props: {  	outcome: number; +	player: number;  	visible: boolean;  }) {  	return <DialogBox title="Speluitkomst" style={{ display: props.visible ? "inline-block" : "none" }}> @@ -109,15 +110,15 @@ function GameOutcomeDialog(props: {  			<h2 style={{  				color:  					props.outcome == 0 ? "var(--text)" : -					props.outcome == 1 ? "var(--disk-a-text)" : -					props.outcome == 2 ? "var(--disk-b-text)" : +					props.outcome == props.player ? "var(--disk-a-text)" : +					props.outcome != props.player ? "var(--disk-b-text)" :  					"var(--text)",  				opacity: props.outcome == 0 ? .75 : 1,  				marginTop: 8  			}}>{  				props.outcome == 0 ? "Gelijkspel" : -				props.outcome == 1 ? "Verloren" : -				props.outcome == 2 ? "Gewonnen" : +				props.outcome == props.player ? "Verloren" : +				props.outcome != props.player ? "Gewonnen" :  				"???"  			}</h2>  			{ false && <p style={{ marginTop: 24 }}>  |