• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IScenePresence类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CanCreateAt

        public bool CanCreateAt(IScenePresence presence, Vector3 location)
        {
            if (m_parcels == null)
                return true;

            SceneParcel parcel;
            if (m_parcels.TryGetParcel(location, out parcel))
            {
                // If we can't enter the parcel we can't create anything there either
                if (!CanEnterParcel(presence, parcel))
                    return false;

                // CreateObjects flag set? We're good
                if ((parcel.Flags & ParcelFlags.CreateObjects) == ParcelFlags.CreateObjects)
                    return true;

                // CreateGroupObjects flag set and we're a member of the parcel group? We're good
                if ((parcel.Flags & ParcelFlags.CreateGroupObjects) == ParcelFlags.CreateGroupObjects && IsInGroup(presence, parcel.GroupID))
                    return true;

                return false;
            }
            else
            {
                m_log.Warn("No parcel found at " + location);
                return true;
            }
        }
开发者ID:osgrid,项目名称:openmetaverse,代码行数:28,代码来源:LLPermissions.cs


示例2: OnMakeRootAgent

 void OnMakeRootAgent (IScenePresence presence)
 {
     if ((presence.CallbackURI != null) && !presence.CallbackURI.Equals(""))
     {
         WebUtils.ServiceOSDRequest(presence.CallbackURI, null, "DELETE", 10000, false, false);
         presence.CallbackURI = null;
         ICapsService service = m_scene.RequestModuleInterface<ICapsService>();
         if (service != null)
         {
             IClientCapsService clientCaps = service.GetClientCapsService (presence.UUID);
             if (clientCaps != null)
             {
                 IRegionClientCapsService regionCaps = clientCaps.GetCapsService (m_scene.RegionInfo.RegionHandle);
                 if (regionCaps != null)
                 {
                     regionCaps.RootAgent = true;
                     foreach (IRegionClientCapsService regionClientCaps in clientCaps.GetCapsServices ())
                     {
                         if (regionCaps.RegionHandle != regionClientCaps.RegionHandle)
                             regionClientCaps.RootAgent = false; //Reset any other agents that we might have
                     }
                 }
             }
         }
     }
 }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:26,代码来源:RobustCaps.cs


示例3: EventManager_OnNewPresence

 private void EventManager_OnNewPresence(IScenePresence presence)
 {
     if (_OnNewUser != null)
     {
         NewUserEventArgs e = new NewUserEventArgs { Avatar = new SPAvatar(m_internalScene, presence.UUID, m_security) };
         _OnNewUser(this, e);
     }
 }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:8,代码来源:World.cs


示例4: OnMakeRootAgent

 void OnMakeRootAgent (IScenePresence presence)
 {
     if ((presence.CallbackURI != null) && !presence.CallbackURI.Equals(""))
     {
         WebUtils.ServiceOSDRequest(presence.CallbackURI, null, "DELETE", 10000);
         presence.CallbackURI = null;
     }
 }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:8,代码来源:RobustCaps.cs


示例5: EventManager_OnRemovePresence

 void EventManager_OnRemovePresence (IScenePresence presence)
 {
     ScriptControllerPresenceModule m = (ScriptControllerPresenceModule)presence.RequestModuleInterface<IScriptControllerModule> ();
     if (m != null)
     {
         m.Close ();
         presence.UnregisterModuleInterface<IScriptControllerModule> (m);
     }
 }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:9,代码来源:ScriptControllerModule.cs


示例6: Animator

 public Animator (IScenePresence sp)
 {
     m_scenePresence = sp;
     IConfig animationConfig = sp.Scene.Config.Configs ["Animations"];
     if (animationConfig != null) {
         SLOWFLY_DELAY = animationConfig.GetInt ("SlowFlyDelay", SLOWFLY_DELAY);
         m_useSplatAnimation = animationConfig.GetBoolean ("enableSplatAnimation", m_useSplatAnimation);
     }
     //This step makes sure that we don't waste almost 2.5! seconds on incoming agents
     m_animations = new AnimationSet (DefaultAnimations);
 }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:11,代码来源:Animator.cs


