/** * React Subcomponent for displaying a location's UI, when that location is a gym * * This subcomponent renders all of the buttons for training at the gym */ import * as React from "react"; import { Location } from "../Location"; import { CONSTANTS } from "../../Constants"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { numeralWrapper } from "../../ui/numeralFormat"; import { StdButton } from "../../ui/React/StdButton"; import { Money } from "../../ui/React/Money"; import { SlotMachine } from "../../Casino/SlotMachine"; import { CoinFlip } from "../../Casino/CoinFlip"; import { Roulette } from "../../Casino/Roulette"; type IProps = { p: IPlayer; } type IState = { game: string; } export class CasinoLocation extends React.Component { constructor(props: IProps) { super(props); this.state = { game: '', } this.updateGame = this.updateGame.bind(this); } updateGame(game: string) { this.setState({ game: game, }); } renderGames() { return (<> this.updateGame('coin')} text={"Play coin flip"} />
this.updateGame('slots')} text={"Play slots"} />
this.updateGame('roulette')} text={"Play roulette"} /> ) } renderGame() { let elem; switch(this.state.game) { case 'coin': elem = break; case 'slots': elem = break; case 'roulette': elem = break; } return (<> this.updateGame('')} text={"Stop playing"} /> {elem} ) } render() { if(!this.state.game) { return this.renderGames(); } else { return this.renderGame(); } } }