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


C# ISceneEntity.ScheduleGroupUpdate方法代码示例

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


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

示例1: CreateEntity

        public ISceneEntity CreateEntity(
            ISceneEntity baseEntity, UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
        {
            if (Array.IndexOf(creationCapabilities, (PCode) shape.PCode) < 0)
            {
                MainConsole.Instance.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
                return null;
            }

            ISceneChildEntity rootPart = baseEntity.GetChildPart(baseEntity.UUID);

            // if grass or tree, make phantom
            //rootPart.TrimPermissions();
            rootPart.AddFlag(PrimFlags.Phantom);
            if (rootPart.Shape.PCode != (byte) PCode.Grass)
                AdaptTree(ref shape);

            m_scene.SceneGraph.AddPrimToScene(baseEntity);
            baseEntity.SetGroup(groupID, ownerID, true);
            baseEntity.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);

            return baseEntity;
        }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:23,代码来源:VegetationModule.cs

示例2: CrossGroupToNewRegion

        /// <summary>
        ///     Move the given scene object into a new region depending on which region its absolute position has moved
        ///     into.
        ///     This method locates the new region handle and offsets the prim position for the new region
        /// </summary>
        /// <param name="attemptedPosition">the attempted out of region position of the scene object</param>
        /// <param name="grp">the scene object that we're crossing</param>
        /// <param name="destination"></param>
        public bool CrossGroupToNewRegion(ISceneEntity grp, Vector3 attemptedPosition, GridRegion destination)
        {
            if (grp == null)
                return false;
            if (grp.IsDeleted)
                return false;

            if (grp.Scene == null)
                return false;
            if (grp.RootChild.DIE_AT_EDGE)
            {
                // We remove the object here
                try
                {
                    IBackupModule backup = grp.Scene.RequestModuleInterface<IBackupModule>();
                    if (backup != null)
                        return backup.DeleteSceneObjects(new[] {grp}, true, true);
                }
                catch (Exception)
                {
                    MainConsole.Instance.Warn(
                        "[DATABASE]: exception when trying to remove the prim that crossed the border.");
                }
                return false;
            }

            if (grp.RootChild.RETURN_AT_EDGE)
            {
                // We remove the object here
                try
                {
                    List<ISceneEntity> objects = new List<ISceneEntity> {grp};
                    ILLClientInventory inventoryModule = grp.Scene.RequestModuleInterface<ILLClientInventory>();
                    if (inventoryModule != null)
                        return inventoryModule.ReturnObjects(objects.ToArray(), UUID.Zero);
                }
                catch (Exception)
                {
                    MainConsole.Instance.Warn(
                        "[SCENE]: exception when trying to return the prim that crossed the border.");
                }
                return false;
            }

            Vector3 oldGroupPosition = grp.RootChild.GroupPosition;
            // If we fail to cross the border, then reset the position of the scene object on that border.
            if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, attemptedPosition))
            {
                grp.OffsetForNewRegion(oldGroupPosition);
                grp.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
                return false;
            }
            return true;
        }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:62,代码来源:EntityTransferModule.cs

示例3: AddSceneObject

        /// <summary>
        ///     Adds a Scene Object group to the Scene.
        ///     Verifies that the creator of the object is not banned from the simulator.
        ///     Checks if the item is an Attachment
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="sceneObject"></param>
        /// <returns>True if the SceneObjectGroup was added, False if it was not</returns>
        public bool AddSceneObject(IScene scene, ISceneEntity sceneObject)
        {
            // If the user is banned, we won't let any of their objects
            // enter. Period.
            //
            if (scene.RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID))
            {
                MainConsole.Instance.Info("[EntityTransferModule]: Denied prim crossing for banned avatar");

                return false;
            }

            //if (!sceneObject.IsAttachmentCheckFull()) // Not Attachment
            {
                if (!scene.Permissions.CanObjectEntry(sceneObject.UUID,
                                                      true, sceneObject.AbsolutePosition, sceneObject.OwnerID))
                {
                    // Deny non attachments based on parcel settings
                    //
                    MainConsole.Instance.Info("[EntityTransferModule]: Denied prim crossing " +
                                              "because of parcel settings");

                    IBackupModule backup = scene.RequestModuleInterface<IBackupModule>();
                    if (backup != null)
                        backup.DeleteSceneObjects(new[] {sceneObject}, true, true);

                    return false;
                }

                sceneObject.IsInTransit = false; //Reset this now that it's entering here
                if (scene.SceneGraph.AddPrimToScene(sceneObject))
                {
                    if (sceneObject.IsSelected)
                        sceneObject.RootChild.CreateSelected = true;
                    sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
                    return true;
                }
            }
            return false;
        }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:48,代码来源:EntityTransferModule.cs

