matchmaking works
This commit is contained in:
@@ -4,7 +4,6 @@ import Board from "./Board";
|
||||
|
||||
export default function TicTacToe() {
|
||||
const [username, setUsername] = useState("");
|
||||
const [matchId, setMatchId] = useState("");
|
||||
|
||||
const [board, setBoard] = useState<string[][]>([
|
||||
["", "", ""],
|
||||
@@ -17,10 +16,9 @@ export default function TicTacToe() {
|
||||
const {
|
||||
loginOrRegister,
|
||||
joinMatchmaker,
|
||||
joinMatch,
|
||||
onMatchData,
|
||||
onMatchmakerMatched,
|
||||
sendMatchData,
|
||||
matchId,
|
||||
} = useNakama();
|
||||
|
||||
// ------------------------------------------
|
||||
@@ -41,15 +39,6 @@ export default function TicTacToe() {
|
||||
setWinner(state.winner || null);
|
||||
}
|
||||
});
|
||||
|
||||
onMatchmakerMatched(async (matched) => {
|
||||
console.log("Matched:", matched);
|
||||
|
||||
const fullMatchId = matched.match_id;
|
||||
setMatchId(fullMatchId);
|
||||
|
||||
await joinMatch(fullMatchId);
|
||||
})
|
||||
}
|
||||
|
||||
// ------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user