Esempio n. 1
0
        public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List <SurfaceTouchEventArgs> surfaceArgs)
        {
            List <EntityBase> EntityList = GetEntities();

            SurfaceTouchEventArgs surfaceArg = null;

            if (surfaceArgs != null && surfaceArgs.Count > 0)
            {
                surfaceArg = surfaceArgs[0];
            }

            foreach (EntityBase ent in EntityList)
            {
                if (ent is SceneObjectGroup)
                {
                    SceneObjectGroup obj = ent as SceneObjectGroup;
                    if (obj != null)
                    {
                        // Is this prim part of the group
                        if (obj.HasChildPrim(localID))
                        {
                            // Currently only grab/touch for the single prim
                            // the client handles rez correctly
                            obj.ObjectGrabHandler(localID, offsetPos, remoteClient);

                            SceneObjectPart part = obj.GetChildPart(localID);

                            // If the touched prim handles touches, deliver it
                            // If not, deliver to root prim
                            if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
                            {
                                EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
                            }
                            // Deliver to the root prim if the touched prim doesn't handle touches
                            // or if we're meant to pass on touches anyway. Don't send to root prim
                            // if prim touched is the root prim as we just did it
                            if (((part.ScriptEvents & scriptEvents.touch_start) == 0) ||
                                (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
                            {
                                EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
                            }

                            return;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List <SurfaceTouchEventArgs> surfaceArgs)
        {
            SceneObjectPart part = GetSceneObjectPart(localID);

            if (part == null)
            {
                return;
            }

            SceneObjectGroup obj = part.ParentGroup;

            SurfaceTouchEventArgs surfaceArg = null;

            if (surfaceArgs != null && surfaceArgs.Count > 0)
            {
                surfaceArg = surfaceArgs[0];
            }

            // Currently only grab/touch for the single prim
            // the client handles rez correctly
            obj.ObjectGrabHandler(localID, offsetPos, remoteClient);

            uint partLocalId = part.LocalId;

            // If the touched prim handles touches, deliver it
            if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
            {
                EventManager.TriggerObjectGrab(partLocalId, 0, offsetPos, remoteClient, surfaceArg);
                if (!part.PassTouches)
                {
                    return;
                }
            }

            // Deliver to the root prim if the touched prim doesn't handle touches
            // or if we're meant to pass on touches anyway.

            uint rootLocalId = obj.RootPart.LocalId;

            if (partLocalId != rootLocalId && (obj.RootPart.ScriptEvents & scriptEvents.touch_start) != 0)
            {
                EventManager.TriggerObjectGrab(rootLocalId, partLocalId, offsetPos, remoteClient, surfaceArg);
            }
        }
Esempio n. 3
0
        public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List <SurfaceTouchEventArgs> surfaceArgs)
        {
            SurfaceTouchEventArgs surfaceArg = null;

            if (surfaceArgs != null && surfaceArgs.Count > 0)
            {
                surfaceArg = surfaceArgs[0];
            }

            SceneObjectGroup obj = this.GetGroupByPrim(localID);

            if (obj != null)
            {
                // Is this prim part of the group
                if (obj.HasChildPrim(localID))
                {
                    // Currently only grab/touch for the single prim
                    // the client handles rez correctly
                    obj.ObjectGrabHandler(localID, offsetPos, remoteClient);

                    SceneObjectPart part = obj.GetChildPart(localID);

                    int touchEvents = ((int)ScriptEvents.touch_start | (int)ScriptEvents.touch | (int)ScriptEvents.touch_end);

                    bool hasTouchEvent = (((int)part.ScriptEvents & touchEvents) != 0);

                    // If the touched prim handles touches, deliver it
                    if (hasTouchEvent)
                    {
                        EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
                    }

                    // If not, or if PassTouches and we haven't just delivered it to the root prim, deliver it there
                    if ((!hasTouchEvent) || (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
                    {
                        EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
                    }
                }
            }
        }