Created
July 25, 2018 15:34
-
-
Save cazala/bf60e1d775be921c547ac76fdf0de318 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderMessage() { | |
const state = store.getState() | |
const { whiteTurn } = state.game | |
const { playerWhite, playerBlack, status } = state.match | |
const yourTurn = | |
(whiteTurn && playerWhite === this.id) || | |
(!whiteTurn && playerBlack === this.id) | |
const theirTurn = | |
(whiteTurn && playerBlack === this.id) || | |
(!whiteTurn && playerWhite === this.id | |
return status === 'checkmate' ? ( | |
<text | |
value="Checkmate!" | |
color="#FF0000" | |
position={{ x: 3.5, y: 2, z: 3.5 }} | |
width={3} | |
billboard={7} | |
/> | |
) : yourTurn ? ( | |
<text | |
value="It's your turn!" | |
color="#000000" | |
position={{ x: 3.5, y: 2, z: 3.5 }} | |
width={2} | |
billboard={7} | |
/> | |
) : theirTurn ? ( | |
<text | |
value="It's your opponent's turn" | |
color="#AAAAAA" | |
position={{ x: 3.5, y: 2, z: 3.5 }} | |
width={2} | |
billboard={7} | |
/> | |
) : null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment