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


C# DeRezAction类代码示例

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


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

示例1: DeleteToInventory

        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                SceneObjectGroup objectGroup, IClientAPI remoteClient, 
                bool permissionToDelete)
        {
            if (Enabled)
                lock (m_inventoryTicker)
                    m_inventoryTicker.Stop();

            lock (m_inventoryDeletes)
            {
                DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
                dtis.action = action;
                dtis.folderID = folderID;
                dtis.objectGroup = objectGroup;
                dtis.remoteClient = remoteClient;
                dtis.permissionToDelete = permissionToDelete;

                m_inventoryDeletes.Enqueue(dtis);
            }

            if (Enabled)
                lock (m_inventoryTicker)
                    m_inventoryTicker.Start();
        
            // Visually remove it, even if it isnt really gone yet.  This means that if we crash before the object
            // has gone to inventory, it will reappear in the region again on restart instead of being lost.
            // This is not ideal since the object will still be available for manipulation when it should be, but it's
            // better than losing the object for now.
            if (permissionToDelete)
                objectGroup.DeleteGroup(false);
        }
开发者ID:intari,项目名称:OpenSimMirror,代码行数:34,代码来源:AsyncSceneObjectGroupDeleter.cs

示例2: DeleteToInventory

        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                IEnumerable<SceneObjectGroup> objectGroups, IClientAPI remoteClient, 
                bool permissionToDelete)
        {
            if (Enabled)
                m_inventoryTicker.Stop();


            lock (m_inventoryDeletes)
            {
                DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
                dtis.action = action;
                dtis.folderID = folderID;
                dtis.objectGroups = new List<SceneObjectGroup>(objectGroups);

                if (dtis.objectGroups.Count == 0)
                {
                    //something is wrong, caller sent us an empty set
                    throw new ArgumentException("DeleteToInventory() Can not work with an empty set", "objectGroups");
                }

                dtis.remoteClient = remoteClient;
                dtis.permissionToDelete = permissionToDelete;

                m_inventoryDeletes.Enqueue(dtis);
            }

            if (Enabled)
                m_inventoryTicker.Start();
        
            // Visually remove it, even if it isnt really gone yet.  This means that if we crash before the object
            // has gone to inventory, it will reappear in the region again on restart instead of being lost.
            // This is not ideal since the object will still be available for manipulation when it should be, but it's
            // better than losing the object for now.
            if (permissionToDelete)
            {
                foreach (SceneObjectGroup group in objectGroups)
                {
                    group.DeleteGroup(false);
                }
            }
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:45,代码来源:AsyncSceneObjectGroupDeleter.cs

示例3: DeleteToInventory

        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, 
                bool permissionToDelete)
        {
            if (Enabled)
                lock (m_inventoryTicker)
                    m_inventoryTicker.Stop();

            lock (m_inventoryDeletes)
            {
                DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
                dtis.action = action;
                dtis.folderID = folderID;
                dtis.objectGroups = objectGroups;
                dtis.remoteClient = remoteClient;
                dtis.permissionToDelete = permissionToDelete;

                m_inventoryDeletes.Enqueue(dtis);
            }

            if (Enabled)
                lock (m_inventoryTicker)
                    m_inventoryTicker.Start();
        
            // Visually remove it, even if it isnt really gone yet.  This means that if we crash before the object
            // has gone to inventory, it will reappear in the region again on restart instead of being lost.
            // This is not ideal since the object will still be available for manipulation when it should be, but it's
            // better than losing the object for now.
            if (permissionToDelete)
            {
                List<uint> killIDs = new List<uint>();

                foreach (SceneObjectGroup g in objectGroups)
                {   killIDs.Add(g.LocalId);
                    g.DeleteGroupFromScene(true);
                }

                m_scene.SendKillObject(killIDs);
            }
        }
开发者ID:4U2NV,项目名称:opensim,代码行数:43,代码来源:AsyncSceneObjectGroupDeleter.cs

