当前位置: 首页>>代码示例>>C#>>正文


C# Framework.AgentPosition类代码示例

本文整理汇总了C#中OpenSim.Framework.AgentPosition的典型用法代码示例。如果您正苦于以下问题:C# AgentPosition类的具体用法?C# AgentPosition怎么用?C# AgentPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AgentPosition类属于OpenSim.Framework命名空间,在下文中一共展示了AgentPosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateAgent

        public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData)
        {
            if (destination == null)
                return false;

            foreach (Scene s in m_sceneList)
            {
                if (s.RegionInfo.RegionHandle == destination.RegionHandle)
                {
                    //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
                    s.IncomingChildAgentDataUpdate(cAgentData);
                    return true;
                }
            }
            //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
            return false;
        }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:17,代码来源:IWCSimulationConnector.cs

示例2: CheckForSignificantMovement

        /// <summary>
        /// This checks for a significant movement and sends a coarselocationchange update
        /// </summary>
        protected void CheckForSignificantMovement()
        {
            if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT)
            {
                posLastSignificantMove = AbsolutePosition;
                m_scene.EventManager.TriggerSignificantClientMovement(this);
            }

            // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
            if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance)
            {
                m_lastChildAgentUpdatePosition = AbsolutePosition;
//                m_lastChildAgentUpdateCamPosition = CameraPosition;

/*  cadu is not used
                ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
                cadu.ActiveGroupID = UUID.Zero.Guid;
                cadu.AgentID = UUID.Guid;
                cadu.alwaysrun = SetAlwaysRun;
                cadu.AVHeight = Appearance.AvatarHeight;
                cadu.cameraPosition = CameraPosition;
                cadu.drawdistance = DrawDistance;
                cadu.GroupAccess = 0;
                cadu.Position = AbsolutePosition;
                cadu.regionHandle = RegionHandle;

                // Throttles 
                float multiplier = 1;

                int childRegions = KnownRegionCount;
                if (childRegions != 0)
                    multiplier = 1f / childRegions;

                // Minimum throttle for a child region is 1/4 of the root region throttle
                if (multiplier <= 0.25f)
                    multiplier = 0.25f;

                cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
                cadu.Velocity = Velocity;
*/
                AgentPosition agentpos = new AgentPosition();
//                agentpos.CopyFrom(cadu, ControllingClient.SessionId);

                agentpos.AgentID = new UUID(UUID.Guid);
                agentpos.SessionID = ControllingClient.SessionId;

                agentpos.Size = Appearance.AvatarSize;

                agentpos.Center = CameraPosition;
                agentpos.Far = DrawDistance;
                agentpos.Position = AbsolutePosition;
                agentpos.Velocity = Velocity;
                agentpos.RegionHandle = RegionHandle;
                agentpos.Throttles = ControllingClient.GetThrottlesPacked(1);


                // Let's get this out of the update loop
                Util.FireAndForget(
                    o => m_scene.SendOutChildAgentUpdates(agentpos, this), null, "ScenePresence.SendOutChildAgentUpdates");
            }
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:64,代码来源:ScenePresence.cs

示例3: SendChildAgentUpdate

        public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData)
        {
            // Try local first
            if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData))
                return true;

            // else do the remote thing
            if (!m_localBackend.IsLocalRegion(regionHandle))
            {
                RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
                if (regInfo != null)
                {
                    return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData);
                }
                else
                    m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
            }
            return false;

        }
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:20,代码来源:RESTInterregionComms.cs

示例4: SendOutChildAgentUpdates

 public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence)
 {
     m_sceneGridService.SendChildAgentDataUpdate(cadu, presence);
 }
开发者ID:CCIR,项目名称:opensim,代码行数:4,代码来源:Scene.cs