示例4: FindAttachmentPoint


//.........这里部分代码省略.........
            itemID = group.RootChild.FromUserInventoryItemID;

            group.RootChild.AttachedAvatar = presence.UUID;

            List<ISceneChildEntity> parts = group.ChildrenEntities();
            for (int i = 0; i < parts.Count; i++)
                parts[i].AttachedAvatar = presence.UUID;

            if (group.RootChild.PhysActor != null)
            {
                m_scene.PhysicsScene.RemovePrim (group.RootChild.PhysActor);
                group.RootChild.PhysActor = null;
            }

            group.RootChild.AttachedPos = attachPos;
            group.RootChild.IsAttachment = true;
            group.AbsolutePosition = attachPos;

            group.RootChild.SetParentLocalId (presence.LocalId);
            group.SetAttachmentPoint(Convert.ToByte(AttachmentPt));

            AvatarAttachments attPlugin = presence.RequestModuleInterface<AvatarAttachments>();
            if (attPlugin != null)
            {
                attPlugin.AddAttachment (group);
                presence.AddAttachment (group);
            }

            // Killing it here will cause the client to deselect it
            // It then reappears on the avatar, deselected
            // through the full update below
            //
            if (group.IsSelected)
            {
                foreach (ISceneChildEntity part in group.ChildrenEntities())
                {
                    part.CreateSelected = true;
                }
            }
            //Kill the previous entity so that it will be selected
            SendKillEntity(group.RootChild);

            //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.
            group.IsSelected = false;

            if (itemID == UUID.Zero)
            {
                //Delete the object inworld to inventory

                List<ISceneEntity> groups = new List<ISceneEntity> (1) { group };

                IInventoryAccessModule inventoryAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
                if (inventoryAccess != null)
                    inventoryAccess.DeleteToInventory(DeRezAction.AcquireToUserInventory, UUID.Zero,
                        groups, remoteClient.AgentId, out itemID);
            }
            else
            {
                //it came from an item, we need to start the scripts

                // Fire after attach, so we don't get messy perms dialogs
                // 4 == AttachedRez
                group.CreateScriptInstances(0, true, StateSource.AttachedRez, UUID.Zero);
                group.ResumeScripts();
            }

            if (UUID.Zero == itemID)
            {
                m_log.Error("[ATTACHMENTS MODULE]: Unable to save attachment. Error inventory item ID.");
                remoteClient.SendAgentAlertMessage(
                    "Unable to save attachment. Error inventory item ID.", false);
                return;
            }

            // XXYY!!
            if (item == null)
            {
                item = new InventoryItemBase(itemID, remoteClient.AgentId);
                item = m_scene.InventoryService.GetItem(item);
            }

            //Update the ItemID with the new item
            group.SetFromItemID (itemID);

            //If we updated the attachment, we need to save the change
            IAvatarAppearanceModule appearance = presence.RequestModuleInterface<IAvatarAppearanceModule> ();
            if (appearance.Appearance.SetAttachment ((int)AttachmentPt, itemID, item.AssetID))
                AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);


            // In case it is later dropped again, don't let
            // it get cleaned up
            group.RootChild.RemFlag(PrimFlags.TemporaryOnRez);
            group.HasGroupChanged = false;
            //Now recreate it so that it is selected
            group.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);

            m_scene.EventManager.TriggerOnAttach(localID, group.RootChild.FromUserInventoryItemID, remoteClient.AgentId);
        }
