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


C# ScenePresence.AddAttachment方法代碼示例

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


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

示例1: AttachToAgent

        /// <summary>
        /// Attach this scene object to the given avatar.
        /// </summary>
        /// <param name="agentID"></param>
        /// <param name="attachmentpoint"></param>
        /// <param name="AttachOffset"></param>
        private void AttachToAgent(
            ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
        {
            if (avatar != null)
            {
                // don't attach attachments to child agents
                if (avatar.IsChildAgent) return;

                // Remove from database and parcel prim count
                m_scene.DeleteFromStorage(so.UUID);
                m_scene.EventManager.TriggerParcelPrimCountTainted();

                so.AttachedAvatar = avatar.UUID;

                if (so.RootPart.PhysActor != null)
                {
                    m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
                    so.RootPart.PhysActor = null;
                }

                so.AbsolutePosition = attachOffset;
                so.RootPart.AttachedPos = attachOffset;
                so.IsAttachment = true;
                so.RootPart.SetParentLocalId(avatar.LocalId);
                so.AttachmentPoint = attachmentpoint;

                avatar.AddAttachment(this);

                if (!silent)
                {
                    // Killing it here will cause the client to deselect it
                    // It then reappears on the avatar, deselected
                    // through the full update below
                    //
                    if (IsSelected)
                    {
                        m_scene.SendKillObject(new List<uint> { m_rootPart.LocalId });
                    }

                    IsSelected = false; // fudge....
                    ScheduleGroupForFullUpdate();
                }
            }
            else
            {
                m_log.WarnFormat(
                    "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present", 
                    UUID, avatar.ControllingClient.AgentId, Scene.RegionInfo.RegionName);
            }
        }
開發者ID:emperorstarfinder,項目名稱:Opensim2,代碼行數:56,代碼來源:SceneObjectGroup.cs

示例2: AttachToAgent

        /// <summary>
        /// Attach this scene object to the given avatar.
        /// </summary>
        /// 
        /// This isn't publicly available since attachments should always perform the corresponding inventory 
        /// operation (to show the attach in user inventory and update the asset with positional information).
        /// 
        /// <param name="sp"></param>
        /// <param name="so"></param>
        /// <param name="attachmentpoint"></param>
        /// <param name="AttachOffset"></param>
        /// <param name="silent"></param>
        protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, int attachmentpoint, Vector3 AttachOffset, bool silent)
        {
            // don't attach attachments to child agents
            if (avatar.IsChildAgent) return;

            //                m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);

            so.DetachFromBackup();

            // Remove from database and parcel prim count
            m_scene.DeleteFromStorage(so.UUID);
            m_scene.EventManager.TriggerParcelPrimCountTainted();

            so.RootPart.AttachedAvatar = avatar.UUID;

            //Anakin Lohner bug #3839 
            SceneObjectPart[] parts = so.Parts;
            for (int i = 0; i < parts.Length; i++)
                parts[i].AttachedAvatar = avatar.UUID;

            if (so.RootPart.PhysActor != null)
            {
                m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
                so.RootPart.PhysActor = null;
            }

            so.AbsolutePosition = AttachOffset;
            so.RootPart.AttachedPos = AttachOffset;
            so.RootPart.IsAttachment = true;

            so.RootPart.SetParentLocalId(avatar.LocalId);
            so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));

            avatar.AddAttachment(so);

            if (!silent)
            {
                // Killing it here will cause the client to deselect it
                // It then reappears on the avatar, deselected
                // through the full update below
                //
                if (so.IsSelected)
                {
                    m_scene.SendKillObject(so.RootPart.LocalId);
                }

                so.IsSelected = false; // fudge....
                so.ScheduleGroupForFullUpdate(PrimUpdateFlags.FullUpdate);
            }

            // In case it is later dropped again, don't let
            // it get cleaned up
            so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
            so.HasGroupChanged = false;
        }
開發者ID:shangcheng,項目名稱:Aurora,代碼行數:67,代碼來源:AttachmentsModule.cs

示例3: AttachToAgent

        /// <summary>
        /// Attach this scene object to the given avatar.
        /// </summary>
        /// 
        /// This isn't publicly available since attachments should always perform the corresponding inventory 
        /// operation (to show the attach in user inventory and update the asset with positional information).
        /// 
        /// <param name="sp"></param>
        /// <param name="so"></param>
        /// <param name="attachmentpoint"></param>
        /// <param name="AttachOffset"></param>
        /// <param name="silent"></param>
        protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, int attachmentpoint, Vector3 AttachOffset)
        {
            // don't attach attachments to child agents
            if (avatar.IsChildAgent) return;

            //                m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);

            // Remove from database and parcel prim count
            IBackupModule backup = so.Scene.RequestModuleInterface<IBackupModule>();
            if (backup != null)
                backup.DeleteFromStorage(so.UUID);

            so.RootPart.AttachedAvatar = avatar.UUID;

            //Anakin Lohner bug #3839 
            SceneObjectPart[] parts = so.Parts;
            for (int i = 0; i < parts.Length; i++)
                parts[i].AttachedAvatar = avatar.UUID;

            if (so.RootPart.PhysActor != null)
            {
                m_scene.SceneGraph.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
                so.RootPart.PhysActor = null;
            }

            so.AbsolutePosition = AttachOffset;
            so.RootPart.AttachedPos = AttachOffset;
            so.RootPart.IsAttachment = true;

            so.RootPart.SetParentLocalId(avatar.LocalId);
            so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));

            avatar.AddAttachment(so);

            // Killing it here will cause the client to deselect it
            // It then reappears on the avatar, deselected
            // through the full update below
            //
            if (so.IsSelected)
            {
                m_scene.ForEachClient(delegate(IClientAPI client)
                {
                    client.SendKillObject(m_scene.RegionInfo.RegionHandle, new ISceneEntity[] { so.RootPart }); 
                });
                foreach (SceneObjectPart part in so.ChildrenList)
                {
                    part.CreateSelected = true;
                }
            }

            //NOTE: This MUST be here, otherwise we limit full updates during attachments when they are selected and it will block the first update.
            // So until that is changed, this MUST stay. The client will instantly reselect it, so this value doesn't stay borked for long.
            so.IsSelected = false;

            so.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);

            // In case it is later dropped again, don't let
            // it get cleaned up
            so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
            so.HasGroupChanged = false;
        }
開發者ID:KristenMynx,項目名稱:Aurora-Sim,代碼行數:73,代碼來源:AttachmentsModule.cs


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