本文整理汇总了C#中OpenSim.Framework.AvatarAppearance.SetAttachments方法的典型用法代码示例。如果您正苦于以下问题:C# AvatarAppearance.SetAttachments方法的具体用法?C# AvatarAppearance.SetAttachments怎么用?C# AvatarAppearance.SetAttachments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Framework.AvatarAppearance
的用法示例。
在下文中一共展示了AvatarAppearance.SetAttachments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnpackAgentCircuitData
/// <summary>
/// Unpack agent circuit data map into an AgentCiruitData object
/// </summary>
/// <param name="args"></param>
public void UnpackAgentCircuitData(OSDMap args)
{
if (args["agent_id"] != null)
AgentID = args["agent_id"].AsUUID();
if (args["base_folder"] != null)
BaseFolder = args["base_folder"].AsUUID();
if (args["caps_path"] != null)
CapsPath = args["caps_path"].AsString();
if ((args["children_seeds"] != null) && (args["children_seeds"].Type == OSDType.Array))
{
OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
ChildrenCapSeeds = new Dictionary<ulong, string>();
foreach (OSD o in childrenSeeds)
{
if (o.Type == OSDType.Map)
{
ulong handle = 0;
string seed = "";
OSDMap pair = (OSDMap)o;
if (pair["handle"] != null)
if (!UInt64.TryParse(pair["handle"].AsString(), out handle))
continue;
if (pair["seed"] != null)
seed = pair["seed"].AsString();
if (!ChildrenCapSeeds.ContainsKey(handle))
ChildrenCapSeeds.Add(handle, seed);
}
}
}
else
ChildrenCapSeeds = new Dictionary<ulong, string>();
if (args["child"] != null)
child = args["child"].AsBoolean();
if (args["circuit_code"] != null)
UInt32.TryParse(args["circuit_code"].AsString(), out circuitcode);
if (args["first_name"] != null)
firstname = args["first_name"].AsString();
if (args["last_name"] != null)
lastname = args["last_name"].AsString();
if (args["inventory_folder"] != null)
InventoryFolder = args["inventory_folder"].AsUUID();
if (args["secure_session_id"] != null)
SecureSessionID = args["secure_session_id"].AsUUID();
if (args["session_id"] != null)
SessionID = args["session_id"].AsUUID();
if (args["service_session_id"] != null)
ServiceSessionID = args["service_session_id"].AsString();
if (args["start_pos"] != null)
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
Appearance = new AvatarAppearance(AgentID);
if (args["appearance_serial"] != null)
Appearance.Serial = args["appearance_serial"].AsInteger();
if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
{
OSDArray wears = (OSDArray)(args["wearables"]);
for (int i = 0; i < wears.Count / 2; i++)
{
Appearance.Wearables[i].ItemID = wears[i*2].AsUUID();
Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID();
}
}
if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
{
OSDArray attachs = (OSDArray)(args["attachments"]);
AttachmentData[] attachments = new AttachmentData[attachs.Count];
int i = 0;
foreach (OSD o in attachs)
{
if (o.Type == OSDType.Map)
{
attachments[i++] = new AttachmentData((OSDMap)o);
}
}
Appearance.SetAttachments(attachments);
}
ServiceURLs = new Dictionary<string, object>();
if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array)
{
OSDArray urls = (OSDArray)(args["service_urls"]);
for (int i = 0; i < urls.Count / 2; i++)
{
ServiceURLs[urls[i * 2].AsString()] = urls[(i * 2) + 1].AsString();
//System.Console.WriteLine("XXX " + urls[i * 2].AsString() + "=" + urls[(i * 2) + 1].AsString());
}
}
}
示例2: GetUserAppearance
/// <summary>
/// Gets the user appearance.
/// </summary>
/// <param name="user">The user.</param>
/// <returns></returns>
override public AvatarAppearance GetUserAppearance(UUID user)
{
try
{
AvatarAppearance appearance = new AvatarAppearance();
string sql = "SELECT * FROM avatarappearance WHERE owner = @UUID";
using (AutoClosingSqlCommand command = database.Query(sql))
{
command.Parameters.Add(database.CreateParameter("@UUID", user));
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
appearance = readUserAppearance(reader);
else
{
m_log.WarnFormat("[USER DB] No appearance found for user {0}", user.ToString());
return null;
}
}
}
appearance.SetAttachments(GetUserAttachments(user));
return appearance;
}
catch (Exception e)
{
m_log.ErrorFormat("[USER DB] Error updating userfriend, error: {0}", e.Message);
}
return null;
}
示例3: ToAvatarAppearance
public AvatarAppearance ToAvatarAppearance(UUID owner)
{
AvatarAppearance appearance = new AvatarAppearance(owner);
try
{
appearance.Serial = Int32.Parse(Data["Serial"]);
// Wearables
appearance.BodyItem = UUID.Parse(Data["BodyItem"]);
appearance.EyesItem = UUID.Parse(Data["EyesItem"]);
appearance.GlovesItem = UUID.Parse(Data["GlovesItem"]);
appearance.HairItem = UUID.Parse(Data["HairItem"]);
appearance.JacketItem = UUID.Parse(Data["JacketItem"]);
appearance.PantsItem = UUID.Parse(Data["PantsItem"]);
appearance.ShirtItem = UUID.Parse(Data["ShirtItem"]);
appearance.ShoesItem = UUID.Parse(Data["ShoesItem"]);
appearance.SkinItem = UUID.Parse(Data["SkinItem"]);
appearance.SkirtItem = UUID.Parse(Data["SkirtItem"]);
appearance.SocksItem = UUID.Parse(Data["SocksItem"]);
appearance.UnderPantsItem = UUID.Parse(Data["UnderPantsItem"]);
appearance.UnderShirtItem = UUID.Parse(Data["UnderShirtItem"]);
appearance.BodyAsset = UUID.Parse(Data["BodyAsset"]);
appearance.EyesAsset = UUID.Parse(Data["EyesAsset"]);
appearance.GlovesAsset = UUID.Parse(Data["GlovesAsset"]);
appearance.HairAsset = UUID.Parse(Data["HairAsset"]);
appearance.JacketAsset = UUID.Parse(Data["JacketAsset"]);
appearance.PantsAsset = UUID.Parse(Data["PantsAsset"]);
appearance.ShirtAsset = UUID.Parse(Data["ShirtAsset"]);
appearance.ShoesAsset = UUID.Parse(Data["ShoesAsset"]);
appearance.SkinAsset = UUID.Parse(Data["SkinAsset"]);
appearance.SkirtAsset = UUID.Parse(Data["SkirtAsset"]);
appearance.SocksAsset = UUID.Parse(Data["SocksAsset"]);
appearance.UnderPantsAsset = UUID.Parse(Data["UnderPantsAsset"]);
appearance.UnderShirtAsset = UUID.Parse(Data["UnderShirtAsset"]);
appearance.AlphaAsset = UUID.Parse(Data["AlphaAsset"]);
appearance.AlphaItem = UUID.Parse(Data["AlphaItem"]);
appearance.TattooAsset = UUID.Parse(Data["TattooAsset"]);
appearance.TattooItem = UUID.Parse(Data["TattooItem"]);
// Attachments
Dictionary<string, string> attchs = new Dictionary<string, string>();
foreach (KeyValuePair<string, string> _kvp in Data)
if (_kvp.Key.StartsWith("_ap_"))
attchs[_kvp.Key] = _kvp.Value;
Hashtable aaAttachs = new Hashtable();
foreach (KeyValuePair<string, string> _kvp in attchs)
{
string pointStr = _kvp.Key.Substring(4);
int point = 0;
if (!Int32.TryParse(pointStr, out point))
continue;
Hashtable tmp = new Hashtable();
UUID uuid = UUID.Zero;
UUID.TryParse(_kvp.Value, out uuid);
tmp["item"] = uuid;
tmp["asset"] = UUID.Zero.ToString();
aaAttachs[point] = tmp;
}
appearance.SetAttachments(aaAttachs);
}
catch { }
return appearance;
}