CREATE YOUR WORLD
멀티플레이
Multiplay 일시적인 Room 접속 제한하기
4분
원하는 시점에 방 접근을 제한하거나 허용하기 위해 잠금 및 잠금 해제 기능을 사용할 수 있습니다 📘 다음 가이드를 참조하십시오 \[ zepeto multiplay(server) api https //developer zepeto me/docs/multiplay server/classes/zepeto multiplay sandbox#lock ] 잠금 잠금 기능은 방 접근을 제한하는 기능입니다 await this lock(); 잠금 해제 잠금 해제 기능은 방 접근을 허용하는 기능입니다 하지만 현재 연결된 사람 수가 방에 허용된 최대 인원 수와 같으면 방을 잠금 해제할 수 없습니다 await this unlock(); 예제 다음은 잠금 및 잠금 해제 기능을 사용하는 예제 코드입니다 import { sandbox, sandboxoptions, sandboxplayer } from 'zepeto multiplay'; export default class extends sandbox { oncreate(options sandboxoptions) { } async onjoin(client sandboxplayer) { try { if (this clients length > 8) { await this lock(); } } catch(e) { console error(e); } } async onleave(client sandboxplayer, consented? boolean){ try { if (this clients length <= 8) { await this unlock(); } } catch(e) { console error(e); } } } 👍 잠금과 개인 기능의 차이 잠금된 멀티플레이어 방은 zepeto 방 목록에 표시되지 않으며 초대 없이 들어갈 수 없습니다 개인 멀티플레이어 방은 zepeto 방 목록에 표시되지 않지만 초대는 가능합니다