Showing player color in lobby.

master
Thomas Hintz 5 years ago
parent 8893a50596
commit a066a507ef

@ -52,17 +52,17 @@ import { buy, roll, endTurn, loan, trade, submitTradeAccept,
function netWorth(player) { function netWorth(player) {
return ((player.assets.hay + player.assets.grain) * 2000) + return ((player.assets.hay + player.assets.grain) * 2000) +
(player.assets.fruit * 5000) + (player.assets.fruit * 5000) +
(player.assets.cows * 500) + (player.assets.cows * 500) +
((player.assets.harvester + player.assets.tractor) * 10000) + ((player.assets.harvester + player.assets.tractor) * 10000) +
player.displayCash - player.debt; player.displayCash - player.debt;
} }
function assetsValue(player) { function assetsValue(player) {
return ((player.assets.hay + player.assets.grain) * 2000) + return ((player.assets.hay + player.assets.grain) * 2000) +
(player.assets.fruit * 5000) + (player.assets.fruit * 5000) +
(player.assets.cows * 500) + (player.assets.cows * 500) +
((player.assets.harvester + player.assets.tractor) * 10000); ((player.assets.harvester + player.assets.tractor) * 10000);
} }
function getElementValue(id) { function getElementValue(id) {
@ -1541,36 +1541,36 @@ class Action extends React.Component {
buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>); buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>);
break; break;
case 'farmers-fate': case 'farmers-fate':
view = ( view = (
<div className='game-card'> <div className='game-card'>
<GroupBox title={fateCard}> <GroupBox title={fateCard}>
<div className='card' <div className='card'
dangerouslySetInnerHTML={{ __html: this.props.ui.actionValue }} /> dangerouslySetInnerHTML={{ __html: this.props.ui.actionValue }} />
</GroupBox> </GroupBox>
</div> </div>
); );
buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>); buttons = (<Button onClick={() => this.props.showNextAction()}>Continue</Button>);
break; break;
case 'ff-uncle-bert': case 'ff-uncle-bert':
const { cash } = this.props.player; const { cash } = this.props.player;
const ffButtons = ( const ffButtons = (
<> <>
{cash < 10000 ? ( {cash < 10000 ? (
<Button onClick={() => this.props.showScreen(SCREENS.loans)}>Raise ${formatMoney(10000 - cash)} Now</Button> <Button onClick={() => this.props.showScreen(SCREENS.loans)}>Raise ${formatMoney(10000 - cash)} Now</Button>
) : (<></>)} ) : (<></>)}
<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} />
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}>Submit</Button>
</form> </form>
</> </>
); );
view = ( view = (
<GroupBox title={`Uncle Bert's inheritance`}> <GroupBox title={`Uncle Bert's inheritance`}>
<div className='center'> <div className='center'>
@ -1936,6 +1936,7 @@ class StartGame extends React.Component {
render() { render() {
const { auditThreshold, downPayment, loanInterest, maxDebt, startingOtbs, startingCash, startingDebt } = this.props.game.settings; const { auditThreshold, downPayment, loanInterest, maxDebt, startingOtbs, startingCash, startingDebt } = this.props.game.settings;
const playerName = this.props.player.name; const playerName = this.props.player.name;
const { color } = this.props.player;
const { name, host } = this.props.game; const { name, host } = this.props.game;
return ( return (
<> <>
@ -1945,10 +1946,10 @@ class StartGame extends React.Component {
</p> </p>
<h3>Players</h3> <h3>Players</h3>
<ul> <ul>
<li>{this.props.player.name}</li> <li><PlayerColorIcon color={color} /> {playerName}</li>
{this.props.game.otherPlayers.map((p, i) => ( {this.props.game.otherPlayers.map((p, i) => (
<li key={i}> <li key={i}>
{p.player.name} <PlayerColorIcon color={p.player.color} /> {p.player.name}
{playerName === host ? ( {playerName === host ? (
<span title="Kick Player" className="kick-player" onClick={() => kickPlayer(p.player.name)}> <span title="Kick Player" className="kick-player" onClick={() => kickPlayer(p.player.name)}>
<FontAwesomeIcon icon={faBan} /> <FontAwesomeIcon icon={faBan} />

Loading…
Cancel
Save