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


C# IScenePresence.RemoveAllInterfaces方法代码示例

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


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

示例1: RemoveAgent

        /// <summary>
        ///     Tell a single agent to disconnect from the region.
        ///     Does not send the DisableSimulator EQM or close child agents
        /// </summary>
        /// <param name="?"></param>
        /// <param name="presence"></param>
        /// <param name="forceClose"></param>
        /// <returns></returns>
        public bool RemoveAgent(IScenePresence presence, bool forceClose)
        {
            AddAsyncEvent(delegate
                              {
                                  presence.ControllingClient.Close(forceClose);
                                  foreach (IClientNetworkServer cns in m_clientServers)
                                      cns.RemoveClient(presence.ControllingClient);

                                  if (presence.ParentID != UUID.Zero)
                                      presence.StandUp();

                                  EventManager.TriggerOnClosingClient(presence.ControllingClient);
                                  EventManager.TriggerOnRemovePresence(presence);

                                  ForEachClient(
                                      delegate(IClientAPI client)
                                          {
                                              if (client.AgentId != presence.UUID)
                                              {
                                                  //We can safely ignore null reference exceptions.  It means the avatar is dead and cleaned up anyway
                                                  try
                                                  {
                                                      client.SendKillObject(presence.Scene.RegionInfo.RegionHandle,
                                                                            new IEntity[] {presence});
                                                  }
                                                  catch (NullReferenceException)
                                                  {
                                                  }
                                              }
                                          });

                                  // Remove the avatar from the scene
                                  m_sceneGraph.RemoveScenePresence(presence);
                                  m_clientManager.Remove(presence.UUID);

                                  try
                                  {
                                      presence.Close();
                                  }
                                  catch (Exception e)
                                  {
                                      MainConsole.Instance.Error(
                                          "[SCENE] Scene.cs:RemoveClient:Presence.Close exception: " + e);
                                  }

                                  //Remove any interfaces it might have stored
                                  presence.RemoveAllInterfaces();

                                  AuthenticateHandler.RemoveCircuit(presence.UUID);
                                  //MainConsole.Instance.InfoFormat("[SCENE] Memory pre  GC {0}", System.GC.GetTotalMemory(false));
                                  //MainConsole.Instance.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
                              });
            return true;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:62,代码来源:AsyncScene.cs

示例2: RemoveAgent

        /// <summary>
        /// Tell a single agent to disconnect from the region.
        /// Does not send the DisableSimulator EQM or close child agents
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public bool RemoveAgent (IScenePresence presence)
        {
            presence.ControllingClient.Close ();
            if (presence.ParentID != UUID.Zero)
            {
                presence.StandUp ();
            }

            EventManager.TriggerClientClosed (presence.UUID, this);
            EventManager.TriggerOnClosingClient (presence.ControllingClient);
            EventManager.TriggerOnRemovePresence (presence);

            ForEachClient (
                delegate (IClientAPI client)
                {
                    //We can safely ignore null reference exceptions.  It means the avatar is dead and cleaned up anyway
                    try { client.SendKillObject (presence.Scene.RegionInfo.RegionHandle, new IEntity[] { presence }); }
                    catch (NullReferenceException) { }
                });

            try
            {
                presence.Close ();
            }
            catch (Exception e)
            {
                m_log.Error ("[SCENE] Scene.cs:RemoveClient:Presence.Close exception: " + e.ToString ());
            }

            //Remove any interfaces it might have stored
            presence.RemoveAllInterfaces ();

            // Remove the avatar from the scene
            m_sceneGraph.RemoveScenePresence (presence);
            m_clientManager.Remove (presence.UUID);

            AuthenticateHandler.RemoveCircuit (presence.ControllingClient.CircuitCode);
            //m_log.InfoFormat("[SCENE] Memory pre  GC {0}", System.GC.GetTotalMemory(false));
            //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
            return true;
        }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:47,代码来源:Scene.cs


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