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


C# IScene.RemoveAgent方法代码示例

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


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

示例1: NewUserConnection

        /// <summary>
        ///     Do the work necessary to initiate a new user connection for a particular scene.
        ///     At the moment, this consists of setting up the caps infrastructure
        ///     The return bool should allow for connections to be refused, but as not all calling paths
        ///     take proper notice of it let, we allowed banned users in still.
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="agent">CircuitData of the agent who is connecting</param>
        /// <param name="UDPPort"></param>
        /// <param name="reason">
        ///     Outputs the reason for the false response on this string,
        ///     If the agent was accepted, this will be the Caps SEED for the region
        /// </param>
        /// <param name="teleportFlags"></param>
        /// <returns>
        ///     True if the region accepts this agent.  False if it does not.  False will
        ///     also return a reason.
        /// </returns>
        public bool NewUserConnection(IScene scene, AgentCircuitData agent, uint teleportFlags, out CreateAgentResponse response)
        {
            response = new CreateAgentResponse();
            response.RequestedUDPPort = scene.RegionInfo.RegionPort;
            IScenePresence sp = scene.GetScenePresence(agent.AgentID);

            // Don't disable this log message - it's too helpful
            MainConsole.Instance.TraceFormat(
                "[ConnectionBegin]: Region {0} told of incoming {1} agent {2} (circuit code {3}, teleportflags {4})",
                scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root", agent.AgentID,
                agent.CircuitCode, teleportFlags);

            CacheUserInfo(scene, agent.CachedUserInfo);

            string reason;
            if (!AuthorizeUser(scene, agent, out reason))
            {
                response.Reason = reason;
                response.Success = false;
                return false;
            }

            if (sp != null && !sp.IsChildAgent)
            {
                // We have a zombie from a crashed session.
                // Or the same user is trying to be root twice here, won't work.
                // Kill it.
                MainConsole.Instance.InfoFormat("[Scene]: Zombie scene presence detected for {0} in {1}", agent.AgentID,
                                                scene.RegionInfo.RegionName);
                //Tell everyone about it
                scene.WhiteCoreEventManager.FireGenericEventHandler("AgentIsAZombie", sp.UUID);
                //Send the killing message (DisableSimulator)
                scene.RemoveAgent(sp, true);
                sp = null;
            }

            response.CapsURIs = scene.EventManager.TriggerOnRegisterCaps(agent.AgentID);
            response.OurIPForClient = MainServer.Instance.HostName;

            scene.WhiteCoreEventManager.FireGenericEventHandler("NewUserConnection", agent);

            //Add the circuit at the end
            scene.AuthenticateHandler.AddNewCircuit(agent.CircuitCode, agent);

            MainConsole.Instance.InfoFormat(
                "[ConnectionBegin]: Region {0} authenticated and authorized incoming {1} agent {2} (circuit code {3})",
                scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root", agent.AgentID,
                agent.CircuitCode);

            response.Success = true;
            return true;
        }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:70,代码来源:EntityTransferModule.cs

示例2: IncomingCloseAgent

        /// <summary>
        ///     Tell a single agent to disconnect from the region.
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="agentID"></param>
        public bool IncomingCloseAgent(IScene scene, UUID agentID)
        {
            //MainConsole.Instance.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);

            IScenePresence presence = scene.GetScenePresence(agentID);
            if (presence != null)
                return scene.RemoveAgent(presence, true);
            return false;
        }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:14,代码来源:EntityTransferModule.cs

