Exemple #1
0
        static Part LoadParts(XElement ell)
        {
            Part part = new Part();

            if (ell.Attribute("helper") != null)
            {
                part.helper = ell.Attribute("helper").Value;
            }
            if (ell.Attribute("name") != null)
            {
                part.name = ell.Attribute("name").Value;                                  /*Console.WriteLine("part.name {0}", part.name);*/
            }
            if (ell.Attribute("class") != null)
            {
                part.partClass = ell.Attribute("class").Value;
            }
            if (part.partClass == "Animated" && ell.Element("Animated") != null)
            {
                part.animatedFilename = ell.Element("Animated").Attribute("filename").Value;
            }
            if (part.partClass == "SubPartWheel" && ell.Element("SubPart") != null)
            {
                part.animatedFilename = ell.Element("SubPart").Attribute("filename").Value;
            }
            //Console.WriteLine(part.name + " " + part.partClass + " " + part.animatedFilename);
            if (part.partClass == "ItemPort")
            {
                if (ell.Element("ItemPort") != null)
                {
                    if (ell.Element("ItemPort").Element("AttachmentPoints") != null)
                    {
                        foreach (XElement ellx in ell.Element("ItemPort").Element("AttachmentPoints").Elements("AttachmentPoint"))
                        {
                            AttachmentPoint attpoint = new AttachmentPoint();
                            attpoint.name = ellx.Attribute("name").Value;
                            attpoint.bone = ellx.Attribute("bone").Value;
                            part.attachmentPoints.Add(attpoint);
                            //Console.WriteLine(attpoint.name);
                        }
                    }
                }
            }
            foreach (XElement ell2 in ell.Elements("Parts").Elements("Part"))
            {
                Part part2 = new Part();
                part2 = LoadParts(ell2);
                part.parts.Add(part2);
            }

            return(part);
        }
Exemple #2
0
        public AttachmentPoint GetAttachmentPointByName(string attName)
        {
            AttachmentPoint attPoint = null;

            foreach (AttachmentPoint at in GetAllAttachmentPoints())
            {
                //Console.WriteLine("AttName {0} Bone {1}",at.name,at.bone);
                if (at.name == attName)
                {
                    attPoint = at;
                }
            }
            return(attPoint);
        }