本文整理汇总了C#中OpenSim.Framework.AvatarAppearance.GetAssetsFrom方法的典型用法代码示例。如果您正苦于以下问题:C# AvatarAppearance.GetAssetsFrom方法的具体用法?C# AvatarAppearance.GetAssetsFrom怎么用?C# AvatarAppearance.GetAssetsFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Framework.AvatarAppearance
的用法示例。
在下文中一共展示了AvatarAppearance.GetAssetsFrom方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AvatarIsWearing
/// <summary>
/// Update what the avatar is wearing using an item from their inventory.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void AvatarIsWearing(IClientAPI client, AvatarWearingArgs e)
{
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
if (sp == null)
{
m_log.WarnFormat("[AVATAR FACTORY MODULE]: AvatarIsWearing unable to find presence for {0}", client.AgentId);
return;
}
// m_log.WarnFormat("[AVATAR FACTORY MODULE]: AvatarIsWearing called for {0}", client.AgentId);
AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (wear.Type < AvatarWearable.MAX_WEARABLES)
avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero);
}
avatAppearance.GetAssetsFrom(sp.Appearance);
// This could take awhile since it needs to pull inventory
SetAppearanceAssets(sp.UUID, ref avatAppearance);
sp.Appearance = avatAppearance;
m_scene.AvatarService.SetAppearance(client.AgentId, sp.Appearance);
}
示例2: AvatarIsWearing
//.........这里部分代码省略.........
item.CurrentPermissions = 0;//Locked
if (m_underPantsUUID == UUID.Zero)
{
m_underPantsUUID = UUID.Random ();
AssetBase asset = new AssetBase(m_underPantsUUID, "Default Underpants", AssetType.Clothing,
UUID.Zero) {Data = Utils.StringToBytes(m_defaultUnderPants)};
asset.FillHash();
asset.ID = m_scene.AssetService.Store(asset);
m_underPantsUUID = asset.ID;
}
item.CreatorId = UUID.Zero.ToString ();
item.AssetID = m_underPantsUUID;
m_scene.InventoryService.AddItem(item);
client.SendInventoryItemCreateUpdate(item, 0);
wear.ItemID = item.ID;
}
if (wear.Type == 11 && wear.ItemID == UUID.Zero && module.DefaultUndershirt != UUID.Zero)
{
NeedsRebake = true;
wear.ItemID = module.DefaultUndershirt;
InventoryItemBase item = new InventoryItemBase(UUID.Random());
item.InvType = (int)InventoryType.Wearable;
item.AssetType = (int)AssetType.Clothing;
item.Name = "Default Undershirt";
item.Folder = m_scene.InventoryService.GetFolderForType(client.AgentId, InventoryType.Wearable, AssetType.Clothing).ID;
item.Owner = client.AgentId;
item.CurrentPermissions = 0;//Locked
item.CreatorId = UUID.Zero.ToString();
item.AssetID = module.DefaultUndershirt;
client.SendInventoryItemCreateUpdate(item, 0);
}
else if (wear.Type == 11 & wear.ItemID == UUID.Zero)
{
NeedsRebake = true;
InventoryItemBase item = new InventoryItemBase (UUID.Random());
item.InvType = (int)InventoryType.Wearable;
item.AssetType = (int)AssetType.Clothing;
item.Name = "Default Undershirt";
item.Folder = m_scene.InventoryService.GetFolderForType (client.AgentId, InventoryType.Wearable, AssetType.Clothing).ID;
item.Owner = client.AgentId;
item.CurrentPermissions = 0;//Locked
if (m_underShirtUUID == UUID.Zero)
{
m_underShirtUUID = UUID.Random ();
AssetBase asset = new AssetBase(m_underShirtUUID, "Default Undershirt", AssetType.Clothing,
UUID.Zero) {Data = Utils.StringToBytes(m_defaultUnderShirt)};
asset.FillHash();
asset.ID = m_scene.AssetService.Store(asset);
m_underShirtUUID = asset.ID;
}
item.CreatorId = UUID.Zero.ToString ();
item.AssetID = m_underShirtUUID;
m_scene.InventoryService.AddItem(item);
client.SendInventoryItemCreateUpdate(item, 0);
wear.ItemID = item.ID;
}
}
}
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (wear.Type < AvatarWearable.MAX_WEARABLES)
{
/*if (incomingLinks.ContainsKey (wear.ItemID))
{
wear.ItemID = incomingLinks[wear.ItemID];
}*/
avatAppearance.Wearables[wear.Type].Add (wear.ItemID, UUID.Zero);
}
}
avatAppearance.GetAssetsFrom (appearance.Appearance);
// This could take awhile since it needs to pull inventory
SetAppearanceAssets(sp.UUID, ref avatAppearance);
// could get fancier with the locks here, but in the spirit of "last write wins"
// this should work correctly, also, we don't need to send the appearance here
// since the "iswearing" will trigger a new set of visual param and baked texture changes
// when those complete, the new appearance will be sent
appearance.Appearance = avatAppearance;
if (NeedsRebake)
{
//Tell the client about the new things it is wearing
sp.ControllingClient.SendWearables (appearance.Appearance.Wearables, appearance.Appearance.Serial);
//Then forcefully tell it to rebake
for (int i = 0; i < appearance.Appearance.Texture.FaceTextures.Length; i++)
{
Primitive.TextureEntryFace face = (appearance.Appearance.Texture.FaceTextures[i]);
if (face != null)
sp.ControllingClient.SendRebakeAvatarTextures (face.TextureID);
}
}
QueueAppearanceSave(sp.UUID);
//Send the wearables HERE so that the client knows what it is wearing
//sp.ControllingClient.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial);
//Do not save or send the appearance! The client loops back and sends a bunch of SetAppearance
// (handled above) and that takes care of it
}
示例3: AvatarIsWearing
/// <summary>
/// Update what the avatar is wearing using an item from their inventory.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void AvatarIsWearing(IClientAPI client, AvatarWearingArgs e)
{
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
if (sp == null)
{
m_log.WarnFormat("[AvatarFactory]: AvatarIsWearing unable to find presence for {0}", client.AgentId);
return;
}
m_log.DebugFormat("[AvatarFactory]: AvatarIsWearing called for {0}", client.AgentId);
// operate on a copy of the appearance so we don't have to lock anything
AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (wear.Type < AvatarWearable.MAX_WEARABLES)
avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero);
}
avatAppearance.GetAssetsFrom(sp.Appearance);
// This could take awhile since it needs to pull inventory
SetAppearanceAssets(sp.UUID, ref avatAppearance);
// could get fancier with the locks here, but in the spirit of "last write wins"
// this should work correctly, also, we don't need to send the appearance here
// since the "iswearing" will trigger a new set of visual param and baked texture changes
// when those complete, the new appearance will be sent
sp.Appearance = avatAppearance;
//Send the wearables HERE so that the client knows what it is wearing
//sp.ControllingClient.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial);
//Do not save or send the appearance! The client loops back and sends a bunch of SetAppearance
// (handled above) and that takes care of it
}
示例4: Client_OnAvatarNowWearing
/// <summary>
/// Update what the avatar is wearing using an item from their inventory.
/// </summary>
/// <param name="client"></param>
/// <param name="e"></param>
private void Client_OnAvatarNowWearing(IClientAPI client, AvatarWearingArgs e)
{
// m_log.WarnFormat("[AVFACTORY]: Client_OnAvatarNowWearing called for {0} ({1})", client.Name, client.AgentId);
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
if (sp == null)
{
m_log.WarnFormat("[AVFACTORY]: Client_OnAvatarNowWearing unable to find presence for {0}", client.AgentId);
return;
}
// we need to clean out the existing textures
sp.Appearance.ResetAppearance();
// operate on a copy of the appearance so we don't have to lock anything yet
AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (wear.Type < AvatarWearable.MAX_WEARABLES)
avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero);
}
avatAppearance.GetAssetsFrom(sp.Appearance);
lock (m_setAppearanceLock)
{
// Update only those fields that we have changed. This is important because the viewer
// often sends AvatarIsWearing and SetAppearance packets at once, and AvatarIsWearing
// shouldn't overwrite the changes made in SetAppearance.
sp.Appearance.Wearables = avatAppearance.Wearables;
sp.Appearance.Texture = avatAppearance.Texture;
// We don't need to send the appearance here since the "iswearing" will trigger a new set
// of visual param and baked texture changes. When those complete, the new appearance will be sent
QueueAppearanceSave(client.AgentId);
}
}
示例5: AvatarIsWearing
/// <summary>
/// Update what the avatar is wearing using an item from their inventory.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void AvatarIsWearing(IClientAPI client, AvatarWearingArgs e)
{
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
if (sp == null)
{
m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing unable to find presence for {0}", client.AgentId);
return;
}
// m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId);
// operate on a copy of the appearance so we don't have to lock anything
AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (wear.Type < AvatarWearable.MAX_WEARABLES)
avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero);
}
avatAppearance.GetAssetsFrom(sp.Appearance);
// This could take awhile since it needs to pull inventory
SetAppearanceAssets(sp.UUID, ref avatAppearance);
// could get fancier with the locks here, but in the spirit of "last write wins"
// this should work correctly, also, we don't need to send the appearance here
// since the "iswearing" will trigger a new set of visual param and baked texture changes
// when those complete, the new appearance will be sent
sp.Appearance = avatAppearance;
QueueAppearanceSave(client.AgentId);
}