Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
rightarea.c
Go to the documentation of this file.
2 {
3  ref PlayerContainer m_PlayerContainer;
4  protected Widget m_ContentParent;
5 
6  protected ScrollWidget m_ScrollWidget;
7  protected Widget m_UpIcon;
8  protected Widget m_DownIcon;
9 
10  protected ref SizeToChild m_ContentResize;
11  protected bool m_ShouldChangeSize = true;
12  protected bool m_ProcessGridMovement;
13 
14  void RightArea(LayoutHolder parent)
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;
24  m_ProcessGridMovement = false;
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 
34  PlayerContainer GetPlayerContainer()
35  {
36  return m_PlayerContainer;
37  }
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 
94  override bool CanTakeToInventoryEx(EntityAI focusedEntity)
95  {
96  return false;
97  }
98 
99  bool HasEntityContainerVisible(EntityAI entity)
100  {
101  return m_PlayerContainer.HasEntityContainerVisible(entity);
102  }
103 
104  void SwapItemsInOrder(int slot1, int slot2)
105  {
106  m_PlayerContainer.SwapItemsInOrder(slot1, slot2);
107  }
108 
109  bool IsPlayerEquipmentActive()
110  {
111  return m_PlayerContainer.IsPlayerEquipmentActive();
112  }
113 
114  override void SetSameLevelNextActive()
115  {
116  m_PlayerContainer.SetSameLevelNextActive();
117  Refresh();
118  }
119  override void SetSameLevelPreviousActive()
120  {
121  m_PlayerContainer.SetSameLevelPreviousActive();
122  Refresh();
123  }
124 
125  override void ExpandCollapseContainer()
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 
177  void MoveUpDownIcons()
178  {
179  if (m_UpIcon && m_DownIcon)
180  {
181  m_UpIcon.Show( m_IsActive );
182  m_DownIcon.Show( m_IsActive );
183  if( m_IsActive )
184  {
185  float x, y;
186  m_UpIcon.GetScreenSize( x, y );
187 
188  float top_y = GetCurrentContainerTopY();
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 );
194  float bottom_y = GetCurrentContainerBottomY() - 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 
216  override ScrollWidget GetScrollWidget()
217  {
218  return m_ScrollWidget;
219  }
220 
221  override void UpdateSelectionIcons()
222  {
223  #ifdef PLATFORM_CONSOLE
224  ScrollToActiveContainer();
225  #endif
226  MoveUpDownIcons();
227  }
228 
229  float GetCurrentContainerTopY()
230  {
231  float x, y;
232  GetMainWidget().Update();
233  GetMainWidget().GetScreenPos( x, y );
234  float cont_screen_pos = GetFocusedContainerYScreenPos();
235 
236  return cont_screen_pos - y;
237  }
238 
239  float GetCurrentContainerBottomY()
240  {
241  float x, y;
242  GetMainWidget().Update();
243  GetMainWidget().GetScreenPos( x, y );
244 
245  float cont_screen_pos = GetFocusedContainerYScreenPos();
246  float cont_screen_height = GetFocusedContainerHeight();
247  return cont_screen_pos - y + cont_screen_height;
248  }
249 }
GetGame
proto native CGame GetGame()
LayoutHolder
Definition: container.c:1
m_RootWidget
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
Definition: pluginremoteplayerdebugclient.c:14
y
Icon y
WidgetLayoutName
Definition: widgetlayoutname.c:1
m_Parent
protected Widget m_Parent
Definition: sizetochild.c:92
RightArea
Definition: rightarea.c:1
PlayerBase
Definition: playerbaseclient.c:1
m_IsActive
bool m_IsActive
Definition: modifierbase.c:20
Container
Definition: cargocontainer.c:2
PlayerContainer
Definition: playercontainer.c:1
ScreenWidthType
ScreenWidthType
Definition: inventorymenu.c:1
x
Icon x
GetPlayer
protected void GetPlayer()
Definition: crosshairselector.c:127
InventoryMenu
void InventoryMenu()
Definition: inventorymenu.c:20
m_ParentWidget
protected Widget m_ParentWidget
Definition: uihintpanel.c:24
Widget
Definition: enwidgets.c:189
Math
Definition: enmath.c:6
EntityAI
Definition: building.c:5