Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_InventorySpinBoxComponent.c
Go to the documentation of this file.
2 {
3  protected bool m_bIsFocused;
4  protected SCR_InventoryHitZoneUI m_FocusedPoint;
5 
6  override void HandlerAttached(Widget w)
7  {
8  super.HandlerAttached(w);
9  SetNavigationActive(false);
10  m_OnChanged.Insert(OnSpinBoxSelectionChanged);
11  }
12 
13  override bool OnFocus(Widget w, int x, int y)
14  {
15  super.OnFocus(w, x, y);
16  SetNavigationActive(true);
17  m_bIsFocused = true;
18 
19  OnSpinBoxSelectionChanged(this, m_iSelectedItem);
20  if (m_FocusedPoint)
21  m_FocusedPoint.GetMenuHandler().OnAttachmentSpinboxFocused();
22 
23  return false;
24  }
25 
26  override bool OnFocusLost(Widget w, int x, int y)
27  {
28  super.OnFocusLost(w, x, y);
29  SetNavigationActive(false);
30  m_bIsFocused = false;
31 
32  return false;
33  }
34 
35  void OnSpinBoxSelectionChanged(SCR_SpinBoxComponent comp, int itemIndex)
36  {
37  if (!m_bIsFocused || itemIndex < 0)
38  return;
39 
40  m_FocusedPoint = null;
41  SCR_InventoryHitZonePointContainerUI hzContainer = SCR_InventoryHitZonePointContainerUI.Cast(comp.GetCurrentItemData());
42  if (hzContainer)
43  {
44  m_FocusedPoint = hzContainer.GetStorage();
45  hzContainer.ShowApplicableItems();
46  }
47 
48  SCR_InventorySlotGearInspectionUI point = SCR_InventorySlotGearInspectionUI.Cast(comp.GetCurrentItemData());
49  if (point)
50  {
51  point.ShowCompatibleAttachments();
52  }
53  }
54 
55  int FindItem(string item)
56  {
57  return m_aElementNames.Find(item);
58  }
59 
60  bool IsFocused()
61  {
62  return m_bIsFocused;
63  }
64 
65  SCR_InventoryHitZoneUI GetFocusedHZPoint()
66  {
67  return m_FocusedPoint;
68  }
69 
70  void SetNavigationActive(bool active)
71  {
72  if (m_ButtonLeft)
73  {
74  if (!active)
75  m_ButtonLeft.m_OnClicked.Remove(OnLeftArrowClick);
76  else
77  m_ButtonLeft.m_OnClicked.Insert(OnLeftArrowClick);
78  }
79  if (m_ButtonRight)
80  {
81  if (!active)
82  m_ButtonRight.m_OnClicked.Remove(OnRightArrowClick);
83  else
84  m_ButtonRight.m_OnClicked.Insert(OnRightArrowClick);
85  }
86  }
87 
88  override protected void OnMenuLeft()
89  {
90 
91  }
92 
93  override protected void OnMenuRight()
94  {
95 
96  }
97 
98 };
SCR_InventorySpinBoxComponent
Definition: SCR_InventorySpinBoxComponent.c:1
SCR_InventorySlotGearInspectionUI
Definition: SCR_InventoryGearInspectionSlotUI.c:258
m_OnChanged
protected ref ScriptInvokerTabViewIndex m_OnChanged
Definition: SCR_TabViewComponent.c:64
SCR_InventoryHitZoneUI
Definition: SCR_InventoryHitZoneSlotUI.c:1
SCR_SpinBoxComponent
Definition: SCR_SpinBoxComponent.c:1
SCR_InventoryHitZonePointContainerUI
Definition: SCR_InventoryHitZonePointUI.c:1