本文整理汇总了C#中WearableType类的典型用法代码示例。如果您正苦于以下问题:C# WearableType类的具体用法?C# WearableType怎么用?C# WearableType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WearableType类属于命名空间,在下文中一共展示了WearableType类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WearableItem
public WearableItem(string wearableName, WearableType type)
{
WearableName = wearableName;
WearType = type;
}
示例2: WearableTypeToAssetType
/// <summary>
/// Converts a WearableType to a bodypart or clothing WearableType
/// </summary>
/// <param name="type">A WearableType</param>
/// <returns>AssetType.Bodypart or AssetType.Clothing or AssetType.Unknown</returns>
public static AssetType WearableTypeToAssetType(WearableType type)
{
switch (type)
{
case WearableType.Shape:
case WearableType.Skin:
case WearableType.Hair:
case WearableType.Eyes:
return AssetType.Bodypart;
case WearableType.Shirt:
case WearableType.Pants:
case WearableType.Shoes:
case WearableType.Socks:
case WearableType.Jacket:
case WearableType.Gloves:
case WearableType.Undershirt:
case WearableType.Underpants:
case WearableType.Skirt:
case WearableType.Tattoo:
case WearableType.Alpha:
case WearableType.Physics:
return AssetType.Clothing;
default:
return AssetType.Unknown;
}
}
示例3: GetWearableAsset
/// <summary>
/// Returns the AssetID of the asset that is currently being worn in a
/// given WearableType slot
/// </summary>
/// <param name="type">WearableType slot to get the AssetID for</param>
/// <returns>The UUID of the asset being worn in the given slot, or
/// UUID.Zero if no wearable is attached to the given slot or wearables
/// have not been downloaded yet</returns>
public UUID GetWearableAsset(WearableType type)
{
WearableData wearable;
if (Wearables.TryGetValue(type, out wearable))
return wearable.AssetID;
else
return UUID.Zero;
}
示例4: WearableTypeToAssetType
private static AssetType WearableTypeToAssetType(WearableType type)
{
switch (type)
{
case WearableType.Shape:
case WearableType.Skin:
case WearableType.Hair:
case WearableType.Eyes:
return AssetType.Bodypart;
case WearableType.Shirt:
case WearableType.Pants:
case WearableType.Shoes:
case WearableType.Socks:
case WearableType.Jacket:
case WearableType.Gloves:
case WearableType.Undershirt:
case WearableType.Underpants:
case WearableType.Skirt:
return AssetType.Clothing;
default:
throw new Exception("Unhandled wearable type " + type);
}
}
示例5: Decode
public override bool Decode()
{
int version = -1;
Permissions = new Permissions();
string data = Utils.BytesToString(AssetData);
data = data.Replace("\r", String.Empty);
string[] lines = data.Split('\n');
for (int stri = 0; stri < lines.Length; stri++)
{
if (stri == 0)
{
string versionstring = lines[stri];
version = Int32.Parse(versionstring.Split(' ')[2]);
if (version != 22 && version != 18)
return false;
}
else if (stri == 1)
{
Name = lines[stri];
}
else if (stri == 2)
{
Description = lines[stri];
}
else
{
string line = lines[stri].Trim();
string[] fields = line.Split('\t');
if (fields.Length == 1)
{
fields = line.Split(' ');
if (fields[0] == "parameters")
{
int count = Int32.Parse(fields[1]) + stri;
for (; stri < count; )
{
stri++;
line = lines[stri].Trim();
fields = line.Split(' ');
int id = Int32.Parse(fields[0]);
if (fields[1] == ",")
fields[1] = "0";
else
fields[1] = fields[1].Replace(',', '.');
float weight = float.Parse(fields[1], System.Globalization.NumberStyles.Float,
Utils.EnUsCulture.NumberFormat);
Params[id] = weight;
}
}
else if (fields[0] == "textures")
{
int count = Int32.Parse(fields[1]) + stri;
for (; stri < count; )
{
stri++;
line = lines[stri].Trim();
fields = line.Split(' ');
AppearanceManager.TextureIndex id = (AppearanceManager.TextureIndex)Int32.Parse(fields[0]);
UUID texture = new UUID(fields[1]);
Textures[id] = texture;
}
}
else if (fields[0] == "type")
{
WearableType = (WearableType)Int32.Parse(fields[1]);
}
}
else if (fields.Length == 2)
{
switch (fields[0])
{
case "creator_mask":
// Deprecated, apply this as the base mask
Permissions.BaseMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "base_mask":
Permissions.BaseMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "owner_mask":
Permissions.OwnerMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "group_mask":
Permissions.GroupMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "everyone_mask":
Permissions.EveryoneMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "next_owner_mask":
Permissions.NextOwnerMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
break;
case "creator_id":
Creator = new UUID(fields[1]);
//.........这里部分代码省略.........
示例6: RequestCreateItem
public void RequestCreateItem(UUID parentFolder, string name, string description, AssetType type,
InventoryType invType, WearableType wearableType, PermissionMask nextOwnerMask,
ItemCreatedCallback callback)
{
RequestCreateItem(parentFolder, name, description, type, UUID.Zero, invType, wearableType, nextOwnerMask, callback);
}
示例7: Decode
public override void Decode()
{
int version = -1;
int n = -1;
string data = Helpers.FieldToUTF8String(AssetData);
n = data.IndexOf('\n');
version = Int32.Parse(data.Substring(19, n - 18));
data = data.Remove(0, n);
if (version != 22)
throw new Exception("Wearable asset has unrecognized version " + version);
n = data.IndexOf('\n');
Name = data.Substring(0, n);
data = data.Remove(0, n);
n = data.IndexOf('\n');
Description = data.Substring(0, n);
data = data.Remove(0, n);
// Split in to an upper and lower half
string[] parts = data.Split(new string[] { "parameters" }, StringSplitOptions.None);
parts[1] = "parameters" + parts[1];
Permissions = new Permissions();
// Parse the upper half
string[] lines = parts[0].Split('\n');
foreach (string thisline in lines)
{
string line = thisline.Trim();
string[] fields = line.Split('\t');
if (fields.Length == 2)
{
if (fields[0] == "creator_mask")
{
// Deprecated, apply this as the base mask
Permissions.BaseMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
}
else if (fields[0] == "base_mask")
{
Permissions.BaseMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
}
else if (fields[0] == "owner_mask")
{
Permissions.OwnerMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
}
else if (fields[0] == "group_mask")
{
Permissions.GroupMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
}
else if (fields[0] == "everyone_mask")
{
Permissions.EveryoneMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
}
else if (fields[0] == "next_owner_mask")
{
Permissions.NextOwnerMask = (PermissionMask)UInt32.Parse(fields[1], System.Globalization.NumberStyles.HexNumber);
}
else if (fields[0] == "creator_id")
{
Creator = new LLUUID(fields[1]);
}
else if (fields[0] == "owner_id")
{
Owner = new LLUUID(fields[1]);
}
else if (fields[0] == "last_owner_id")
{
LastOwner = new LLUUID(fields[1]);
}
else if (fields[0] == "group_id")
{
Group = new LLUUID(fields[1]);
}
else if (fields[0] == "group_owned")
{
GroupOwned = (Int32.Parse(fields[1]) != 0);
}
else if (fields[0] == "sale_type")
{
ForSale = InventoryManager.StringToSaleType(fields[1]);
}
else if (fields[0] == "sale_price")
{
SalePrice = Int32.Parse(fields[1]);
}
}
else if (line.StartsWith("type "))
{
WearableType = (WearableType)Int32.Parse(line.Substring(5));
break;
}
}
// Break up the lower half in to parameters and textures
string[] lowerparts = parts[1].Split(new string[] { "textures" }, StringSplitOptions.None);
lowerparts[1] = "textures" + lowerparts[1];
//.........这里部分代码省略.........
示例8: CreateItem
private static UUID CreateItem(Dictionary<UUID, InventoryBase> inventory, UUID parentID, string name, string description,
WearableType wearableType, UUID assetID, string assetType, UUID agentID)
{
InventoryItem item = new InventoryItem();
item.ID = UUID.Random();
item.Name = name;
item.Description = description;
item.OwnerID = agentID;
item.ParentID = parentID;
item.AssetID = assetID;
item.ContentType = assetType;
item.CreationDate = DateTime.UtcNow;
// HACK: Set LLInventoryItem flags
item.ExtraData["flags"] = OSD.FromInteger((int)wearableType);
// HACK: Set default LLInventoryItem permissions
Permissions perm = Permissions.NoPermissions;
perm.BaseMask = PermissionMask.All;
perm.OwnerMask = PermissionMask.All;
perm.NextOwnerMask = PermissionMask.All;
item.ExtraData["permissions"] = perm.GetOSD();
InventoryBase parent;
if (inventory.TryGetValue(parentID, out parent) && parent is InventoryFolder)
((InventoryFolder)parent).Children[item.ID] = item;
inventory[item.ID] = item;
return item.ID;
}
示例9: GetWornAt
public List<InventoryItem> GetWornAt(WearableType type)
{
var ret = new List<InventoryItem>();
ContentLinks().ForEach(link =>
{
var item = RealInventoryItem(link);
if (item is InventoryWearable)
{
var w = (InventoryWearable)item;
if (w.WearableType == type)
{
ret.Add(item);
}
}
});
return ret;
}
示例10: GetDefaultItem
private UUID GetDefaultItem(WearableType wearable)
{
// These are ruth
UUID ret = UUID.Zero;
switch (wearable)
{
case WearableType.Eyes:
ret = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7");
break;
case WearableType.Hair:
ret = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66");
break;
case WearableType.Pants:
ret = new UUID("00000000-38f9-1111-024e-222222111120");
break;
case WearableType.Shape:
ret = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
break;
case WearableType.Shirt:
ret = new UUID("00000000-38f9-1111-024e-222222111110");
break;
case WearableType.Skin:
ret = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb");
break;
case WearableType.Undershirt:
ret = new UUID("16499ebb-3208-ec27-2def-481881728f47");
break;
case WearableType.Underpants:
ret = new UUID("4ac2e9c7-3671-d229-316a-67717730841d");
break;
}
return ret;
}
示例11: TryAndRepairBrokenWearable
private void TryAndRepairBrokenWearable(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance)
{
UUID defaultwearable = GetDefaultItem(type);
if (defaultwearable != UUID.Zero)
{
UUID newInvItem = UUID.Random();
InventoryItemBase itembase = new InventoryItemBase(newInvItem, userID)
{
AssetID = defaultwearable,
AssetType = (int)FolderType.BodyPart,
CreatorId = userID.ToString(),
//InvType = (int)InventoryType.Wearable,
Description = "Failed Wearable Replacement",
Folder = invService.GetFolderForType(userID, FolderType.BodyPart).ID,
Flags = (uint) type, Name = Enum.GetName(typeof (WearableType), type),
BasePermissions = (uint) PermissionMask.Copy,
CurrentPermissions = (uint) PermissionMask.Copy,
EveryOnePermissions = (uint) PermissionMask.Copy,
GroupPermissions = (uint) PermissionMask.Copy,
NextPermissions = (uint) PermissionMask.Copy
};
invService.AddItem(itembase);
UUID LinkInvItem = UUID.Random();
itembase = new InventoryItemBase(LinkInvItem, userID)
{
AssetID = newInvItem,
AssetType = (int)AssetType.Link,
CreatorId = userID.ToString(),
InvType = (int) InventoryType.Wearable,
Description = "Failed Wearable Replacement",
Folder = invService.GetFolderForType(userID, FolderType.CurrentOutfit).ID,
Flags = (uint) type,
Name = Enum.GetName(typeof (WearableType), type),
BasePermissions = (uint) PermissionMask.Copy,
CurrentPermissions = (uint) PermissionMask.Copy,
EveryOnePermissions = (uint) PermissionMask.Copy,
GroupPermissions = (uint) PermissionMask.Copy,
NextPermissions = (uint) PermissionMask.Copy
};
invService.AddItem(itembase);
appearance.Wearables[(int)type] = new AvatarWearable(newInvItem, GetDefaultItem(type));
ScenePresence presence = null;
if (m_scene.TryGetScenePresence(userID, out presence))
{
m_scene.SendInventoryUpdate(presence.ControllingClient,
invService.GetFolderForType(userID, FolderType.CurrentOutfit), false, true);
}
}
}
示例12: GetWearableAsset
/// <summary>
/// Returns the assetID for a given WearableType
/// </summary>
/// <param name="type">the <seealso cref="OpenMetaverse.WearableType"/> of the asset</param>
/// <returns>The <seealso cref="OpenMetaverse.Guid"/> of the WearableType</returns>
public Guid GetWearableAsset(WearableType type)
{
WearableData wearable;
if (Wearables.TryGetValue(type, out wearable))
return wearable.Item.AssetGuid;
else
return Guid.Empty;
}
示例13: RequestCreateItem
public void RequestCreateItem(LLUUID parentFolder, string name, string description, AssetType type,
InventoryType invType, WearableType wearableType, PermissionMask nextOwnerMask,
ItemCreatedCallback callback)
{
CreateInventoryItemPacket create = new CreateInventoryItemPacket();
create.AgentData.AgentID = _Client.Self.AgentID;
create.AgentData.SessionID = _Client.Self.SessionID;
create.InventoryBlock.CallbackID = RegisterItemCreatedCallback(callback);
create.InventoryBlock.FolderID = parentFolder;
create.InventoryBlock.TransactionID = LLUUID.Random();
create.InventoryBlock.NextOwnerMask = (uint)nextOwnerMask;
create.InventoryBlock.Type = (sbyte)type;
create.InventoryBlock.InvType = (sbyte)invType;
create.InventoryBlock.WearableType = (byte)wearableType;
create.InventoryBlock.Name = Helpers.StringToField(name);
create.InventoryBlock.Description = Helpers.StringToField(description);
_Client.Network.SendPacket(create);
}
示例14: InventoryWearable
/// <summary>
///
/// </summary>
/// <param name="manager"></param>
/// <param name="name"></param>
/// <param name="description"></param>
/// <param name="folderID"></param>
/// <param name="uuidOwnerCreater"></param>
internal InventoryWearable(InventoryManager manager, string name, string description, LLUUID folderID, LLUUID uuidOwnerCreater, WearableType wtype)
: base(manager, name, description, folderID, 18, (sbyte)wtype, uuidOwnerCreater)
{
}