Universe.Modules.Selection.SelectionModule.ProcessViewerEffect C# (CSharp) Method

ProcessViewerEffect() protected method

protected ProcessViewerEffect ( IClientAPI remoteClient, List args ) : void
remoteClient IClientAPI
args List
return void
        protected void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
        {
            IScene scene = remoteClient.Scene;
            // TODO: don't create new blocks if recycling an old packet
            ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count];
            IScenePresence SP;
            scene.TryGetScenePresence(remoteClient.AgentId, out SP);
            for (int i = 0; i < args.Count; i++)
            {
                ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock
                                                            {
                                                                AgentID = args[i].AgentID,
                                                                Color = args[i].Color,
                                                                Duration = args[i].Duration,
                                                                ID = args[i].ID,
                                                                Type = args[i].Type,
                                                                TypeData = args[i].TypeData
                                                            };
                effectBlockArray[i] = effect;
                //Save the color
                if (effect.Type == (int) EffectType.Beam || effect.Type == (int) EffectType.Point
                    || effect.Type == (int) EffectType.Sphere)
                {
                    Color4 color = new Color4(effect.Color, 0, false);
                    if (SP != null && !(color.R == 0 && color.G == 0 && color.B == 0))
                    {
                        PerClientSelectionParticles selection = SP.RequestModuleInterface<PerClientSelectionParticles>();
                        if (selection != null)
                        {
                            selection.EffectColor = args[i].Color;
                        }
                    }
                }

                foreach (
                    IScenePresence client in
                        scene.GetScenePresences()
                             .Where(client => client.ControllingClient.AgentId != remoteClient.AgentId))
                {
                    client.ControllingClient.SendViewerEffect(effectBlockArray);
                }
            }
        }