fix : matchmaker issue

This commit is contained in:
Halit Aksoy 2022-04-23 14:17:54 +03:00
parent ca829741e5
commit 4605e27d81
2 changed files with 2 additions and 1 deletions

View File

@ -49,6 +49,7 @@ rtmt.listenMessage(channel_new_game, (userKey: string, message: Object) => {
const gameStore = new Map<string, Game>() const gameStore = new Map<string, Game>()
matchmaker.onPlayersPaired = (userKey1: string, userKey2: string) => { matchmaker.onPlayersPaired = (userKey1: string, userKey2: string) => {
console.log('onPlayersPaired');
const game = createGame(userKey1, userKey2) const game = createGame(userKey1, userKey2)
gameStore.set(userKey1, game) gameStore.set(userKey1, game)
gameStore.set(userKey2, game) gameStore.set(userKey2, game)

View File

@ -6,7 +6,7 @@ export class MatchMaker {
public onPlayersPaired!: (userKey1: string, userKey2: string) => void public onPlayersPaired!: (userKey1: string, userKey2: string) => void
public find(userKey : string) : void{ public find(userKey : string) : void{
if(this.waitingUserKey == userKey) return; if(this.waitingUserKey === userKey) return;
if(this.waitingUserKey){ if(this.waitingUserKey){
const user1 = this.waitingUserKey as string const user1 = this.waitingUserKey as string
this.waitingUserKey = undefined this.waitingUserKey = undefined