mode: string;
mode는 게임 난이도로 "easy", "normal", "hard" 셋 중에 하나를 쓰면 됨.
아무것도 넣지 않거나 유효하지 않은 string이 들어왔을 때는 기본값으로 mode = normal로 큐가 잡힘.
다른 mode로 randomMatchApply가 들어오면 기존에 잡고 있던 mode의 랜덤매치큐는 취소됨.
예를 들어 "easy"로 랜덤매치를 잡던 도중 randomMatchApply("hard")가 들어오면 기존 easy매칭은 취소되고 "hard" 매칭을 잡게 됨.
-
랜덤매칭 취소
{
from: string; // 닉네임
to: string;
mode: string; // easy normal hard
}
상대 유저가 connected라면 양 쪽 유저에게
'updateInvitationList'이벤트를 emit함.
{
from: string;
fromId: number;
to: string;
toId: number;
mode: string;
}
상대 유저가 connected라면 양 쪽 유저에게
'matchStartCheck'이벤트를 emit하고,
'updateInvitationList'이벤트를 emit함.
{
from: string;
fromId: number;
to: string;
toId: number;
mode: string;
}
양 쪽 유저에게
'updateInvitationList'이벤트를 emit함.
roomName: string;
'matchStartCheck' 이벤트를 받았을 때 매치를 수락
roomName: string;
'matchStartCheck' 이벤트를 받았을 때 매치를 거절
nickname: string;
{
roomName: string;
player: string[]; // [ nickname_1, nickname_2 ]
mode: string;
}
랜덤매칭 또는 1대1매칭이 잡혔을 때 게임을 시작할 건지 확인
roomName: string;
'matchStartCheck' 후에 상대방이 매칭을 거절 했을 때
array[] of
{
from: string; // 닉네임
fromId: number;
to: string;
toId: number;
mode: string; // easy normal hard
}
초대장 목록 전송