本文整理汇总了C#中OpenMetaverse.InventoryBase类的典型用法代码示例。如果您正苦于以下问题:C# InventoryBase类的具体用法?C# InventoryBase怎么用?C# InventoryBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InventoryBase类属于OpenMetaverse命名空间,在下文中一共展示了InventoryBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RezAll
public string RezAll(BotInventoryEval man, InventoryBase b, SimPosition dest)
{
string ret = "";
var manager = man.Manager;
if (b is InventoryItem)
{
InventoryItem item = b as InventoryItem;
bool canCopy = (item.Permissions.OwnerMask & PermissionMask.Copy) == PermissionMask.Copy;
ret += item.Name + nl;
if (dest == null)
{
Simulator sim = Client.Network.CurrentSim;
Client.Inventory.RequestRestoreRezFromInventory(sim, item, item.UUID);
}
else
{
Simulator sim = SimRegion.GetRegion(dest.GlobalPosition).TheSimulator;
Client.Inventory.RequestRezFromInventory(sim, dest.SimRotation, dest.SimPosition, item, UUID.Zero);
}
}
else if (b is InventoryFolder)
{
InventoryFolder folder = b as InventoryFolder;
List<InventoryBase> folderContents = man.FolderContents(folder.UUID);
if (folderContents != null)
foreach (InventoryBase list in folderContents)
{
ret += RezAll(man, list, dest);
}
}
return ret;
}
示例2: InventoryNode
/// <summary>
/// De-serialization constructor for the InventoryNode Class
/// </summary>
public InventoryNode(InventoryBase data, InventoryNode parent)
{
this.data = data;
this.parent = parent;
if (parent != null)
{
// Add this node to the collection of parent nodes
lock (parent.Nodes.SyncRoot) parent.Nodes.Add(data.UUID, this);
}
}
示例3: CompareNodes
public int CompareNodes(InventoryBase x, InventoryBase y, TreeNode nodeX, TreeNode nodeY)
{
int returnVal = 0;
if (x is InventoryItem && y is InventoryItem)
{
InventoryItem itemX = (InventoryItem)x;
InventoryItem itemY = (InventoryItem)y;
returnVal = -itemX.CreationDate.CompareTo(itemY.CreationDate);
}
else if (x is InventoryFolder && y is InventoryFolder)
returnVal = nodeX.Text.CompareTo(nodeY.Text);
else if (x is InventoryFolder && y is InventoryItem)
returnVal = 1;
else if (x is InventoryItem && y is InventoryFolder)
returnVal = -1;
return returnVal;
}
示例4: GiveAll
public string GiveAll(BotInventoryEval man, InventoryBase b, SimObject dest, bool moveInsteadOfCopy)
{
string ret = "";
var manager = man.Manager;
if (b is InventoryItem)
{
InventoryItem item = b as InventoryItem;
bool canCopy = (item.Permissions.OwnerMask & PermissionMask.Copy) == PermissionMask.Copy;
ret += item.Name + nl;
if (dest.IsAvatar)
{
manager.GiveItem(item.UUID, item.Name, item.AssetType, dest.ID, true);
}
else
{
throw new NotImplementedException("giving items to objects");
}
}
else if (b is InventoryFolder)
{
InventoryFolder item = b as InventoryFolder;
if (dest.IsAvatar)
{
manager.GiveFolder(item.UUID, item.Name, AssetType.Folder, dest.ID, true);
return item.Name + nl;
}
InventoryFolder folder = b as InventoryFolder;
List<InventoryBase> folderContents = man.FolderContents(folder.UUID);
if (folderContents != null)
foreach (InventoryBase list in folderContents)
{
ret += GiveAll(man, list, dest, moveInsteadOfCopy);
}
}
return ret;
}
示例5: Equals
/// <summary>
/// Determine whether the specified <seealso cref="OpenMetaverse.InventoryBase"/> object is equal to the current object
/// </summary>
/// <param name="o">The <seealso cref="OpenMetaverse.InventoryBase"/> object to compare against</param>
/// <returns>true if objects are the same</returns>
public override bool Equals(InventoryBase o)
{
InventoryItem item = o as InventoryItem;
return item != null && Equals(item);
}
示例6: Exec_OnInventoryObjectAdded
void Exec_OnInventoryObjectAdded(InventoryBase obj)
{
if (InvokeRequired)
{
Invoke(new MethodInvoker(delegate()
{
Exec_OnInventoryObjectAdded(obj);
}
));
return;
}
lock (attachments)
{
if (attachments.ContainsKey(obj.UUID))
{
attachments[obj.UUID].Item = (InventoryItem)obj;
}
}
TreeNode parent = findNodeForItem(obj.ParentUUID);
if (parent != null)
{
TreeNode newNode = AddBase(parent, obj);
if (obj.Name == newItemName)
{
if (newNode.Parent.IsExpanded)
{
newNode.BeginEdit();
}
else
{
newNode.Parent.Expand();
}
}
}
newItemName = string.Empty;
}
示例7: Exec_OnInventoryObjectUpdated
void Exec_OnInventoryObjectUpdated(InventoryBase oldObject, InventoryBase newObject)
{
if (newObject == null) return;
if (InvokeRequired)
{
BeginInvoke(new MethodInvoker(() => Exec_OnInventoryObjectUpdated(oldObject, newObject)));
return;
}
lock (attachments)
{
if (attachments.ContainsKey(newObject.UUID))
{
attachments[newObject.UUID].Item = (InventoryItem)newObject;
}
}
// Find our current node in the tree
TreeNode currentNode = findNodeForItem(newObject.UUID);
// Find which node should be our parrent
TreeNode parent = findNodeForItem(newObject.ParentUUID);
if (parent == null) return;
if (currentNode != null)
{
// Did we move to a different folder
if (currentNode.Parent != parent)
{
TreeNode movedNode = (TreeNode)currentNode.Clone();
movedNode.Tag = newObject;
parent.Nodes.Add(movedNode);
removeNode(currentNode);
cacheNode(movedNode);
}
else // Update
{
currentNode.Tag = newObject;
currentNode.Text = ItemLabel(newObject, false);
currentNode.Name = newObject.Name;
}
}
else // We are not in the tree already, add
{
AddBase(parent, newObject);
}
}
示例8: ItemLabel
/// <summary>
/// Returns text of the label
/// </summary>
/// <param name="invBase">Inventory item</param>
/// <param name="returnRaw">Should we return raw text, or if false decorated text with (worn) info, and (no copy) etc. permission info</param>
/// <returns></returns>
public string ItemLabel(InventoryBase invBase, bool returnRaw)
{
if (returnRaw || (invBase is InventoryFolder))
return invBase.Name;
InventoryItem item = (InventoryItem)invBase;
string raw = item.Name;
if (item.IsLink())
{
raw += " (link)";
if (Inventory.Contains(item.AssetUUID) && Inventory[item.AssetUUID] is InventoryItem)
{
item = (InventoryItem)Inventory[item.AssetUUID];
}
}
if ((item.Permissions.OwnerMask & PermissionMask.Modify) == 0)
raw += " (no modify)";
if ((item.Permissions.OwnerMask & PermissionMask.Copy) == 0)
raw += " (no copy)";
if ((item.Permissions.OwnerMask & PermissionMask.Transfer) == 0)
raw += " (no transfer)";
if (IsWorn(item))
raw += " (worn)";
if (IsAttached(item))
{
raw += " (worn on " + AttachedTo(item).ToString() + ")";
}
return raw;
}
示例9: OnItemChange
void OnItemChange(object sender, TreeViewEventArgs e)
{
selected = (InventoryBase)e.Node.Tag;
SayWhere();
}
示例10: DescriptiveName
string DescriptiveName(InventoryBase item)
{
string name = NiceName(item.Name);
if (item is InventoryFolder)
return name + " folder";
if (item is InventoryNotecard)
return name + ", a notecard";
if (item is InventoryWearable)
return name + ", a " + WearableType(item as InventoryWearable);
if (item is InventoryLandmark)
return name + ", a landmark";
// TODO other types
return name;
}
示例11: CanBeWorn
/// <summary>
/// Can this inventory type be worn
/// </summary>
/// <param name="item">Item to check</param>
/// <returns>True if the inventory item can be worn</returns>
public static bool CanBeWorn(InventoryBase item)
{
return item is InventoryWearable || item is InventoryAttachment || item is InventoryObject;
}
示例12: Equals
/// <summary>
/// Determine whether the specified <seealso cref="OpenMetaverse.InventoryBase"/> object is equal to the current object
/// </summary>
/// <param name="o">InventoryBase object to compare against</param>
/// <returns>true if objects are the same</returns>
public virtual bool Equals(InventoryBase o)
{
return o.Guid == Guid
&& o.ParentGuid == ParentGuid
&& o.Name == Name
&& o.OwnerID == OwnerID;
}
示例13: Move
/// <summary>
/// Move an inventory item or folder to a new location
/// </summary>
/// <param name="item">The <seealso cref="T:InventoryBase"/> item or folder to move</param>
/// <param name="newParent">The <seealso cref="T:InventoryFolder"/> to move item or folder to</param>
public void Move(InventoryBase item, InventoryFolder newParent)
{
if (item is InventoryFolder)
MoveFolder(item.Guid, newParent.Guid);
else
MoveItem(item.Guid, newParent.Guid);
}
示例14: Inventory_OnInventoryItemCopied
private void Inventory_OnInventoryItemCopied(InventoryBase item)
{
if (InvokeRequired)
{
if (!instance.MonoRuntime || IsHandleCreated)
BeginInvoke(new MethodInvoker(() => Inventory_OnInventoryItemCopied(item)));
return;
}
if (null == item) return;
instance.TabConsole.DisplayNotificationInChat(
string.Format("{0} saved to inventory", item.Name),
ChatBufferTextStyle.Invisible);
tlblStatus.Text = "Saved";
if (item is InventoryNotecard)
{
Notecard nc = new Notecard(instance, (InventoryNotecard)item);
nc.pnlKeepDiscard.Visible = true;
nc.ShowDetached();
}
}
示例15: InventoryClipboard
public InventoryClipboard(ClipboardOperation operation, InventoryBase item)
{
Operation = operation;
Item = item;
}