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

            if (phoneCall != null)
            {
                this.LeavePhoneCall(voiceClient, phoneCall);
            }
        }
Ejemplo 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);
                }
            }
        }
Ejemplo 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);
            }
        }
Ejemplo 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);
        }
Ejemplo 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);
            }
        }
Ejemplo n.º 6
0
 public void JoinPhoneCall(VoiceClient voiceClient, PhoneCall phoneCall)
 {
     phoneCall.AddMember(voiceClient);
 }
Ejemplo n.º 7
0
        public void JoinPhoneCall(VoiceClient voiceClient, string identifier)
        {
            PhoneCall phoneCall = this.GetPhoneCall(identifier, true);

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