AddressableInfoManifestTab.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using XGame.Framework.Asset.Addressable;
  2. using UnityEditor;
  3. using UnityEngine;
  4. namespace XGame.Editor.Asset
  5. {
  6. public class AddressableInfoManifestTab
  7. {
  8. private AddressableClassify classifyOperation;
  9. private AddressableInfosSoEditor manifestEditor;
  10. private string[] assetsRoots;
  11. public AddressableInfoManifestTab(AddressableClassify classify)
  12. {
  13. classifyOperation = classify;
  14. var manifest = AddressableHelper.LoadAssetManifest(classify);
  15. if (manifest != null)
  16. {
  17. manifestEditor = new AddressableInfosSoEditor(manifest);
  18. assetsRoots = AddressableHelper.GetAssetsRoots(classify);
  19. }
  20. }
  21. private Vector2 scrollPosition;
  22. public void OnGUI()
  23. {
  24. if (manifestEditor != null)
  25. {
  26. if (assetsRoots != null)
  27. {
  28. EditorGUI.BeginDisabledGroup(true);
  29. EditorGUILayout.BeginVertical();
  30. foreach (var resRoot in assetsRoots)
  31. {
  32. var fold = AssetDatabase.LoadMainAssetAtPath(resRoot);
  33. if (fold != null)
  34. {
  35. EditorGUILayout.ObjectField("资源目录", fold, fold.GetType(), false);
  36. }
  37. }
  38. EditorGUILayout.EndVertical();
  39. EditorGUI.EndDisabledGroup();
  40. //EditorGUILayout.BeginHorizontal();
  41. scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, false, true);
  42. manifestEditor?.OnGUI();
  43. if (classifyOperation == AddressableClassify.Product)
  44. {
  45. if (GUILayout.Button("导出Excel"))
  46. {
  47. ExcelHelper.AddressableAssetsToExcel(classifyOperation);
  48. }
  49. }
  50. EditorGUILayout.EndScrollView();
  51. //EditorGUILayout.EndHorizontal();
  52. }
  53. }
  54. }
  55. public void Close()
  56. {
  57. manifestEditor?.Close();
  58. }
  59. }
  60. }