import { Game2GetAccountGameStatusMessageComposer, GetGameStatusMessageComposer, JoinQueueMessageComposer } from '@nitrots/nitro-renderer'; import { useEffect } from 'react'; import { ColorUtils, LocalizeText, SendMessageComposer } from '../../../api'; import { Button, Flex, LayoutItemCountView, Text } from '../../../common'; import { useGameCenter } from '../../../hooks'; export const GameView = () => { const { selectedGame, accountStatus } = useGameCenter(); useEffect(()=> { if(selectedGame) { SendMessageComposer(new GetGameStatusMessageComposer(selectedGame.gameId)); SendMessageComposer(new Game2GetAccountGameStatusMessageComposer(selectedGame.gameId)); } },[ selectedGame ]); const getBgColour = (): string => { return ColorUtils.uintHexColor(selectedGame.bgColor); }; const getBgImage = (): string => { return `url(${ selectedGame.assetUrl }${ selectedGame.gameNameId }_theme.png)`; }; const getColor = () => { return ColorUtils.uintHexColor(selectedGame.textColor); }; const onPlay = () => { SendMessageComposer(new JoinQueueMessageComposer(selectedGame.gameId)); }; return { LocalizeText(`gamecenter.${ selectedGame.gameNameId }.description_title`) } { (accountStatus.hasUnlimitedGames || accountStatus.freeGamesLeft > 0) && <> } { LocalizeText(`gamecenter.${ selectedGame.gameNameId }.description_content`) }
; };