コード例 #1
0
ファイル: Body.cs プロジェクト: FilippoLeon/ProjectMandragola
    public void ReadXml(XmlReader reader)
    {
        reader.MoveToContent();

        id = reader.GetAttribute("id");
        Debug.Assert(id != null, string.Format("Invalid Body id, name = {0}", name));
        name = reader.GetAttribute("name");
        if (name == null)
        {
            name = id;
        }
        type = reader.GetAttribute("type");

        while (reader.Read())
        {
            XmlNodeType nodeType = reader.NodeType;
            switch (nodeType)
            {
            case XmlNodeType.Element:
                if (reader.Name.Equals("Management"))
                {
                    BodyManagement bm      = new BodyManagement(this);
                    XmlReader      subtree = reader.ReadSubtree();
                    bm.ReadXml(subtree);
                    government.addPower(bm);
                    subtree.Close();
                }
                break;

            case XmlNodeType.EndElement:
            default:
                break;
            }
        }
        //Debug.Log("New body with id = " + id);
    }