Skip to main content

VoiceChat

A class in Root.Township, Alta.Voice.

Client voice chat mute logic: who you can hear (everyone, friends or no one) plus your own muted players list, applied to Vivox. Does nothing on Linux.

Constructors​

MemberWhat it is
VoiceChat()Creates a VoiceChat with default values.

Fields​

2 private and internal fields
MemberWhat it is
private static Logger loggerClass logger.
private IVivoxMutedPlayerStore mutedStoreYour muted user ids, kept in PlayerPrefs.

Properties​

MemberWhat it is
VoiceChatScope AudibleScope { get; private set; }Who you can hear. Starts at Everyone.

Methods​

MemberWhat it is
void CycleAudibleScope()Steps the scope from everyone to friends to no one and back, then reapplies mutes.
bool GetPlayerMuted(int player)Whether you have muted that user id.
void SetPlayerMuted(int player, bool isMuted)Adds or removes a user id from your muted list and applies it.
6 private and internal methods
MemberWhat it is
private void NewPlayerCreated(Player player)Applies the mute state for a player as they're added.
private void OnFriendStatusUpdated(int player, bool isFriend)Reapplies the mute state when a friendship changes, which matters in friends scope.
private void OnPlayerJoinedChannel(IParticipant player)Applies the mute state when someone joins the Vivox channel, reading their user id from the account name.
private void OnVivoxClientCreated(VivoxClient client)Hooks the client's player joined channel event.
private void SyncMuteStateForPlayer(int userID)Mutes the user in Vivox if the scope excludes them or you muted them, else unmutes. Skipped on Linux and in the editor.
private void UpdateMuteAllPlayers()Applies the mute state for every other player.