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


C# ISceneEntity.RemoveScriptInstances方法代码示例

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


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

示例1: DeleteSceneObject

            /// <summary>
            ///     Synchronously delete the given object from the scene.
            /// </summary>
            /// <param name="group">Object Id</param>
            /// <param name="DeleteScripts">Remove the scripts from the ScriptEngine as well</param>
            /// <param name="removeFromDatabase">Remove from the database?</param>
            protected bool DeleteSceneObject(ISceneEntity group, bool DeleteScripts, bool removeFromDatabase)
            {
                //MainConsole.Instance.DebugFormat("[Backup]: Deleting scene object {0} {1}", group.Name, group.UUID);

                if (group.SitTargetAvatar.Count != 0)
                {
                    foreach (UUID avID in group.SitTargetAvatar)
                    {
                        //Don't screw up avatar's that are sitting on us!
                        IScenePresence SP = m_scene.GetScenePresence(avID);
                        if (SP != null)
                            SP.StandUp();
                    }
                }

                // Serialise calls to RemoveScriptInstances to avoid
                // deadlocking on m_parts inside SceneObjectGroup
                if (DeleteScripts)
                {
                    group.RemoveScriptInstances(true);
                }

                foreach (ISceneChildEntity part in group.ChildrenEntities())
                {
                    IScriptControllerModule m = m_scene.RequestModuleInterface<IScriptControllerModule>();
                    if (m != null)
                        m.RemoveAllScriptControllers(part);
                }
                if (group.RootChild.PhysActor != null)
                {
                    //Remove us from the physics sim
                    m_scene.PhysicsScene.DeletePrim(group.RootChild.PhysActor);
                    group.RootChild.PhysActor = null;
                }

                if (!group.IsAttachment)
                    m_scene.SimulationDataService.Tainted();
                if (m_scene.SceneGraph.DeleteEntity(group))
                {
                    // We need to keep track of this state in case this group is still queued for backup.
                    group.IsDeleted = true;
                    m_scene.EventManager.TriggerObjectBeingRemovedFromScene(group);
                    return true;
                }

                //MainConsole.Instance.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
                return false;
            }
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:54,代码来源:Backup.cs

示例2: DeleteSceneObject

            /// <summary>
            /// Synchronously delete the given object from the scene.
            /// </summary>
            /// <param name="group">Object Id</param>
            /// <param name="DeleteScripts">Remove the scripts from the ScriptEngine as well</param>
            /// <param name="removeFromDatabase">Remove from the database?</param>
            protected bool DeleteSceneObject(ISceneEntity group, bool DeleteScripts, bool removeFromDatabase)
            {
                //m_log.DebugFormat("[Backup]: Deleting scene object {0} {1}", group.Name, group.UUID);

                lock (group.SitTargetAvatar)
                {
                    if (group.SitTargetAvatar.Count != 0)
                    {
                        UUID[] ids = new UUID[group.SitTargetAvatar.Count];
                        group.SitTargetAvatar.CopyTo(ids);
                        foreach (UUID avID in ids)
                        {
                            //Don't screw up avatar's that are sitting on us!
                            IScenePresence SP = m_scene.GetScenePresence(avID);
                            if (SP != null)
                                SP.StandUp();
                        }
                    }
                }

                // Serialise calls to RemoveScriptInstances to avoid
                // deadlocking on m_parts inside SceneObjectGroup
                if (DeleteScripts)
                {
                    group.RemoveScriptInstances(true);
                }

                foreach (ISceneChildEntity part in group.ChildrenEntities())
                {
                    IScriptControllerModule m = m_scene.RequestModuleInterface<IScriptControllerModule>();
                    if(m != null)
                        m.RemoveAllScriptControllers(part);
                    if (part.PhysActor != null)
                    {
                        //Remove us from the physics sim
                        m_scene.PhysicsScene.RemovePrim(part.PhysActor);
                        //We MUST leave this to the PhysicsScene or it will hate us forever!
                        //part.PhysActor = null;
                    }
                }

                m_scene.SimulationDataService.Tainted ();
                if (m_scene.SceneGraph.DeleteEntity(group))
                {
                    // We need to keep track of this state in case this group is still queued for backup.
                    group.IsDeleted = true;
                    //Clear the update schedule HERE so that IsDeleted will not have to fire as well

                    foreach (ISceneChildEntity part in group.ChildrenEntities ())
                    {
                        //Make sure it isn't going to be updated again
                        part.ClearUpdateSchedule ();
                    }
                    m_scene.EventManager.TriggerObjectBeingRemovedFromScene(group);
                    return true;
                }

                //m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
                return false;
            }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:66,代码来源:Backup.cs


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