Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_InventorySlotQuickSlotUI.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
5{
6 ResourceName m_sPrimarySecondaryWeapon = "{F565C4A388964DBE}UI/Textures/InventoryIcons/InventorySlot_gadget.edds"; //TODO: icon for weapon
7
11
12 //------------------------------------------------------------------------ USER METHODS ----------------------------------------------------------------------
13
14 //------------------------------------------------------------------------------------------------
19
20 //------------------------------------------------------------------------------------------------
21 override void Init()
22 {
23 super.Init();
24 GetGame().OnInputDeviceIsGamepadInvoker().Insert(UpdateHints);
25 }
26
27 //------------------------------------------------------------------------------------------------
29 override void SetSlotVisible( bool bVisible )
30 {
31 super.SetSlotVisible( bVisible );
32
33 m_wKeybindText = RichTextWidget.Cast(m_widget.FindAnyWidget("KeybindRichText"));
35 {
36 EInputDeviceType currentDevice = GetGame().GetInputManager().GetLastUsedInputDevice();
37 InputBinding binding = GetGame().GetInputManager().CreateUserBinding();
38
39 string deviceString = "keyboard";
40 if (currentDevice == EInputDeviceType.GAMEPAD)
41 deviceString = "gamepad";
42
43 string name = string.Format("%1%2", "SwitchWeaponCategory", (m_iQuickSlotIndex + 1));
44
45 array<string> bindings = {};
46 if (deviceString == "gamepad" &&
47 !binding.GetBindings(name, bindings, currentDevice))
48 return;
49
50 if (name == "SwitchWeaponCategory10")
51 name = "SwitchWeaponCategory0";
52
53 m_wKeybindText.SetText(string.Format("<action name='%1' preset='%2' device='" + deviceString + "' scale='1.25'/>", name, ""));
54 }
55
56 if( bVisible )
57 {
58 m_wSelectedEffect = m_widget.FindAnyWidget("SelectedFrame");
59
60 if ( !m_pItem ) //if item is not available, it's the empty slot, show the large number
61 {
62 m_wTextQuickSlotLarge = TextWidget.Cast( m_widget.FindAnyWidget( "TextQuickSlotLarge" ) );
65 }
66 else
67 {
68 SetQuickSlotIndexVisible( m_wTextQuickSlot, m_pStorageUI.GetInventoryMenuHandler() != null );
70 }
71 }
72 else
73 {
74 m_wSelectedEffect = null;
76 }
77 }
78
79 //------------------------------------------------------------------------------------------------
80 override string SetSlotSize()
81 {
82 ESlotSize slotSize;
83 string slotLayout = SLOT_LAYOUT_1x1;
84
86 {
87 slotSize = ESlotSize.SLOT_2x1;
88 m_iSizeX = 2;
89 m_iSizeY = 1;
90 }
91 else
92 {
93 slotSize = ESlotSize.SLOT_1x1;
94 m_iSizeX = 1;
95 m_iSizeY = 1;
96 }
97
98 return slotLayout;
99 }
100
102 {
103 // SetQuickSlotHintVisible(m_wKeybindText);
104 m_wKeybindText.SetVisible(!GetGame().GetInputManager().IsUsingMouseAndKeyboard());
105 }
106
107 //------------------------------------------------------------------------------------------------
109 {
110 if (!GetGame().GetInputManager().IsUsingMouseAndKeyboard() && hintWidget.IsEnabled())
111 hintWidget.SetVisible(true);
112 }
113
114 //------------------------------------------------------------------------ COMMON METHODS ----------------------------------------------------------------------
115
116 //------------------------------------------------------------------------------------------------
117 void SCR_InventorySlotQuickSlotUI( InventoryItemComponent pComponent = null, SCR_InventoryStorageBaseUI pStorageUI = null, bool bVisible = true, int iSlotIndex = -1, SCR_ItemAttributeCollection pAttributes = null )
118 {
119 m_iQuickSlotIndex = iSlotIndex;
120 m_Attributes = pAttributes;
121 }
122
123 //------------------------------------------------------------------------------------------------
127};
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_EAnalyticalItemSlotType
InputManager GetInputManager()
const string SLOT_LAYOUT_1x1
Manages input key bindings, presets, contexts, and device calibration. Provides functions for creatin...
override SCR_EAnalyticalItemSlotType GetAnalyticalItemSlotType()
override void SetSlotVisible(bool bVisible)
should be the slot visible?
void SCR_InventorySlotQuickSlotUI(InventoryItemComponent pComponent=null, SCR_InventoryStorageBaseUI pStorageUI=null, bool bVisible=true, int iSlotIndex=-1, SCR_ItemAttributeCollection pAttributes=null)
void SetQuickSlotHintVisible(RichTextWidget hintWidget)
void SCR_InventorySlotUI(InventoryItemComponent pComponent=null, SCR_InventoryStorageBaseUI pStorageUI=null, bool bVisible=true, int iSlotIndex=-1, SCR_ItemAttributeCollection pAttributes=null)
ref SCR_ItemAttributeCollection m_Attributes
void SetQuickSlotIndexVisible(TextWidget textQuickSlot, bool bVisible)
InventoryItemComponent m_pItem
SCR_InventoryStorageBaseUI m_pStorageUI