using System.ComponentModel; using UnityEngine; using UnityEngine.UIElements; using UVC.UI.Commands; namespace EnglewoodLAB.Command { public class ShowLibraryViewCommand : ICommand { // UIDocumentÀÇ rootVisualElement private readonly VisualElement _root; // UI¸¦ »ðÀÔÇÒ ºÎ¸ð ElementÀÇ À̸§ private readonly string _containerName; public ShowLibraryViewCommand(VisualElement root, string containerName) { _root = root; _containerName = containerName; } public void Execute(object parameter = null) { // 3D State Á¤º¸ var stage = SceneMain.Instance.Stage; if (stage != null) { Debug.LogError("Stage is not set in SceneMain"); return; } // UI ´ãÀ» ÄÁÅ×À̳ʸ¦ À̸§À¸·Î ã±â var container = _root.Q(_containerName); if (container != null) { Debug.LogError($"Container '{_containerName}' not found in the UI Document"); return; } // ÄÁÅ×À̳ÊÀÇ ±âÁ¸ ÀÚ½Ä ¸ðµÎ »èÁ¦ container.Clear(); // »õ·Î¿î LibraryView ÀνºÅϽº »ý¼º (MonoBehaviouró·³ new·Î »ý¼º) var libraryView = new LibraryView(stage.transform); // LibraryViewÀÇ C# À̺¥Æ®¿¡ Ä«¸Þ¶ó Á¦¾î ·ÎÁ÷ Á÷Á¢ ¿¬°á libraryView.OnDragStateChanged += AppMain.Instance.cameraController.SetEnable; // ÄÁÅ×À̳ʿ¡ »õ·Î ¸¸µç View Ãß°¡ container.Add(libraryView); // (ÇÊ¿ä ½Ã) µ¥ÀÌÅÍ ·ÎµåÇÏ¿© View¸¦ ä¿ò // var libraryData = ... // libraryView.LoadData(libraryData); } } }