[对接文档] - 广播文档构建器支持对参数的单独描述
iohao opened this issue · comments
渔民小镇 commented
新增功能的使用场景
private void extractedDco(BarSkeletonBuilder builder) {
// UserCmd
builder.addBroadcastDoc(BroadcastDoc.newBuilder(UserCmd.of(UserCmd.enterSquare))
.setDataClass(SquarePlayer.class)
.setDescription("新玩家加入房间,给房间内的其他玩家广播")
).addBroadcastDoc(BroadcastDoc.newBuilder(UserCmd.of(UserCmd.offline))
.setDataClass(LongValue.class, "userId")
.setDescription("有玩家下线了")
);
}
下面是生成后的对接文档预览
==================== 游戏文档格式说明 ====================
https://www.yuque.com/iohao/game/irth38#cJLdC
==================== FightHallAction 大厅(类似地图) ====================
路由: 1 - 2 --- 【进入大厅】 --- 【FightHallAction:94】【enterSquare】
方法参数: EnterSquare enterSquare 进入大厅
方法返回值: ByteValueList<SquarePlayer> 所有玩家
广播推送: SquarePlayer ,(新玩家加入房间,给房间内的其他玩家广播)
路由: 1 - 5 --- 【玩家下线】 --- 【FightHallAction:154】【offline】
方法返回值: void
广播推送: LongValue userId,(有玩家下线了)