public void OnRemovePlayer(int voiceid, IPlayer player) { voiceid += 999; TempVoice voice = GetVoiceChannelById(voiceid); if (voice != null) { voice.RemovePlayer(player); } }
public void OnPlayersDisconnect(IPlayer player, string reason) { TempVoice removed = null; foreach (TempVoice voice in VoiceChannels) { if (voice.Players.Contains(player)) { removed = voice; } } if (removed != null) { removed.RemovePlayer(player); } }
public void OnCreateChannel(int voiceid, IPlayer[] players = null) { voiceid += 999; if (DoesChannelWithIDExists(voiceid)) { Debug.LogError("Create VC Error: Id already in use"); return; } TempVoice channel = new TempVoice(voiceid); if (players != null) { for (int i = 0; i < players.Length; i++) { channel.AddPlayer(players[i]); } } }
public void OnChangeChannel(IPlayer player, int channel) { TempVoice voice; if (!DoesChannelWithIDExists(channel)) { voice = new TempVoice(channel); } else { voice = GetVoiceChannelById(channel); } if (player.HasData("altvoice:radio")) { player.GetData("altvoice:radio", out TempVoice radio); radio.RemovePlayer(player); player.DeleteData("altvoice:radio"); } voice.AddPlayer(player); player.SetData("altvoice:radio", voice); }