本文整理汇总了C#中Skeleton.AssignChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Skeleton.AssignChildren方法的具体用法?C# Skeleton.AssignChildren怎么用?C# Skeleton.AssignChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skeleton
的用法示例。
在下文中一共展示了Skeleton.AssignChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LstHeads_SelectedIndexChanged
/// <summary>
/// User clicked on an item in the list containing available heads and bodies.
/// </summary>
private void LstHeads_SelectedIndexChanged(object sender, EventArgs e)
{
if (m_Skeleton == null)
{
m_Skeleton = new Skeleton(this.Device, ContentManager.GetResourceFromLongID(0x100000005));
m_Skeleton.AssignChildren(ref m_Skeleton);
}
foreach(KeyValuePair<ulong, string> Pair in ContentManager.Resources)
{
if ((string)LstHeads.SelectedItem == Pair.Value)
{
//HAndGroup files are used to group together different hand meshes and textures.
if (Pair.Value.Contains(".hag"))
{
Hag HandGroup = new Hag(ContentManager.GetResourceFromLongID(Pair.Key));
m_CurrentAppearance = new Appearance(ContentManager.GetResourceFromLongID(
HandGroup.Appearances[0]));
LstAppearances.Items.Clear();
foreach (ulong AppearanceID in HandGroup.Appearances)
LstAppearances.Items.Add(AppearanceID);
List<Binding> Bindings = new List<Binding>();
foreach (ulong BindingID in m_CurrentAppearance.BindingIDs)
Bindings.Add(new Binding(ContentManager.GetResourceFromLongID(BindingID)));
m_Tex = Texture2D.FromFile(this.Device, new MemoryStream(
ContentManager.GetResourceFromLongID(Bindings[0].TextureAssetID)));
m_CurrentMesh = new Mesh(ContentManager.GetResourceFromLongID(Bindings[0].MeshAssetID), false);
LoadMesh(m_CurrentMesh);
}
else
{
PurchasableObject PO = new PurchasableObject(ContentManager.GetResourceFromLongID(Pair.Key));
m_CurrentOutfit = new Outfit(ContentManager.GetResourceFromLongID(PO.OutfitID));
m_CurrentAppearance = new Appearance(
ContentManager.GetResourceFromLongID(m_CurrentOutfit.LightAppearanceID));
LstAppearances.Items.Clear();
LstAppearances.Items.Add(m_CurrentOutfit.LightAppearanceID);
LstAppearances.Items.Add(m_CurrentOutfit.MediumAppearanceID);
LstAppearances.Items.Add(m_CurrentOutfit.DarkAppearanceID);
List<Binding> Bindings = new List<Binding>();
foreach (ulong BindingID in m_CurrentAppearance.BindingIDs)
Bindings.Add(new Binding(ContentManager.GetResourceFromLongID(BindingID)));
m_Tex = Texture2D.FromFile(this.Device, new MemoryStream(
ContentManager.GetResourceFromLongID(Bindings[0].TextureAssetID)));
//The file selected was most likely a body-mesh, so apply the adult skeleton to it.
if (Pair.Value.Contains("bodies"))
{
m_CurrentMesh = new Mesh(ContentManager.GetResourceFromLongID(Bindings[0].MeshAssetID), true);
m_CurrentMesh.TransformVertices2(m_Skeleton.Bones[0], ref mSimpleEffect);
m_CurrentMesh.BlendVertices2();
LoadMesh(m_CurrentMesh);
}
else
{
m_CurrentMesh = new Mesh(ContentManager.GetResourceFromLongID(Bindings[0].MeshAssetID), false);
LoadMesh(m_CurrentMesh);
}
}
m_LoadComplete = true;
}
}
}
示例2: LstAppearances_SelectedIndexChanged
/// <summary>
/// User clicked on an item in the list containing available appearances.
/// </summary>
private void LstAppearances_SelectedIndexChanged(object sender, EventArgs e)
{
if (m_Skeleton == null)
{
m_Skeleton = new Skeleton(this.Device, ContentManager.GetResourceFromLongID(0x100000005));
m_Skeleton.AssignChildren(ref m_Skeleton);
}
m_CurrentAppearance = new Appearance(ContentManager.GetResourceFromLongID(
(ulong)LstAppearances.SelectedItem));
List<Binding> Bindings = new List<Binding>();
foreach (ulong BindingID in m_CurrentAppearance.BindingIDs)
Bindings.Add(new Binding(ContentManager.GetResourceFromLongID(BindingID)));
m_Tex = Texture2D.FromFile(this.Device, new MemoryStream(
ContentManager.GetResourceFromLongID(Bindings[0].TextureAssetID)));
string SelectedStr = (string)LstHeads.SelectedItem;
if (SelectedStr.Contains("bodies"))
{
m_CurrentMesh = new Mesh(ContentManager.GetResourceFromLongID(Bindings[0].MeshAssetID), true);
m_CurrentMesh.TransformVertices2(m_Skeleton.Bones[0], ref mSimpleEffect);
m_CurrentMesh.BlendVertices2();
}
else
m_CurrentMesh = new Mesh(ContentManager.GetResourceFromLongID(Bindings[0].MeshAssetID), false);
LoadMesh(m_CurrentMesh);
}