private string AnalyaseSpriteDetailData(SpriteConsistencyInfo spriteInfo) { string detailData = string.Empty; if (null == spriteInfo) { return(detailData); } string projectPos = string.Empty; string prefabPos = string.Empty; string sourceAB = string.Empty; if (spriteInfo.ExistInProject) { projectPos = m_spriteExistIcon; } else { projectPos = m_spriteUnExistIcon; } if (spriteInfo.ExistInPrefab) { prefabPos = m_spriteExistIcon; } else { prefabPos = m_spriteUnExistIcon; } if (spriteInfo.ExistInSourceAB) { sourceAB = m_spriteExistIcon; } else { sourceAB = m_spriteUnExistIcon; } detailData = spriteInfo.SpriteName + "," + projectPos + "," + prefabPos + "," + sourceAB; return(detailData); }
private void CheckUnConsistentSpriteInProject(AtlasProject project, out bool isAtlasConsistent, out List <SpriteConsistencyInfo> consistencyInfoTbl) { consistencyInfoTbl = new List <SpriteConsistencyInfo>(); isAtlasConsistent = true; if (null == project) { return; } List <string> spriteNameTblInProject = GetAllSpritePathInProject(project); List <string> spriteNameTblInPrefab = GetAllSpriteNameInPrefab(project.DescribePath); //查找project foreach (var item in spriteNameTblInProject) { SpriteConsistencyInfo newConsistencyInfo = new SpriteConsistencyInfo(); string spriteNameWithoutExt = Path.GetFileNameWithoutExtension(item); if (spriteNameTblInPrefab.Contains(spriteNameWithoutExt)) { if (!File.Exists(@item)) { newConsistencyInfo.SpriteName = spriteNameWithoutExt; newConsistencyInfo.ProjectPath = project.Path; newConsistencyInfo.ExistInProject = true; newConsistencyInfo.ExistInPrefab = true; newConsistencyInfo.ExistInSourceAB = false; newConsistencyInfo.IsConsistent = false; consistencyInfoTbl.Add(newConsistencyInfo); } //从prefab中移除该Sprite spriteNameTblInPrefab.Remove(spriteNameWithoutExt); } else { if (!File.Exists(item)) { newConsistencyInfo.ExistInSourceAB = false; } else { newConsistencyInfo.ExistInSourceAB = true; } newConsistencyInfo.SpriteName = spriteNameWithoutExt; newConsistencyInfo.ProjectPath = project.Path; newConsistencyInfo.ExistInProject = true; newConsistencyInfo.ExistInPrefab = false; newConsistencyInfo.IsConsistent = false; consistencyInfoTbl.Add(newConsistencyInfo); } } //查找prefab if (spriteNameTblInPrefab.Count != 0) { List <string> sourcePicFilePath = UniversalEditorUtility.GetAllFileNameWithoutExtension(m_inputInfo.SourceSpriteDir); foreach (var item in spriteNameTblInPrefab) { SpriteConsistencyInfo newConsistencyInfo = new SpriteConsistencyInfo(); if (!sourcePicFilePath.Contains(item)) { newConsistencyInfo.ExistInSourceAB = false; } else { newConsistencyInfo.ExistInSourceAB = true; } newConsistencyInfo.SpriteName = item; newConsistencyInfo.ProjectPath = project.Path; newConsistencyInfo.ExistInProject = false; newConsistencyInfo.ExistInPrefab = true; newConsistencyInfo.IsConsistent = false; consistencyInfoTbl.Add(newConsistencyInfo); } } if (0 == consistencyInfoTbl.Count) { isAtlasConsistent = true; } else { isAtlasConsistent = false; } }