示例5: SendChildAgentDataUpdate

        public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence)
        {
//            m_log.DebugFormat(
//                "[SCENE COMMUNICATION SERVICE]: Sending child agent position updates for {0} in {1}", 
//                presence.Name, m_scene.Name);

            // This assumes that we know what our neighbors are.
            try
            {
                uint x = 0, y = 0;
                List<string> simulatorList = new List<string>();
                foreach (ulong regionHandle in presence.KnownRegionHandles)
                {
                    if (regionHandle != m_regionInfo.RegionHandle)
                    {
                        // we only want to send one update to each simulator; the simulator will
                        // hand it off to the regions where a child agent exists, this does assume
                        // that the region position is cached or performance will degrade
                        Util.RegionHandleToWorldLoc(regionHandle, out x, out y);
                        GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
                        if (dest == null)
                            continue;

                        if (!simulatorList.Contains(dest.ServerURI))
                        {
                            // we havent seen this simulator before, add it to the list
                            // and send it an update
                            simulatorList.Add(dest.ServerURI);
                            // Let move this to sync. Mono definitely does not like async networking.
                            m_scene.SimulationService.UpdateAgent(dest, cAgentData);

                            // Leaving this here as a reminder that we tried, and it sucks.
                            //SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
                            //d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest,
                            //              SendChildAgentDataUpdateCompleted,
                            //              d);
                        }
                    }
                }
            }
            catch (InvalidOperationException)
            {
                // We're ignoring a collection was modified error because this data gets old and outdated fast.
            }
        }
开发者ID:szielins,项目名称:opensim,代码行数:45,代码来源:SceneCommunicationService.cs

示例6: ChildAgentDataUpdate

        /// <summary>
        /// This updates important decision making data about a child agent
        /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
        /// </summary>
        public void ChildAgentDataUpdate(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
        {
            if (!IsChildAgent)
                return;

            //m_log.Debug("   >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY);
            int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
            int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;

            Vector3 offset = new Vector3(shiftx, shifty, 0f);

            // When we get to the point of re-computing neighbors everytime this
            // changes, then start using the agent's drawdistance rather than the 
            // region's draw distance.
            // DrawDistance = cAgentData.Far;
            DrawDistance = Scene.DefaultDrawDistance;

            if (cAgentData.Position != marker) // UGH!!
                m_pos = cAgentData.Position + offset;

            if (Vector3.Distance(AbsolutePosition, posLastSignificantMove) >= Scene.ChildReprioritizationDistance)
            {
                posLastSignificantMove = AbsolutePosition;
                ReprioritizeUpdates();
            }

            CameraPosition = cAgentData.Center + offset;

            if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
                ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);

            //cAgentData.AVHeight;
            RegionHandle = cAgentData.RegionHandle;
            //m_velocity = cAgentData.Velocity;
        }
开发者ID:CCIR,项目名称:opensim,代码行数:39,代码来源:ScenePresence.cs

示例7: UpdateAgent

        public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData)
        {
            if (destination == null)
                return false;

            bool retVal = false;
            foreach (Scene s in m_sceneList)
            {
                //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
                IEntityTransferModule transferModule = s.RequestModuleInterface<IEntityTransferModule> ();
                if (transferModule != null)
                    if (retVal)
                        transferModule.IncomingChildAgentDataUpdate (s, cAgentData);
                    else
                        retVal = transferModule.IncomingChildAgentDataUpdate (s, cAgentData);
            }
            //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
            return retVal;
        }
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:19,代码来源:LocalSimulationServiceConnector.cs

示例8: SendChildAgentDataUpdateAsync

        /// <summary>
        /// This informs all neighboring regions about the settings of it's child agent.
        /// Calls an asynchronous method to do so..  so it doesn't lag the sim.
        ///
        /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
        ///
        /// </summary>
        private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, ulong regionHandle)
        {
            //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName);
            try
            {
                //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
                m_interregionCommsOut.SendChildAgentUpdate(regionHandle, cAgentData);
            }
            catch
            {
                // Ignore; we did our best
            }

            //if (regionAccepted)
            //{
            //    //m_log.Info("[INTERGRID]: Completed sending a neighbor an update about my agent");
            //}
            //else
            //{
            //    //m_log.Info("[INTERGRID]: Failed sending a neighbor an update about my agent");
            //}
                
        }
开发者ID:dirkhusemann,项目名称:opensim,代码行数:30,代码来源:SceneCommunicationService.cs