示例3: IncomingCloseAgent

        /// <summary>
        /// Tell a single agent to disconnect from the region.
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="agentID"></param>
        public bool IncomingCloseAgent (IScene scene, UUID agentID)
        {
            //MainConsole.Instance.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);

            IScenePresence presence = scene.GetScenePresence (agentID);
            if (presence != null)
            {
                bool RetVal = scene.RemoveAgent (presence, true);

                ISyncMessagePosterService syncPoster = scene.RequestModuleInterface<ISyncMessagePosterService> ();
                if (syncPoster != null)
                {
                    //Tell the grid that we are logged out
                    syncPoster.Post (SyncMessageHelper.DisableSimulator (presence.UUID, scene.RegionInfo.RegionHandle), scene.RegionInfo.RegionHandle);
                }
                return RetVal;
            }
            return false;
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:24,代码来源:EntityTransferModule.cs

示例4: NewUserConnection

        /// <summary>
        /// Do the work necessary to initiate a new user connection for a particular scene.
        /// At the moment, this consists of setting up the caps infrastructure
        /// The return bool should allow for connections to be refused, but as not all calling paths
        /// take proper notice of it let, we allowed banned users in still.
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="agent">CircuitData of the agent who is connecting</param>
        /// <param name="UDPPort"></param>
        /// <param name="reason">Outputs the reason for the false response on this string,
        /// If the agent was accepted, this will be the Caps SEED for the region</param>
        /// <param name="teleportFlags"></param>
        /// <returns>True if the region accepts this agent.  False if it does not.  False will 
        /// also return a reason.</returns>
        public bool NewUserConnection (IScene scene, AgentCircuitData agent, uint teleportFlags, out int UDPPort, out string reason)
        {
            reason = String.Empty;
            UDPPort = GetUDPPort(scene);
            IScenePresence sp = scene.GetScenePresence(agent.AgentID);

            // Don't disable this log message - it's too helpful
            MainConsole.Instance.TraceFormat (
                "[ConnectionBegin]: Region {0} told of incoming {1} agent {2} (circuit code {3}, teleportflags {4})",
                scene.RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.AgentID,
                agent.circuitcode, teleportFlags);

            if (!AuthorizeUser (scene, agent, out reason))
            {
                OSDMap map = new OSDMap ();
                map["Reason"] = reason;
                map["success"] = false;
                reason = OSDParser.SerializeJsonString (map);
                return false;
            }

            CacheUserInfo(scene, agent.OtherInformation);

            if (sp != null && !sp.IsChildAgent)
            {
                // We have a zombie from a crashed session. 
                // Or the same user is trying to be root twice here, won't work.
                // Kill it.
                MainConsole.Instance.InfoFormat ("[Scene]: Zombie scene presence detected for {0} in {1}", agent.AgentID, scene.RegionInfo.RegionName);
                //Tell everyone about it
                scene.AuroraEventManager.FireGenericEventHandler ("AgentIsAZombie", sp.UUID);
                //Send the killing message (DisableSimulator)
                scene.RemoveAgent (sp, true);
                sp = null;
            }

            OSDMap responseMap = new OSDMap ();
            responseMap["CapsUrls"] = scene.EventManager.TriggerOnRegisterCaps (agent.AgentID);
            responseMap["OurIPForClient"] = MainServer.Instance.HostName;

            // In all cases, add or update the circuit data with the new agent circuit data and teleport flags
            agent.teleportFlags = teleportFlags;

            responseMap["Agent"] = agent.PackAgentCircuitData ();

            object[] obj = new object[2];
            obj[0] = responseMap;
            obj[1] = agent;
            scene.AuroraEventManager.FireGenericEventHandler ("NewUserConnection", obj);

            //Add the circuit at the end
            scene.AuthenticateHandler.AddNewCircuit (agent.circuitcode, agent);

            MainConsole.Instance.InfoFormat (
                "[ConnectionBegin]: Region {0} authenticated and authorized incoming {1} agent {2} (circuit code {3})",
                scene.RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.AgentID,
                agent.circuitcode);

            responseMap["success"] = true;
            reason = OSDParser.SerializeJsonString (responseMap);
            return true;
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:76,代码来源:EntityTransferModule.cs

示例5: NewUserConnection

        /// <summary>
        /// Do the work necessary to initiate a new user connection for a particular scene.
        /// At the moment, this consists of setting up the caps infrastructure
        /// The return bool should allow for connections to be refused, but as not all calling paths
        /// take proper notice of it let, we allowed banned users in still.
        /// </summary>
        /// <param name="agent">CircuitData of the agent who is connecting</param>
        /// <param name="reason">Outputs the reason for the false response on this string,
        /// If the agent was accepted, this will be the Caps SEED for the region</param>
        /// <param name="requirePresenceLookup">True for normal presence. False for NPC
        /// or other applications where a full grid/Hypergrid presence may not be required.</param>
        /// <returns>True if the region accepts this agent.  False if it does not.  False will 
        /// also return a reason.</returns>
        public bool NewUserConnection (IScene scene, AgentCircuitData agent, uint teleportFlags, out string reason)
        {
            reason = String.Empty;

            // Don't disable this log message - it's too helpful
            m_log.DebugFormat (
                "[ConnectionBegin]: Region {0} told of incoming {1} agent {2} (circuit code {3}, teleportflags {4})",
                scene.RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.AgentID,
                agent.circuitcode, teleportFlags);

            if (!AuthorizeUser (scene, agent, out reason))
            {
                OSDMap map = new OSDMap ();
                map["Reason"] = reason;
                map["Success"] = false;
                reason = OSDParser.SerializeJsonString (map);
                return false;
            }

            IScenePresence sp = scene.GetScenePresence (agent.AgentID);

            if (sp != null && !sp.IsChildAgent)
            {
                // We have a zombie from a crashed session. 
                // Or the same user is trying to be root twice here, won't work.
                // Kill it.
                m_log.InfoFormat ("[Scene]: Zombie scene presence detected for {0} in {1}", agent.AgentID, scene.RegionInfo.RegionName);
                scene.RemoveAgent (sp);
                sp = null;
            }

            //Add possible Urls for the given agent
            IConfigurationService configService = scene.RequestModuleInterface<IConfigurationService> ();
            if (configService != null && agent.OtherInformation.ContainsKey ("UserUrls"))
            {
                configService.AddNewUser (agent.AgentID.ToString (), (OSDMap)agent.OtherInformation["UserUrls"]);
            }

            OSDMap responseMap = new OSDMap ();
            responseMap["CapsUrls"] = scene.EventManager.TriggerOnRegisterCaps (agent.AgentID);

            // In all cases, add or update the circuit data with the new agent circuit data and teleport flags
            agent.teleportFlags = teleportFlags;

            //Add the circuit at the end
            scene.AuthenticateHandler.AddNewCircuit (agent.circuitcode, agent);

            responseMap["Agent"] = agent.PackAgentCircuitData ();

            scene.AuroraEventManager.FireGenericEventHandler ("NewUserConnection", responseMap);

            m_log.InfoFormat (
                "[ConnectionBegin]: Region {0} authenticated and authorized incoming {1} agent {2} (circuit code {3})",
                scene.RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.AgentID,
                agent.circuitcode);

            responseMap["Success"] = true;
            reason = OSDParser.SerializeJsonString (responseMap);
            return true;
        }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:73,代码来源:EntityTransferModule.cs


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