2021-09-23 23:34:33 -04:00
|
|
|
import React, { useEffect } from 'react'
|
|
|
|
|
2021-09-24 00:47:45 -04:00
|
|
|
import useSocket from './useSocket.ts'
|
2021-09-23 23:34:33 -04:00
|
|
|
import {CardInstance} from './types.ts'
|
|
|
|
|
|
|
|
interface GameActionsContextValue {}
|
|
|
|
|
|
|
|
const GameActionsContext = React.createContext<GameActionsContextValue | null>(null)
|
|
|
|
|
|
|
|
interface GameClientState {
|
|
|
|
player_id: string
|
|
|
|
match_id: string
|
|
|
|
result: string
|
|
|
|
}
|
|
|
|
|
|
|
|
interface BoardPosition {
|
|
|
|
card: CardInstance | null
|
|
|
|
}
|
|
|
|
|
|
|
|
interface PlayerBoard {
|
|
|
|
0: BoardPosition
|
|
|
|
1: BoardPosition
|
|
|
|
2: BoardPosition
|
|
|
|
3: BoardPosition
|
|
|
|
}
|
|
|
|
|
|
|
|
interface GameState {
|
|
|
|
self_board: PlayerBoard
|
|
|
|
self_hand: CardInstance[]
|
|
|
|
enemy_board: PlayerBoard
|
|
|
|
enemy_hand: CardInstance[]
|
|
|
|
}
|
|
|
|
|
|
|
|
interface GameProps {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Game(props: GameProps): JSX.Element {
|
|
|
|
const [state, setState] = React.useState()
|
|
|
|
|
|
|
|
// ensure this is stable wrt state so that onMessage does not have to be constantly reattached
|
2021-09-24 00:47:45 -04:00
|
|
|
// const onMessage = React.useCallback(() => {}, [])
|
2021-09-23 23:34:33 -04:00
|
|
|
|
2021-09-24 00:47:45 -04:00
|
|
|
// const handle = useSocket()
|
2021-09-23 23:34:33 -04:00
|
|
|
|
|
|
|
return (
|
2021-09-24 00:47:45 -04:00
|
|
|
<GameActionsContext.Provider value={{}}>
|
|
|
|
<div>Hello world!</div>
|
2021-09-23 23:34:33 -04:00
|
|
|
</GameActionsContext.Provider>
|
|
|
|
)
|
|
|
|
}
|