1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using XGame.Framework.Asset.Addressable;
- using UnityEditor;
- using UnityEngine;
- namespace XGame.Editor.Asset
- {
- public class AddressableAssetsWindow : EditorWindow
- {
- [MenuItem("Build/CollectAddressableAssets", priority = 20)]
- private static void CreateWindow()
- {
- (new AddressableBuildTask()).Run();
- var window = EditorWindow.GetWindow<AddressableAssetsWindow>(true, "AddressableAssetsWindow");
- window.Show();
- }
- private string[] labels = { "项目资源", "内置资源", "测试资源" };
- private int selected = 0;
- private AddressableInfoManifestTab[] manifestTabs;
- private void OnEnable()
- {
- manifestTabs = new AddressableInfoManifestTab[3];
- manifestTabs[0] = new AddressableInfoManifestTab(AddressableClassify.Product);
- manifestTabs[1] = new AddressableInfoManifestTab(AddressableClassify.BuiltIn);
- manifestTabs[2] = new AddressableInfoManifestTab(AddressableClassify.Tests);
- }
- private void OnDisable()
- {
- if (manifestTabs != null)
- {
- foreach (var manifest in manifestTabs)
- {
- manifest?.Close();
- }
- }
- }
- private Vector2 scrollPosition;
- private void OnGUI()
- {
- int lastSelected = selected;
- selected = GUILayout.Toolbar(selected, labels, "LargeButton", GUILayout.Width(500));
- if (manifestTabs != null)
- {
- manifestTabs[selected].OnGUI();
- }
- }
- }
- }
|