示例4: DeleteToInventory

        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                List<SceneObjectGroup> objectGroups, UUID AgentId,
                bool permissionToDelete, bool permissionToTake)
        {
            DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
            dtis.action = action;
            dtis.folderID = folderID;
            dtis.objectGroups = objectGroups;
            dtis.agentId = AgentId;
            dtis.permissionToDelete = permissionToDelete;
            dtis.permissionToTake = permissionToTake;
            //Do this before the locking so that the objects 'appear' gone and the client doesn't think things have gone wrong
            if (permissionToDelete)
            {
                m_scene.DeleteGroups(objectGroups);
            }

            lock (m_sendToInventoryQueue)
            {
                m_sendToInventoryQueue.Enqueue(dtis);
            }

            lock (m_removeFromSimQueue)
            {
                m_removeFromSimQueue.Enqueue(dtis);
            }

            if (!DeleteLoopInUse)
            {
                DeleteLoopInUse = true;
                //m_log.Debug("[SCENE]: Starting delete loop");
                Util.FireAndForget(DoDeleteObject, new Object[] { 0 });
            }
            if (!SendToInventoryLoopInUse)
            {
                SendToInventoryLoopInUse = true;
                //m_log.Debug("[SCENE]: Starting send to inventory loop");
                Util.FireAndForget(DoSendToInventory, new Object[] { 0 });
            }
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:43,代码来源:AsyncSceneObjectGroupDeleter.cs

示例5: DeleteToInventory

        /// <summary>
        /// Delete a scene object from a scene and place in the given avatar's inventory.
        /// Returns the UUID of the newly created asset.
        /// </summary>
        /// <param name="action"></param>
        /// <param name="folderID"></param>
        /// <param name="objectGroup"></param>
        /// <param name="remoteClient"> </param>
        public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
                IEnumerable<SceneObjectGroup> objectGroups, IClientAPI remoteClient)
        {
            StringBuilder objectNames = new StringBuilder();
            foreach (var obj in objectGroups)
            {
                objectNames.Append(obj.Name);
                objectNames.Append(", ");
            }

            string agentText = "(unknown/internal)";
            if (remoteClient != null)
                agentText = remoteClient.AgentId.ToString();
            m_log.InfoFormat("[AGENT INVENTORY] About to DeRezAction.{0} for client {1}. Groups: {2}", action, agentText, objectNames.ToString());

            //now lets deal with the individual cases..
            switch (action)
            {
                case DeRezAction.Delete:
                    this.PerformInventoryDelete(folderID, objectGroups, remoteClient);
                    break;

                case DeRezAction.Return:
                    this.PerformInventoryReturn(folderID, objectGroups, remoteClient);
                    break;

                case DeRezAction.GodTakeCopy:
                    this.PerformGodTakeCopy(folderID, objectGroups, remoteClient);
                    break;

                case DeRezAction.SaveToExistingUserInventoryItem:
                    this.PerformSaveToExistingUserInventoryItem(folderID, objectGroups, remoteClient);
                    break;

                case DeRezAction.Take:
                    this.PerformTake(folderID, objectGroups, remoteClient, true);
                    break;

                case DeRezAction.TakeCopy:
                    this.PerformTake(folderID, objectGroups, remoteClient, false);
                    break;
            }

            return UUID.Zero;
        }
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:53,代码来源:Scene.Inventory.cs

示例6: DeRezObject

        public virtual void DeRezObject(IClientAPI remoteClient, uint localId,
            UUID groupId, DeRezAction action, UUID destinationID)
        {
            List<uint> partInfo = new List<uint>();
            partInfo.Add(localId);

            this.DeRezObjects(remoteClient, partInfo, groupId, action, destinationID);
        }
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:8,代码来源:Scene.Inventory.cs