开发者ID:Krazy-Bish-Margie,项目名称:Aurora-Sim,代码行数:101,代码来源:AttachmentsModule.cs

示例5: UpdateAttachmentPosition

 /// <summary>
 ///     Update the position of the given attachment
 /// </summary>
 /// <param name="client"></param>
 /// <param name="sog"></param>
 /// <param name="localID"></param>
 /// <param name="pos"></param>
 public void UpdateAttachmentPosition(IClientAPI client, ISceneEntity sog, uint localID, Vector3 pos)
 {
     if (sog != null)
     {
         // If this is an attachment, then we need to save the modified
         // object back into the avatar's inventory. First we save the
         // attachment point information, then we update the relative
         // positioning (which caused this method to get driven in the
         // first place. Then we have to mark the object as NOT an
         // attachment. This is necessary in order to correctly save
         // and retrieve GroupPosition information for the attachment.
         // Then we save the asset back into the appropriate inventory
         // entry. Finally, we restore the object's attachment status.
         byte attachmentPoint = (byte) sog.RootChild.AttachmentPoint;
         sog.UpdateGroupPosition(pos, true);
         sog.RootChild.AttachedPos = pos;
         sog.RootChild.FixOffsetPosition((pos), false);
         //sog.AbsolutePosition = sog.RootChild.AttachedPos;
         sog.SetAttachmentPoint(attachmentPoint);
         sog.ScheduleGroupUpdate(PrimUpdateFlags.TerseUpdate);
         //Don't update right now, wait until logout
         //UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
     }
     else
     {
         MainConsole.Instance.Warn("[Attachments]: Could not find attachment by ItemID!");
     }
 }
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:35,代码来源:AttachmentsModule.cs

示例6: CreateEntity

        /// <summary>
        /// Create a tree entity
        /// </summary>
        /// <param name="sceneObject">Scene object.</param>
        /// <param name="ownerID"></param>
        /// <param name="groupID"></param>
        /// <param name="pos"></param>
        /// <param name="rot"></param>
        /// <param name="shape"></param>
        /// <returns>The tree entity created, or null if the creation failed</returns>
        public ISceneEntity CreateEntity(
            ISceneEntity sceneObject, UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
        {
            if ( Array.IndexOf( creationCapabilities, ( PCode)shape.PCode ) < 0 )
            {
                MainConsole.Instance.Debug ( "[VEGETATION]: PCode " + shape.PCode + " not handled by "+ Name );
                return null;
            }

            ISceneChildEntity rootPart = sceneObject.GetChildPart(sceneObject.UUID);

            rootPart.AddFlag(PrimFlags.Phantom);
            if ( rootPart.Shape.PCode != (byte)PCode.Grass )
            {
                // Tree size has to be adapted depending on its type
                switch ( (Tree)rootPart.Shape.State )
                {
                    case Tree.Cypress1:
                    case Tree.Cypress2:
                    case Tree.Palm1:
                    case Tree.Palm2:
                    case Tree.WinterAspen:
                        rootPart.Scale = new Vector3(4, 4, 10);
                        break;
                    case Tree.WinterPine1:
                    case Tree.WinterPine2:
                        rootPart.Scale = new Vector3(4, 4, 20);
                        break;

                    case Tree.Dogwood:
                        rootPart.Scale = new Vector3(6.5f, 6.5f, 6.5f);
                        break;

                    // case... other tree types
                    // tree.Scale = new Vector3(?, ?, ?);
                    // break;
                    default:
                        rootPart.Scale = new Vector3(4, 4, 4);
                        break;
                }
            }

            sceneObject.SetGroup( groupID, UUID.Zero, false );
            m_scene.SceneGraph.AddPrimToScene( sceneObject );
            sceneObject.ScheduleGroupUpdate( PrimUpdateFlags.ForcedFullUpdate );

            return sceneObject;
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Optional-Modules,代码行数:58,代码来源:TreePopulatorModule.cs


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