示例7: OnMakeRootAgent

        void OnMakeRootAgent(IScenePresence presence)
        {
            try
            {
                //Add the user
                FileStream stream = new FileStream(m_fileName, FileMode.OpenOrCreate);
                StreamWriter m_streamWriter = new StreamWriter(stream);
                m_streamWriter.BaseStream.Position += m_streamWriter.BaseStream.Length;
                
                string LineToWrite = DateTime.Now.ToLongTimeString() + " - " + presence.Name + " entered " + presence.Scene.RegionInfo.RegionName + ".";
                m_timesOfUsers[presence.UUID] = DateTime.Now;

                m_streamWriter.WriteLine(LineToWrite);
                m_streamWriter.WriteLine();
                m_streamWriter.Close();
            }
            catch { }
        }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:18,代码来源:VisitorLogger.cs


示例8: ShowEntityToClient

        public bool ShowEntityToClient(IScenePresence client, IEntity entity, IScene scene, int currentTickCount)
        {
            if (!m_useCulling)
                return true; //If we arn't using culling, return true by default to show all prims
            if (entity == null || client == null || scene == null)
                return false;

            bool cull = false;
            lock (m_previousCulled)
            {
                if (m_previousCulled.TryGetValue(entity.LocalId, out cull))
                {
                    Int32 diff = currentTickCount - m_lastCached;
                    Int32 timingDiff = (diff >= 0) ? diff : (diff + Util.EnvironmentTickCountMask + 1);
                    if (timingDiff > 5*1000) //Only recheck every 5 seconds
                    {
                        m_lastCached = Util.EnvironmentTickCount();
                        m_previousCulled.Clear();
                    }
                    else
                        return cull;
                }
            }

            if (m_useDistanceCulling && !DistanceCulling(client, entity, scene))
            {
                lock (m_previousCulled)
                    m_previousCulled[entity.LocalId] = false;
                return false;
            }

            if (!ParcelPrivateCulling(client, entity))
            {
                lock (m_previousCulled)
                    m_previousCulled[entity.LocalId] = false;
                return false;
            }

            //No more, guess its fine
            lock (m_previousCulled)
                m_previousCulled[entity.LocalId] = true;
            return true;
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:43,代码来源:Prioritizer.cs


示例9: OnNewPresence

 void OnNewPresence(IScenePresence presence)
 {
     SendTerrainUpdatesForClient(presence);
 }
开发者ID:VirtualReality,项目名称:Universe,代码行数:4,代码来源:TerrainModule.cs


示例10: SendTerrainUpdatesForClient

        protected void SendTerrainUpdatesForClient(IScenePresence presence)
        {
            if (!m_sendTerrainUpdatesByViewDistance || m_noTerrain || presence.DrawDistance == 0)
                return;

            if (presence == null)
                return;

            bool[,] terrainarray;
            lock (m_terrainPatchesSent)
            {
                m_terrainPatchesSent.TryGetValue(presence.UUID, out terrainarray);
            }
            bool fillLater = false;
            if (terrainarray == null)
            {
                int xSize = m_scene.RegionInfo.RegionSizeX != int.MaxValue
                                ? m_scene.RegionInfo.RegionSizeX/Constants.TerrainPatchSize
                                : Constants.RegionSize/Constants.TerrainPatchSize;
                int ySize = m_scene.RegionInfo.RegionSizeX != int.MaxValue
                                ? m_scene.RegionInfo.RegionSizeY/Constants.TerrainPatchSize
                                : Constants.RegionSize/Constants.TerrainPatchSize;
                terrainarray = new bool[xSize,ySize];
                fillLater = true;
            }

            List<int> xs = new List<int>();
            List<int> ys = new List<int>();
            int startX = (((int) (presence.AbsolutePosition.X - presence.DrawDistance))/Constants.TerrainPatchSize) - 2;
            startX = Math.Max(startX, 0);
            startX = Math.Min(startX, m_scene.RegionInfo.RegionSizeX/Constants.TerrainPatchSize);
            int startY = (((int) (presence.AbsolutePosition.Y - presence.DrawDistance))/Constants.TerrainPatchSize) - 2;
            startY = Math.Max(startY, 0);
            startY = Math.Min(startY, m_scene.RegionInfo.RegionSizeY/Constants.TerrainPatchSize);
            int endX = (((int) (presence.AbsolutePosition.X + presence.DrawDistance))/Constants.TerrainPatchSize) + 2;
            endX = Math.Max(endX, 0);
            endX = Math.Min(endX, m_scene.RegionInfo.RegionSizeX/Constants.TerrainPatchSize);
            int endY = (((int) (presence.AbsolutePosition.Y + presence.DrawDistance))/Constants.TerrainPatchSize) + 2;
            endY = Math.Max(endY, 0);
            endY = Math.Min(endY, m_scene.RegionInfo.RegionSizeY/Constants.TerrainPatchSize);
            for (int x = startX; x < endX; x++)
            {
                for (int y = startY; y < endY; y++)
                {
                    if (x < 0 || y < 0 || x >= m_scene.RegionInfo.RegionSizeX/Constants.TerrainPatchSize ||
                        y >= m_scene.RegionInfo.RegionSizeY/Constants.TerrainPatchSize)
                        continue;
                    //Need to make sure we don't send the same ones over and over
                    if (!terrainarray[x, y])
                    {
                        Vector3 posToCheckFrom = new Vector3(presence.AbsolutePosition.X % m_scene.RegionInfo.RegionSizeX,
                                                             presence.AbsolutePosition.Y % m_scene.RegionInfo.RegionSizeY,
                                                             presence.AbsolutePosition.Z);
                        //Check which has less distance, camera or avatar position, both have to be done
                        if (Util.DistanceLessThan(posToCheckFrom,
                                                  new Vector3(
                                                      x*Constants.TerrainPatchSize,
                                                      y*Constants.TerrainPatchSize,
                                                      0), presence.DrawDistance + 50) ||
                            Util.DistanceLessThan(presence.CameraPosition,
                                                  new Vector3(x*Constants.TerrainPatchSize, y*Constants.TerrainPatchSize,
                                                              0), presence.DrawDistance + 50))
                            //Its not a radius, its a diameter and we add 35 so that it doesn't look like it cuts off
                        {
                            //They can see it, send it to them
                            terrainarray[x, y] = true;
                            xs.Add(x);
                            ys.Add(y);
                            //Wait and send them all at once
                            //presence.ControllingClient.SendLayerData(x, y, serializedMap);
                        }
                    }
                }
            }
            if (xs.Count != 0)
            {
                //Send all the terrain patches at once
                presence.ControllingClient.SendLayerData(xs.ToArray(), ys.ToArray(), m_channel.GetSerialized(),
                                                         TerrainPatch.LayerType.Land);
                if (m_use3DWater)
                {
                    //Send all the water patches at once
                    presence.ControllingClient.SendLayerData(xs.ToArray(), ys.ToArray(),
                                                             m_waterChannel.GetSerialized(),
                                                             TerrainPatch.LayerType.Water);
                }
            }
            if ((xs.Count != 0) || (fillLater))
            {
                if (m_terrainPatchesSent.ContainsKey(presence.UUID))
                {
                    lock (m_terrainPatchesSent)
                        m_terrainPatchesSent[presence.UUID] = terrainarray;
                }
                else
                {
                    lock (m_terrainPatchesSent)
                        m_terrainPatchesSent.Add(presence.UUID, terrainarray);
                }
            }
//.........这里部分代码省略.........
开发者ID:VirtualReality,项目名称:Universe,代码行数:101,代码来源:TerrainModule.cs


示例11: TriggerOnMakeRootAgent

 public void TriggerOnMakeRootAgent (IScenePresence presence)
 {
     OnMakeRootAgentDelegate handlerMakeRootAgent = OnMakeRootAgent;
     if (handlerMakeRootAgent != null)
     {
         foreach (OnMakeRootAgentDelegate d in handlerMakeRootAgent.GetInvocationList ())
         {
             try
             {
                 d (presence);
             }
             catch (Exception e)
             {
                 m_log.ErrorFormat (
                     "[EVENT MANAGER]: Delegate for TriggerOnMakeRootAgent failed - continuing.  {0} {1}",
                     e.ToString (), e.StackTrace);
             }
         }
     }
 }
开发者ID:salahzar,项目名称:Aurora-Sim,代码行数:20,代码来源:ISceneEntity.cs


示例12: TriggerOnRemovePresence

 public void TriggerOnRemovePresence (IScenePresence presence)
 {
     OnNewPresenceDelegate handlerRemovePresence = OnRemovePresence;
     if (handlerRemovePresence != null)
     {
         foreach (OnNewPresenceDelegate d in handlerRemovePresence.GetInvocationList ())
         {
             try
             {
                 d (presence);
             }
             catch (Exception e)
             {
                 m_log.ErrorFormat (
                     "[EVENT MANAGER]: Delegate for TriggerOnRemovePresence failed - continuing.  {0} {1}",
                     e.ToString (), e.StackTrace);
             }
         }
     }
 }
开发者ID:salahzar,项目名称:Aurora-Sim,代码行数:20,代码来源:ISceneEntity.cs


示例13: BuildLandmark

 private byte[] BuildLandmark (IScenePresence presence)
 {
     //See whether we have a gatekeeperURL
     IConfigurationService configService = m_scene.RequestModuleInterface<IConfigurationService> ();
     //We have one!
     Vector3 pos = presence.AbsolutePosition;
     string strdata = String.Format (
         "Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}",
         presence.Scene.RegionInfo.RegionID,
         pos.X, pos.Y, pos.Z,
         presence.Scene.RegionInfo.RegionHandle);
     return Encoding.ASCII.GetBytes (strdata);
 }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:13,代码来源:LLClientInventory.cs


示例14: 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


示例15: AttachObjectInternal

        /// <summary>
        /// Internal method which actually does all the work for attaching an object.
        /// </summary>
        /// <returns>The object attached.</returns>
        /// <param name='sp'></param>
        /// <param name='group'>The object to attach.</param>
        /// <param name='attachmentPt'></param>
        /// <param name='silent'></param>
        /// <param name='addToInventory'>If true then add object to user inventory.</param>
        /// <param name='resumeScripts'>If true then scripts are resumed on the attached object.</param>
        /// <param name='append'>Append to attachment point rather than replace.</param>
        private bool AttachObjectInternal(
            IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool addToInventory, bool resumeScripts, bool append)
        {
            if (group.GetSittingAvatarsCount() != 0)
            {
                if (DebugLevel > 0)
                    m_log.WarnFormat(
                        "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since {4} avatars are still sitting on it",
                        group.Name, group.LocalId, sp.Name, attachmentPt, group.GetSittingAvatarsCount());

                return false;
            }

            Vector3 attachPos = group.AbsolutePosition;
            // If the attachment point isn't the same as the one previously used
            // set it's offset position = 0 so that it appears on the attachment point
            // and not in a weird location somewhere unknown.
            if (attachmentPt != (uint)AttachmentPoint.Default && attachmentPt != group.AttachmentPoint)
            {
                attachPos = Vector3.Zero;
            }

            // if the attachment point is the same as previous, make sure we get the saved
            // position info.
            if (attachmentPt != 0 && attachmentPt == group.RootPart.Shape.LastAttachPoint)
            {
                attachPos = group.RootPart.AttachedPos;
            }

            // AttachmentPt 0 means the client chose to 'wear' the attachment.
            if (attachmentPt == (uint)AttachmentPoint.Default)
            {
                // Check object for stored attachment point
                attachmentPt = group.AttachmentPoint;
            }

            // if we didn't find an attach point, look for where it was last attached
            if (attachmentPt == 0)
            {
                attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
                attachPos = group.RootPart.AttachedPos;
                group.HasGroupChanged = true;
            }

            // if we still didn't find a suitable attachment point.......
            if (attachmentPt == 0)
            {
                // Stick it on left hand with Zero Offset from the attachment point.
                attachmentPt = (uint)AttachmentPoint.LeftHand;
                attachPos = Vector3.Zero;
            }

            group.AttachmentPoint = attachmentPt;
            group.AbsolutePosition = attachPos;

            List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);

            if (attachments.Contains(group))
            {
                if (DebugLevel > 0)
                    m_log.WarnFormat(
                        "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
                        group.Name, group.LocalId, sp.Name, attachmentPt);

                return false;
            }

            // If we already have 5, remove the oldest until only 4 are left. Skip over temp ones
            while (attachments.Count >= 5)
            {
                if (attachments[0].FromItemID != UUID.Zero)
                    DetachSingleAttachmentToInv(sp, attachments[0]);
                attachments.RemoveAt(0);
            }

            // If we're not appending, remove the rest as well
            if (attachments.Count != 0 && !append)
            {
                foreach (SceneObjectGroup g in attachments)
                {
                    if (g.FromItemID != UUID.Zero)
                        DetachSingleAttachmentToInv(sp, g);
                }
            }

            lock (sp.AttachmentsSyncLock)
            {
                if (addToInventory && sp.PresenceType != PresenceType.Npc)
                    UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:101,代码来源:AttachmentsModule.cs


示例16: AttachToAgent

        /// <summary>
        /// Attach this scene object to the given avatar.
        /// </summary>
        /// <remarks>
        /// 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).
        /// </remarks>
        /// <param name="sp"></param>
        /// <param name="so"></param>
        /// <param name="attachmentpoint"></param>
        /// <param name="attachOffset"></param>
        /// <param name="silent"></param>
        private void AttachToAgent(
            IScenePresence sp, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
        {
            if (DebugLevel > 0)
                m_log.DebugFormat(
                    "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
                    so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos);

            so.DetachFromBackup();

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

            so.AttachedAvatar = sp.UUID;

            if (so.RootPart.PhysActor != null)
                so.RootPart.RemoveFromPhysics();

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

            sp.AddAttachment(so);

            if (!silent)
            {
                if (so.HasPrivateAttachmentPoint)
                {
                    if (DebugLevel > 0)
                        m_log.DebugFormat(
                            "[ATTACHMENTS MODULE]: Killing private HUD {0} for avatars other than {1} at attachment point {2}",
                            so.Name, sp.Name, so.AttachmentPoint);

                    // As this scene object can now only be seen by the attaching avatar, tell everybody else in the
                    // scene that it's no longer in their awareness.
                    m_scene.ForEachClient(
                        client =>
                            { if (client.AgentId != so.AttachedAvatar)
                                client.SendKillObject(new List<uint>() { so.LocalId });
                            });
                }

                // Fudge below is an extremely unhelpful comment.  It's probably here so that the scheduled full update
                // will succeed, as that will not update if an attachment is selected.
                so.IsSelected = false; // fudge.... 

                so.ScheduleGroupForFullUpdate();
            }

            // In case it is later dropped again, don't let
            // it get cleaned up
            so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:68,代码来源:AttachmentsModule.cs


示例17: AddSceneObjectAsNewAttachmentInInv

        /// <summary>
        /// Add a scene object as a new attachment in the user inventory.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="grp"></param>
        /// <returns>The user inventory item created that holds the attachment.</returns>
        private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IScenePresence sp, SceneObjectGroup grp)
        {
            if (m_invAccessModule == null)
                return null;

            if (DebugLevel > 0)
                m_log.DebugFormat(
                    "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}",
                    grp.Name, grp.LocalId, sp.Name);

            InventoryItemBase newItem
                = m_invAccessModule.CopyToInventory(
                    DeRezAction.TakeCopy,
                    m_scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object).ID,
                    new List<SceneObjectGroup> { grp },
                    sp.ControllingClient, true)[0];

            // sets itemID so client can show item as 'attached' in inventory
            grp.FromItemID = newItem.ID;

            return newItem;
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:28,代码来源:AttachmentsModule.cs


示例18: UpdateUserInventoryWithAttachment

        private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool append)
        {
            // Add the new attachment to inventory if we don't already have it.
            UUID newAttachmentItemID = group.FromItemID;
            if (newAttachmentItemID == UUID.Zero)
                newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;

            ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append);
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:9,代码来源:AttachmentsModule.cs


示例19: RezSingleAttachmentFromInventoryInternal

        protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
            IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, bool append)
        {
            if (m_invAccessModule == null)
                return null;

            SceneObjectGroup objatt;

            if (itemID != UUID.Zero)
                objatt = m_invAccessModule.RezObject(sp.ControllingClient,
                    itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
                    false, false, sp.UUID, true);
            else
                objatt = m_invAccessModule.RezObject(sp.ControllingClient,
                    null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
                    false, false, sp.UUID, true);

            if (objatt == null)
            {
                m_log.WarnFormat(
                    "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
                    itemID, sp.Name, attachmentPt);

                return null;
            }
            else if (itemID == UUID.Zero)
            {
                // We need to have a FromItemID for multiple attachments on a single attach point to appear.  This is 
                // true on Singularity 1.8.5 and quite possibly other viewers as well.  As NPCs don't have an inventory
                // we will satisfy this requirement by inserting a random UUID.
                objatt.FromItemID = UUID.Random();
            }

            if (DebugLevel > 0)
                m_log.DebugFormat(
                    "[ATTACHMENTS MODULE]: Rezzed single object {0} with {1} prims for attachment to {2} on point {3} in {4}",
                    objatt.Name, objatt.PrimCount, sp.Name, attachmentPt, m_scene.Name);

            // HasGroupChanged is being set from within RezObject.  Ideally it would be set by the caller.
            objatt.HasGroupChanged = false;
            bool tainted = false;
            if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint)
                tainted = true;

            // FIXME: Detect whether it's really likely for AttachObject to throw an exception in the normal
            // course of events.  If not, then it's probably not worth trying to recover the situation
            // since this is more likely to trigger further exceptions and confuse later debugging.  If
            // exceptions can be thrown in expected error conditions (not NREs) then make this consistent
            // since other normal error conditions will simply return false instead.
            // This will throw if the attachment fails
            try
            {
                AttachObjectInternal(sp, objatt, attachmentPt, false, true, true, append);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat(
                    "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}",
                    objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace);

                // Make sure the object doesn't stick around and bail
                sp.RemoveAttachment(objatt);
                m_scene.DeleteSceneObject(objatt, false);
                return null;
            }

            if (tainted)
                objatt.HasGroupChanged = true;           

            if (ThrottlePer100PrimsRezzed > 0)
            {
                int throttleMs = (int)Math.Round((float)objatt.PrimCount / 100 * ThrottlePer100PrimsRezzed);

                if (DebugLevel > 0)
                    m_log.DebugFormat(
                        "[ATTACHMENTS MODULE]: Throttling by {0}ms after rez of {1} with {2} prims for attachment to {3} on point {4} in {5}",
                        throttleMs, objatt.Name, objatt.PrimCount, sp.Name, attachmentPt, m_scene.Name);

                Thread.Sleep(throttleMs);
            }

            return objatt;
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:83,代码来源:AttachmentsModule.cs


示例20: RezSingleAttachmentFromInventory

        public SceneObjectGroup RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
        {
            if (!Enabled)
                return null;

            if (DebugLevel > 0)
                m_log.DebugFormat(
                    "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2} in {3}",
                    (AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name);

            // We check the attachments in the avatar appearance here rather than the objects attached to the
            // ScenePresence itself so that we can ignore calls by viewer 2/3 to attach objects on startup.  We are 
            // already doing this in ScenePresence.MakeRootAgent().  Simulator-side attaching needs to be done 
            // because pre-outfit folder viewers (most version 1 viewers) require it.
            bool alreadyOn = false;
            List<AvatarAttachment> existingAttachments = sp.Appearance.GetAttachments();
            foreach (AvatarAttachment existingAttachment in existingAttachments)
            {
                if (existingAttachment.ItemID == itemID)
                {
                    alreadyOn = true;
                    break;
                }
            }

            if (alreadyOn)
            {
                if (DebugLevel > 0)
                    m_log.DebugFormat(
                        "[ATTACHMENTS MODULE]: Ignoring request by {0} to wear item {1} at {2} since it is already worn",
                        sp.Name, itemID, AttachmentPt);

                return null;
            }

            bool append = (AttachmentPt & 0x80) != 0;
            AttachmentPt &= 0x7f;

            return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, append);
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:40,代码来源:AttachmentsModule.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISchedule类代码示例发布时间:2022-05-24
下一篇:
C# ISceneObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap