UGUIPackDB.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using UnityEngine.Serialization;
  5. namespace UnityEngine.UI.PackgTool
  6. {
  7. [System.Serializable]
  8. public class UGUIPackDB
  9. {
  10. public List<PackInfo> allPackgInfos = new List<PackInfo>();
  11. [NonSerialized] public string uiPath2;
  12. public bool isJiaoYan;
  13. [System.NonSerialized] public bool isShowPack;
  14. [System.NonSerialized] public bool isShowUpdatePack;
  15. public UGUIPackDB()
  16. {
  17. uiPath2 = PlayerPrefs.GetString("uiPath", "");
  18. }
  19. public PackInfo GetPackgInfo(string packName)
  20. {
  21. packName = packName.Replace("\r", "");
  22. for (int i = 0; i < allPackgInfos.Count; i++)
  23. {
  24. if (allPackgInfos[i].packName.Equals(packName))
  25. {
  26. return allPackgInfos[i];
  27. }
  28. }
  29. return null;
  30. }
  31. public void ClearUselessPack()
  32. {
  33. for (int i = 0; i < allPackgInfos.Count; i++)
  34. {
  35. string path = allPackgInfos[i].packgJsonPath;
  36. if (path != null)
  37. {
  38. if (!File.Exists(Application.dataPath + path))
  39. {
  40. allPackgInfos.RemoveAt(i);
  41. i--;
  42. }
  43. }
  44. }
  45. #if UNITY_EDITOR
  46. UGUICacheInfo.SaveDB();
  47. #endif
  48. }
  49. }
  50. }