DayZ 1.24
Loading...
Searching...
No Matches
RightArea.c
Go to the documentation of this file.
2{
5
7 protected Widget m_UpIcon;
8 protected Widget m_DownIcon;
9
11 protected bool m_ShouldChangeSize = true;
12 protected bool m_ProcessGridMovement;
13
15 {
16 m_MainWidget.Show(true);
17 m_ScrollWidget = ScrollWidget.Cast(m_MainWidget.FindAnyWidget("Scroller"));
18 m_MainWidget = m_MainWidget.FindAnyWidget("Content");
19 //m_ContentParent = m_RootWidget.FindAnyWidget("ContentParent");
20 m_PlayerContainer = new PlayerContainer(this, false);
21 m_PlayerContainer.SetPlayer(PlayerBase.Cast(GetGame().GetPlayer()));
22 m_Body.Insert(m_PlayerContainer);
23 m_ActiveIndex = 0;
25
26 m_UpIcon = m_RootWidget.FindAnyWidget("Up");
27 m_DownIcon = m_RootWidget.FindAnyWidget("Down");
28
29 //m_ContentParent.GetScript( m_ContentResize );
30
31 RecomputeOpenedContainers();
32 }
33
38
39 override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
40 {
41 m_PlayerContainer.DraggingOverHeader(w, x, y, receiver);
42 }
43
44 override bool Select()
45 {
46 return m_PlayerContainer.Select();
47 }
48
49 override bool SelectItem()
50 {
51 return m_PlayerContainer.SelectItem();
52 }
53
54 override bool Combine()
55 {
56 return m_PlayerContainer.Combine();
57 }
58
59 override bool SplitItem()
60 {
61 return m_PlayerContainer.SplitItem();
62 }
63
64 override bool EquipItem()
65 {
66 return m_PlayerContainer.EquipItem();
67 }
68
69 override bool TransferItem()
70 {
71 return m_PlayerContainer.TransferItem();
72 }
73
74 override bool InspectItem()
75 {
76 return m_PlayerContainer.InspectItem();
77 }
78
79 override bool TransferItemToVicinity()
80 {
81 return m_PlayerContainer.TransferItemToVicinity();
82 }
83
84 override void UnfocusGrid()
85 {
86 m_PlayerContainer.UnfocusGrid();
87 }
88
89 override bool CanTakeToInventory()
90 {
91 return false;
92 }
93
95 {
96 return false;
97 }
98
100 {
101 return m_PlayerContainer.HasEntityContainerVisible(entity);
102 }
103
105 {
106 m_PlayerContainer.SwapItemsInOrder(slot1, slot2);
107 }
108
110 {
111 return m_PlayerContainer.IsPlayerEquipmentActive();
112 }
113
115 {
116 m_PlayerContainer.SetSameLevelNextActive();
117 Refresh();
118 }
120 {
121 m_PlayerContainer.SetSameLevelPreviousActive();
122 Refresh();
123 }
124
126 {
127 m_PlayerContainer.ExpandCollapseContainer();
128 }
129
130 override void Refresh()
131 {
132 m_ScrollWidget.Update();
133 m_PlayerContainer.Refresh();
134 m_ShouldChangeSize = true;
135 }
136
137 override void SetLayoutName()
138 {
139#ifdef PLATFORM_CONSOLE
140 m_LayoutName = WidgetLayoutName.RightAreaXbox;
141#else
142 switch (InventoryMenu.GetWidthType())
143 {
144 case ScreenWidthType.NARROW:
145 m_LayoutName = WidgetLayoutName.RightAreaNarrow;
146 break;
147 case ScreenWidthType.MEDIUM:
148 m_LayoutName = WidgetLayoutName.RightAreaMedium;
149 break;
150 case ScreenWidthType.WIDE:
151 m_LayoutName = WidgetLayoutName.RightAreaWide;
152 break;
153 }
154#endif
155
156 }
157
158 override void SetParentWidget()
159 {
160 m_ParentWidget = m_Parent.GetMainWidget().FindAnyWidget("RightPanel");
161 }
162
163 override void OnShow()
164 {
165 super.OnShow();
166 Refresh();
167 }
168
169 override void UpdateInterval()
170 {
171 super.UpdateInterval();
172 m_PlayerContainer.UpdateInterval();
173
174 CheckScrollbarVisibility();
175 }
176
178 {
179 if (m_UpIcon && m_DownIcon)
180 {
181 m_UpIcon.Show(m_IsActive);
183 if (m_IsActive)
184 {
185 float x, y;
186 m_UpIcon.GetScreenSize(x, y);
187
189 m_UpIcon.SetPos(0, Math.Clamp(top_y, 0, 99999));
190
191#ifndef PLATFORM_CONSOLE
192 float x2, y2;
193 m_DownIcon.GetScreenSize(x2, y2);
195
196 float diff = bottom_y - (top_y + y);
197 if (diff < 0)
198 {
199 top_y += diff / 2;
200 bottom_y -= diff / 2;
201 }
202 m_DownIcon.SetPos(0, bottom_y);
203#endif
204 }
205 }
206 /*else
207 {
208 ErrorEx("up/down icons not present!");
209 }
210 #else
211 m_ScrollWidget.Update();
212 #endif*/
213
214 }
215
217 {
218 return m_ScrollWidget;
219 }
220
221 override void UpdateSelectionIcons()
222 {
223#ifdef PLATFORM_CONSOLE
224 ScrollToActiveContainer();
225#endif
227 }
228
230 {
231 float x, y;
232 GetMainWidget().Update();
233 GetMainWidget().GetScreenPos(x, y);
235
236 return cont_screen_pos - y;
237 }
238
240 {
241 float x, y;
242 GetMainWidget().Update();
243 GetMainWidget().GetScreenPos(x, y);
244
248 }
249}
Icon x
Icon y
ScreenWidthType
void InventoryMenu()
bool m_IsActive
PlayerBase GetPlayer()
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
Widget m_Parent
Definition SizeToChild.c:86
Widget m_ParentWidget
override float GetFocusedContainerHeight(bool contents=false)
override float GetFocusedContainerYScreenPos(bool contents=false)
Definition EnMath.c:7
override void SetSameLevelNextActive()
Definition RightArea.c:114
override bool TransferItem()
Definition RightArea.c:69
override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
Definition RightArea.c:39
override bool InspectItem()
Definition RightArea.c:74
override void Refresh()
Definition RightArea.c:130
bool m_ProcessGridMovement
Definition RightArea.c:12
Widget m_DownIcon
Definition RightArea.c:8
void SwapItemsInOrder(int slot1, int slot2)
Definition RightArea.c:104
override void UpdateInterval()
Definition RightArea.c:169
void RightArea(LayoutHolder parent)
Definition RightArea.c:14
bool IsPlayerEquipmentActive()
Definition RightArea.c:109
override bool CanTakeToInventory()
Definition RightArea.c:89
override bool TransferItemToVicinity()
Definition RightArea.c:79
override bool CanTakeToInventoryEx(EntityAI focusedEntity)
Definition RightArea.c:94
override void ExpandCollapseContainer()
Definition RightArea.c:125
float GetCurrentContainerBottomY()
Definition RightArea.c:239
override void SetSameLevelPreviousActive()
Definition RightArea.c:119
Widget m_UpIcon
Definition RightArea.c:7
float GetCurrentContainerTopY()
Definition RightArea.c:229
override void SetLayoutName()
Definition RightArea.c:137
PlayerContainer GetPlayerContainer()
Definition RightArea.c:34
bool HasEntityContainerVisible(EntityAI entity)
Definition RightArea.c:99
Widget m_ContentParent
Definition RightArea.c:4
override bool Combine()
Definition RightArea.c:54
ScrollWidget m_ScrollWidget
Definition RightArea.c:6
override void OnShow()
Definition RightArea.c:163
override bool SplitItem()
Definition RightArea.c:59
override bool Select()
Definition RightArea.c:44
ref PlayerContainer m_PlayerContainer
Definition RightArea.c:3
override bool SelectItem()
Definition RightArea.c:49
override bool EquipItem()
Definition RightArea.c:64
void MoveUpDownIcons()
Definition RightArea.c:177
override void SetParentWidget()
Definition RightArea.c:158
override void UpdateSelectionIcons()
Definition RightArea.c:221
override ScrollWidget GetScrollWidget()
Definition RightArea.c:216
ref SizeToChild m_ContentResize
Definition RightArea.c:10
override void UnfocusGrid()
Definition RightArea.c:84
bool m_ShouldChangeSize
Definition RightArea.c:11
const string RightAreaWide
const string RightAreaNarrow
const string RightAreaMedium
const string RightAreaXbox
proto native CGame GetGame()
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.