频道类型
Vivox 使用以下类型的频道:
频道类型由用于发起频道加入的方法表示。JoinEchoChannelAsync
加入回声频道,JoinGroupChannelAsyc
加入群组频道,JoinPositionalChannelAsync
加入位置频道。
注意:当同时使用位置频道和群组频道时,先加入位置频道,然后是群组频道。
回声频道
使用 JoinEchoChannelAsync
方法加入回声频道,如下例所示:
JoinEchoChannelAsync("TestChannel", ChatCapability.AudioOnly)
开发者可以使用这些频道为用户提供麦克风测试位置,或是作为一种通用方法测试与 Vivox Voice Server 的连接。
群组频道
使用 JoinGroupChannelAsync
方法加入群组频道,如下例所示:
JoinGroupChannelAsync("TestChannel", ChatCapability.TextAndAudio)
开发者可以使用这些频道支持供玩家连接的关卡范围音频和文本频道。
经常使用非位置频道的示例包括第一人称射击游戏中的团队和小队以及 MMO 中的团队聊天。
非位置频道通常是 Vivox 实现中最常用的频道类型。
位置频道
使用 JoinPositionalChannelAsync
方法加入位置频道(也称为 3D 频道),如下例所示:
Channel3DProperties props = new Channel3DProperties() //The Channel3DProperties are set to default values, but might need to be changed based on the wanted scale of your game.
JoinPositionalChannelAsync("TestChannel", ChatCapability.TextAndAudio, Channel3DProperties)
开发者可以使用这些频道实现融入到世界中的语音聊天,而玩家语音的衰减和平移使他们看起来好像是在游戏世界中所处的位置说话。要使此效果起作用,您必须设置用户的位置。有关如何设置玩家位置的说明,请参阅“位置频道配置”页面。您可以使用特定值对位置频道进行参数化,这些值可更改玩家定位如何影响其语音。
> 注意:一次只能加入一个位置频道。