创造你的世界
社交
从房间成员列表屏幕检索跟随状态回调
3 分
我们添加了一个功能,当有人在世界中一起玩时开始关注您时,您将收到回调。 在社交内容中充分利用此功能! 此功能适用于world sdk版本1 21 21及zepeto module版本1 0 11或更高版本。 适用于具有多人功能的世界。 您可以在zepeto移动应用中查看房间成员列表屏幕。 请参考以下示例代码以了解如何使用回调 socialservice onroommemberstatuschanged 这是一个示例,当房间成员列表的关注状态在世界中发生变化时,将用户id和关注状态打印到控制台日志。 import { roommemberstatus, socialservice } from 'zepeto module social'; import { zepetoscriptbehaviour } from 'zepeto script' export default class samplescript extends zepetoscriptbehaviour { start() { socialservice onroommemberstatuschanged += (userid string, status roommemberstatus) => { console log(`onroommemberstatuschanged userid = ${userid}, status = ${status}`); } } 房间成员状态 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 如果您在移动设备上运行上述示例代码,您会看到每当房间成员列表屏幕上的跟随状态发生变化时,控制台日志都会被调用。
