using System; using System.Collections.Generic; using System.Linq; using ClusterVR.CreatorKit.Editor.Utils; using ClusterVR.CreatorKit.Translation; using UnityEditor; using UnityEngine; using UnityEngine.UIElements; using Object = UnityEngine.Object; namespace ClusterVR.CreatorKit.Editor.Window.GltfItemExporter.View { public sealed class ItemUploadView : VisualElement { const string MainTemplatePath = "Packages/mu.cluster.cluster-creator-kit/Editor/Window/GltfItemExporter/Uxml/ItemUploaderWindow.uxml"; const string MainStyleSheetPath = "Packages/mu.cluster.cluster-creator-kit/Editor/Window/GltfItemExporter/Uss/ItemUploaderWindow.uss"; const string ItemViewStyleSheetPath = "Packages/mu.cluster.cluster-creator-kit/Editor/Window/GltfItemExporter/Uss/ItemView.uss"; const int ItemViewHeight = 95; readonly string editorTypeName; readonly Label itemCountLabel; readonly ListView itemList; readonly VisualElement itemContainer; readonly VisualElement helpViewContainer; readonly VisualElement dragAreaPanel; readonly Button clearItemViewsButton; readonly Button uploadItemsButton; readonly Button addItemButton; readonly List itemViewModels = new(); ItemUploadProgressWindow progressWindow; event Action OnProgressWindowClosed; event Action OnDropItems; public ItemUploadView(string editorTypeName) { this.editorTypeName = editorTypeName; var mainTemplate = AssetDatabase.LoadAssetAtPath(MainTemplatePath); VisualElement view = mainTemplate.CloneTree(); var mainStyleSheet = AssetDatabase.LoadAssetAtPath(MainStyleSheetPath); var itemViewStyleSheet = AssetDatabase.LoadAssetAtPath(ItemViewStyleSheetPath); view.styleSheets.Add(mainStyleSheet); view.styleSheets.Add(itemViewStyleSheet); hierarchy.Add(view); itemCountLabel = view.Q