Private
Public Access
1
0

bugfix opponent bomb btn buzz on hover #10

This commit is contained in:
2016-11-20 12:41:38 +01:00
parent 4c99df0b40
commit 864f322f6b
5 changed files with 18 additions and 3 deletions

View File

@@ -44,6 +44,7 @@ class UserControl extends React.Component {
<div className="users">
<User ref="blue"
color="blue"
webPlayer={this.props.webPlayer}
active={this.state.activePlayer === 1}
onClickBombSelector={this.onClickBombSelector.bind(this, 1)}/>
<div className="active-mines-container">
@@ -57,6 +58,7 @@ class UserControl extends React.Component {
<div className="clear"></div>
<User ref="red"
color="red"
webPlayer={this.props.webPlayer}
active={this.state.activePlayer === 0}
onClickBombSelector={this.onClickBombSelector.bind(this, 0)}/>
<div className="resign">

View File

@@ -24,6 +24,17 @@ class User extends React.Component {
return this.state.srcRoot + 'bg-flag-' + color + '-outbg.png';
}
getBombBuzzClass(webPlayer) {
let activePlayer = this.state.color === 1 ? 'blue' : 'red';
return "bomb-container" +
(
this.state.active && (activePlayer === webPlayer) && this.state.haveBomb && this.state.enabledBomb
? ' buzz'
: ''
);
}
getBomb() {
let src = this.state.srcRoot;
@@ -64,7 +75,7 @@ class User extends React.Component {
<div className="user-control-mines">
{this.state.mines}
</div>
<div className="bomb-container" onClick={this.props.onClickBombSelector}>
<div className={this.getBombBuzzClass(this.props.webPlayer)} onClick={this.props.onClickBombSelector}>
<div className="bomb">
<img src={this.getBomb()} alt="bomb"/>
</div>