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


C# IScenePresence类代码示例

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


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


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