本文整理汇总了C#中OpenSim.Region.Framework.Scenes.Scene.GiveInventoryFolder方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.GiveInventoryFolder方法的具体用法?C# Scene.GiveInventoryFolder怎么用?C# Scene.GiveInventoryFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.Scene
的用法示例。
在下文中一共展示了Scene.GiveInventoryFolder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UserInventoryOffer
////////////////////////////////////////////////
// User-to-user inventory offers
private void UserInventoryOffer(IClientAPI client, Scene scene, GridInstantMessage im)
{
InventoryFolderBase folder = null;
InventoryItemBase item = null;
UUID toAgentID = new UUID(im.toAgentID);
IMuteListModule m_muteListModule = scene.RequestModuleInterface<IMuteListModule>();
if (m_muteListModule != null)
{
if (m_muteListModule.IsMuted(client.AgentId, toAgentID))
{
client.SendAgentAlertMessage("Inventory offer was automatically declined.", false);
return; // recipient has sender muted
}
}
// Unpack the binary bucket
AssetType assetType = (AssetType)im.binaryBucket[0];
UUID destID = new UUID(im.binaryBucket, 1);
UUID copyID;
bool isFolder = (assetType == AssetType.Folder);
ScenePresence recipient = scene.GetScenePresence(toAgentID);
if (recipient != null && recipient.IsBot)
{
client.SendAgentAlertMessage("Can't give inventory to bots.", false);
return;//can't give objects to bots
}
if (assetType == AssetType.Folder)
{
folder = scene.GiveInventoryFolder(toAgentID, client.AgentId, destID, UUID.Zero);
if (folder == null)
{
client.SendAgentAlertMessage("Can't find folder to give. Nothing given.", false);
return;
}
copyID = folder.ID;
}
else
{
item = scene.GiveInventoryItem(toAgentID, client.AgentId, destID);
if (item == null)
{
client.SendAgentAlertMessage("Can't find item to give. Nothing given.", false);
return;
}
copyID = item.ID;
}
// m_log.InfoFormat("[AGENT INVENTORY]: Offering {0} {1} to user {2} inventory as {3}", isFolder ? "folder" : "item", destID, toAgentID, copyID);
// Update the asset type and destination ID into the outgoing IM.
im.binaryBucket = new byte[17];
im.binaryBucket[0] = (byte)assetType;
Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16);
// Also stuff the destination ID into the session ID field for retrieval in accept/decline
im.imSessionID = copyID.Guid;
CachedUserInfo recipientInfo = scene.CommsManager.UserService.GetUserDetails(toAgentID);
if (recipientInfo != null && recipient != null)
{
if ((!isFolder) && (item != null))
{
// item offer?
recipient.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
}
if (isFolder && (folder != null))
{
// folder offer?
folder = recipientInfo.GetFolder(folder.ID);
if (folder != null)
{
recipient.ControllingClient.SendBulkUpdateInventory(folder);
recipientInfo.SendInventoryDecendents(recipient.ControllingClient, folder.ID, false, true);
}
}
}
// Send the IM to the recipient. The item is already in their inventory, so
// it will not be lost if they are offline. Transaction ID is the item ID.
// We get that same ID back on the reply so we know what to act on.
RelayInventoryOfferIM(scene, recipient, im);
}