Change money to automatically color grey when something cannot be bought.

This commit is contained in:
Olivier Gagnon
2021-09-04 03:27:31 -04:00
parent 3a943e0e50
commit 6e013e4e6a
37 changed files with 112 additions and 92 deletions
+4 -4
View File
@@ -314,7 +314,7 @@ export class Blackjack extends Game<Props, State> {
label={
<>
{"Wager (Max: "}
{Money(MAX_BET)}
<Money money={MAX_BET} />
{")"}
</>
}
@@ -333,7 +333,7 @@ export class Blackjack extends Game<Props, State> {
<p>
{"Total earnings this session: "}
{Money(gains)}
<Money money={gains} />
</p>
</div>
@@ -404,13 +404,13 @@ export class Blackjack extends Game<Props, State> {
{this.isPlayerWinResult(result) && (
<>
{" You gained "}
{Money(this.state.bet)}
<Money money={this.state.bet} />
</>
)}
{result === Result.DealerWon && (
<>
{" You lost "}
{Money(this.state.bet)}
<Money money={this.state.bet} />
</>
)}
</p>
+2 -2
View File
@@ -202,10 +202,10 @@ export class Roulette extends Game<IProps, IState> {
}
if(playerWin) {
gain = this.state.investment*this.state.strategy.payout;
status = <>won {Money(gain)}</>;
status = <>won <Money money={gain} /></>;
} else {
gain = -this.state.investment;
status = <>lost {Money(-gain)}</>;
status = <>lost <Money money={-gain} /></>;
}
this.win(this.props.p, gain);
this.setState({
+1 -1
View File
@@ -170,7 +170,7 @@ export class SlotMachine extends Game<IProps, IState> {
}
this.setState({
status: <>{gains>0?"gained":"lost"} {Money(Math.abs(gains))}</>,
status: <>{gains>0?"gained":"lost"} <Money money={Math.abs(gains)} /></>,
canPlay: true,
})
if(this.reachedLimit(this.props.p)) return;