コード例 #1
0
        private void ReadLevelDefFull()
        {
            try
            {
                XmlNode nodeMod = levelDefXmlDoc.SelectSingleNode("Level");
                foreach (XmlNode node in nodeMod.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "Game": ReadLevelDefGame(node); break;

                    case "Groups": ReadLevelDefGroup(node); break;

                    case "Data": break;

                    default:
                        if (ModManager.LevelDefCustomPropertySolver.ContainsKey(node.Name))
                        {
                            ModManager.LevelDefCustomPropertySolver[node.Name](node, this);
                        }
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                GameLogger.Error(TAG, (object)("Failed to solve LevelDef.xml : " + e.Message));
                GameLogger.Exception(e);
            }
        }
コード例 #2
0
        //读取模组定义文件
        private void ReadLevelDef(string defText)
        {
            LevelDefText = defText;
            try
            {
                levelDefXmlDoc = new XmlDocument();
                levelDefXmlDoc.LoadXml(defText);

                XmlNode nodeMod = levelDefXmlDoc.SelectSingleNode("Level");
                foreach (XmlNode node in nodeMod.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "BaseInfo": ReadLevelDefBaseInfo(node); break;

                    case "Compatibility": ReadLevelDefCompatibility(node); break;
                    }
                }
            }
            catch (Exception e)
            {
                GameLogger.Error(TAG, (object)("Failed to solve LevelDef.xml : " + e.Message));
                GameLogger.Exception(e);
            }
        }