示例7: DeRezObjects

        /// <summary>
        /// Called when an object is removed from the environment into inventory.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="localID"></param>
        /// <param name="groupID"></param>
        /// <param name="action"></param>
        /// <param name="destinationID"></param>
        public virtual void DeRezObjects(IClientAPI remoteClient, ICollection<uint> objectParts, 
            UUID groupId, DeRezAction action, UUID destinationID)
        {
            //get the intended behavior of this action
            DeRezActionResult intendedResult = this.GetIntendedResult(action);

            //List for collecting found prims
            List<SceneObjectGroup> groupsToDerez = new List<SceneObjectGroup>();
            bool abort = false;
            bool reportErrorForNoGroupsReturned = true;

            using (SceneTransaction transaction = SceneGraph.BeginPrimTransaction(objectParts))
            {
                try
                {
                    //check to make sure each part can meet the intended result
                    //skip with null client
                    if (remoteClient != null)
                    {
                        foreach (uint partInfo in objectParts)
                        {
                            SceneObjectGroup grp = this.FindGroupAppropriateForDeRez(partInfo);
                            if (grp == null) return; //couldn't find groups
                            if (grp.IsAttachment) continue; //none of this should be done on attachments

                            if (this.FindDeRezPermissions(remoteClient, grp, action) != this.GetIntendedResult(action))
                            {
                                //missing permissions for one or more of the objects
                                remoteClient.SendAlertMessage("Insuffient permissions on '" + grp.Name + "'.");
                                return;
                            }
                            else
                            {
                                if (!this.AddToListIfDerezOk(intendedResult, grp, groupsToDerez))
                                {
                                    //could not derez
                                    abort = true;
                                    remoteClient.SendBlueBoxMessage(UUID.Zero, String.Empty, "Could not take/remove '" + grp.Name + "', operation aborted.");
                                    return;
                                }
                            }
                        }
                    }
                    else
                    {
                        //delete called from parcel return
                        foreach (uint partInfo in objectParts)
                        {
                            SceneObjectGroup grp = this.FindGroupAppropriateForDeRez(partInfo);
                            if (grp == null) return; //couldn't find groups
                            if (grp.IsAttachment) continue; //none of this should be done on attachments

                            //protect against a return on the same object happing multiple times
                            if (!this.AddToListIfDerezOk(intendedResult, grp, groupsToDerez))
                            {
                                //could not derez
                                reportErrorForNoGroupsReturned = false;
                                continue;
                            }
                        }
                    }

                    if (groupsToDerez.Count == 0)
                    {
                        //there must've been a problem locating the group(s), inform the user

                        if (reportErrorForNoGroupsReturned)
                        {
                            m_log.ErrorFormat("[Scene.Inventory] No groups found to derez after scene search, Action: {0}", action);
                        }

                        /*
                        if (remoteClient != null)
                        {
                            remoteClient.SendBlueBoxMessage(UUID.Zero, String.Empty, "Could not find objects to derez");
                        }
                        */
                        return;
                    }

                    //if we got here, we can start completing the requested action
                    ForceBulkSceneObjectBackup(groupsToDerez);

                    if (intendedResult == DeRezActionResult.Both || intendedResult == DeRezActionResult.Take)
                    {
                        m_asyncSceneObjectDeleter.DeleteToInventory(
                                action, destinationID, groupsToDerez, remoteClient,
                                intendedResult == DeRezActionResult.Both //also delete?
                                );
                    }
                    else if (intendedResult == DeRezActionResult.Delete)
                    {
//.........这里部分代码省略.........
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:101,代码来源:Scene.Inventory.cs

示例8: DeRezObjects

        /// <summary>
        /// Derez one or more objects from the scene.
        /// </summary>
        /// <remarks>
        /// Won't actually remove the scene object in the case where the object is being copied to a user inventory.
        /// </remarks>
        /// <param name='remoteClient'>Client requesting derez</param>
        /// <param name='localIDs'>Local ids of root parts of objects to delete.</param>
        /// <param name='groupID'>Not currently used.  Here because the client passes this to us.</param>
        /// <param name='action'>DeRezAction</param>
        /// <param name='destinationID'>User folder ID to place derezzed object</param>
        public virtual void DeRezObjects(
            IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID)
        {
            // First, see of we can perform the requested action and
            // build a list of eligible objects
            List<uint> deleteIDs = new List<uint>();
            List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>();

            // Start with true for both, then remove the flags if objects
            // that we can't derez are part of the selection
            bool permissionToTake = true;
            bool permissionToTakeCopy = true;
            bool permissionToDelete = true;

            foreach (uint localID in localIDs)
            {
                // Invalid id
                SceneObjectPart part = GetSceneObjectPart(localID);
                if (part == null)
                    continue;

                // Already deleted by someone else
                if (part.ParentGroup.IsDeleted)
                    continue;

                // Can't delete child prims
                if (part != part.ParentGroup.RootPart)
                    continue;

                SceneObjectGroup grp = part.ParentGroup;

                deleteIDs.Add(localID);
                deleteGroups.Add(grp);

                // If child prims have invalid perms, fix them
                grp.AdjustChildPrimPermissions(false);

                if (remoteClient == null)
                {
                    // Autoreturn has a null client. Nothing else does. So
                    // allow only returns
                    if (action != DeRezAction.Return)
                    {
                        m_log.WarnFormat(
                            "[AGENT INVENTORY]: Ignoring attempt to {0} {1} {2} without a client", 
                            action, grp.Name, grp.UUID);
                        return;
                    }

                    permissionToTakeCopy = false;
                }
                else
                {
                    if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
                        permissionToTakeCopy = false;
                    
                    if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
                        permissionToTake = false;
                    
                    if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
                        permissionToDelete = false;
                }
            }

            // Handle god perms
            if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId))
            {
                permissionToTake = true;
                permissionToTakeCopy = true;
                permissionToDelete = true;
            }

            // If we're re-saving, we don't even want to delete
            if (action == DeRezAction.SaveToExistingUserInventoryItem)
                permissionToDelete = false;

            // if we want to take a copy, we also don't want to delete
            // Note: after this point, the permissionToTakeCopy flag
            // becomes irrelevant. It already includes the permissionToTake
            // permission and after excluding no copy items here, we can
            // just use that.
            if (action == DeRezAction.TakeCopy)
            {
                // If we don't have permission, stop right here
                if (!permissionToTakeCopy)
                {
                    remoteClient.SendAlertMessage("You don't have permission to take the object");
                    return;
                }
//.........这里部分代码省略.........
开发者ID:Barosonix,项目名称:Barosonix-Core,代码行数:101,代码来源:Scene.Inventory.cs

示例9: DeRezObject

 /// <summary>
 /// Called when an object is removed from the environment into inventory.
 /// </summary>
 /// <param name="remoteClient"></param>
 /// <param name="localID"></param>
 /// <param name="groupID"></param>
 /// <param name="action"></param>
 /// <param name="destinationID"></param>
 public virtual void DeRezObject(IClientAPI remoteClient, uint localID,
         UUID groupID, DeRezAction action, UUID destinationID)
 {
     DeRezObjects(remoteClient, new List<uint>() { localID} , groupID, action, destinationID);
 }
开发者ID:AlexRa,项目名称:opensim-mods-Alex,代码行数:13,代码来源:Scene.Inventory.cs

示例10: CreateItemForObject

        /// <summary>
        /// Create an item using details for the given scene object.
        /// </summary>
        /// <param name="action"></param>
        /// <param name="remoteClient"></param>
        /// <param name="so"></param>
        /// <param name="folderID"></param>
        /// <returns></returns>
        protected InventoryItemBase CreateItemForObject(
            DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID)
        {
            // Get the user info of the item destination
            //
            UUID userID = UUID.Zero;

            if (action == DeRezAction.Take || action == DeRezAction.TakeCopy ||
                action == DeRezAction.SaveToExistingUserInventoryItem)
            {
                // Take or take copy require a taker
                // Saving changes requires a local user
                //
                if (remoteClient == null)
                    return null;

                userID = remoteClient.AgentId;

//                m_log.DebugFormat(
//                    "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is {1} {2}",
//                    action, remoteClient.Name, userID);
            }
            else if (so.RootPart.OwnerID == so.RootPart.GroupID)
            {
                // Group owned objects go to the last owner before the object was transferred.
                userID = so.RootPart.LastOwnerID;
            }
            else
            {
                // Other returns / deletes go to the object owner
                //
                userID = so.RootPart.OwnerID;

//                m_log.DebugFormat(
//                    "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is object owner {1}",
//                    action, userID);
            }

            if (userID == UUID.Zero) // Can't proceed
            {
                return null;
            }

            // If we're returning someone's item, it goes back to the
            // owner's Lost And Found folder.
            // Delete is treated like return in this case
            // Deleting your own items makes them go to trash
            //
            
            InventoryFolderBase folder = null;
            InventoryItemBase item = null;

            if (DeRezAction.SaveToExistingUserInventoryItem == action)
            {
                item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID);
                item = m_Scene.InventoryService.GetItem(item);

                //item = userInfo.RootFolder.FindItem(
                //        objectGroup.RootPart.FromUserInventoryItemID);

                if (null == item)
                {
                    m_log.DebugFormat(
                        "[INVENTORY ACCESS MODULE]:  Object {0} {1} scheduled for save to inventory has already been deleted.",
                        so.Name, so.UUID);
                    
                    return null;
                }
            }
            else
            {
                // Folder magic
                //
                if (action == DeRezAction.Delete)
                {
                    // Deleting someone else's item
                    //
                    if (remoteClient == null ||
                        so.OwnerID != remoteClient.AgentId)
                    {
                        folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
                    }
                    else
                    {
                        folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
                    }
                }
                else if (action == DeRezAction.Return)
                {
                    // Dump to lost + found unconditionally
                    //
                    folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
//.........这里部分代码省略.........
开发者ID:JeffCost,项目名称:opensim,代码行数:101,代码来源:InventoryAccessModule.cs

示例11: DeleteToInventory

        /// <summary>
        ///     Delete a scene object from a scene and place in the given avatar's inventory.
        ///     Returns the UUID of the newly created asset.
        /// </summary>
        /// <param name="action"></param>
        /// <param name="folderID"></param>
        /// <param name="objectGroups"></param>
        /// <param name="agentId"></param>
        /// <param name="itemID"></param>
        public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
            List<ISceneEntity> objectGroups, UUID agentId, out UUID itemID)
        {
            itemID = UUID.Zero;
            if (objectGroups.Count == 0)
                return UUID.Zero;

            // Get the user info of the item destination
            //
            IScenePresence SP = m_scene.GetScenePresence(agentId);
            UUID userID = UUID.Zero;

            if (action == DeRezAction.Take || action == DeRezAction.AcquireToUserInventory ||
                action == DeRezAction.SaveToExistingUserInventoryItem)
            {
                // Take or take copy require a taker
                // Saving changes requires a local user
                //
                if (SP == null || SP.ControllingClient == null)
                    return UUID.Zero;

                userID = agentId;
            }
            else
            {
                // All returns / deletes go to the object owner
                //

                userID = objectGroups[0].OwnerID;
            }

            if (userID == UUID.Zero) // Can't proceed
            {
                return UUID.Zero;
            }

            // If we're returning someone's item, it goes back to the
            // owner's Lost And Found folder.
            // Delete is treated like return in this case
            // Deleting your own items makes them go to trash
            //

            InventoryFolderBase folder = null;
            InventoryItemBase item = null;

            if (DeRezAction.SaveToExistingUserInventoryItem == action)
            {
                item = m_scene.InventoryService.GetItem(userID, objectGroups[0].RootChild.FromUserInventoryItemID);

                //item = userInfo.RootFolder.FindItem(
                //        objectGroup.RootPart.FromUserInventoryItemID);

                if (null == item)
                {
                    MainConsole.Instance.DebugFormat(
                        "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
                        objectGroups[0].Name, objectGroups[0].UUID);
                    return UUID.Zero;
                }
            }
            else
            {
                // Folder magic
                //
                if (action == DeRezAction.Delete)
                {
                    // Deleting someone else's item
                    //

                    if (SP == null || SP.ControllingClient == null ||
                        objectGroups[0].OwnerID != agentId)
                    {
                        folder = m_scene.InventoryService.GetFolderForType(userID, InventoryType.Unknown,
                                                                           AssetType.LostAndFoundFolder);
                    }
                    else
                    {
                        folder = m_scene.InventoryService.GetFolderForType(userID, InventoryType.Unknown,
                                                                           AssetType.TrashFolder);
                    }
                }
                else if (action == DeRezAction.Return)
                {
                    // Dump to lost + found unconditionally
                    //
                    folder = m_scene.InventoryService.GetFolderForType(userID, InventoryType.Unknown,
                                                                       AssetType.LostAndFoundFolder);
                }

                if (folderID == UUID.Zero && folder == null)
                {
//.........这里部分代码省略.........
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:101,代码来源:InventoryAccessModule.cs

示例12: DeleteToInventory

        /// <summary>
        /// Delete a scene object from a scene and place in the given avatar's inventory.
        /// Returns the UUID of the newly created asset.
        /// </summary>
        /// <param name="action"></param>
        /// <param name="folderID"></param>
        /// <param name="objectGroup"></param>
        /// <param name="remoteClient"> </param>
        public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
                List<SceneObjectGroup> objectGroups, IClientAPI remoteClient)
        {
            // HACK: This is only working for lists containing a single item!
            // It's just a hack to make this WIP compile and run. Nothing
            // currently calls this with multiple items.
            UUID ret = UUID.Zero; 

            Dictionary<UUID, List<SceneObjectGroup>> deletes =
                    new Dictionary<UUID, List<SceneObjectGroup>>();

            foreach (SceneObjectGroup g in objectGroups)
            {
                if (!deletes.ContainsKey(g.OwnerID))
                    deletes[g.OwnerID] = new List<SceneObjectGroup>();

                deletes[g.OwnerID].Add(g);
            }

            foreach (List<SceneObjectGroup> objlist in deletes.Values)
            {
                foreach (SceneObjectGroup g in objlist)
                    ret = DeleteToInventory(action, folderID, g, remoteClient);
            }

            return ret;
        }
开发者ID:openmetaversefoundation,项目名称:fortis-opensim,代码行数:35,代码来源:InventoryAccessModule.cs

示例13: DeRezObject

   /// <summary>
 /// Called when one or more objects are removed from the environment into inventory.
 /// </summary>
 /// <param name="remoteClient"></param>
 /// <param name="localID"></param>
 /// <param name="groupID"></param>
 /// <param name="action"></param>
 /// <param name="destinationID"></param>
 public virtual void DeRezObject(IClientAPI remoteClient, List<uint> localIDs,
         UUID groupID, DeRezAction action, UUID destinationID)
 {
     foreach (uint localID in localIDs)
     {
         DeRezObject(remoteClient, localID, groupID, action, destinationID);
     }
 }
开发者ID:ChrisD,项目名称:opensim,代码行数:16,代码来源:Scene.Inventory.cs

示例14: CopyBundleToInventory

        /// <summary>
        /// Copy a bundle of objects to inventory.  If there is only one object, then this will create an object
        /// item.  If there are multiple objects then these will be saved as a single coalesced item.
        /// </summary>
        /// <param name="action"></param>
        /// <param name="folderID"></param>
        /// <param name="objlist"></param>
        /// <param name="remoteClient"></param>
        /// <returns></returns>
        protected UUID CopyBundleToInventory(
            DeRezAction action, UUID folderID, List<SceneObjectGroup> objlist, IClientAPI remoteClient)
        {
            UUID assetID = UUID.Zero;
            
            CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);                
            Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();

            foreach (SceneObjectGroup objectGroup in objlist)
            {
                Vector3 inventoryStoredPosition = new Vector3
                            (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
                                  ? 250
                                  : objectGroup.AbsolutePosition.X)
                             ,
                             (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize)
                                 ? 250
                                 : objectGroup.AbsolutePosition.Y,
                             objectGroup.AbsolutePosition.Z);

                originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;

                objectGroup.AbsolutePosition = inventoryStoredPosition;

                // Make sure all bits but the ones we want are clear
                // on take.
                // This will be applied to the current perms, so
                // it will do what we want.
                objectGroup.RootPart.NextOwnerMask &=
                        ((uint)PermissionMask.Copy |
                         (uint)PermissionMask.Transfer |
                         (uint)PermissionMask.Modify);
                objectGroup.RootPart.NextOwnerMask |=
                        (uint)PermissionMask.Move;
                
                coa.Add(objectGroup);
            }

            string itemXml;

            if (objlist.Count > 1)
                itemXml = CoalescedSceneObjectsSerializer.ToXml(coa);
            else
                itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]);
            
            // Restore the position of each group now that it has been stored to inventory.
            foreach (SceneObjectGroup objectGroup in objlist)
                objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];

            InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID);
            if (item == null)
                return UUID.Zero;
                            
            // Can't know creator is the same, so null it in inventory
            if (objlist.Count > 1)
            {
                item.CreatorId = UUID.Zero.ToString();
                item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems;
            }
            else
            {
                item.CreatorId = objlist[0].RootPart.CreatorID.ToString();                
                item.SaleType = objlist[0].RootPart.ObjectSaleType;
                item.SalePrice = objlist[0].RootPart.SalePrice;                    
            }              

            AssetBase asset = CreateAsset(
                objlist[0].GetPartName(objlist[0].RootPart.LocalId),
                objlist[0].GetPartDescription(objlist[0].RootPart.LocalId),
                (sbyte)AssetType.Object,
                Utils.StringToBytes(itemXml),
                objlist[0].OwnerID.ToString());
            m_Scene.AssetService.Store(asset);
            
            item.AssetID = asset.FullID;  
            assetID = asset.FullID;                              

            if (DeRezAction.SaveToExistingUserInventoryItem == action)
            {
                m_Scene.InventoryService.UpdateItem(item);
            }
            else
            {
                AddPermissions(item, objlist[0], objlist, remoteClient);

                item.CreationDate = Util.UnixTimeSinceEpoch();
                item.Description = asset.Description;
                item.Name = asset.Name;
                item.AssetType = asset.Type;

                m_Scene.AddInventoryItem(item);
//.........这里部分代码省略.........
开发者ID:allquixotic,项目名称:opensim-autobackup,代码行数:101,代码来源:InventoryAccessModule.cs

示例15: DeleteSceneObjectAsync

        /// <summary>
        /// Delete a scene object asynchronously
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="part"></param>
        /// <param name="action"></param>
        /// <param name="destinationId"></param>
        /// <param name="client"></param>
        public static void DeleteSceneObjectAsync(
            TestScene scene, SceneObjectPart part, DeRezAction action, UUID destinationId, IClientAPI client)
        {
            // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test
            AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
            sogd.Enabled = false;

            scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId);
            sogd.InventoryDeQueueAndDelete();
        }
开发者ID:intari,项目名称:OpenSimMirror,代码行数:18,代码来源:SceneSetupHelpers.cs


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