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


C# IScenePresence.CopyTo方法代码示例

本文整理汇总了C#中IScenePresence.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# IScenePresence.CopyTo方法的具体用法?C# IScenePresence.CopyTo怎么用?C# IScenePresence.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IScenePresence的用法示例。


在下文中一共展示了IScenePresence.CopyTo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoTeleport

        public virtual void DoTeleport(IScenePresence sp, GridRegion finalDestination, Vector3 position, Vector3 lookAt,
            uint teleportFlags)
        {
            sp.ControllingClient.SendTeleportProgress(teleportFlags, "sending_dest");
            if (finalDestination == null)
            {
                sp.ControllingClient.SendTeleportFailed("Unable to locate destination");
                return;
            }

            MainConsole.Instance.DebugFormat(
                "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}/{2}",
                finalDestination.ServerURI, finalDestination.RegionName, position);

            sp.ControllingClient.SendTeleportProgress(teleportFlags, "arriving");
            sp.SetAgentLeaving(finalDestination);

            // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
            // both regions
            if (sp.ParentID != UUID.Zero)
                sp.StandUp();

            AgentCircuitData agentCircuit = BuildCircuitDataForPresence(sp, position);

            AgentData agent = new AgentData();
            sp.CopyTo(agent);
            //Fix the position
            agent.Position = position;

            ISyncMessagePosterService syncPoster = sp.Scene.RequestModuleInterface<ISyncMessagePosterService>();
            if (syncPoster != null)
            {
                //This does CreateAgent and sends the EnableSimulator/EstablishAgentCommunication/TeleportFinish
                //  messages if they need to be called and deals with the callback
                syncPoster.PostToServer(SyncMessageHelper.TeleportAgent((int) sp.DrawDistance,
                                                                        agentCircuit, agent, teleportFlags,
                                                                        finalDestination, sp.Scene.RegionInfo.RegionID));
            }
        }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:39,代码来源:EntityTransferModule.cs

示例2: InternalCross

        public virtual void InternalCross(IScenePresence agent, Vector3 attemptedPos, bool isFlying,
            GridRegion crossingRegion)
        {
            MainConsole.Instance.DebugFormat("[EntityTransferModule]: Crossing agent {0} to region {1}", agent.Name,
                                             crossingRegion.RegionName);

            try
            {
                agent.SetAgentLeaving(crossingRegion);

                AgentData cAgent = new AgentData();
                agent.CopyTo(cAgent);
                cAgent.Position = attemptedPos;
                if (isFlying)
                    cAgent.ControlFlags |= (uint) AgentManager.ControlFlags.AGENT_CONTROL_FLY;

                AgentCircuitData agentCircuit = BuildCircuitDataForPresence(agent, attemptedPos);
                agentCircuit.TeleportFlags = (uint) TeleportFlags.ViaRegionID;

                //This does UpdateAgent and closing of child agents
                //  messages if they need to be called
                ISyncMessagePosterService syncPoster =
                    agent.Scene.RequestModuleInterface<ISyncMessagePosterService>();
                if (syncPoster != null)
                {
                    syncPoster.PostToServer(SyncMessageHelper.CrossAgent(crossingRegion, attemptedPos,
                                                                         agent.Velocity, agentCircuit, cAgent,
                                                                         agent.Scene.RegionInfo.RegionID));
                }
            }
            catch (Exception ex)
            {
                MainConsole.Instance.Warn("[EntityTransferModule]: Exception in crossing: " + ex);
            }
        }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:35,代码来源:EntityTransferModule.cs

