DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
LeftArea.c
См. документацию.
2{
3 protected Widget m_UpIcon;
4 protected Widget m_DownIcon;
9 protected ScrollWidget m_SlotsScrollWidget;
10 protected ScrollWidget m_ScrollWidget;
11 protected ref SizeToChild m_ContentResize;
12 protected bool m_ShouldChangeSize = true;
13 protected bool m_IsProcessing = false; // Prevents refreshing every time a child is added while it is still processing
14
15 void LeftArea(LayoutHolder parent )
16 {
17 m_MainWidget.Show(true, false);
18
19 m_ContentParent = m_MainWidget.FindAnyWidget("ContentParent");
21
22 #ifndef PLATFORM_CONSOLE
23 m_SlotsHeader = m_MainWidget.FindAnyWidget("SlotsHeader");
24 m_SlotsContent = m_MainWidget.FindAnyWidget("SlotsContent");
25 m_SlotsScrollWidget = ScrollWidget.Cast(m_MainWidget.FindAnyWidget("ScrollerSlotsContent"));
26 #endif
27
28 m_ScrollWidget = ScrollWidget.Cast(m_MainWidget.FindAnyWidget("Scroller"));
29 m_MainWidget = m_MainWidget.FindAnyWidget("Content");
30
31 m_UpIcon = m_RootWidget.FindAnyWidget("Up");
32 m_DownIcon = m_RootWidget.FindAnyWidget("Down");
33
34 m_VicinityContainer = new VicinityContainer(this, false);
35 m_Body.Insert(m_VicinityContainer);
36 m_ActiveIndex = 0;
37
38 WidgetEventHandler.GetInstance().RegisterOnChildAdd(m_MainWidget, this, "OnChildAdd");
39 WidgetEventHandler.GetInstance().RegisterOnChildRemove(m_MainWidget, this, "OnChildRemove");
40 RecomputeOpenedContainers();
41 }
42
43 override void UnfocusGrid()
44 {
45 Container active_container;
46 for ( int i = 0; i < m_OpenedContainers.Count(); i++ )
47 {
48 active_container = Container.Cast( m_OpenedContainers.Get( i ) );
49 active_container.UnfocusGrid();
50 }
51 }
52
53 override bool IsActive()
54 {
55 if( m_OpenedContainers.Count() <= m_ActiveIndex )
56 {
57 m_ActiveIndex = 0;
58 }
59 Container active_container = Container.Cast( m_OpenedContainers.Get( m_ActiveIndex ) );
60 return active_container.IsActive( );
61 }
62
63 override void SetActive( bool active )
64 {
65 super.SetActive( active );
66
68 }
69
70 override ScrollWidget GetScrollWidget()
71 {
72 return m_ScrollWidget;
73 }
74
75 override void UpdateSelectionIcons()
76 {
77 #ifdef PLATFORM_CONSOLE
78 ScrollToActiveContainer();
79 #endif
80 m_UpIcon.Show( m_IsActive );
81 m_DownIcon.Show( m_IsActive );
82 if( m_IsActive )
83 {
84 float x, y;
85 m_UpIcon.GetScreenSize( x, y );
86
87 float top_y = GetCurrentContainerTopY();
88 m_UpIcon.SetPos( 0, Math.Clamp( top_y, 0, 99999 ) );
89
90 #ifndef PLATFORM_CONSOLE
91 float x2, y2;
92 m_DownIcon.GetScreenSize( x2, y2 );
93 float bottom_y = GetCurrentContainerBottomY() - y2;
94
95 float diff = bottom_y - ( top_y + y );
96 if( diff < 0 )
97 {
98 top_y += diff / 2;
99 bottom_y -= diff / 2;
100 }
101 m_DownIcon.SetPos( 0, bottom_y );
102 #endif
103 }
104 }
105
107 {
108 float x, y, cont_screen_pos;
109 m_MainWidget.GetScreenPos( x, y );
110 if ( m_OpenedContainers.IsValidIndex( m_ActiveIndex ) )
111 cont_screen_pos = Container.Cast( m_OpenedContainers.Get( m_ActiveIndex ) ).GetFocusedContainerYScreenPos();
112
113 return cont_screen_pos - y;
114 }
115
117 {
118 float x, y, cont_screen_pos, cont_screen_height;
119 m_MainWidget.GetScreenPos( x, y );
120
121 if ( m_OpenedContainers.IsValidIndex( m_ActiveIndex ) )
122 {
123 cont_screen_pos = Container.Cast( m_OpenedContainers.Get( m_ActiveIndex ) ).GetFocusedContainerYScreenPos();
124 cont_screen_height = Container.Cast( m_OpenedContainers.Get( m_ActiveIndex ) ).GetFocusedContainerHeight();
125 }
126
127 return cont_screen_pos - y + cont_screen_height;
128 }
129
131 {
132 super.SetSameLevelNextActive();
133 Refresh();
134 }
135
137 {
138 super.SetSameLevelPreviousActive();
139 Refresh();
140 }
141
143 {
144 Container c = GetFocusedContainer();
145 if (c)
146 {
147 c.ExpandCollapseContainer();
148 }
149
150 Refresh();
151 }
152
153 void OnLeftPanelDropReceived( Widget w, int x, int y, Widget receiver )
154 {
155 m_VicinityContainer.OnLeftPanelDropReceived( w, x, y, receiver );
156 }
157
158 override void DraggingOverHeader( Widget w, int x, int y, Widget receiver )
159 {
160 m_VicinityContainer.DraggingOverHeader( w, x, y, receiver );
161 }
162
163 override void SetLayoutName()
164 {
165 #ifdef PLATFORM_CONSOLE
166 m_LayoutName = WidgetLayoutName.LeftAreaXbox;
167 #else
168 switch ( InventoryMenu.GetWidthType() )
169 {
170 case ScreenWidthType.NARROW:
171 {
172 m_LayoutName = WidgetLayoutName.LeftAreaNarrow;
173 break;
174 }
175 case ScreenWidthType.MEDIUM:
176 {
177 m_LayoutName = WidgetLayoutName.LeftAreaMedium;
178 break;
179 }
180 case ScreenWidthType.WIDE:
181 {
182 m_LayoutName = WidgetLayoutName.LeftAreaWide;
183 break;
184 }
185 }
186 #endif
187 }
188
190 {
191 EntityAI item = GetFocusedContainer().GetFocusedItem();
192 return item;
193 }
194
199
200 override void SetParentWidget()
201 {
202 m_ParentWidget = m_Parent.GetMainWidget().FindAnyWidget( "LeftPanel" );
203 }
204
205 override void OnShow()
206 {
207 super.OnShow();
208 Refresh();
209 }
210
211 override void Refresh()
212 {
213 super.Refresh();
214
215 m_MainWidget.Update();
216 m_RootWidget.Update();
217 #ifndef PLATFORM_CONSOLE
218 m_SlotsScrollWidget.Update();
219 #endif
220 m_ScrollWidget.Update();
221
223 m_ShouldChangeSize = true;
224 }
225
226 override void UpdateInterval()
227 {
228 m_IsProcessing = true;
229 super.UpdateInterval();
230 m_IsProcessing = false;
231
232 float x, y;
233 float x2, y2;
234 m_ContentParent.GetScreenSize( x, y );
235 m_MainWidget.GetScreenSize( x2, y2 );
236 if ( y2 != y )
237 m_ShouldChangeSize = true;
238 bool changed_size;
239 //if ( m_ShouldChangeSize )
240 m_ContentResize.ResizeParentToChild( changed_size );
241 if ( changed_size || m_ShouldChangeSize )
242 {
243 m_MainWidget.Update();
244 m_RootWidget.Update();
245 #ifndef PLATFORM_CONSOLE
246 m_SlotsScrollWidget.Update();
247 #endif
248 m_ScrollWidget.Update();
249 m_ShouldChangeSize = false;
250 }
251 CheckScrollbarVisibility();
252 }
253
254 override bool OnChildRemove( Widget w, Widget child )
255 {
256 if (!m_IsProcessing)
257 Refresh();
258 return true;
259 }
260
261 override bool OnChildAdd( Widget w, Widget child )
262 {
263 if (!m_IsProcessing)
264 Refresh();
265 return true;
266 }
267
268 #ifndef PLATFORM_CONSOLE
269 override ScrollWidget GetSlotsScrollWidget()
270 {
271 return m_SlotsScrollWidget;
272 }
273
275 {
276 return m_SlotsHeader;
277 }
278
280 {
281 return m_SlotsContent;
282 }
283 #endif
284}
Icon x
Icon y
ScreenWidthType
Определения InventoryMenu.c:2
void InventoryMenu()
Определения InventoryMenu.c:20
bool m_IsActive
Определения ModifierBase.c:19
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
Определения PluginRemotePlayerDebugClient.c:14
Widget m_Parent
Определения SizeToChild.c:92
Widget m_ParentWidget
Определения UiHintPanel.c:318
override float GetFocusedContainerHeight(bool contents=false)
Определения CargoContainer.c:436
override float GetFocusedContainerYScreenPos(bool contents=false)
Определения CargoContainer.c:456
Определения CargoContainer.c:3
Определения Building.c:6
Определения Container.c:2
override void ExpandCollapseContainer()
Определения LeftArea.c:142
override void UpdateInterval()
Определения LeftArea.c:226
override bool OnChildAdd(Widget w, Widget child)
Определения LeftArea.c:261
bool m_IsProcessing
Определения LeftArea.c:13
Widget m_SlotsContent
Определения LeftArea.c:8
override void SetParentWidget()
Определения LeftArea.c:200
override void SetSameLevelNextActive()
Определения LeftArea.c:130
override void SetActive(bool active)
Определения LeftArea.c:63
override bool IsActive()
Определения LeftArea.c:53
override EntityAI GetFocusedItem()
Определения LeftArea.c:189
float GetCurrentContainerTopY()
Определения LeftArea.c:106
override void SetLayoutName()
Определения LeftArea.c:163
void OnLeftPanelDropReceived(Widget w, int x, int y, Widget receiver)
Определения LeftArea.c:153
Widget m_ContentParent
Определения LeftArea.c:5
ScrollWidget m_ScrollWidget
Определения LeftArea.c:10
Widget m_SlotsHeader
Определения LeftArea.c:7
Widget m_UpIcon
Определения LeftArea.c:3
void LeftArea(LayoutHolder parent)
Определения LeftArea.c:15
override ScrollWidget GetScrollWidget()
Определения LeftArea.c:70
Widget GetSlotsArea()
Определения LeftArea.c:279
ScrollWidget m_SlotsScrollWidget
Определения LeftArea.c:9
override void UpdateSelectionIcons()
Определения LeftArea.c:75
float GetCurrentContainerBottomY()
Определения LeftArea.c:116
override ScrollWidget GetSlotsScrollWidget()
Определения LeftArea.c:269
bool m_ShouldChangeSize
Определения LeftArea.c:12
override void Refresh()
Определения LeftArea.c:211
VicinityContainer GetVicinityContainer()
Определения LeftArea.c:195
override void SetSameLevelPreviousActive()
Определения LeftArea.c:136
override bool OnChildRemove(Widget w, Widget child)
Определения LeftArea.c:254
ref VicinityContainer m_VicinityContainer
Определения LeftArea.c:6
ref SizeToChild m_ContentResize
Определения LeftArea.c:11
override void UnfocusGrid()
Определения LeftArea.c:43
override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
Определения LeftArea.c:158
Widget m_DownIcon
Определения LeftArea.c:4
Widget GetSlotsHeader()
Определения LeftArea.c:274
override void OnShow()
Определения LeftArea.c:205
Определения EnMath.c:7
void RegisterOnChildRemove(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:167
static WidgetEventHandler GetInstance()
Определения WidgetEventHandler.c:22
void RegisterOnChildAdd(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:160
Определения EnWidgets.c:190
const string LeftAreaWide
Определения WidgetLayoutName.c:35
const string LeftAreaNarrow
Определения WidgetLayoutName.c:33
const string LeftAreaXbox
Определения WidgetLayoutName.c:36
const string LeftAreaMedium
Определения WidgetLayoutName.c:34
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'.