|
|
@ -51,14 +51,20 @@ import { buy, roll, endTurn, loan, trade, submitTradeAccept,
|
|
|
|
leaveGame, kickPlayer, toggleRevealForTrade,
|
|
|
|
leaveGame, kickPlayer, toggleRevealForTrade,
|
|
|
|
addAIPlayer } from './interface.js'
|
|
|
|
addAIPlayer } from './interface.js'
|
|
|
|
|
|
|
|
|
|
|
|
const showScreenDelay = 0;
|
|
|
|
let showScreenDelay = 2000;
|
|
|
|
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
function test() {
|
|
|
|
|
|
|
|
showScreenDelay = 0;
|
|
|
|
if (!document.querySelector('.show-for-large .action-item')) {
|
|
|
|
if (!document.querySelector('.show-for-large .action-item')) {
|
|
|
|
setTimeout(test, 500);
|
|
|
|
setTimeout(test, 0);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
document.querySelector('.show-for-large .action-item').click();
|
|
|
|
if (document.querySelector('.show-for-large .action-item')) {
|
|
|
|
setTimeout(test, 100);
|
|
|
|
document.querySelector('.show-for-large .action-item').click();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (document.querySelector('.show-for-large .action-item2')) {
|
|
|
|
|
|
|
|
document.querySelector('.show-for-large .action-item2').click();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setTimeout(test, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -247,11 +253,27 @@ class PlayerSummary extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class PlayerTurnContainer extends React.Component {
|
|
|
|
class PlayerTurnContainer extends React.Component {
|
|
|
|
|
|
|
|
state = {
|
|
|
|
|
|
|
|
endedTurn: false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
clickRoll = () => {
|
|
|
|
clickRoll = () => {
|
|
|
|
roll();
|
|
|
|
roll();
|
|
|
|
this.props.showScreen(SCREENS.action);
|
|
|
|
this.props.showScreen(SCREENS.action);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clickEndTurn = () => {
|
|
|
|
|
|
|
|
this.setState({ endedTurn: true });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps, prevState) {
|
|
|
|
|
|
|
|
if (this.state.endedTurn && !prevState.endedTurn) {
|
|
|
|
|
|
|
|
endTurn();
|
|
|
|
|
|
|
|
} else if (this.props.player.state === 'pre-turn' && prevProps.player.state !== 'pre-turn') {
|
|
|
|
|
|
|
|
this.setState({ endedTurn: false });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
let view;
|
|
|
|
let view;
|
|
|
|
const { player, ui } = this.props,
|
|
|
|
const { player, ui } = this.props,
|
|
|
@ -283,10 +305,16 @@ class PlayerTurnContainer extends React.Component {
|
|
|
|
Raise Cash
|
|
|
|
Raise Cash
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
} else if (this.state.endedTurn) {
|
|
|
|
|
|
|
|
view = (
|
|
|
|
|
|
|
|
<Button disabled={true}>
|
|
|
|
|
|
|
|
Loading...
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
view = (
|
|
|
|
view = (
|
|
|
|
<Fragment>
|
|
|
|
<Fragment>
|
|
|
|
<Button className="action-item" onClick={endTurn}>
|
|
|
|
<Button className="action-item" onClick={this.clickEndTurn}>
|
|
|
|
End Turn
|
|
|
|
End Turn
|
|
|
|
</Button>{' '}{auditButton}
|
|
|
|
</Button>{' '}{auditButton}
|
|
|
|
</Fragment>);
|
|
|
|
</Fragment>);
|
|
|
@ -1552,7 +1580,8 @@ class Moving extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
class Action extends React.Component {
|
|
|
|
class Action extends React.Component {
|
|
|
|
state = {
|
|
|
|
state = {
|
|
|
|
bertChoice: 'nothing'
|
|
|
|
bertChoice: 'nothing',
|
|
|
|
|
|
|
|
aiPlayerTurnEnded: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setBertChoice = (e) => {
|
|
|
|
setBertChoice = (e) => {
|
|
|
@ -1569,6 +1598,18 @@ class Action extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endAiTurn = () => {
|
|
|
|
|
|
|
|
this.setState({ aiPlayerTurnEnded: true });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps, prevState) {
|
|
|
|
|
|
|
|
if (this.state.aiPlayerTurnEnded && !prevState.aiPlayerTurnEnded) {
|
|
|
|
|
|
|
|
endAiTurn();
|
|
|
|
|
|
|
|
} else if (this.props.game.currentPlayer !== prevProps.game.currentPlayer) {
|
|
|
|
|
|
|
|
this.setState({ aiPlayerTurnEnded: false });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
let view,
|
|
|
|
let view,
|
|
|
|
buttons = false;
|
|
|
|
buttons = false;
|
|
|
@ -1622,14 +1663,18 @@ class Action extends React.Component {
|
|
|
|
) : (<></>)}
|
|
|
|
) : (<></>)}
|
|
|
|
<form onSubmit={this.bertSubmit}>
|
|
|
|
<form onSubmit={this.bertSubmit}>
|
|
|
|
<label>
|
|
|
|
<label>
|
|
|
|
<input type="radio" name="bert" value="accept" onClick={this.setBertChoice} />
|
|
|
|
<input type="radio" name="bert" value="accept" onClick={this.setBertChoice} className="action-item" />
|
|
|
|
Yes, take over for $10,000!
|
|
|
|
Yes, take over for $10,000!
|
|
|
|
</label>
|
|
|
|
</label>
|
|
|
|
<label>
|
|
|
|
<label>
|
|
|
|
<input type="radio" name="bert" value="deny" onClick={this.setBertChoice} />
|
|
|
|
<input type="radio" name="bert" value="deny" onClick={this.setBertChoice} />
|
|
|
|
No, continue on
|
|
|
|
No, continue on
|
|
|
|
</label>
|
|
|
|
</label>
|
|
|
|
<Button type="submit" disabled={this.state.bertChoice === 'nothing' || this.state.bertChoice === 'accept' && cash < 10000}>Submit</Button>
|
|
|
|
<Button type="submit" disabled={this.state.bertChoice === 'nothing' || this.state.bertChoice === 'accept' && cash < 10000}
|
|
|
|
|
|
|
|
className="action-item2"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
Submit
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -1777,9 +1822,9 @@ class Action extends React.Component {
|
|
|
|
screen={this.props.screen}
|
|
|
|
screen={this.props.screen}
|
|
|
|
showScreen={this.props.showScreen}
|
|
|
|
showScreen={this.props.showScreen}
|
|
|
|
game={this.props.game} />);
|
|
|
|
game={this.props.game} />);
|
|
|
|
} else if (currentPlayer.ai) {
|
|
|
|
} else if (currentPlayer.ai && !this.state.aiPlayerTurnEnded) {
|
|
|
|
view = (
|
|
|
|
view = (
|
|
|
|
<Button className="action-item" onClick={endAiTurn}>
|
|
|
|
<Button className="action-item" onClick={this.endAiTurn}>
|
|
|
|
Next Player's Turn
|
|
|
|
Next Player's Turn
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
);
|
|
|
|
);
|
|
|
|