private void CheckConfigs(string prefabName) { var dirInfo = new DirectoryInfo(ROOTDIR_BUILDINGANIM); var files = dirInfo.GetFiles("*.txt", SearchOption.TopDirectoryOnly); int finishedCount = 0; int totalCount = files.Length; if (prefabName.EndsWith(".txt")) { prefabName = Path.GetFileNameWithoutExtension(prefabName); } foreach (var file in files) { string fileName = Path.GetFileNameWithoutExtension(file.FullName); if (ResPublisher.EXCLUDE_BUILDINGS.Contains(fileName)) { continue; } var configText = File.ReadAllText(file.FullName); var blockConfigInfo = new PPBlockConfigInfo(); XmlDocument xml = new XmlDocument(); xml.LoadXml(configText); PPLiteracy.LoadBlockInfo(xml, blockConfigInfo); var configFile = blockConfigInfo.BlockInfos.FirstOrDefault(s => s.PrefabName == prefabName); if (configFile != null) { checkResult.Add(fileName); } bool result = EditorUtility.DisplayCancelableProgressBar("配置文件过滤", string.Format(fileName + "检测中....{0}/{1}", finishedCount, totalCount), finishedCount * 1.0f / totalCount); if (result) { break; } finishedCount++; } EditorUtility.ClearProgressBar(); EditorUtility.DisplayDialog("配置文件过滤", "完成", "确认"); }
private static PPBlockConfigInfo InnerLoadBlockInfos(string configName, string configText, bool loadAnim) { PPBlockConfigInfo blockConfigInfo = new PPBlockConfigInfo(); XmlDocument xml = new XmlDocument(); xml.LoadXml(configText); blockConfigInfo.ConfigName = configName; PPLiteracy.LoadGlobalInfo(xml, blockConfigInfo); PPLiteracy.LoadBlockInfo(xml, blockConfigInfo); PBPrefabLiteracy.LoadPrefabInfo(xml, blockConfigInfo); if (loadAnim) { PPLiteracy.LoadFrameInfo(xml, blockConfigInfo); } xml = null; return(blockConfigInfo); }