Exemple #1
0
        public IEnumerable <RadioChannelMember> GetPlayerRadioChannelMembership(VoiceClient voiceClient)
        {
            foreach (RadioChannel radioChannel in this.RadioChannels)
            {
                RadioChannelMember membership = radioChannel.Members.FirstOrDefault(m => m.VoiceClient == voiceClient);

                if (membership != null)
                {
                    yield return(membership);
                }
            }
        }
Exemple #2
0
        internal void RemoveMember(VoiceClient voiceClient)
        {
            lock (this._memberLock)
            {
                RadioChannelMember member = this._members.FirstOrDefault(m => m.VoiceClient == voiceClient);

                if (member != null)
                {
                    if (member.IsSending)
                    {
                        CitizenFX.Core.Vector3 position = member.VoiceClient.Player.GetPosition();

                        if (member.VoiceClient.IsRadioSpeakerEnabled)
                        {
                            foreach (VoiceClient client in VoiceManager.Instance.VoiceClients)
                            {
                                client.TriggerEvent(Event.SaltyChat_IsSendingRelayed, voiceClient.Player.Handle, voiceClient.TeamSpeakName, this.Name, false, true, position, false, new string[0]);
                            }
                        }
                        else
                        {
                            foreach (RadioChannelMember channelMember in this._members)
                            {
                                channelMember.VoiceClient.TriggerEvent(Event.SaltyChat_IsSending, voiceClient.Player.Handle, voiceClient.TeamSpeakName, this.Name, false, true, position);
                            }
                        }
                    }

                    this._members.Remove(member);

                    foreach (RadioChannelMember channelMember in this._members.Where(m => m.IsSending))
                    {
                        voiceClient.TriggerEvent(Event.SaltyChat_IsSending, channelMember.VoiceClient.Player.Handle, channelMember.VoiceClient.TeamSpeakName, this.Name, false, false, channelMember.VoiceClient.Player.GetPosition());
                    }

                    voiceClient.TriggerEvent(Event.SaltyChat_SetRadioChannel, null, member.IsPrimary);

                    this.BroadcastEvent(Event.SaltyChat_RadioChannelMemberUpdated, this.Name, this.Members.Select(m => m.VoiceClient.TeamSpeakName));
                }
            }
        }
        internal void RemoveMember(VoiceClient voiceClient)
        {
            lock (this._memberLock)
            {
                RadioChannelMember member = this._members.FirstOrDefault(m => m.VoiceClient == voiceClient);

                if (member != null)
                {
                    this._members.Remove(member);

                    voiceClient.TriggerEvent(Event.SaltyChat_SetRadioChannel, null, member.IsPrimary);

                    if (member.IsSending)
                    {
                        this.UpdateSenderStateBag();
                    }

                    this.UpdateMemberStateBag();
                }
            }
        }
Exemple #4
0
        internal void RemoveMember(VoiceClient voiceClient)
        {
            lock (this._members)
            {
                RadioChannelMember member = this._members.FirstOrDefault(m => m.VoiceClient == voiceClient);

                if (member != null)
                {
                    if (member.IsSending)
                    {
                        string positionJson = JsonConvert.SerializeObject(member.VoiceClient.Player.Character.Position);

                        if (member.VoiceClient.RadioSpeaker)
                        {
                            foreach (VoiceClient client in VoiceManager.Instance.VoiceClients)
                            {
                                client.Player.TriggerEvent(Event.SaltyChat_IsSendingRelayed, voiceClient.Player.Handle, this.Name, false, true, positionJson, false, new string[0]);
                            }
                        }
                        else
                        {
                            foreach (RadioChannelMember channelMember in this._members)
                            {
                                channelMember.VoiceClient.Player.TriggerEvent(Event.SaltyChat_IsSending, voiceClient.Player.Handle, this.Name, false, true, positionJson);
                            }
                        }
                    }

                    this._members.Remove(member);

                    foreach (RadioChannelMember channelMember in this._members.Where(m => m.IsSending))
                    {
                        voiceClient.Player.TriggerEvent(Event.SaltyChat_IsSending, channelMember.VoiceClient.Player.Handle, this.Name, false, false, JsonConvert.SerializeObject(channelMember.VoiceClient.Player.Character.Position));
                    }

                    voiceClient.Player.TriggerEvent(Event.SaltyChat_SetRadioChannel, null, member.IsPrimary);
                }
            }
        }
        internal void RemoveMember(VoiceClient voiceClient)
        {
            lock (this._members)
            {
                RadioChannelMember member = this._members.FirstOrDefault(m => m.VoiceClient == voiceClient);

                if (member != null)
                {
                    if (member.IsSending)
                    {
                        if (member.VoiceClient.RadioSpeaker)
                        {
                            foreach (VoiceClient client in VoiceManager.VoiceClients)
                            {
                                client.Player.TriggerEvent(SaltyShared.Event.SaltyChat_IsSendingRelayed, voiceClient.Player.Handle.Value, false, true, false, "{}");
                            }
                        }
                        else
                        {
                            foreach (RadioChannelMember channelMember in this._members)
                            {
                                channelMember.VoiceClient.Player.TriggerEvent(SaltyShared.Event.SaltyChat_IsSending, voiceClient.Player.Handle.Value, false);
                            }
                        }
                    }

                    this._members.Remove(member);
                    voiceClient.Player.TriggerEvent(SaltyShared.Event.SaltyChat_SetRadioChannel, "");

                    foreach (RadioChannelMember channelMember in this._members.Where(m => m.IsSending))
                    {
                        voiceClient.Player.TriggerEvent(SaltyShared.Event.SaltyChat_IsSending, channelMember.VoiceClient.Player.Handle.Value, false);
                    }
                }
            }
        }
Exemple #6
0
        internal bool TryGetMember(VoiceClient voiceClient, out RadioChannelMember radioChannelMember)
        {
            radioChannelMember = this.Members.FirstOrDefault(m => m.VoiceClient == voiceClient);

            return(radioChannelMember != null);
        }