ShootSolutionSector _LoadShootSolutionSector(int idx, string strFileName, bool bForEditor) { ShootSolutionSector sector = new ShootSolutionSector(idx); //读取以及处理XML文本的类 XmlDocument xmlDoc; if (bForEditor) { xmlDoc = new XmlDocument(); xmlDoc.Load("Assets/Resources/" + GlobalConst.DIR_XML_SHOOT_SOLUTION + strFileName + ".xml"); } else { xmlDoc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_SHOOT_SOLUTION + strFileName); } //解析xml的过程 int iSolutionIdx = 0; XmlNodeList nodelist = xmlDoc.SelectNodes("root/success"); foreach (XmlElement elem in nodelist) { ShootSolution sucSolution = new ShootSolution(idx * 1000 + iSolutionIdx); if (!sucSolution.Create(elem, true, bForEditor)) { continue; } sector.success.Add(sucSolution); iSolutionIdx++; } nodelist = xmlDoc.SelectNodes("root/fail"); foreach (XmlElement elem in nodelist) { ShootSolution failSolution = new ShootSolution(idx * 1000 + iSolutionIdx); if (!failSolution.Create(elem, false, bForEditor)) { continue; } sector.fail.Add(failSolution); iSolutionIdx++; } return(sector); }
void ReadShootSolutionSector(int index, string filePath) { ShootSolutionSector sector = new ShootSolutionSector(index); //读取以及处理XML文本的类 string text = ResourceLoadManager.Instance.GetConfigText(GlobalConst.DIR_XML_SHOOT_SOLUTION + filePath); if (text == null) { Debug.LogError("LoadConfig failed: " + name + filePath); return; } XmlDocument xmlDoc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_SHOOT_SOLUTION + filePath, text); //解析xml的过程 int iSolutionIdx = 0; XmlNodeList nodelist = xmlDoc.SelectNodes("root/success"); foreach (XmlElement elem in nodelist) { ShootSolution sucSolution = new ShootSolution(index * 1000 + iSolutionIdx); if (!sucSolution.Create(elem, true)) { continue; } sector.success.Add(sucSolution); iSolutionIdx++; } nodelist = xmlDoc.SelectNodes("root/fail"); foreach (XmlElement elem in nodelist) { ShootSolution failSolution = new ShootSolution(index * 1000 + iSolutionIdx); if (!failSolution.Create(elem, false)) { continue; } sector.fail.Add(failSolution); iSolutionIdx++; } shootSolutionData.shootSolutionSectors.Add(index, sector); }