Exemplo n.º 1
0
 internal RadioChannelMember(RadioChannel radioChannel, VoiceClient voiceClient, bool isPrimary)
 {
     this.RadioChannel     = radioChannel;
     this.VoiceClient      = voiceClient;
     this.IsPrimary        = isPrimary;
     this.IsSpeakerEnabled = voiceClient.IsRadioSpeakerEnabled;
 }
Exemplo n.º 2
0
        public void LeaveRadioChannel(VoiceClient voiceClient, RadioChannel radioChannel)
        {
            radioChannel.RemoveMember(voiceClient);

            if (radioChannel.Members.Length == 0)
            {
                lock (this._radioChannels)
                {
                    this._radioChannels.Remove(radioChannel);
                }
            }
        }
Exemplo n.º 3
0
        public void JoinRadioChannel(VoiceClient voiceClient, string radioChannelName, bool isPrimary)
        {
            foreach (RadioChannel channel in this.RadioChannels)
            {
                if (channel.Members.Any(v => v.VoiceClient == voiceClient && v.IsPrimary == isPrimary))
                {
                    return;
                }
            }

            RadioChannel radioChannel = this.GetRadioChannel(radioChannelName, true);

            radioChannel.AddMember(voiceClient, isPrimary);
        }
Exemplo n.º 4
0
        private void OnSendingOnRadio([FromSource] Player player, string radioChannelName, bool isSending)
        {
            if (!this._voiceClients.TryGetValue(player, out VoiceClient voiceClient))
            {
                return;
            }

            RadioChannel radioChannel = this.GetRadioChannel(radioChannelName, false);

            if (radioChannel == null || !radioChannel.IsMember(voiceClient))
            {
                return;
            }

            radioChannel.Send(voiceClient, isSending);
        }
Exemplo n.º 5
0
        public void SendingOnRadio(IPlayer player, string radioChannelName, bool isSending)
        {
            if (!this.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            RadioChannel radioChannel = this.GetRadioChannel(radioChannelName, false);

            if (radioChannel == null || !radioChannel.IsMember(voiceClient))
            {
                return;
            }

            radioChannel.Send(voiceClient, isSending);
        }
Exemplo n.º 6
0
        public static void SendingOnRadio(GTANetworkAPI.Client player, string radioChannelName, bool isSending)
        {
            if (!VoiceManager.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            RadioChannel radioChannel = VoiceManager.GetRadioChannel(radioChannelName, false);

            if (radioChannel == null || !radioChannel.IsMember(voiceClient))
            {
                return;
            }

            radioChannel.Send(voiceClient, isSending);
        }
Exemplo n.º 7
0
        public RadioChannel GetRadioChannel(string name, bool create)
        {
            RadioChannel radioChannel;

            lock (this._radioChannels)
            {
                radioChannel = this.RadioChannels.FirstOrDefault(r => r.Name == name);

                if (radioChannel == null && create)
                {
                    radioChannel = new RadioChannel(name);

                    this._radioChannels.Add(radioChannel);
                }
            }

            return(radioChannel);
        }
Exemplo n.º 8
0
        public static RadioChannel GetRadioChannel(string name, bool create)
        {
            RadioChannel radioChannel;

            lock (VoiceManager._radioChannels)
            {
                radioChannel = VoiceManager.RadioChannels.FirstOrDefault(r => r.Name == name);

                if (radioChannel == null && create)
                {
                    radioChannel = new RadioChannel(name);

                    VoiceManager._radioChannels.Add(radioChannel);
                }
            }

            return(radioChannel);
        }
Exemplo n.º 9
0
        public void LeaveRadioChannel(IPlayer player, string radioChannelName)
        {
            if (!this.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            RadioChannel radioChannel = this.GetRadioChannel(radioChannelName, false);

            if (radioChannel != null)
            {
                radioChannel.RemoveMember(voiceClient);

                if (radioChannel.Members.Length == 0)
                {
                    this._radioChannels.Remove(radioChannel);
                }
            }
        }
Exemplo n.º 10
0
        public void JoinRadioChannel(IPlayer player, string radioChannelName)
        {
            if (!this.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            foreach (RadioChannel channel in this.RadioChannels)
            {
                if (channel.IsMember(voiceClient))
                {
                    return;
                }
            }

            RadioChannel radioChannel = this.GetRadioChannel(radioChannelName, true);

            radioChannel.AddMember(voiceClient);
        }
Exemplo n.º 11
0
        public static void LeaveRadioChannel(Player player, string radioChannelName)
        {
            if (!VoiceManager._voiceClients.TryGetValue(player, out VoiceClient voiceClient))
            {
                return;
            }

            RadioChannel radioChannel = VoiceManager.GetRadioChannel(radioChannelName, false);

            if (radioChannel != null)
            {
                radioChannel.RemoveMember(voiceClient);

                if (radioChannel.Members.Length == 0)
                {
                    VoiceManager._radioChannels.Remove(radioChannel);
                }
            }
        }
Exemplo n.º 12
0
        public static void JoinRadioChannel(Player player, string radioChannelName, bool isPrimary)
        {
            if (!VoiceManager._voiceClients.TryGetValue(player, out VoiceClient voiceClient))
            {
                return;
            }

            foreach (RadioChannel channel in VoiceManager.RadioChannels)
            {
                if (channel.Members.Any(v => v.VoiceClient == voiceClient && v.IsPrimary == isPrimary))
                {
                    return;
                }
            }

            RadioChannel radioChannel = VoiceManager.GetRadioChannel(radioChannelName, true);

            radioChannel.AddMember(voiceClient, isPrimary);
        }
Exemplo n.º 13
0
        public static void JoinRadioChannel(GTANetworkAPI.Client player, string radioChannelName)
        {
            if (!VoiceManager.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            foreach (RadioChannel channel in VoiceManager.RadioChannels)
            {
                if (channel.IsMember(voiceClient))
                {
                    return;
                }
            }

            RadioChannel radioChannel = VoiceManager.GetRadioChannel(radioChannelName, true);

            radioChannel.AddMember(voiceClient);
        }
Exemplo n.º 14
0
 internal RadioChannelMember(RadioChannel radioChannel, VoiceClient voiceClient, bool isPrimary)
 {
     this.RadioChannel = radioChannel;
     this.VoiceClient  = voiceClient;
     this.IsPrimary    = isPrimary;
 }
Exemplo n.º 15
0
 internal RadioChannelMember(RadioChannel radioChannel, VoiceClient voiceClient)
 {
     this.RadioChannel = radioChannel;
     this.VoiceClient  = voiceClient;
 }