コード例 #1
0
    protected override void ChildrenExportToXML(XmlElement level_ele)
    {
        XmlDocument doc       = level_ele.OwnerDocument;
        XmlElement  enemy_ele = doc.CreateElement("EnemyInfo");

        level_ele.AppendChild(enemy_ele);

        enemy_ele.SetAttribute("enemyType", EnemyType.ToString());
        BuildInfo.ExportToXML(enemy_ele);

        XmlElement bonusGroupInfos_ele = doc.CreateElement("BonusGroupInfos");

        enemy_ele.AppendChild(bonusGroupInfos_ele);

        foreach (BonusGroup bg in BonusGroups)
        {
            bg.ExportToXML(bonusGroupInfos_ele);
        }

        CardPriority.ExportToXML(enemy_ele);

        XmlElement cardComboList_ele = doc.CreateElement("CardComboList");

        enemy_ele.AppendChild(cardComboList_ele);

        foreach (CardCombo cc in CardComboList)
        {
            cc.ExportToXML(cardComboList_ele);
        }
    }
コード例 #2
0
    public static void RefreshBuildXML(BuildGroups buildGroup, BuildInfo buildInfo)
    {
        buildInfo = buildInfo.Clone();
        Dictionary<string, BuildInfo> dict = BuildGroupDict[buildGroup].Builds;
        if (dict.ContainsKey(buildInfo.BuildName))
        {
            dict[buildInfo.BuildName] = buildInfo;
        }
        else
        {
            dict.Add(buildInfo.BuildName, buildInfo);
        }

        string text;
        using (StreamReader sr = new StreamReader(BuildGroupXMLDict[buildGroup]))
        {
            text = sr.ReadToEnd();
        }

        XmlDocument doc = new XmlDocument();
        doc.LoadXml(text);
        XmlElement allBuilds = doc.DocumentElement;
        buildInfo.ExportToXML(allBuilds);

        using (StreamWriter sw = new StreamWriter(BuildGroupXMLDict[buildGroup]))
        {
            doc.Save(sw);
        }
    }