|
@ -9,25 +9,42 @@ export default class GameScreen extends Component{ |
|
|
console.log(this.props.gameData); |
|
|
console.log(this.props.gameData); |
|
|
|
|
|
|
|
|
this.state={ |
|
|
this.state={ |
|
|
userScore:0, |
|
|
|
|
|
round:1, |
|
|
|
|
|
inputValue: '', |
|
|
|
|
|
currentWord: '' |
|
|
|
|
|
|
|
|
inputValue: '' |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setInputState(word) { |
|
|
|
|
|
this.setState({ |
|
|
|
|
|
input: word |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render(){ |
|
|
render(){ |
|
|
return( |
|
|
|
|
|
<div> |
|
|
|
|
|
<UserList gameDataPassed={this.props.gameData} userArray = {this.props.gameData.users} /> |
|
|
|
|
|
<WordInput socket={this.props.socket}/> |
|
|
|
|
|
</div> |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
if(this.props.gameData.gameState === 3){ |
|
|
|
|
|
return( |
|
|
|
|
|
<div> |
|
|
|
|
|
<h2>Round:</h2> |
|
|
|
|
|
<h1>Results!</h1> |
|
|
|
|
|
<h1>Round Winner{this.props.gameData.roundWinner}</h1> |
|
|
|
|
|
<UserList gameDataPassed={this.props.gameData} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
) |
|
|
|
|
|
} else if(this.props.gameData.gameState === 2){ |
|
|
|
|
|
console.log('multiple players in lobby') |
|
|
|
|
|
return( |
|
|
|
|
|
<div> |
|
|
|
|
|
<h1>Round: {this.props.gameData.round}</h1> |
|
|
|
|
|
|
|
|
|
|
|
<UserList gameDataPassed={this.props.gameData} /> |
|
|
|
|
|
<WordInput active='true' socket={this.props.socket} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
) |
|
|
|
|
|
} else if (this.props.gameData.gameState === 1){ |
|
|
|
|
|
console.log('single player method called') |
|
|
|
|
|
return( |
|
|
|
|
|
<div> |
|
|
|
|
|
<h2>Round: {this.props.gameData.round}</h2> |
|
|
|
|
|
<h1></h1> |
|
|
|
|
|
<UserList gameDataPassed={this.props.gameData} /> |
|
|
|
|
|
<WordInput active='false' socket={this.props.socket} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |