コード例 #1
0
        public StructurePart(XmlNode node)
            : this()
        {
            bIsRoot = (node.Name == "ROOT");

            foreach (XmlAttribute attribute in node.Attributes)
            {
                switch (attribute.Name)
                {
                    case "name":
                        this.name = attribute.Value;
                        break;

                    default:
                        throw new NotImplementedException("Unknown Part attribute: " + attribute.Name);
                }
            }

            foreach (XmlNode data in node.ChildNodes)
            {
                switch (data.NodeType)
                {
                    case XmlNodeType.CDATA:
                        this.damage = StructureDamageCode.Parse(data.InnerText);
                        break;

                    case XmlNodeType.Element:
                        switch (data.Name)
                        {
                            case "PART":
                                parts.Add(new StructurePart(data));
                                break;

                            case "WELD":
                                welds.Add(new StructureWeld(data));
                                break;

                            default:
                                throw new NotImplementedException("Unknown Element of PART: " + data.Name);
                        }
                        break;
                }
            }
        }
コード例 #2
0
        public StructurePart()
        {
            damage = new StructureDamageCode();

            parts = new List<StructurePart>();
            welds = new List<StructureWeld>();
        }