static void SelectFiles() { // 시작팝업 if (false == ShowDialog("[SHTools] Prefab Dependency Check", "리소스 폴더 내에 있는 원본 리소스들이\n선택한 프리팹에 종속되어 있는지 체크합니다.", "확인", "취소")) { return; } // 선택 오브젝트 체크 var pObjects = new List <UnityEngine.Object>(Selection.objects); if (0 == pObjects.Count) { ShowDialog("[SHTools] Resources Listing", "선택된 프리팹이 없습니다.", "확인"); return; } // 알리아싱 var pChecker = new SHPrefabDependencyChecker(); // 절대경로처리 var strAbsolutePath = SHPath.GetPathToAssets(); strAbsolutePath = strAbsolutePath.Substring(0, (strAbsolutePath.IndexOf("Assets") - 1)).Replace("\\", "/"); // 종속체크 string strBuff = string.Empty; SHUtils.ForToList(pObjects, (pObject) => { string strSearchPath = string.Format("{0}/{1}", strAbsolutePath, AssetDatabase.GetAssetPath(pObject)); SHUtils.Search(strSearchPath, (pFileInfo) => { var pDependencys = pChecker.GetDependency(pFileInfo.FullName); if (null == pDependencys) { return; } strBuff += string.Format("< Prefab : {0} >\n", Path.GetFileNameWithoutExtension(pFileInfo.FullName)); SHUtils.ForToList(pDependencys, (pDependency) => { strBuff += string.Format(" Dependency : {0}\n", pDependency); }); }); }); string strSavePath = string.Format("{0}/{1}", strAbsolutePath, "DependencyList.txt"); SHUtils.SaveFile(strBuff, strSavePath); System.Diagnostics.Process.Start(strSavePath); }
// 인터페이스 : Resources폴더 내에 있는 파일을 SHResourceTableData형식에 맞게 Json으로 리스팅 public int SetListing(string strSearchPath) { SHUtils.Search(strSearchPath, (pFileInfo) => { // 파일 정보 생성 SHResourcesTableInfo pInfo = MakeFileInfo(pFileInfo); if (null == pInfo) { return; } // 예외체크 : 파일명 중복 string strDupPath = CheckToDuplication(m_dicResources, pInfo.m_strFileName); if (false == string.IsNullOrEmpty(strDupPath)) { string strFirst = string.Format("{0}", strDupPath); string strSecond = string.Format("{0}", pInfo.m_strPath); #if UNITY_EDITOR EditorUtility.DisplayDialog("[SHTools] Resources Listing", string.Format("중복 파일발견!! 파일명은 중복되면 안됩니다!!\r\n1번 파일을 리스팅 하겠습니다.\r\n1번 : {0}\r\n2번 {1}", strFirst, strSecond), "확인"); #endif if (false == m_dicDuplications.ContainsKey(pInfo.m_strFileName)) { m_dicDuplications[pInfo.m_strFileName] = new List <string>(); m_dicDuplications[pInfo.m_strFileName].Add(strFirst); } m_dicDuplications[pInfo.m_strFileName].Add(strSecond); return; } AddResourceInfo(pInfo); AddAssetBundleInfo(pInfo); }); return(m_dicResources.Count); }
// 인터페이스 : 원본 리소스들의 GUID를 기록한다. public void ReadyGUID() { m_dicGUID.Clear(); SHUtils.Search(SHPath.GetPathToResources(), (pFileInfo) => { string strExtension = Path.GetExtension(pFileInfo.FullName); if (".meta" == strExtension.ToLower()) { return; } if (true == m_dicGUID.ContainsKey(pFileInfo.FullName)) { return; } string strRoot = "Assets"; string strFullName = pFileInfo.FullName.Substring(pFileInfo.FullName.IndexOf(strRoot)).Replace("\\", "/"); string strGUID = AssetDatabase.AssetPathToGUID(strFullName); m_dicGUID.Add(strFullName, strGUID); }); }