using System; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UIElements; using PlayerInputManager = VOID.Generic.Player.Input.PlayerInputManager; using ShortcutsInputManager = VOID.Generic.Player.Input.ShortcutsInputManager; namespace VOID.UserInterface.Game.Util { [Serializable] public class WindowUI : MonoBehaviour { public static List openWindows = new(); // UI Visual Elements private VisualElement _parentElement; private VisualElement _rootElement; private Button _windowCloseButton; private VisualElement _headerElement; private Label _titleLabel; // Events public event Action OnClose; public event Action OnOpen; // References private PlayerInputManager _playerInputManager; private GameUI _gameUI; // Toggle private bool _isOpen; private bool _isOverHeader; private bool _isDragging; // Offset - relative position from window position to cursor private Vector2 _draggingOffset; private void Awake() { var uiDocument = gameObject.GetComponent(); var templateElement = uiDocument.rootVisualElement; // Find all visual elements _rootElement = templateElement.Q("root-window"); _parentElement = _rootElement.parent.parent; _headerElement = _rootElement.Q("header"); _titleLabel = _headerElement.Q