Exemplo n.º 1
0
        //
        public void SendVoicesInfo(IEnumerable <LocalVoice> voices, int channelId, int targetPlayerId)
        {
            object content = protocol.buildVoicesInfo(voices, true);

            var sendOpt = new SendOptions()
            {
                Reliability = true,
            };

            var opt = new RaiseEventOptions();

            if (targetPlayerId != 0)
            {
                opt.TargetActors = new int[] { targetPlayerId };
            }
            lock (sendLock)
            {
                this.OpRaiseEvent(VoiceEvent.Code, content, opt, sendOpt);
            }

            if (targetPlayerId == 0) // send debug echo infos to myself if broadcast requested
            {
                SendDebugEchoVoicesInfo(channelId);
            }
        }
        //
        public void SendVoicesInfo(IEnumerable <LocalVoice> voices, int channelId, int targetPlayerId)
        {
            foreach (var codecVoices in voices.GroupBy(v => v.Info.Codec))
            {
                object content = protocol.buildVoicesInfo(codecVoices, true);

                var sendOpt = new SendOptions()
                {
                    Reliability = true,
                    Channel     = photonChannelForCodec(codecVoices.Key),
                };

                var opt = new RaiseEventOptions();
                if (targetPlayerId == -1)
                {
                    opt.TargetActors = new int[] { this.LocalPlayer.ActorNumber };
                }
                else if (targetPlayerId != 0)
                {
                    opt.TargetActors = new int[] { targetPlayerId };
                }
                lock (sendLock)
                {
                    this.OpRaiseEvent(VoiceEvent.Code, content, opt, sendOpt);
                }
            }
        }