當前位置: 首頁>>代碼示例>>C#>>正文


C# SceneObjectGroup.ForEachPart方法代碼示例

本文整理匯總了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.ForEachPart方法的典型用法代碼示例。如果您正苦於以下問題:C# SceneObjectGroup.ForEachPart方法的具體用法?C# SceneObjectGroup.ForEachPart怎麽用?C# SceneObjectGroup.ForEachPart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenSim.Region.Framework.Scenes.SceneObjectGroup的用法示例。


在下文中一共展示了SceneObjectGroup.ForEachPart方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: UpdateDetachedObject

        private void UpdateDetachedObject(IScenePresence sp, SceneObjectGroup so, string scriptedState)
        {
            // Don't save attachments for HG visitors, it
            // messes up their inventory. When a HG visitor logs
            // out on a foreign grid, their attachments will be
            // reloaded in the state they were in when they left
            // the home grid. This is best anyway as the visited
            // grid may use an incompatible script engine.
            bool saveChanged
                    = sp.PresenceType != PresenceType.Npc
                    && (m_scene.UserManagementModule == null
                    || m_scene.UserManagementModule.IsLocalGridUser(sp.UUID));

            // Remove the object from the scene so no more updates
            // are sent. Doing this before the below changes will ensure
            // updates can't cause "HUD artefacts"
            m_scene.DeleteSceneObject(so, false, false);

            // Prepare sog for storage
            so.AttachedAvatar = UUID.Zero;
            so.RootPart.SetParentLocalId(0);
            so.IsAttachment = false;

            if (saveChanged)
            {
                // We cannot use AbsolutePosition here because that would
                // attempt to cross the prim as it is detached
                so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; });

                UpdateKnownItem(sp, so, scriptedState);
            }

            // Now, remove the scripts
            so.RemoveScriptInstances(true);
        }
開發者ID:BogusCurry,項目名稱:arribasim-dev,代碼行數:35,代碼來源:AttachmentsModule.cs

示例2: EventManagerOnObjectBeingRemovedFromScene

 // -----------------------------------------------------------------
 /// <summary>
 /// 
 /// </summary>
 // -----------------------------------------------------------------
 public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
 {
     obj.ForEachPart(delegate(SceneObjectPart sop) { DestroyStore(sop.UUID); } );
 }
開發者ID:BogusCurry,項目名稱:arribasim-dev,代碼行數:9,代碼來源:JsonStoreModule.cs

示例3: SOGToXml2

        ////////// Write /////////

        public static void SOGToXml2(XmlTextWriter writer, SceneObjectGroup sog, Dictionary<string, object>options)
        {
            writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
            SOPToXml2(writer, sog.RootPart, options);
            writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);

            sog.ForEachPart(delegate(SceneObjectPart sop)
            {
                if (sop.UUID != sog.RootPart.UUID)
                    SOPToXml2(writer, sop, options);
            });

            writer.WriteEndElement();
            writer.WriteEndElement();
        }
開發者ID:JAllard,項目名稱:opensim,代碼行數:17,代碼來源:SceneObjectSerializer.cs

