using UnityEngine; using UnityEngine.UIElements; using VOID.Generic.Dict; using VOID.Generic.Objects.Abstract.Events; 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 EquipmentUI : MonoBehaviour, IHasWindow { public static EquipmentUI current {get; private set;} // WindowUI public WindowUI windowUI { get; private set; } // Visual Elements private VisualElement _rootElement; private Button[] _tabElements; private VisualElement[] _tabContentElements; // Visual Elements - Attributes values private Label _strengthLabel; private Label _dexterityLabel; private Label _intelligenceLabel; private Label _constitutionLabel; private Label _speedLabel; private Label _perceptionLabel; private Label _damageLabel; private Label _accuracyLabel; private Label _dodgeLabel; private Label _criticalChanceLabel; private Label _criticalMultiplierLabel; private Label _sightLabel; private Label _hearLabel; private Label _moveLabel; private Label _initiativeLabel; private Label _carryCapacityLabel; // Visual Elements - Resources values private Label _healthLabel; private Label _actionPointsLabel; private Label _movePointsLabel; // Visual Elements - Equipment Slots private readonly SlotUI _mainHandSlot = new(); private readonly SlotUI _offHandSlot = new(); private readonly SlotUI _helmetSlot = new(); private readonly SlotUI _armorSlot = new(); private readonly SlotUI _beltSlot = new(); private readonly SlotUI _pantsSlot = new(); private readonly SlotUI _bootsSlot = new(); private readonly SlotUI _necklaceSlot = new(); private readonly SlotUI _glovesSlot = new(); private readonly SlotUI _ringOneSlot = new(); private readonly SlotUI _ringTwoSlot = new(); // References private UnitObject _unit; private UnitObjectEquipment _equipment; private PlayerController _playerController; private ShortcutsInputManager _shortcutsInputManager; // String formattings private const string F0 = "F0"; private const string F1 = "F1"; private const string F2 = "F2"; private const string P0 = "P0"; private const string P1 = "P1"; private const string P2 = "P2"; private void Awake() { current = this; var uiDocument = gameObject.GetComponent(); var templateElement = uiDocument.rootVisualElement; // Get all VisualElements _rootElement = templateElement.Q("root-equipment"); windowUI = gameObject.GetComponent(); // Get all VisualElements - Attributes _strengthLabel = _rootElement.Q