Populate() public méthode

public Populate ( IScene scene ) : void
scene IScene
Résultat void
Exemple #1
0
        public void touch(ISceneChildEntity part, ISceneChildEntity child, Vector3 offsetPos,
                          IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
        {
            Dictionary <UUID, DetectParams> det = new Dictionary <UUID, DetectParams>();

            if (!CoalescedTouchEvents.TryGetValue(part.LocalId, out det))
            {
                det = new Dictionary <UUID, DetectParams>();
            }

            // Add to queue for all scripts in ObjectID object
            DetectParams detparam = new DetectParams();

            detparam = new DetectParams
            {
                Key       = remoteClient.AgentId,
                OffsetPos = new LSL_Types.Vector3(offsetPos.X,
                                                  offsetPos.Y,
                                                  offsetPos.Z)
            };

            detparam.Populate(part.ParentEntity.Scene);
            detparam.LinkNum = child.LinkNum;

            if (surfaceArgs != null)
            {
                detparam.SurfaceTouchArgs = surfaceArgs;
            }

            det[remoteClient.AgentId]          = detparam;
            CoalescedTouchEvents[part.LocalId] = det;

            ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

            if (datas == null || datas.Length == 0)
            {
                return;
            }

            string functionName = "touch";

            object[] param = new Object[] { new LSL_Types.LSLInteger(det.Count) };

            foreach (ScriptData ID in datas)
            {
                m_scriptEngine.AddToScriptQueue(ID, functionName, new List <DetectParams>(det.Values).ToArray(),
                                                EventPriority.FirstStart, param);
            }
        }
        public void touch_end(ISceneChildEntity part, ISceneChildEntity child, IClientAPI remoteClient,
                              SurfaceTouchEventArgs surfaceArgs)
        {
            Dictionary<UUID, DetectParams> det = new Dictionary<UUID, DetectParams>();
            if (!CoalescedTouchEvents.TryGetValue(part.LocalId, out det))
                det = new Dictionary<UUID, DetectParams>();

            // Add to queue for all scripts in ObjectID object
            DetectParams detparam = new DetectParams();
            detparam = new DetectParams {Key = remoteClient.AgentId};

            detparam.Populate(part.ParentEntity.Scene);
            detparam.LinkNum = child.LinkNum;

            if (surfaceArgs != null)
                detparam.SurfaceTouchArgs = surfaceArgs;

            det[remoteClient.AgentId] = detparam;
            CoalescedTouchEvents[part.LocalId] = det;

            ScriptData[] datas = ScriptEngine.ScriptProtection.GetScripts(part.UUID);

            if (datas == null || datas.Length == 0)
                return;

            string functionName = "touch_end";
            object[] param = {new LSL_Types.LSLInteger(det.Count)};

            foreach (ScriptData ID in datas)
            {
                m_scriptEngine.AddToScriptQueue(ID, functionName, new List<DetectParams>(det.Values).ToArray(),
                                                EventPriority.FirstStart, param);
            }
            //Remove us from the det param list
            det.Remove(remoteClient.AgentId);
            CoalescedTouchEvents[part.LocalId] = det;
        }