示例9: SendChildAgentDataUpdate

        public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence)
        {
            // This assumes that we know what our neighbors are.
            try
            {
                foreach (ulong regionHandle in presence.KnownChildRegionHandles)
                {
                    if (regionHandle != m_regionInfo.RegionHandle)
                    {
                        SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
                        d.BeginInvoke(cAgentData, regionHandle,
                                      SendChildAgentDataUpdateCompleted,
                                      d);
                    }
                }
            }
            catch (InvalidOperationException)
            {
                // We're ignoring a collection was modified error because this data gets old and outdated fast.
            }

        }
开发者ID:dirkhusemann,项目名称:opensim,代码行数:22,代码来源:SceneCommunicationService.cs

示例10: CheckForSignificantMovement

        /// <summary>
        /// This checks for a significant movement and sends a courselocationchange update
        /// </summary>
        protected void CheckForSignificantMovement()
        {
            // Movement updates for agents in neighboring regions are sent directly to clients.
            // This value only affects how often agent positions are sent to neighbor regions
            // for things such as distance-based update prioritization
            const float SIGNIFICANT_MOVEMENT = 2.0f;

            if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT)
            {
                posLastSignificantMove = AbsolutePosition;
                m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient);
                m_scene.NotifyMyCoarseLocationChange();
            }

            // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
            if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance ||
                Util.GetDistanceTo(CameraPosition, m_lastChildAgentUpdateCamPosition) >= Scene.ChildReprioritizationDistance)
            {
                m_lastChildAgentUpdatePosition = AbsolutePosition;
                m_lastChildAgentUpdateCamPosition = CameraPosition;

                ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
                cadu.ActiveGroupID = UUID.Zero.Guid;
                cadu.AgentID = UUID.Guid;
                cadu.alwaysrun = m_setAlwaysRun;
                cadu.AVHeight = m_avHeight;
                Vector3 tempCameraCenter = m_CameraCenter;
                cadu.cameraPosition = tempCameraCenter;
                cadu.drawdistance = m_DrawDistance;
                cadu.GroupAccess = 0;
                cadu.Position = AbsolutePosition;
                cadu.regionHandle = m_rootRegionHandle;
                float multiplier = 1;
                int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
                if (innacurateNeighbors != 0)
                {
                    multiplier = 1f / (float)innacurateNeighbors;
                }
                if (multiplier <= 0f)
                {
                    multiplier = 0.25f;
                }

                //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
                cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
                cadu.Velocity = Velocity;

                AgentPosition agentpos = new AgentPosition();
                agentpos.CopyFrom(cadu);

                m_scene.SendOutChildAgentUpdates(agentpos, this);
            }
        }
开发者ID:dreamerc,项目名称:diva-distribution,代码行数:56,代码来源:ScenePresence.cs

示例11: ChildAgentDataUpdate

        /// <summary>
        /// This updates important decision making data about a child agent
        /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
        /// </summary>
        public void ChildAgentDataUpdate(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
        {
            if (!IsChildAgent)
                return;

            //m_log.Debug("   >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY);
            int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
            int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;

            Vector3 offset = new Vector3(shiftx, shifty, 0f);

            m_DrawDistance = cAgentData.Far;
            if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!!
                m_pos = cAgentData.Position + offset;

            if (Vector3.Distance(AbsolutePosition, posLastSignificantMove) >= Scene.ChildReprioritizationDistance)
            {
                posLastSignificantMove = AbsolutePosition;
                ReprioritizeUpdates();
            }

            m_CameraCenter = cAgentData.Center + offset;

            m_avHeight = cAgentData.Size.Z;
            //SetHeight(cAgentData.AVHeight);

            if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
                ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);

            // Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
            if (m_scene.m_seeIntoRegionFromNeighbor)
                m_sceneViewer.Reset();

            //cAgentData.AVHeight;
            m_rootRegionHandle = cAgentData.RegionHandle;
            //m_velocity = cAgentData.Velocity;
        }
开发者ID:dreamerc,项目名称:diva-distribution,代码行数:41,代码来源:ScenePresence.cs

