Ignore:
Timestamp:
07/12/22 00:13:20 (2 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
e9f11ac
Parents:
95ce58b
Message:

Roulette rethought with 1 second update calls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • components/roulette/BetModal.jsx

    r95ce58b rd0ef259  
    3030
    3131    function placeBet() {
    32         axios.get(`/api/roulette?action=place_bet&session_id=${localStorage.CAESSINO_SESSION_ID}&betAmount=${styleState.roulette.inputControls.bet.chosenCredits}&whichBets=${styleState.roulette.whichBets.toString()}`).then(res => {
    33             if (res.data?.success) {
    34                 dispatch(setPlayer({
    35                     ...playerState.player,
    36                     credits: res.data?.credits,
    37                 }));
     32        axios.get(`/api/roulette?action=place_bet&session_id=${localStorage.CAESSINO_SESSION_ID}&betAmount=${styleState.roulette.inputControls.bet.chosenCredits}&whichBets=${styleState.roulette.whichBets.toString()}&coinPlacedX=${styleState.roulette.coinPlaced.x}&coinPlacedY=${styleState.roulette.coinPlaced.y}`);
    3833
    39                 dispatch(setRouletteGame(res.data?.game));
    40 
    41                 closeModal(false);
    42             }
    43         });
     34        closeModal();
    4435    }
    4536
    46     function closeModal(removeCoin = true) {
    47         if (removeCoin) {
    48             dispatch(setRoulette({
    49                 ...styleState.roulette,
    50                 displays: {
    51                   ...styleState.roulette.displays,
    52                   betModal: false,
    53                 },
    54                 showCoin: false,
    55               }))
    56         }
    57         else {
    58             dispatch(setRoulette({
    59                 ...styleState.roulette,
    60                 displays: {
    61                     ...styleState.roulette.displays,
    62                     betModal: false,
    63                 },
    64                 showCoin: true,
    65             }));
    66         }
     37    function closeModal() {
     38        dispatch(setRoulette({
     39            ...styleState.roulette,
     40            displays: {
     41                ...styleState.roulette.displays,
     42                betModal: false,
     43            },
     44        }));
    6745    }
    6846
    6947    return (
    70         <div className="rouletteBetModal" style={{display: styleState.roulette.displays.betModal && playerState.rouletteGame.timeToStart > 10 ? 'flex' : 'none'}}>
     48        <div className="rouletteBetModal" style={{display: styleState.roulette.displays.betModal && playerState.rouletteGame.game.timeToStart > 10 && playerState.rouletteGame.game.timeToStart <= playerState.rouletteGame.game.COUNTDOWN_FROM ? 'flex' : 'none'}}>
    7149            <p>You have chosen to bet on: <span>{styleState.roulette.whichBets.map((bet, i) => `${bet} `)}</span><br/>Please select the amount you will bet</p>
    7250            <div>
Note: See TracChangeset for help on using the changeset viewer.