示例4: SOGToXml2

        ////////// Write /////////

        public static void SOGToXml2(XmlTextWriter writer, SceneObjectGroup sog, Dictionary<string, object>options)
        {
            writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
            SOPToXml2(writer, sog.RootPart, options);
            writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);

            sog.ForEachPart(delegate(SceneObjectPart sop)
            {
                if (sop.UUID != sog.RootPart.UUID)
                    SOPToXml2(writer, sop, options);
            });

            writer.WriteEndElement();

            if (sog.RootPart.KeyframeMotion != null)
            {
                Byte[] data = sog.RootPart.KeyframeMotion.Serialize();

                writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
                writer.WriteBase64(data, 0, data.Length);
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
開發者ID:SignpostMarv,項目名稱:opensim,代碼行數:27,代碼來源:SceneObjectSerializer.cs

示例5: ChangeScriptEnabledLandStatus

 public void ChangeScriptEnabledLandStatus(SceneObjectGroup group, bool enabled)
 {
     group.ForEachPart(delegate(SceneObjectPart part)
     {
         foreach (TaskInventoryItem item in part.Inventory.GetScripts())
         {
             if (enabled)
             {
                 _exeScheduler.ChangeEnabledStatus(item.ItemID, EnableDisableFlag.ParcelEnable);
             }
             else
             {   
                 _exeScheduler.ChangeEnabledStatus(item.ItemID, EnableDisableFlag.ParcelDisable);
             }
         }
     });
 }
開發者ID:digitalmystic,項目名稱:halcyon,代碼行數:17,代碼來源:EngineInterface.cs

示例6: EventManager_OnGroupCrossedToNewParcel

        void EventManager_OnGroupCrossedToNewParcel(SceneObjectGroup group, ILandObject oldParcel, ILandObject newParcel)
        {
            if (group.IsAttachment)
            {
                //attachment scripts always run and are unaffected by crossings
                return;
            }

            bool scriptsCouldRun = false;
            bool scriptsCanRun = false;

            bool oldParcelAllowedOtherScripts = oldParcel != null && (oldParcel.landData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0;
            bool oldParcelAllowedGroupScripts = oldParcel != null && (oldParcel.landData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0;
            bool oldParcelMatchesObjectGroup = oldParcel != null && oldParcel.landData.GroupID == group.GroupID;
            bool ownerOwnedOldParcel = oldParcel != null && oldParcel.landData.OwnerID == group.OwnerID;

            bool newParcelAllowsOtherScripts = newParcel != null && (newParcel.landData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0;
            bool newParcelAllowsGroupScripts = newParcel != null && (newParcel.landData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0;
            bool newParcelMatchesObjectGroup = newParcel != null && newParcel.landData.GroupID == group.GroupID;
            bool ownerOwnsNewParcel = newParcel != null && newParcel.landData.OwnerID == group.OwnerID;

            if (oldParcel == null ||
                ownerOwnedOldParcel ||
                oldParcelAllowedOtherScripts ||
                (oldParcelAllowedGroupScripts && oldParcelMatchesObjectGroup))
            {
                scriptsCouldRun = true;
            }

            if (ownerOwnsNewParcel ||
                newParcelAllowsOtherScripts ||
                (newParcelAllowsGroupScripts && newParcelMatchesObjectGroup))
            {
                scriptsCanRun = true;
            }

            List<TaskInventoryItem> scripts = new List<TaskInventoryItem>();
            if (scriptsCanRun != scriptsCouldRun)
            {
                EnableDisableFlag flag = 
                    scriptsCanRun ? EnableDisableFlag.ParcelEnable : EnableDisableFlag.ParcelDisable;

                if (flag == EnableDisableFlag.ParcelDisable)
                {
                    //do not parcel disable any scripted group that is holding avatar controls
                    if (group.HasAvatarControls)
                    {
                        return;
                    }
                }

                group.ForEachPart(delegate(SceneObjectPart part)
                {
                    foreach (TaskInventoryItem script in part.Inventory.GetScripts())
                    {
                        _exeScheduler.ChangeEnabledStatus(script.ItemID, flag);
                    }
                });
            }
        }
開發者ID:digitalmystic,項目名稱:halcyon,代碼行數:60,代碼來源:EngineInterface.cs

示例7: EventManager_OnSOGOwnerGroupChanged

        void EventManager_OnSOGOwnerGroupChanged(SceneObjectGroup sog, UUID oldGroup, UUID newGroup)
        {
            ILandObject parcel = _scene.LandChannel.GetLandObject(sog.RootPart.GroupPosition.X, sog.RootPart.GroupPosition.Y);
            bool scriptsCanRun = ScriptsCanRun(parcel, sog.RootPart);

            EnableDisableFlag flag =
                    scriptsCanRun ? EnableDisableFlag.ParcelEnable : EnableDisableFlag.ParcelDisable;

            sog.ForEachPart(delegate(SceneObjectPart part)
            {
                foreach (TaskInventoryItem script in part.Inventory.GetScripts())
                {
                    _exeScheduler.ChangeEnabledStatus(script.ItemID, flag);
                }
            });
        }
開發者ID:digitalmystic,項目名稱:halcyon,代碼行數:16,代碼來源:EngineInterface.cs

示例8: EventManager_OnGroupBeginInTransit

 void EventManager_OnGroupBeginInTransit(SceneObjectGroup sog)
 {
     sog.ForEachPart(delegate(SceneObjectPart part)
     {
         foreach (TaskInventoryItem script in part.Inventory.GetScripts())
         {
             _exeScheduler.ChangeEnabledStatus(script.ItemID, EnableDisableFlag.CrossingWaitDisable);
         }
     });
 }
開發者ID:digitalmystic,項目名稱:halcyon,代碼行數:10,代碼來源:EngineInterface.cs


注:本文中的OpenSim.Region.Framework.Scenes.SceneObjectGroup.ForEachPart方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。