本文整理汇总了C#中OpenSim.Region.Framework.Scenes.Scene.AddInventoryItem方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.AddInventoryItem方法的具体用法?C# Scene.AddInventoryItem怎么用?C# Scene.AddInventoryItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.Scene
的用法示例。
在下文中一共展示了Scene.AddInventoryItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateInventoryItem
public static InventoryItemBase CreateInventoryItem(
Scene scene, string itemName, UUID itemId, string folderPath, UUID userId)
{
InventoryItemBase item = new InventoryItemBase();
item.Name = itemName;
item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID;
item.ID = itemId;
// Really quite bad since the objs folder could be moved in the future and confuse the tests
InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
item.Folder = objsFolder.ID;
scene.AddInventoryItem(item);
return item;
}
示例2: CreateInventoryItem
/// <summary>
/// Creates a notecard in the objects folder and specify an item id.
/// </summary>
/// <param name="scene"></param>
/// <param name="itemName"></param>
/// <param name="itemId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId)
{
AssetBase asset = AssetHelpers.CreateAsset(scene, userId);
InventoryItemBase item = new InventoryItemBase();
item.Name = itemName;
item.AssetID = asset.FullID;
item.ID = itemId;
item.Owner = userId;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Notecard;
InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard);
item.Folder = folder.ID;
scene.AddInventoryItem(item);
return item;
}
示例3: AddInventoryItem
/// <summary>
/// Adds the given item to an inventory folder
/// </summary>
/// <param name="scene"></param>
/// <param name="itemName"></param>
/// <param name="itemId"></param>
/// <param name="itemType"></param>
/// <param name="asset">The serialized asset for this item</param>
/// <param name="userId"></param>
/// <param name="path">Existing inventory path at which to add.</param>
/// <returns></returns>
private static InventoryItemBase AddInventoryItem(
Scene scene, string itemName, UUID itemId, InventoryType itemType, AssetBase asset, UUID userId, string path)
{
scene.AssetService.Store(asset);
InventoryItemBase item = new InventoryItemBase();
item.Name = itemName;
item.AssetID = asset.FullID;
item.ID = itemId;
item.Owner = userId;
item.AssetType = asset.Type;
item.InvType = (int)itemType;
InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, path)[0];
item.Folder = folder.ID;
scene.AddInventoryItem(item);
return item;
}
示例4: CreateInventoryItem
/// <summary>
/// Creates a notecard in the objects folder and specify an item id.
/// </summary>
/// <param name="scene"></param>
/// <param name="itemName"></param>
/// <param name="itemId"></param>
/// <param name="assetId"></param>
/// <param name="userId"></param>
/// <param name="type">Type of item to create</param>
/// <returns></returns>
public static InventoryItemBase CreateInventoryItem(
Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType type)
{
AssetBase asset = null;
if (type == InventoryType.Notecard)
asset = AssetHelpers.CreateAsset(scene, userId);
else if (type == InventoryType.Object)
asset = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId));
else
throw new Exception(string.Format("Inventory type {0} not supported", type));
scene.AssetService.Store(asset);
InventoryItemBase item = new InventoryItemBase();
item.Name = itemName;
item.AssetID = asset.FullID;
item.ID = itemId;
item.Owner = userId;
item.AssetType = asset.Type;
item.InvType = (int)type;
InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard);
item.Folder = folder.ID;
scene.AddInventoryItem(item);
return item;
}
示例5: AddInventoryItem
/// <summary>
/// Adds the given item to an inventory folder
/// </summary>
/// <param name="scene"></param>
/// <param name="itemName"></param>
/// <param name="itemId"></param>
/// <param name="itemType"></param>
/// <param name="asset">The serialized asset for this item</param>
/// <param name="userId"></param>
/// <param name="path">Existing inventory path at which to add.</param>
/// <returns></returns>
private static InventoryItemBase AddInventoryItem(
Scene scene, string itemName, UUID itemId, InventoryType itemType, AssetBase asset, UUID userId, string path)
{
scene.AssetService.Store(asset);
InventoryItemBase item = new InventoryItemBase();
item.Name = itemName;
item.AssetID = asset.FullID;
item.ID = itemId;
item.Owner = userId;
item.AssetType = asset.Type;
item.InvType = (int)itemType;
item.BasePermissions = (uint)OpenMetaverse.PermissionMask.All |
(uint)(Framework.PermissionMask.foldedMask | Framework.PermissionMask.foldedCopy | Framework.PermissionMask.foldedModify | Framework.PermissionMask.foldedTransfer);
item.CurrentPermissions = (uint)OpenMetaverse.PermissionMask.All |
(uint)(Framework.PermissionMask.foldedMask | Framework.PermissionMask.foldedCopy | Framework.PermissionMask.foldedModify | Framework.PermissionMask.foldedTransfer);
InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, path)[0];
item.Folder = folder.ID;
scene.AddInventoryItem(item);
return item;
}
示例6: TaskInventoryOfferDecline
private void TaskInventoryOfferDecline(IClientAPI client, Scene scene, GridInstantMessage im)
{
// The inventory item/folder, back from it's trip
UUID inventoryEntityID = new UUID(im.imSessionID);
// Here, the recipient is local and we can assume that the inventory is loaded.
// Courtesy of the above bulk update, it will have been pushed to the client, too.
CachedUserInfo userInfo = scene.CommsManager.UserService.GetUserDetails(client.AgentId);
if (userInfo != null)
{
InventoryFolderBase trashFolder = userInfo.FindFolderForType((int)FolderType.Trash);
if (null == trashFolder)
{
client.SendAgentAlertMessage("Unable to decline received inventory: Trash folder not found.", false);
return;
}
// Is it a folder or an item?
if (userInfo.QueryItem(inventoryEntityID))
{ // It's an item.
InventoryItemBase item = userInfo.FindItem(inventoryEntityID);
if (item == null)
{
client.SendAgentAlertMessage("Unable to decline received inventory: item/folder not found.", false);
return;
}
userInfo.MoveItemToTrash(item, trashFolder);
scene.AddInventoryItem(client, item);
client.SendInventoryItemCreateUpdate(item, 0);
}
else
{ // It's a folder.
InventoryFolderBase folder = userInfo.GetFolderAttributes(inventoryEntityID);
userInfo.MoveFolder(inventoryEntityID, trashFolder.ID);
folder = userInfo.GetFolder(inventoryEntityID);
if (folder != null)
{
client.SendBulkUpdateInventory(folder);
// If we don't send the descendents, viewer shows "Loading..." on the trash item.
userInfo.SendInventoryDecendents(client, folder.ID, false, true);
}
}
}
}
示例7: AddInventoryItem
/// <summary>
/// Creates a notecard in the objects folder and specify an item id.
/// </summary>
/// <param name="scene"></param>
/// <param name="itemName"></param>
/// <param name="itemId"></param>
/// <param name="itemType"></param>
/// <param name="asset">The serialized asset for this item</param>
/// <param name="userId"></param>
/// <returns></returns>
private static InventoryItemBase AddInventoryItem(
Scene scene, string itemName, UUID itemId, InventoryType itemType, AssetBase asset, UUID userId)
{
scene.AssetService.Store(asset);
InventoryItemBase item = new InventoryItemBase();
item.Name = itemName;
item.AssetID = asset.FullID;
item.ID = itemId;
item.Owner = userId;
item.AssetType = asset.Type;
item.InvType = (int)itemType;
InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, (AssetType)asset.Type);
item.Folder = folder.ID;
scene.AddInventoryItem(item);
return item;
}
示例8: MoveInventory
public UUID MoveInventory(Scene scene,UUID destID, string category, SceneObjectPart host, List<UUID> items)
{
InventoryFolderBase StoreFolder = new InventoryFolderBase();
List<InventoryFolderBase> m_invbase = new List<InventoryFolderBase> ();
m_invbase = inventoryService.GetInventorySkeleton (destID);
foreach (InventoryFolderBase current in m_invbase) {
if (current.Name.ToString () == "Web Store Items") {
StoreFolder = current;
}
}
UUID newFolderID = UUID.Random();
InventoryFolderBase newFolder = new InventoryFolderBase(newFolderID, category, destID, -1, StoreFolder.ID, StoreFolder.Version);
inventoryService.AddFolder(newFolder);
foreach (UUID itemID in items)
{
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(scene,destID, host, itemID);
if (agentItem != null)
{
agentItem.Folder = newFolderID;
scene.AddInventoryItem(agentItem);
}
}
ScenePresence avatar = null;
if (scene.TryGetScenePresence(destID, out avatar))
{
scene.SendInventoryUpdate(avatar.ControllingClient, StoreFolder, true, false);
scene.SendInventoryUpdate(avatar.ControllingClient, newFolder, false, true);
}
return newFolderID;
}