当前位置: 首页>>代码示例>>C#>>正文


C# Skeleton.AssignChildren方法代码示例

本文整理汇总了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;
                }
            }
        }
开发者ID:pepster98,项目名称:Project-Dollhouse,代码行数:79,代码来源:Form1.cs

示例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);
        }
开发者ID:pepster98,项目名称:Project-Dollhouse,代码行数:34,代码来源:Form1.cs


注:本文中的Skeleton.AssignChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。