Skip to content

Instantly share code, notes, and snippets.

@cazala
Created July 25, 2018 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cazala/bf60e1d775be921c547ac76fdf0de318 to your computer and use it in GitHub Desktop.
Save cazala/bf60e1d775be921c547ac76fdf0de318 to your computer and use it in GitHub Desktop.
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