DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
UIScriptedMenu.c
См. документацию.
1//-----------------------------------------------------------------------------
3{
4 proto native UIMenuPanel GetSubMenu();
5 proto native UIMenuPanel GetParentMenu();
6 proto native UIMenuPanel GetVisibleMenu();
7 proto native void SetSubMenu(UIMenuPanel submenu);
8 proto native void SetParentMenu(UIMenuPanel parent);
9 proto native bool CanClose();
10 proto native bool CanCloseOnEscape();
12 proto native UIScriptedMenu EnterScriptedMenu(int id);
13
14 proto native void DestroySubmenu();
15 proto native bool IsAnyMenuVisible();
16 proto native bool IsVisible();
17 proto native bool IsClosing();
18
19#ifdef FEATURE_CURSOR
21 proto native bool IsCreatedHidden();
22#endif
23
26 void OnVisibilityChanged(bool isVisible)
27 {
28 }
29
31 proto native void Close();
32
33 bool UseMouse() {
34 #ifdef PLATFORM_CONSOLE
36 #else
37 return true;
38 #endif
39 }
40
41 bool UseKeyboard() {
42 #ifdef PLATFORM_CONSOLE
44 #else
45 return true;
46 #endif
47 }
48
49 bool UseGamepad() {
50 return true;
51 }
52
54 int GetID() {
55 return MENU_UNKNOWN;
56 }
57
59 void Refresh()
60 {
61 }
62};
63
64//-----------------------------------------------------------------------------
66class UIScriptedMenu extends UIMenuPanel
67{
68 int m_id;
72 private float m_AnimAlphaValue;
73 private ScriptInvoker m_PlayerDeathInvoker; //DayZPlayer::GetOnDeathStart -> used to keep track of and ensure proper callback handling
74
76 {
77 return layoutRoot;
78 }
79
81 {
82#ifdef FEATURE_CURSOR
83 if (IsCreatedHidden())
84 return;
85#endif
86
87 if (UseMouse())
88 {
91 }
92
93 if (UseKeyboard())
94 {
96 }
97
98 if (UseGamepad())
99 {
101 }
102 }
103
105 {
106#ifdef FEATURE_CURSOR
107 if (IsCreatedHidden())
108 return;
109#endif
110
111 if (UseMouse())
112 {
114 }
115
117 {
119 }
120 else
121 {
123 }
124
125 if(UseKeyboard())
126 {
128 }
129
130 if(UseGamepad())
131 {
133 }
134 }
135
137 {
139 }
140
142 {
143 }
144
146 void SetID(int id) {
147 m_id = id;
148 }
149
151 override int GetID() {
152 return m_id;
153 }
154
156 {
157 m_AnimAlphaValue = 0.3;
158 m_AnimAlphaWidget = widget;
159 }
160
161 //create widgets here and return layout root Widget
162 //widgets will be destroyed automatically by c++ side
164 {
165 return NULL;
166 }
167
168 void Cleanup()
169 {
170 }
171
172 //after show
173 void OnShow()
174 {
175 LockControls();
176 if (IsHandlingPlayerDeathEvent() && g_Game && g_Game.GetPlayer())
177 {
178 m_PlayerDeathInvoker = g_Game.GetPlayer().GetOnDeathStart();
180 }
181 }
182
183 //after hide
184 void OnHide()
185 {
187 if (m_PlayerDeathInvoker) // Only ever registered while `IsHandlingPlayerDeathEvent`. Remove callback directly.
188 {
189 m_PlayerDeathInvoker.Remove( OnPlayerDeath, EScriptInvokerRemoveFlags.NONE );
191 }
192 }
193
195 void Update(float timeslice)
196 {
197 #ifdef PLATFORM_CONSOLE
198 if ( m_AnimAlphaWidget )
199 {
200 float anim_speed = 1.2;
201 float anim_value_max = 1.0;
202 float anim_value_min = 0.3;
204 {
205 m_AnimAlphaValue += anim_speed * timeslice;
206
207 if ( m_AnimAlphaValue >= anim_value_max )
208 {
209 m_AnimAlphaValue = anim_value_max;
211 }
212 }
213 else
214 {
215 m_AnimAlphaValue -= anim_speed * timeslice;
216
217 if ( m_AnimAlphaValue <= anim_value_min )
218 {
219 m_AnimAlphaValue = anim_value_min;
221 }
222 }
223
224
226 }
227 #endif
228 }
229
230 // Moved to parent
232 //void Refresh()
233 //{
234 //}
235
236 proto native void SetFadingPanels(Widget panel0, Widget panel1, Widget panel2, Widget panel3, Widget panel4);
237
238 bool OnClick(Widget w, int x, int y, int button)
239 {
241 {
242 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
243 {
244 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnClick( w, x, y, button ) )
245 {
246 return true;
247 }
248 }
249 }
250
251 return false;
252 }
253 bool OnModalResult(Widget w, int x, int y, int code, int result)
254 {
256 {
257 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
258 {
259 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnModalResult( w, x, y, code, result ) )
260 {
261 return true;
262 }
263 }
264 }
265
266 return false;
267 }
268 bool OnDoubleClick(Widget w, int x, int y, int button)
269 {
271 {
272 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
273 {
274 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnDoubleClick( w, x, y, button ) )
275 {
276 return true;
277 }
278 }
279 }
280
281 return false;
282 }
283 bool OnSelect(Widget w, int x, int y)
284 {
286 {
287 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
288 {
289 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnSelect( w, x, y ) )
290 {
291 return true;
292 }
293 }
294 }
295
296 return false;
297 }
298 bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
299 {
301 {
302 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
303 {
304 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnItemSelected( w, x, y, row, column, oldRow, oldColumn ) )
305 {
306 return true;
307 }
308 }
309 }
310
311 return false;
312 }
313 bool OnFocus(Widget w, int x, int y)
314 {
316 {
317 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
318 {
319 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnFocus( w, x, y ) )
320 {
321 return true;
322 }
323 }
324 }
325
326 return false;
327 }
328 bool OnFocusLost(Widget w, int x, int y)
329 {
331 {
332 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
333 {
334 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnFocusLost( w, x, y ) )
335 {
336 return true;
337 }
338 }
339 }
340
341 return false;
342 }
343 bool OnMouseEnter(Widget w, int x, int y)
344 {
346 {
347 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
348 {
349 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnMouseEnter( w, x, y ) )
350 {
351 return true;
352 }
353 }
354 }
355
356 return false;
357 }
358 bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
359 {
361 {
362 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
363 {
364 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnMouseLeave( w, enterW, x, y ) )
365 {
366 return true;
367 }
368 }
369 }
370
371 return false;
372 }
373 bool OnMouseButtonDown(Widget w, int x, int y, int button)
374 {
376 {
377 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
378 {
379 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnMouseButtonDown( w, x, y, button ) )
380 {
381 return true;
382 }
383 }
384 }
385
386 return false;
387 }
388 bool OnMouseButtonUp(Widget w, int x, int y, int button)
389 {
391 {
392 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
393 {
394 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnMouseButtonUp( w, x, y, button ) )
395 {
396 return true;
397 }
398 }
399 }
400
401 return false;
402 }
403 bool OnMouseWheel(Widget w, int x, int y, int wheel)
404 {
406 {
407 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
408 {
409 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnMouseWheel( w, x, y, wheel ) )
410 {
411 return true;
412 }
413 }
414 }
415
416 return false;
417 }
418 bool OnController(Widget w, int control, int value)
419 {
421 {
422 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
423 {
424 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnController( w, control, value ) )
425 {
426 return true;
427 }
428 }
429 }
430
431 return false;
432 }
433 bool OnKeyDown(Widget w, int x, int y, int key)
434 {
436 {
437 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
438 {
439 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnKeyDown( w, x, y, key ) )
440 {
441 return true;
442 }
443 }
444 }
445
446 return false;
447 }
448 bool OnKeyUp(Widget w, int x, int y, int key)
449 {
451 {
452 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
453 {
454 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnKeyUp( w, x, y, key ) )
455 {
456 return true;
457 }
458 }
459 }
460
461 return false;
462 }
463 bool OnKeyPress(Widget w, int x, int y, int key)
464 {
466 {
467 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
468 {
469 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnKeyPress( w, x, y, key ) )
470 {
471 return true;
472 }
473 }
474 }
475
476 return false;
477 }
478 bool OnChange(Widget w, int x, int y, bool finished)
479 {
481 {
482 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
483 {
484 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnChange( w, x, y, finished ) )
485 {
486 return true;
487 }
488 }
489 }
490
491 return false;
492 }
493 bool OnDrag(Widget w, int x, int y)
494 {
496 {
497 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
498 {
499 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnDrag( w, x, y ) )
500 {
501 return true;
502 }
503 }
504 }
505
506 return false;
507 }
508 bool OnDragging(Widget w, int x, int y, Widget reciever)
509 {
511 {
512 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
513 {
514 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnDragging( w, x, y, reciever ) )
515 {
516 return true;
517 }
518 }
519 }
520
521 return false;
522 }
523 bool OnDraggingOver(Widget w, int x, int y, Widget reciever)
524 {
526 {
527 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
528 {
529 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnDraggingOver( w, x, y, reciever ) )
530 {
531 return true;
532 }
533 }
534 }
535
536 return false;
537 }
538 bool OnDrop(Widget w, int x, int y, Widget reciever)
539 {
541 {
542 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
543 {
544 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnDrop( w, x, y, reciever ) )
545 {
546 return true;
547 }
548 }
549 }
550
551 return false;
552 }
553 bool OnDropReceived(Widget w, int x, int y, Widget reciever)
554 {
556 {
557 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
558 {
559 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnDropReceived( w, x, y, reciever ) )
560 {
561 return true;
562 }
563 }
564 }
565
566 return false;
567 }
568
569 bool OnEvent(EventType eventType, Widget target, int parameter0, int parameter1)
570 {
572 {
573 for ( int i = 0; i < UIScriptedWindow.GetActiveWindows().Count(); i++ )
574 {
575 if ( UIScriptedWindow.GetActiveWindows().GetElement( i ).OnEvent( eventType, target, parameter0, parameter1 ) )
576 {
577 return true;
578 }
579 }
580 }
581
582 return false;
583 }
584
586 {
587 return null;
588 }
589
590 bool OnXboxEvent(int xboxEvent)
591 {
592 return true;
593 }
594
596 void OnRPCEx(int rpc_type, ParamsReadContext ctx){}
597
598 void InitNoteWrite(EntityAI paper, EntityAI pen, string text = "") {}
599 void InitNoteRead(string text = "") {}
600 void InitMapItem(EntityAI item) {}
602
604 {
605 return true;
606 }
607
609 {
610 Close();
611 }
612};
DayZGame g_Game
Определения DayZGame.c:3868
Icon x
Icon y
void Close()
@ Count
Определения RandomGeneratorSyncManager.c:8
proto native UIManager GetUIManager()
proto native Input GetInput()
proto native void ChangeGameFocus(int add, int input_device=-1)
Change game focus number.
proto native bool IsEnabledMouseAndKeyboardEvenOnServer()
TODO doc.
Определения EnScript.c:118
ScriptInvoker Class provide list of callbacks usage:
Определения 2_GameLib/tools.c:116
map: item x vector(index, width, height)
Определения EnWidgets.c:651
void ShowUICursor(bool visible)
Определения UIManager.c:244
bool UseKeyboard()
Определения UIScriptedMenu.c:41
void ~UIScriptedMenu()
Определения UIScriptedMenu.c:141
proto native bool IsAnyMenuVisible()
bool OnDropReceived(Widget w, int x, int y, Widget reciever)
Определения UIScriptedMenu.c:553
proto native UIMenuPanel GetVisibleMenu()
bool OnXboxEvent(int xboxEvent)
Определения UIScriptedMenu.c:590
bool OnClick(Widget w, int x, int y, int button)
Определения UIScriptedMenu.c:238
Widget layoutRoot
Определения UIScriptedMenu.c:69
float m_AnimAlphaValue
Определения UIScriptedMenu.c:72
proto native void SetParentMenu(UIMenuPanel parent)
bool OnDrag(Widget w, int x, int y)
Определения UIScriptedMenu.c:493
void OnRPCEx(int rpc_type, ParamsReadContext ctx)
Определения UIScriptedMenu.c:596
override int GetID()
Returns MenuID.
Определения UIScriptedMenu.c:151
Widget Init()
Определения UIScriptedMenu.c:163
ScriptedWidgetEventHandler GetContextMenu()
Определения UIScriptedMenu.c:585
proto native void SetSubMenu(UIMenuPanel submenu)
Widget m_AnimAlphaWidget
Определения UIScriptedMenu.c:70
bool OnDrop(Widget w, int x, int y, Widget reciever)
Определения UIScriptedMenu.c:538
void OnHide()
Определения UIScriptedMenu.c:184
proto native UIMenuPanel GetSubMenu()
void SetWidgetAnimAlpha(Widget widget)
Определения UIScriptedMenu.c:155
void UnlockControls()
Определения UIScriptedMenu.c:104
int m_id
Определения UIScriptedMenu.c:68
bool IsHandlingPlayerDeathEvent()
Определения UIScriptedMenu.c:603
bool OnFocusLost(Widget w, int x, int y)
Определения UIScriptedMenu.c:328
bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
Определения UIScriptedMenu.c:298
proto native void DestroySubmenu()
bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения UIScriptedMenu.c:358
ScriptInvoker m_PlayerDeathInvoker
Определения UIScriptedMenu.c:73
proto native void SetFadingPanels(Widget panel0, Widget panel1, Widget panel2, Widget panel3, Widget panel4)
Refresh request, called from anywhere.
bool UseMouse()
Определения UIScriptedMenu.c:33
void OnRPC(ParamsReadContext ctx)
Определения UIScriptedMenu.c:595
void InitNoteRead(string text="")
Определения UIScriptedMenu.c:599
bool OnKeyDown(Widget w, int x, int y, int key)
Определения UIScriptedMenu.c:433
bool OnDoubleClick(Widget w, int x, int y, int button)
Определения UIScriptedMenu.c:268
bool UseGamepad()
Определения UIScriptedMenu.c:49
proto native bool IsVisible()
bool OnChange(Widget w, int x, int y, bool finished)
Определения UIScriptedMenu.c:478
bool m_AnimAlphaIsIncreasing
Определения UIScriptedMenu.c:71
proto native UIScriptedMenu EnterScriptedMenu(int id)
Create & open menu with specific id (see MenuID) and set this menu as its parent.
bool OnSelect(Widget w, int x, int y)
Определения UIScriptedMenu.c:283
bool OnKeyUp(Widget w, int x, int y, int key)
Определения UIScriptedMenu.c:448
bool OnFocus(Widget w, int x, int y)
Определения UIScriptedMenu.c:313
bool OnDragging(Widget w, int x, int y, Widget reciever)
Определения UIScriptedMenu.c:508
void Refresh()
Refresh request, called from anywhere.
Определения UIScriptedMenu.c:59
void Cleanup()
Определения UIScriptedMenu.c:168
bool OnController(Widget w, int control, int value)
Определения UIScriptedMenu.c:418
void OnVisibilityChanged(bool isVisible)
Определения UIScriptedMenu.c:26
proto native bool IsClosing()
void InitMapItem(EntityAI item)
Определения UIScriptedMenu.c:600
proto native bool CanClose()
void LoadMapMarkers()
Определения UIScriptedMenu.c:601
void InitNoteWrite(EntityAI paper, EntityAI pen, string text="")
Определения UIScriptedMenu.c:598
int GetID()
Returns MenuID.
Определения UIScriptedMenu.c:54
void UIScriptedMenu()
Определения UIScriptedMenu.c:136
void Update(float timeslice)
Per frame update, called from engine.
Определения UIScriptedMenu.c:195
bool OnMouseEnter(Widget w, int x, int y)
Определения UIScriptedMenu.c:343
bool OnModalResult(Widget w, int x, int y, int code, int result)
Определения UIScriptedMenu.c:253
void OnShow()
Определения UIScriptedMenu.c:173
bool OnEvent(EventType eventType, Widget target, int parameter0, int parameter1)
Определения UIScriptedMenu.c:569
bool OnDraggingOver(Widget w, int x, int y, Widget reciever)
Определения UIScriptedMenu.c:523
bool OnMouseWheel(Widget w, int x, int y, int wheel)
Определения UIScriptedMenu.c:403
bool OnMouseButtonUp(Widget w, int x, int y, int button)
Определения UIScriptedMenu.c:388
void LockControls()
Определения UIScriptedMenu.c:80
proto native bool CanCloseOnEscape()
proto native UIMenuPanel GetParentMenu()
void OnPlayerDeath()
Определения UIScriptedMenu.c:608
void SetID(int id)
Sets MenuID.
Определения UIScriptedMenu.c:146
proto native void Close()
Safe way to close window, using this function can even window safely close itself.
bool OnMouseButtonDown(Widget w, int x, int y, int button)
Определения UIScriptedMenu.c:373
bool OnKeyPress(Widget w, int x, int y, int key)
Определения UIScriptedMenu.c:463
Widget GetLayoutRoot()
Определения UIScriptedMenu.c:75
Part of main menu hierarchy to create custom menus from script.
Определения UIScriptedMenu.c:3
override bool IsHandlingPlayerDeathEvent()
Определения DayZGame.c:104
override bool UseMouse()
Определения GesturesMenu.c:274
override bool UseGamepad()
Определения GesturesMenu.c:279
override bool UseKeyboard()
Определения ChatInputMenu.c:24
Определения DayZGame.c:64
static map< int, UIScriptedWindow > GetActiveWindows()
Определения UIScriptedWindow.c:37
Определения EnWidgets.c:190
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()
const int INPUT_DEVICE_MOUSE
Определения 1_Core/constants.c:24
const int INPUT_DEVICE_GAMEPAD
Определения 1_Core/constants.c:28
const int INPUT_DEVICE_KEYBOARD
Определения 1_Core/constants.c:23
const int MENU_UNKNOWN
Определения 3_Game/constants.c:173
TypeID EventType
Определения EnWidgets.c:55