Esempio n. 1
0
        public void LeavePhoneCall(VoiceClient voiceClient, string identifier)
        {
            PhoneCall phoneCall = this.GetPhoneCall(identifier, false);

            if (phoneCall != null)
            {
                this.LeavePhoneCall(voiceClient, phoneCall);
            }
        }
Esempio n. 2
0
        public void LeavePhoneCall(VoiceClient voiceClient, PhoneCall phoneCall)
        {
            phoneCall.RemoveMember(voiceClient);

            if (phoneCall.Members.Length == 0)
            {
                lock (this._phoneCalls)
                {
                    this._phoneCalls.Remove(phoneCall);
                }
            }
        }
Esempio n. 3
0
        private void AddPlayersToCall(string identifier, List <dynamic> players)
        {
            PhoneCall phoneCall = this.GetPhoneCall(identifier, true);

            foreach (int playerHandle in players)
            {
                VoiceClient voiceClient = this.VoiceClients.FirstOrDefault(c => c.Player.GetServerId() == playerHandle);

                if (voiceClient == null)
                {
                    continue;
                }

                this.JoinPhoneCall(voiceClient, phoneCall);
            }
        }
Esempio n. 4
0
        public PhoneCall GetPhoneCall(string identifier, bool create)
        {
            PhoneCall phoneCall;

            lock (this._phoneCalls)
            {
                phoneCall = this.PhoneCalls.FirstOrDefault(r => r.Identifier == identifier);

                if (phoneCall == null && create)
                {
                    phoneCall = new PhoneCall(identifier);

                    this._phoneCalls.Add(phoneCall);
                }
            }

            return(phoneCall);
        }
Esempio n. 5
0
        private void RemovePlayersFromCall(string identifier, List <dynamic> players)
        {
            PhoneCall phoneCall = this.GetPhoneCall(identifier, false);

            if (phoneCall == null)
            {
                return;
            }

            foreach (int playerHandle in players)
            {
                VoiceClient voiceClient = this.VoiceClients.FirstOrDefault(c => c.Player.GetServerId() == playerHandle);

                if (voiceClient == null)
                {
                    continue;
                }

                this.LeavePhoneCall(voiceClient, phoneCall);
            }
        }
Esempio n. 6
0
 public void JoinPhoneCall(VoiceClient voiceClient, PhoneCall phoneCall)
 {
     phoneCall.AddMember(voiceClient);
 }
Esempio n. 7
0
        public void JoinPhoneCall(VoiceClient voiceClient, string identifier)
        {
            PhoneCall phoneCall = this.GetPhoneCall(identifier, true);

            this.JoinPhoneCall(voiceClient, phoneCall);
        }
Esempio n. 8
0
 internal PhoneCallMember(PhoneCall phoneCall, VoiceClient voiceClient)
 {
     this.PhoneCall        = phoneCall;
     this.VoiceClient      = voiceClient;
     this.IsSpeakerEnabled = false;
 }