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

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

            if (phoneCall.Members.Length == 0)
            {
                lock (this._phoneCalls)
                {
                    this._phoneCalls.Remove(phoneCall);
                }
            }
        }
예제 #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);
            }
        }
예제 #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);
        }
예제 #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);
            }
        }
예제 #6
0
 public void JoinPhoneCall(VoiceClient voiceClient, PhoneCall phoneCall)
 {
     phoneCall.AddMember(voiceClient);
 }
예제 #7
0
        public void JoinPhoneCall(VoiceClient voiceClient, string identifier)
        {
            PhoneCall phoneCall = this.GetPhoneCall(identifier, true);

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