示例3: InternalCross

        public virtual void InternalCross(IScenePresence agent, Vector3 attemptedPos, bool isFlying, GridRegion crossingRegion)
        {
            if(agent.PhysicsActor != null)
                agent.PhysicsActor.IsPhysical = false;
            
            MainConsole.Instance.DebugFormat("[EntityTransferModule]: Crossing agent {0} to region {1}", agent.Name, crossingRegion.RegionName);

            try
            {
                agent.SetAgentLeaving(crossingRegion);

                AgentData cAgent = new AgentData();
                agent.CopyTo(cAgent);
                cAgent.Position = attemptedPos;
                if (isFlying)
                    cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;

                AgentCircuitData agentCircuit = BuildCircuitDataForPresence(agent, attemptedPos);
                agentCircuit.teleportFlags = (uint)TeleportFlags.ViaRegionID;

                IEventQueueService eq = agent.Scene.RequestModuleInterface<IEventQueueService>();
                if (eq != null)
                {
                    //This does UpdateAgent and closing of child agents
                    //  messages if they need to be called
                    ISyncMessagePosterService syncPoster =
                        agent.Scene.RequestModuleInterface<ISyncMessagePosterService>();
                    if (syncPoster != null)
                    {
                        syncPoster.Get(SyncMessageHelper.CrossAgent(crossingRegion, attemptedPos,
                            agent.Velocity, agentCircuit, cAgent,
                            agent.Scene.RegionInfo.RegionHandle),
                            agent.UUID, agent.Scene.RegionInfo.RegionHandle,
                            (map) =>
                            {
                                if (map == null || !map["success"].AsBoolean())
                                {
                                    //Tell modules that we have failed
                                    agent.AgentFailedToLeave();
                                    if (map != null)
                                    {
                                        if (map.ContainsKey("Note") && !map["Note"].AsBoolean())
                                            return;
                                        agent.ControllingClient.SendTeleportFailed(map["Reason"].AsString());
                                    }
                                    else
                                        agent.ControllingClient.SendTeleportFailed("TP Failed");
                                    if (agent.PhysicsActor != null)
                                        agent.PhysicsActor.IsPhysical = true; //Fix the setting that we set earlier
                                    // In any case
                                    agent.FailedCrossingTransit(crossingRegion);
                                    return;
                                }
                                //We're killing the animator and the physics actor, so we don't need to worry about agent.PhysicsActor.IsPhysical
                                agent.MakeChildAgent(crossingRegion);
                                //Revolution- We already were in this region... we don't need updates about the avatars we already know about, right?
                                // OLD: now we have a child agent in this region. Request and send all interesting data about (root) agents in the sim
                                //agent.SendOtherAgentsAvatarDataToMe();
                                //agent.SendOtherAgentsAppearanceToMe();

                                //Kill the groups here, otherwise they will become ghost attachments 
                                //  and stay in the sim, they'll get readded below into the new sim
                                //KillAttachments(agent);
                                // In any case
                                agent.SuccessfulCrossingTransit(crossingRegion);
                            });
                    }
                }

            }
            catch(Exception ex)
            {
                MainConsole.Instance.Warn("[EntityTransferModule]: Exception in crossing: " + ex);
            }
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:75,代码来源:EntityTransferModule.cs

示例4: DoTeleport

        public virtual void DoTeleport(IScenePresence sp, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags)
        {
            sp.ControllingClient.SendTeleportProgress(teleportFlags, "sending_dest");
            if (finalDestination == null)
            {
                sp.ControllingClient.SendTeleportFailed("Unable to locate destination");
                return;
            }

            MainConsole.Instance.DebugFormat(
                "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}/{2}",
                finalDestination.ServerURI, finalDestination.RegionName, position);

            sp.ControllingClient.SendTeleportProgress(teleportFlags, "arriving");
            sp.SetAgentLeaving(finalDestination);

            // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
            // both regions
            if (sp.ParentID != UUID.Zero)
                sp.StandUp();

            AgentCircuitData agentCircuit = BuildCircuitDataForPresence(sp, position);

            AgentData agent = new AgentData();
            sp.CopyTo(agent);
            //Fix the position
            agent.Position = position;

            IEventQueueService eq = sp.Scene.RequestModuleInterface<IEventQueueService>();
            if (eq != null)
            {
                ISyncMessagePosterService syncPoster = sp.Scene.RequestModuleInterface<ISyncMessagePosterService>();
                if (syncPoster != null)
                {
                    //This does CreateAgent and sends the EnableSimulator/EstablishAgentCommunication/TeleportFinish
                    //  messages if they need to be called and deals with the callback
                    syncPoster.Get(SyncMessageHelper.TeleportAgent((int)sp.DrawDistance,
                        agentCircuit, agent, teleportFlags, finalDestination, sp.Scene.RegionInfo.RegionHandle),
                        sp.UUID, sp.Scene.RegionInfo.RegionHandle, (map) =>
                        {
                            if (map == null || !map["success"].AsBoolean())
                            {
                                // Fix the agent status
                                sp.IsChildAgent = false;
                                //Tell modules about it
                                sp.AgentFailedToLeave();
                                sp.ControllingClient.SendTeleportFailed(map != null
                                                                            ? map["Reason"].AsString()
                                                                            : "Teleport Failed");
                                return;
                            }
                            //Get the new destintation, it may have changed
                            if (map.ContainsKey("Destination"))
                            {
                                finalDestination = new GridRegion();
                                finalDestination.FromOSD((OSDMap)map["Destination"]);
                            }
                            MakeChildAgent(sp, finalDestination, false);
                        });
                }
            }

        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:63,代码来源:EntityTransferModule.cs

示例5: CrossAgentToNewRegionAsync

        /// <summary>
        /// This Closes child agents on neighboring regions
        /// Calls an asynchronous method to do so..  so it doesn't lag the sim.
        /// </summary>
        protected IScenePresence CrossAgentToNewRegionAsync(IScenePresence agent, Vector3 pos,
            GridRegion crossingRegion, bool isFlying, bool positionIsAlreadyFixed)
        {
            m_log.DebugFormat("[EntityTransferModule]: Crossing agent {0} to region {1}", agent.Name, crossingRegion.RegionName);

            IScene m_scene = agent.Scene;

            try
            {
                if (crossingRegion != null)
                {
                    //Make sure that all attachments are ready for the teleport
                    IAttachmentsModule attModule = agent.Scene.RequestModuleInterface<IAttachmentsModule>();
                    if (attModule != null)
                        attModule.ValidateAttachments(agent.UUID);

                    if(!positionIsAlreadyFixed)
                    {
                        int xOffset = crossingRegion.RegionLocX - m_scene.RegionInfo.RegionLocX;
                        int yOffset = crossingRegion.RegionLocY - m_scene.RegionInfo.RegionLocY;

                        if(xOffset < 0)
                            pos.X += m_scene.RegionInfo.RegionSizeX;
                        else if(xOffset > 0)
                            pos.X -= m_scene.RegionInfo.RegionSizeX;

                        if(yOffset < 0)
                            pos.Y += m_scene.RegionInfo.RegionSizeY;
                        else if(yOffset > 0)
                            pos.Y -= m_scene.RegionInfo.RegionSizeY;

                        //Make sure that they are within bounds (velocity can push it out of bounds)
                        if(pos.X < 0)
                            pos.X = 1;
                        if(pos.Y < 0)
                            pos.Y = 1;

                        if(pos.X > crossingRegion.RegionSizeX)
                            pos.X = crossingRegion.RegionSizeX - 1;
                        if(pos.Y > crossingRegion.RegionSizeY)
                            pos.Y = crossingRegion.RegionSizeY - 1;
                    }

                    AgentData cAgent = new AgentData();
                    agent.CopyTo(cAgent);
                    cAgent.Position = pos;
                    if (isFlying)
                        cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;

                    AgentCircuitData agentCircuit = agent.ControllingClient.RequestClientInfo();
                    agentCircuit.startpos = pos;
                    agentCircuit.child = false;
                    agentCircuit.teleportFlags = (uint)TeleportFlags.ViaRegionID;
                    IAvatarAppearanceModule appearance = agent.RequestModuleInterface<IAvatarAppearanceModule>();
                    if (appearance != null)
                        agentCircuit.Appearance = appearance.Appearance;

                    IEventQueueService eq = agent.Scene.RequestModuleInterface<IEventQueueService>();
                    if (eq != null)
                    {
                        //This does UpdateAgent and closing of child agents
                        //  messages if they need to be called
                        ISyncMessagePosterService syncPoster = agent.Scene.RequestModuleInterface<ISyncMessagePosterService>();
                        if (syncPoster != null)
                        {
                            OSDMap map = syncPoster.Get(SyncMessageHelper.CrossAgent(crossingRegion, pos,
                                agent.Velocity, agentCircuit, cAgent, agent.Scene.RegionInfo.RegionHandle),
                                agent.UUID, agent.Scene.RegionInfo.RegionHandle);
                            bool result = false;
                            if (map != null)
                                result = map["Success"].AsBoolean();
                            if (!result)
                            {
                                //Fix user's attachments
                                attModule.RezAttachments (agent);
                                if (map != null)
                                {
                                    if (map.ContainsKey("Note") && !map["Note"].AsBoolean ())
                                        return agent;
                                    agent.ControllingClient.SendTeleportFailed (map["Reason"].AsString ());
                                }
                                else
                                    agent.ControllingClient.SendTeleportFailed ("TP Failed");
                                if (agent.PhysicsActor != null)
                                    agent.PhysicsActor.IsPhysical = true; //Fix the setting that we set earlier
                                // In any case
                                agent.FailedCrossingTransit(crossingRegion);
                                return agent;
                            }
                        }
                    }
                    //We're killing the animator and the physics actor, so we don't need to worry about agent.PhysicsActor.IsPhysical
                    agent.MakeChildAgent(crossingRegion);

                    //Revolution- We already were in this region... we don't need updates about the avatars we already know about, right?
                    // OLD: now we have a child agent in this region. Request and send all interesting data about (root) agents in the sim
//.........这里部分代码省略.........
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:101,代码来源:EntityTransferModule.cs

示例6: DoTeleport

        public virtual void DoTeleport(IScenePresence sp, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags)
        {
            sp.ControllingClient.SendTeleportProgress(teleportFlags, "sending_dest");
            if (finalDestination == null)
            {
                sp.ControllingClient.SendTeleportFailed("Unable to locate destination");
                return;
            }

            m_log.DebugFormat(
                "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}/{2}",
                finalDestination.ServerURI, finalDestination.RegionName, position);

            sp.ControllingClient.SendTeleportProgress(teleportFlags, "arriving");

            // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
            // both regions
            if (sp.ParentID != UUID.Zero)
                sp.StandUp();

            //Make sure that all attachments are ready for the teleport
            IAttachmentsModule attModule = sp.Scene.RequestModuleInterface<IAttachmentsModule>();
            if (attModule != null)
                attModule.ValidateAttachments(sp.UUID);

            AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo();
            agentCircuit.startpos = position;
            //The agent will be a root agent
            agentCircuit.child = false;
            //Make sure the appearnace is right
            IAvatarAppearanceModule appearance = sp.RequestModuleInterface<IAvatarAppearanceModule> ();
            if(appearance != null)
                agentCircuit.Appearance = appearance.Appearance;

            AgentData agent = new AgentData();
            sp.CopyTo(agent);
            //Fix the position
            agent.Position = position;

            IEventQueueService eq = sp.Scene.RequestModuleInterface<IEventQueueService>();
            if (eq != null)
            {
                ISyncMessagePosterService syncPoster = sp.Scene.RequestModuleInterface<ISyncMessagePosterService>();
                if (syncPoster != null)
                {
                    AgentCircuitData oldCircuit = sp.Scene.AuthenticateHandler.AgentCircuitsByUUID[sp.UUID];
                    agentCircuit.ServiceURLs = oldCircuit.ServiceURLs;
                    agentCircuit.firstname = oldCircuit.firstname;
                    agentCircuit.lastname = oldCircuit.lastname;
                    agentCircuit.ServiceSessionID = oldCircuit.ServiceSessionID;
                    //This does CreateAgent and sends the EnableSimulator/EstablishAgentCommunication/TeleportFinish
                    //  messages if they need to be called and deals with the callback
                    OSDMap map = syncPoster.Get(SyncMessageHelper.TeleportAgent((int)sp.DrawDistance,
                        agentCircuit, agent, teleportFlags, finalDestination, sp.Scene.RegionInfo.RegionHandle), 
                        sp.UUID, sp.Scene.RegionInfo.RegionHandle);
                    bool result = false;
                    if(map != null)
                        result = map["Success"].AsBoolean();
                    if (!result)
                    {
                        // Fix the agent status
                        sp.IsChildAgent = false;
                        //Fix user's attachments
                        attModule.RezAttachments (sp);
                        if (map != null)
                            sp.ControllingClient.SendTeleportFailed (map["Reason"].AsString ());
                        else
                            sp.ControllingClient.SendTeleportFailed ("Teleport Failed");
                        return;
                    }
                    else
                    {
                        //Get the new destintation, it may have changed
                        if(map.ContainsKey("Destination"))
                        {
                            finalDestination = new GridRegion();
                            finalDestination.FromOSD((OSDMap)map["Destination"]);
                        }
                    }
                }
            }

            MakeChildAgent(sp, finalDestination);
        }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:84,代码来源:EntityTransferModule.cs

示例7: DoTeleport

        public virtual void DoTeleport(IScenePresence sp, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags)
        {
            sp.ControllingClient.SendTeleportProgress(teleportFlags, "sending_dest");
            if (finalDestination == null)
            {
                sp.ControllingClient.SendTeleportFailed("Unable to locate destination");
                return;
            }

            m_log.DebugFormat(
                "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}/{2}",
                finalDestination.ServerURI, finalDestination.RegionName, position);

            sp.ControllingClient.SendTeleportProgress(teleportFlags, "arriving");

            // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
            // both regions
            if (sp.ParentID != UUID.Zero)
                sp.StandUp();

            //Make sure that all attachments are ready for the teleport
            IAttachmentsModule attModule = sp.Scene.RequestModuleInterface<IAttachmentsModule>();
            if (attModule != null)
                attModule.ValidateAttachments(sp.UUID);

            AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo();
            agentCircuit.startpos = position;
            //The agent will be a root agent
            agentCircuit.child = false;
            //Make sure the appearnace is right
            IAvatarAppearanceModule appearance = sp.RequestModuleInterface<IAvatarAppearanceModule> ();
            agentCircuit.Appearance = appearance.Appearance;

            AgentData agent = new AgentData();
            sp.CopyTo(agent);
            //Fix the position
            agent.Position = position;

            IEventQueueService eq = sp.Scene.RequestModuleInterface<IEventQueueService>();
            if (eq != null)
            {
                ISyncMessagePosterService syncPoster = sp.Scene.RequestModuleInterface<ISyncMessagePosterService>();
                if (syncPoster != null)
                {
                    //This does CreateAgent and sends the EnableSimulator/EstablishAgentCommunication/TeleportFinish
                    //  messages if they need to be called and deals with the callback
                    OSDMap map = syncPoster.Get(SyncMessageHelper.TeleportAgent((int)sp.DrawDistance,
                        agentCircuit, agent, teleportFlags, finalDestination, sp.Scene.RegionInfo.RegionHandle), 
                        sp.UUID, sp.Scene.RegionInfo.RegionHandle);
                    bool result = false;
                    if(map != null)
                        result = map["Success"].AsBoolean();
                    if (!result)
                    {
                        // Fix the agent status
                        sp.IsChildAgent = false;
                        if(map != null)
                            sp.ControllingClient.SendTeleportFailed(map["Reason"].AsString());
                        else
                            sp.ControllingClient.SendTeleportFailed ("Teleport Failed");
                        return;
                    }
                }
            }

            sp.Scene.AuroraEventManager.FireGenericEventHandler ("SendingAttachments", new object[2] { finalDestination, sp });

            //Kill the groups here, otherwise they will become ghost attachments 
            //  and stay in the sim, they'll get readded below into the new sim
            KillAttachments(sp);

            // Well, this is it. The agent is over there.
            KillEntity(sp.Scene, sp);

            //Make it a child agent for now... the grid will kill us later if we need to close
            sp.MakeChildAgent();
        }
开发者ID:RevolutionSmythe,项目名称:Aurora-Sim,代码行数:77,代码来源:EntityTransferModule.cs


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