示例12: CheckForSignificantMovement

        /// <summary>
        /// This checks for a significant movement and sends a courselocationchange update
        /// </summary>
        protected void CheckForSignificantMovement()
        {
            if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > 0.5)
            {
                posLastSignificantMove = AbsolutePosition;
                m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient);
                m_scene.NotifyMyCoarseLocationChange();
            }

            // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
            if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance ||
                Util.GetDistanceTo(CameraPosition, m_lastChildAgentUpdateCamPosition) >= Scene.ChildReprioritizationDistance)
            {
                ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
                cadu.ActiveGroupID = UUID.Zero.Guid;
                cadu.AgentID = UUID.Guid;
                cadu.alwaysrun = m_setAlwaysRun;
                cadu.AVHeight = m_avHeight;
                sLLVector3 tempCameraCenter = new sLLVector3(new Vector3(m_CameraCenter.X, m_CameraCenter.Y, m_CameraCenter.Z));
                cadu.cameraPosition = tempCameraCenter;
                cadu.drawdistance = m_DrawDistance;
                if (m_scene.Permissions.IsGod(new UUID(cadu.AgentID)))
                    cadu.godlevel = m_godlevel;
                cadu.GroupAccess = 0;
                cadu.Position = new sLLVector3(AbsolutePosition);
                cadu.regionHandle = m_rootRegionHandle;
                float multiplier = 1;
                int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
                if (innacurateNeighbors != 0)
                {
                    multiplier = 1f / (float)innacurateNeighbors;
                }
                if (multiplier <= 0f)
                {
                    multiplier = 0.25f;
                }

                //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
                cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
                cadu.Velocity = new sLLVector3(Velocity);

                AgentPosition agentpos = new AgentPosition();
                agentpos.CopyFrom(cadu);

                m_scene.SendOutChildAgentUpdates(agentpos, this);

                m_lastChildAgentUpdatePosition = AbsolutePosition;
                m_lastChildAgentUpdateCamPosition = CameraPosition;
            }
        }
开发者ID:dirkhusemann,项目名称:opensim,代码行数:53,代码来源:ScenePresence.cs

