コード例 #1
0
ファイル: Scene.cs プロジェクト: sonjamichelle/WhiteCore-Dev
        /// <summary>
        ///     This is the method that shuts down the scene.
        /// </summary>
        public void Close(bool killAgents)
        {
            if (shuttingdown)
            {
                MainConsole.Instance.WarnFormat("[Scene]: Ignoring close request because already closing {0}",
                                                RegionInfo.RegionName);
                return;
            }

            // Stop updating the scene objects and agents.
            shuttingdown = true;

            MainConsole.Instance.InfoFormat("[Scene]: Closing down region: {0}", RegionInfo.RegionName);

            SimulationDataService.Shutdown();

            if (killAgents)
            {
                // Kick all ROOT agents with the message, 'The simulator is going down'
                ForEachScenePresence(delegate(IScenePresence avatar)
                {
                    if (!avatar.IsChildAgent)
                    {
                        avatar.ControllingClient.Kick("The simulator is going down.");
                    }
                });

                // Let things process and get sent for a bit
                Thread.Sleep(1000);

                IEntityTransferModule transferModule = RequestModuleInterface <IEntityTransferModule>();
                if (transferModule != null)
                {
                    foreach (IScenePresence avatar in new List <IScenePresence>(GetScenePresences()))
                    {
                        transferModule.IncomingCloseAgent(this, avatar.UUID);
                    }
                }
            }
            m_ShouldRunHeartbeat = false; //Stop the heartbeat

            if (m_sceneGraph.PhysicsScene != null)
            {
                m_sceneGraph.PhysicsScene.Dispose();
            }

            m_sceneGraph.Close();
            foreach (IClientNetworkServer clientServer in m_clientServers)
            {
                clientServer.Stop();
                Thread.Sleep(500);
            }
        }
コード例 #2
0
        /// <summary>
        /// This is the method that shuts down the scene.
        /// </summary>
        public void Close()
        {
            m_log.InfoFormat("[Scene]: Closing down the single simulator: {0}", RegionInfo.RegionName);

            // Kick all ROOT agents with the message, 'The simulator is going down'
            ForEachScenePresence(delegate(IScenePresence avatar)
            {
                if (!avatar.IsChildAgent)
                {
                    avatar.ControllingClient.Kick("The simulator is going down.");
                }
            });

            IEntityTransferModule transferModule = RequestModuleInterface <IEntityTransferModule> ();

            if (transferModule != null)
            {
                foreach (IScenePresence avatar in GetScenePresences())
                {
                    transferModule.IncomingCloseAgent(this, avatar.UUID);
                }
            }
            ShouldRunHeartbeat = false; //Stop the heartbeat
            //Now close the tracker
            monitor.Stop();

            if (m_sceneGraph.PhysicsScene != null)
            {
                m_sceneGraph.PhysicsScene.Dispose();
            }

            //Tell the neighbors that this region is now down
            INeighborService service = RequestModuleInterface <INeighborService>();

            if (service != null)
            {
                service.InformNeighborsThatRegionIsDown(RegionInfo);
            }

            // Stop updating the scene objects and agents.
            shuttingdown = true;

            m_sceneGraph.Close();
        }