using System; using JetBrains.Annotations; using UnityEngine; using UnityEngine.UIElements; using VOID.Generic.Dict; using VOID.Generic.Objects.Item; using VOID.Generic.Objects.Unit; using VOID.Generic.Objects.Unit.Events; using VOID.Generic.Player; using VOID.Generic.Player.Input; using VOID.UserInterface.Game.Interfaces; using VOID.UserInterface.Game.Util; namespace VOID.UserInterface.Game { public class BackpackUI : MonoBehaviour, IHasWindow { public static BackpackUI current { get; private set; } // WindowUI public WindowUI windowUI { get; private set; } // Active Unit and his Backpack private UnitObject _unit; private UnitObjectBackpack _backpack; // Visual Elements private VisualElement _rootElement; private VisualElement _slotsElement; private SlotUI[] _slots; // References private ShortcutsInputManager _shortcutsInputManager; private PlayerController _playerController; // Sort buttons private Button _sortButton; private void Awake() { current = this; var uiDocument = gameObject.GetComponent(); var templateElement = uiDocument.rootVisualElement; // Find all important elements _rootElement = templateElement.Q("root-backpack"); _slotsElement = templateElement.Q("slots"); windowUI = gameObject.GetComponent(); // Sort buttons _sortButton = templateElement.Q