示例13: ChildAgentPositionUpdate

        /// <summary>
        /// This updates important decision making data about a child agent
        /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
        /// </summary>
        public void ChildAgentPositionUpdate(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
        {
            // m_log.Warn("[SCENE PRESENCE]: >>> ChildAgentPositionUpdate (" + rRegionX + "," + rRegionY+") at "+cAgentData.Position.ToString());
            int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
            int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;

            // m_log.ErrorFormat("[SCENE PRESENCE]: SP.ChildAgentPositionUpdate for R({0},{1}) T({2},{3}) at {4}+{5},{6}+{7},{8}",
            //          rRegionX.ToString(), rRegionY.ToString(), tRegionX.ToString(), tRegionY.ToString(),
            //          cAgentData.Position.X.ToString(), shiftx.ToString(), cAgentData.Position.Y.ToString(), shifty, cAgentData.Position.Z.ToString());

            if (!IsChildAgent)
            {
                m_log.Error("[SCENE PRESENCE]: ChildAgentPositionUpdate is NOT child agent - refused.");
                return;
            }
            if (IsInTransit)
            {
                m_log.Info("[SCENE PRESENCE]: ChildAgentPositionUpdate while in transit - ignored.");
                return;
            }
            if (cAgentData.Position != new Vector3(-1, -1, -1)) // UGH!!
            {
                lock (m_posInfo)
                {
                    if (m_posInfo.Parent != null)
                    {
                        m_log.InfoFormat("[SCENE PRESENCE]: ChildAgentPositionUpdate move to {0} refused for agent already sitting at {1}.",
                                        cAgentData.Position.ToString(), cAgentData.Position.ToString());
                        return;
                    }
                    AbsolutePosition = new Vector3(cAgentData.Position.X + shiftx, cAgentData.Position.Y + shifty, cAgentData.Position.Z);
                }
            }

            // Do this after updating the position!
            m_DrawDistance = cAgentData.Far;    // update the SP draw distance *before* checking culling
            if (m_sceneView != null && m_sceneView.UseCulling)
            {
                //Check for things that may have just entered the draw distance of the user
                m_sceneView.CheckForDistantEntitiesToShow();
            }

            m_CameraCenter = new Vector3(cAgentData.Center.X + shiftx, cAgentData.Center.Y + shifty, cAgentData.Center.Z);

            m_avHeight = cAgentData.Size.Z;
            //SetHeight(cAgentData.AVHeight);

            if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
                ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
        }
开发者ID:emperorstarfinder,项目名称:halcyon,代码行数:54,代码来源:ScenePresence.cs

示例14: SendChildAgentUpdate

        public void SendChildAgentUpdate()
        {
            Vector3 pos = AbsolutePosition;
            m_LastChildAgentUpdatePosition.X = pos.X;
            m_LastChildAgentUpdatePosition.Y = pos.Y;
            m_LastChildAgentUpdatePosition.Z = pos.Z;

            ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
            cadu.ActiveGroupID = UUID.Zero.Guid;
            cadu.AgentID = UUID.Guid;
            cadu.alwaysrun = m_setAlwaysRun;
            cadu.AVHeight = m_avHeight;
            sLLVector3 tempCameraCenter = new sLLVector3(new Vector3(m_CameraCenter.X, m_CameraCenter.Y, m_CameraCenter.Z));
            cadu.cameraPosition = tempCameraCenter;
            cadu.drawdistance = m_DrawDistance;
            if (!this.IsBot)    // bots don't need IsGod checks
                if (m_scene.Permissions.IsGod(new UUID(cadu.AgentID)))
                    cadu.godlevel = m_godlevel;
            cadu.GroupAccess = 0;
            cadu.Position = new sLLVector3(pos);
            cadu.regionHandle = m_scene.RegionInfo.RegionHandle;

            float multiplier = CalculateNeighborBandwidthMultiplier();
            //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
            cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
            cadu.Velocity = new sLLVector3(Velocity);

            AgentPosition agentpos = new AgentPosition();
            agentpos.CopyFrom(cadu);

            m_scene.SendOutChildAgentUpdates(agentpos, this);
        }
开发者ID:emperorstarfinder,项目名称:halcyon,代码行数:32,代码来源:ScenePresence.cs

示例15: DoAgentPut

        protected void DoAgentPut(Hashtable request, Hashtable responsedata)
        {
            OSDMap args = Utils.GetOSDMap((string)request["body"]);
            if (args == null)
            {
                responsedata["int_response_code"] = HttpStatusCode.BadRequest;
                responsedata["str_response_string"] = "Bad request";
                return;
            }

            // retrieve the input arguments
            int x = 0, y = 0;
            UUID uuid = UUID.Zero;
            string regionname = string.Empty;
            if (args.ContainsKey("destination_x") && args["destination_x"] != null)
                Int32.TryParse(args["destination_x"].AsString(), out x);
            if (args.ContainsKey("destination_y") && args["destination_y"] != null)
                Int32.TryParse(args["destination_y"].AsString(), out y);
            if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
                UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
            if (args.ContainsKey("destination_name") && args["destination_name"] != null)
                regionname = args["destination_name"].ToString();

            GridRegion destination = new GridRegion();
            destination.RegionID = uuid;
            destination.RegionLocX = x;
            destination.RegionLocY = y;
            destination.RegionName = regionname;

            string messageType;
            if (args["message_type"] != null)
                messageType = args["message_type"].AsString();
            else
            {
                m_log.Warn("[AGENT HANDLER]: Agent Put Message Type not found. ");
                messageType = "AgentData";
            }

            bool result = true;
            if ("AgentData".Equals(messageType))
            {
                AgentData agent = new AgentData();
                try
                {
                    agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle));
                }
                catch (Exception ex)
                {
                    m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
                    responsedata["int_response_code"] = HttpStatusCode.BadRequest;
                    responsedata["str_response_string"] = "Bad request";
                    return;
                }

                //agent.Dump();
                // This is one of the meanings of PUT agent
                result = UpdateAgent(destination, agent);

            }
            else if ("AgentPosition".Equals(messageType))
            {
                AgentPosition agent = new AgentPosition();
                try
                {
                    agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle));
                }
                catch (Exception ex)
                {
                    m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
                    return;
                }
                //agent.Dump();
                // This is one of the meanings of PUT agent
                result = m_SimulationService.UpdateAgent(destination, agent);

            }

            responsedata["int_response_code"] = HttpStatusCode.OK;
            responsedata["str_response_string"] = result.ToString();
            //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead
        }
开发者ID:justasabc,项目名称:opensim,代码行数:81,代码来源:AgentHandlers.cs


注:本文中的OpenSim.Framework.AgentPosition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。