Dayz Explorer 1.29.162510
Loading...
Searching...
No Matches
radialquickbarmenu.c
Go to the documentation of this file.
6
8{
9 protected bool m_IsLightSourceExtra;
10 protected bool m_IsNVG;
11 protected int m_Id;
12 protected int m_Category;
13 protected int m_CategorySwitchID;
14 protected EntityAI m_Item;
15 protected string m_ItemName;
16
17 //radial menu
18 protected Widget m_RadialMenuSelector;
19 protected Widget m_RadialMenuItemCard;
20
21 void RadialQuickbarItem( int id, EntityAI item, string item_name, int category = RadialQuickbarCategory.DEFAULT, int category_switch = -1 )
22 {
23 m_Id = id;
24 m_Item = item;
25 m_ItemName = item_name;
26 m_Category = category;
27 m_CategorySwitchID = category_switch;
28
29 //
30 if (ItemBase.Cast(m_Item))
31 {
32 m_IsNVG = ItemBase.Cast(m_Item).IsNVG();
33 m_IsLightSourceExtra = ItemBase.Cast(m_Item).IsLightSource();
34 }
35 }
36
38 {
39 return m_Item;
40 }
41
42 void SetItem( EntityAI item )
43 {
44 m_Item = item;
45 }
46
48 {
50 }
51
53 {
54 return m_IsNVG;
55 }
56
57 int GetId()
58 {
59 return m_Id;
60 }
61
63 {
64 return m_Category;
65 }
66
68 {
69 return m_CategorySwitchID;
70 }
71
73 {
75 }
76
77 void SetRadialItemCard( Widget widget )
78 {
79 m_RadialMenuItemCard = widget;
80 }
81
82 string GetItemName()
83 {
84 return m_ItemName;
85 }
86}
87
88class RadialQuickbarMenu extends UIScriptedMenu
89{
90 protected Widget m_ItemCardPanel;
92 protected Widget m_ToolbarPanel;
93
94 protected bool m_IsMenuClosing;
95 protected int m_CurrentCategory;
96 //
97 const string TEXT_ITEM_NAME = "ItemName";
98 const string TEXT_ITEM_TITLE = "ItemTitle";
99 //selections
100 protected Widget m_SelectedItem;
102
103 //instance
105
106 //============================================
107 // RadialQuickbarMenu
108 //============================================
110 {
113
114 if ( !instance )
115 {
116 instance = this;
117 }
118
119 g_Game.GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
120 }
121
123 {
124 if (g_Game && g_Game.GetMission())
125 {
126 g_Game.GetMission().RemoveActiveInputExcludes({"radialmenu"},false);
127 }
128 }
129
130 static void SetItemToAssign( EntityAI item )
131 {
132 m_ItemToAssign = item;
133 }
134
136 {
137 return m_ItemToAssign;
138 }
139
141 {
142 return instance;
143 }
144
145 protected void OnInputPresetChanged()
146 {
147 #ifdef PLATFORM_CONSOLE
149 #endif
150 }
151
152 //============================================
153 // Menu Controls
154 //============================================
155 static void OpenMenu( UIScriptedMenu parent = NULL )
156 {
157 g_Game.GetUIManager().EnterScriptedMenu( MENU_RADIAL_QUICKBAR, parent );
158 }
159
160 static void CloseMenu()
161 {
162 g_Game.GetUIManager().Back();
163 //g_Game.GetMission().RemoveActiveInputExcludes({"radialmenu"},false);
164 }
165
166 //============================================
167 // Init & Widget Events
168 //============================================
169 override Widget Init()
170 {
171 layoutRoot = g_Game.GetWorkspace().CreateWidgets("gui/layouts/radial_menu/radial_quickbar/radial_quickbar_menu.layout");
172 m_ItemCardPanel = layoutRoot.FindAnyWidget(RadialMenu.RADIAL_ITEM_CARD_CONTAINER);
173
174 //register gestures menu
175 RadialMenu.GetInstance().RegisterClass(this);
176
177 //delay updates until fully initialized
178 RadialMenu.GetInstance().SetWidgetInitialized(false);
179
180 //set radial menu properties
181 RadialMenu.GetInstance().SetWidgetProperties("gui/layouts/radial_menu/radial_quickbar/radial_quickbar_delimiter.layout");
182
183 //create content (widgets) for items
185
186 //set controller toolbar icons
188
189 m_ToolbarPanel = layoutRoot.FindAnyWidget( "toolbar_bg" );
190 m_ToolbarPanel.Show( true );
191
192 return layoutRoot;
193 }
194
195 override void OnShow()
196 {
197 super.OnShow();
198
199 Mission mission = g_Game.GetMission();
200 if (mission)
201 {
202 IngameHud hud = IngameHud.Cast(mission.GetHud());
203 if (hud)
204 {
205 hud.ShowQuickbarUI(false);
206 hud.ShowHudUI(false);
207 }
208 }
209
210 SetFocus(layoutRoot);
211 m_IsMenuClosing = false;
212 }
213
214 override void OnHide()
215 {
216 super.OnHide();
217
218 Mission mission = g_Game.GetMission();
219 if (mission)
220 {
221 IngameHud hud = IngameHud.Cast(mission.GetHud());
222 if (hud)
223 {
224 hud.ShowQuickbarUI(true);
225 hud.ShowHudUI(true);
226 }
227 }
228
229 //reset item to assign
230 RadialQuickbarMenu.SetItemToAssign(NULL);
231 m_IsMenuClosing = true;
232 }
233
234 override bool OnController( Widget w, int control, int value )
235 {
236 super.OnController( w, control, value );
237
238 RadialMenu.GetInstance().SetControlType( RadialMenuControlType.CONTROLLER );
239
240 return false;
241 }
242
243 override bool OnMouseEnter( Widget w, int x, int y )
244 {
245 super.OnMouseEnter( w, x, y );
246
247 RadialMenu.GetInstance().SetControlType( RadialMenuControlType.MOUSE );
248
249 return false;
250 }
251
252 override bool UseMouse()
253 {
254 return true;
255 }
256
257 override bool UseGamepad()
258 {
259 return true;
260 }
261
262 //============================================
263 // Content
264 //============================================
265 //reset_selection - if false, selected quick bar item will be remembered after content refresh
266 protected void RefreshQuickbar( bool reset_selection = true )
267 {
268 int selected_item_id = -1;
269 if ( !reset_selection )
270 {
271 RadialQuickbarItem quickbar_item;
272 if ( instance.m_SelectedItem )
273 {
274 instance.m_SelectedItem.GetUserData( quickbar_item );
275 selected_item_id = quickbar_item.GetId();
276 }
277 }
278
279 GetItems( m_Items );
280 //CheckForLightsAndNVG( m_Items );
281 CreateContent( selected_item_id );
282 }
283
284 //
285 // ITEMS
286 //
287 protected void GetItems( out array<ref RadialQuickbarItem> items )
288 {
289 items.Clear();
290
291 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
292 int size = player.GetQuickBarSize();
293 EntityAI entity;
294
295 for ( int i = 0; i < size; ++i )
296 {
297 entity = player.GetQuickBarEntity( i );
298
299 items.Insert( new RadialQuickbarItem( i, entity, "" ) );
300 }
301
303 }
304
305 protected void CheckForLightsAndNVG( out array<ref RadialQuickbarItem> items, int last_idx )
306 {
307 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
308 int count = 0;
309 EntityAI entity;
310 ItemBase headgear = ItemBase.Cast(player.FindAttachmentBySlotName("Headgear"));
311 ItemBase eyewear = ItemBase.Cast(player.FindAttachmentBySlotName("Eyewear"));
312
313 //nvg - headgear check
314 if ( headgear )
315 {
316 entity = headgear.FindAttachmentBySlotName("NVG");
317 if (entity)
318 {
319 items.Insert( new RadialQuickbarItem( count, entity, "", RadialQuickbarCategory.SPECIALIZED_LIGHTS ) );
320 count++;
321 }
322 }
323 //nvg/light - eyewear check
324 if ( eyewear )
325 {
326 entity = eyewear.FindAttachmentBySlotName("NVG");
327 if (entity)
328 {
329 items.Insert( new RadialQuickbarItem( count, entity, "", RadialQuickbarCategory.SPECIALIZED_LIGHTS ) );
330 count++;
331 }
332 else if ( eyewear.IsLightSource() && eyewear.HasEnergyManager() && eyewear.GetCompEM().CanWork() )
333 {
334 entity = eyewear;
335 items.Insert( new RadialQuickbarItem( count, entity, "", RadialQuickbarCategory.SPECIALIZED_LIGHTS ) );
336 count++;
337 }
338 }
339 //light
340 if ( headgear )
341 {
342 if ( headgear.GetInventory().AttachmentCount() > 0 )
343 {
344 ItemBase attachment;
345 for (int i = 0; i < headgear.GetInventory().AttachmentCount(); i++)
346 {
347 attachment = ItemBase.Cast(headgear.GetInventory().GetAttachmentFromIndex(i));
348 if ( attachment && attachment.IsLightSource() && attachment.HasEnergyManager() && attachment.GetCompEM().CanWork() )
349 {
350 entity = attachment;
351 items.Insert( new RadialQuickbarItem( count, entity, "", RadialQuickbarCategory.SPECIALIZED_LIGHTS ) );
352 count++;
353 }
354 }
355 }
356 }
357
358 //Add a category switchers
359 if (m_CurrentCategory == RadialQuickbarCategory.DEFAULT && count > 0)
360 {
361 items.InsertAt( new RadialQuickbarItem(32,null,"#toggle_lights",RadialQuickbarCategory.DEFAULT,RadialQuickbarCategory.SPECIALIZED_LIGHTS),0 );
362 }
363 else if (m_CurrentCategory == RadialQuickbarCategory.SPECIALIZED_LIGHTS)
364 {
365 items.InsertAt( new RadialQuickbarItem(32,null,"#menu_back",RadialQuickbarCategory.SPECIALIZED_LIGHTS,RadialQuickbarCategory.DEFAULT),0 );
366 }
367 }
368
369 protected void CreateContent( int selected_item_id = -1 )
370 {
371 //delete existing content
372 DeleteItems();
373
374 int category_item_count;
375
376 for ( int i = 0; i < m_Items.Count(); ++i )
377 {
378 RadialQuickbarItem quickbar_item = m_Items.Get( i );
379
380 if (quickbar_item.GetItemCategory() == m_CurrentCategory)
381 {
382 //create item card
383 Widget item_card_widget = Widget.Cast( g_Game.GetWorkspace().CreateWidgets( "gui/layouts/radial_menu/radial_quickbar/radial_quickbar_item_card.layout", m_ItemCardPanel ) );
384 quickbar_item.SetRadialItemCard( item_card_widget );
385
386 //update item card widget
387 UpdateQuickbarItemCard( quickbar_item );
388
389 //set data
390 item_card_widget.SetUserData( quickbar_item );
391
392 //set selection
393 if ( quickbar_item.GetId() == selected_item_id )
394 {
395 MarkSelected( quickbar_item.GetRadialItemCard() );
396 }
397 category_item_count++;
398 }
399 }
400
401 //adjust radial parameters for content
402 if ( /*m_Items.Count()*/category_item_count > 0 )
403 {
404 RadialMenu radial_menu = RadialMenu.GetInstance();
405 radial_menu.SetRadiusOffset( 0 );
406 radial_menu.SetExecuteDistOffset( 0.5 );
407 radial_menu.SetOffsetFromTop( 0 );
408 radial_menu.SetItemCardRadiusOffset( 0.25 );
409 radial_menu.ActivateControllerTimeout( false );
410 }
411
412 //refresh radial menu
413 RadialMenu.GetInstance().Refresh( false );
414 }
415
416 protected void UpdateQuickbarItemCard( RadialQuickbarItem quickbar_item )
417 {
418 Widget item_card_widget = quickbar_item.GetRadialItemCard();
419
420 //get content panels
421 Widget item_details = item_card_widget.FindAnyWidget( "ItemDetails" );
422 TextWidget item_title = TextWidget.Cast( item_card_widget.FindAnyWidget( "ItemTitle" ) );
423
424 //set text
425 TextWidget text_widget = TextWidget.Cast( item_card_widget.FindAnyWidget( TEXT_ITEM_NAME ) );
426 EntityAI item = quickbar_item.GetItem();
427
428 Widget quantity_panel = item_card_widget.FindAnyWidget( "QuantityPanel" );
429 if ( item )
430 {
431 //item text
432 text_widget.SetText( quickbar_item.GetItem().GetDisplayName() );
433
434 //item preview
435 ItemPreviewWidget item_preview = ItemPreviewWidget.Cast( item_card_widget.FindAnyWidget( "ItemPreview" ) );
436 item_preview.SetItem( item );
437 item_preview.SetView( item.GetViewIndex() );
438 item_preview.SetModelOrientation( Vector( 0,0,0 ) );
439
440 //item quantity
441 Widget quantity_stack = quantity_panel.FindAnyWidget( "QuantityStackPanel" );
442 ProgressBarWidget quantity_bar = ProgressBarWidget.Cast( quantity_panel.FindAnyWidget( "QuantityBar" ) );
443 int has_quantity = QuantityConversions.HasItemQuantity( item );
444 //calculate and set quantity
445 if ( has_quantity == QUANTITY_HIDDEN )
446 {
447 quantity_panel.Show( false );
448 }
449 else if ( has_quantity == QUANTITY_COUNT )
450 {
451 //hide bar
452 quantity_bar.Show( false );
453
454 //show stack
455 TextWidget quantity_text = TextWidget.Cast( quantity_stack.FindAnyWidget( "Quantity" ) );
456 quantity_text.SetText( QuantityConversions.GetItemQuantityText( item ) );
457 quantity_stack.Show( true );
458 }
459 else if ( has_quantity == QUANTITY_PROGRESS )
460 {
461 //hide stack
462 quantity_stack.Show( false );
463
464 //show bar
465 float progress_max = quantity_bar.GetMax();
466 int max = item.ConfigGetInt( "varQuantityMax" );
467 int count = item.ConfigGetInt( "count" );
468 float quantity = QuantityConversions.GetItemQuantity( ItemBase.Cast( item ) );
469
470 if ( count > 0 )
471 {
472 max = count;
473 }
474 if ( max > 0 )
475 {
476
477 float value = Math.Round( ( quantity / max ) * 100 );
478 quantity_bar.SetCurrent( value );
479 }
480
481 quantity_bar.Show( true );
482 }
483
484 //display content panels
485 item_details.Show( true );
486 item_title.Show( false );
487 }
488 else if ( quickbar_item.GetCategorySwitchID() != -1 )
489 {
490 item_title.SetText( quickbar_item.GetItemName() );
491
492 item_details.Show( false );
493 item_title.Show( true );
494 }
495 else
496 {
497 item_title.SetText( "#container_empty" );
498
499 //display content panels
500 item_details.Show( false );
501 item_title.Show( true );
502 }
503 }
504
505 //Common
506 protected void DeleteItems()
507 {
508 Widget child;
509 Widget child_to_destroy;
510
511 child = m_ItemCardPanel.GetChildren();
512 while ( child )
513 {
514 child_to_destroy = child;
515 child = child.GetSibling();
516
517 delete child_to_destroy;
518 }
519 }
520
521 protected void ChangeCurrentCategory(int category)
522 {
523 m_CurrentCategory = category;
524 RefreshQuickbar(false);
526 }
527
528 //============================================
529 // Radial Menu Events
530 //============================================
531 //Common
533 {
534 }
535
536 //Mouse
537 void OnMouseSelect( Widget w )
538 {
539 MarkSelected( w );
540 }
541
542 void OnMouseDeselect( Widget w )
543 {
544 UnmarkSelected( w );
545 }
546
547 void OnMouseExecute( Widget w )
548 {
549 }
550
552 void OnMousePressLeft( Widget w )
553 {
554 PrimaryAction( w );
555 }
556
558 void OnMousePressRight( Widget w )
559 {
560 BackOneLevel();
561 }
562
563 //Controller
564 void OnControllerSelect( Widget w )
565 {
566 MarkSelected( w );
567 }
568
569 void OnControllerDeselect( Widget w )
570 {
571 UnmarkSelected( w );
572 }
573
574 void OnControllerPressSelect( Widget w )
575 {
576 PrimaryAction( w );
577 }
578
579 void OnControllerPressBack( Widget w )
580 {
581 //SecondaryAction( w );
582 BackOneLevel();
583 }
584
585 //Actions
586 protected void MarkSelected( Widget w )
587 {
588 m_SelectedItem = w;
589
590 if (w)
591 {
592 RadialQuickbarItem quickbar_item;
593 w.GetUserData( quickbar_item );
594 ItemBase item;
595
596 if (quickbar_item && Class.CastTo(item,quickbar_item.GetItem()))
597 {
598 w.SetFlags(WidgetFlags.DISABLED);
599 }
600 else
601 {
602 w.ClearFlags(WidgetFlags.DISABLED);
603 }
604/*
605 //is not category
606 if ( quickbar_item )
607 {
608 if ( quickbar_item.GetItem() )
609 {
610 //alter item visual
611 TextWidget text_widget = TextWidget.Cast( quickbar_item.GetRadialItemCard().FindAnyWidget( TEXT_ITEM_NAME ) );
612 text_widget.SetColor( ARGB( 255, 66, 175, 95 ) );
613 }
614 else
615 {
616 //alter item visual
617 TextWidget title_widget = TextWidget.Cast( quickbar_item.GetRadialItemCard().FindAnyWidget( TEXT_ITEM_TITLE ) );
618 title_widget.SetColor( ARGB( 255, 66, 175, 95 ) );
619 }
620 }
621*/
622 }
623 }
624
625 protected void UnmarkSelected( Widget w )
626 {
627 m_SelectedItem = NULL;
628
629 /*
630 if ( w )
631 {
632 RadialQuickbarItem quickbar_item;
633 w.GetUserData( quickbar_item );
634
635 //is not category
636 if ( quickbar_item )
637 {
638 if ( quickbar_item.GetItem() )
639 {
640 //alter item visual
641 TextWidget text_widget = TextWidget.Cast( quickbar_item.GetRadialItemCard().FindAnyWidget( TEXT_ITEM_NAME ) );
642 text_widget.SetColor( ARGB( 255, 255, 255, 255 ) );
643 }
644 else
645 {
646 //alter item visual
647 TextWidget title_widget = TextWidget.Cast( quickbar_item.GetRadialItemCard().FindAnyWidget( TEXT_ITEM_TITLE ) );
648 title_widget.SetColor( ARGB( 255, 255, 255, 255 ) );
649 }
650 }
651 }
652 */
653 }
654
655 protected void PrimaryAction( Widget w )
656 {
657 if ( instance.m_SelectedItem )
658 {
659 if ( !g_Game.IsDedicatedServer() )
660 {
661 RadialQuickbarItem quickbar_item;
662 instance.m_SelectedItem.GetUserData( quickbar_item );
663
664 if ( quickbar_item )
665 {
666 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
667
668 //ASSIGN ACTION
669 if ( GetItemToAssign() )
670 {
671 //assign item to slot
672 if ( quickbar_item.GetItem() == GetItemToAssign() )
673 {
674 player.RemoveQuickBarEntityShortcut( GetItemToAssign() );
675 }
676 else
677 {
678 player.SetQuickBarEntityShortcut( GetItemToAssign(), quickbar_item.GetId() );
679 }
680 }
681 //LIGHTS
682 else if (m_CurrentCategory == RadialQuickbarCategory.SPECIALIZED_LIGHTS && quickbar_item.IsLightSourceExtra())
683 {
684 HandleLights(quickbar_item);
685 }
686 //NVG
687 else if (m_CurrentCategory == RadialQuickbarCategory.SPECIALIZED_LIGHTS && quickbar_item.IsNVGExtra())
688 {
689 HandleNVG(quickbar_item);
690 }
691 //change quickbar category
692 else if (quickbar_item.GetCategorySwitchID() != -1)
693 {
694 ChangeCurrentCategory(quickbar_item.GetCategorySwitchID());
695 return;
696 }
697 //SWAP
698 else
699 {
700 EntityAI item = quickbar_item.GetItem();
701
702 if ( item )
703 {
704 //swap
705 player.RadialQuickBarSingleUse( quickbar_item.GetId() + 1 ); //id must begin with 1 (simulating key press 1-9)
706 }
707 }
708
709 RefreshQuickbar( false );
710 }
711 }
712 }
713 }
714
715 protected void SecondaryAction( Widget w )
716 {
717 if ( instance.m_SelectedItem && m_CurrentCategory == RadialQuickbarCategory.DEFAULT )
718 {
719 if ( !g_Game.IsDedicatedServer() )
720 {
721 RadialQuickbarItem quickbar_item;
722 instance.m_SelectedItem.GetUserData( quickbar_item );
723
724 if ( quickbar_item )
725 {
726 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
727 EntityAI item = quickbar_item.GetItem();
728
729 if ( item )
730 {
731 player.RadialQuickBarCombine( quickbar_item.GetId() + 1 ); //id must begin with 1 (simulating key press 1-9)
732 RefreshQuickbar( false );
733 }
734 }
735 }
736 }
737 }
738
739 // returns to default, missing hierarchy to properly traverse ATM
740 protected void BackOneLevel()
741 {
743 {
745 }
746 }
747
748 //-------------------------------------------
749 //NVG/Light handling extension
750 //-------------------------------------------
752 {
753 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
754 ItemBase item = ItemBase.Cast(quickbar_item.GetItem());
755 ActionManagerClient mngr_client = ActionManagerClient.Cast(player.GetActionManager());
756 ActionTarget atrg;
757
758 if ( Headtorch_ColorBase.Cast(item) )
759 {
760 atrg = new ActionTarget(item,null,-1,vector.Zero,-1.0);
761 if ( mngr_client.GetAction(ActionTurnOnHeadtorch).Can(player,atrg,null) )
762 {
763 mngr_client.PerformActionStart(player.GetActionManager().GetAction(ActionTurnOnHeadtorch),atrg,null);
764 }
765 else if ( mngr_client.GetAction(ActionTurnOffHeadtorch).Can(player,atrg,null) )
766 {
767 mngr_client.PerformActionStart(player.GetActionManager().GetAction(ActionTurnOffHeadtorch),atrg,null);
768 }
769 }
770 else if ( Mich2001Helmet.Cast(item.GetHierarchyParent()) )
771 {
772 atrg = new ActionTarget(item.GetHierarchyParent(),null,-1,vector.Zero,-1.0);
773 if ( mngr_client.GetAction(ActionTurnOnHelmetFlashlight).Can(player,atrg,null) )
774 {
775 mngr_client.PerformActionStart(player.GetActionManager().GetAction(ActionTurnOnHelmetFlashlight),atrg,null);
776 }
777 else if ( mngr_client.GetAction(ActionTurnOffHelmetFlashlight).Can(player,atrg,null) )
778 {
779 mngr_client.PerformActionStart(player.GetActionManager().GetAction(ActionTurnOffHelmetFlashlight),atrg,null);
780 }
781 }
782 }
783
784 void HandleNVG(RadialQuickbarItem quickbar_item)
785 {
786 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
787 ActionManagerClient mngr_client = ActionManagerClient.Cast(player.GetActionManager());
788 ActionTarget atrg;
789
790 atrg = new ActionTarget(quickbar_item.GetItem().GetHierarchyParent(),null,-1,vector.Zero,-1.0);
791 if ( mngr_client.GetAction(ActionToggleNVG).Can(player,atrg,null) )
792 {
793 mngr_client.PerformActionStart(player.GetActionManager().GetAction(ActionToggleNVG),atrg,null);
794 }
795 }
796
798 {
799 return m_IsMenuClosing;
800 }
801
802 void SetMenuClosing(bool state)
803 {
804 m_IsMenuClosing = state;
805 }
806
807 protected void UpdateControlsElements()
808 {
809 Widget toolbarBackSpacer = layoutRoot.FindAnyWidget("BackSpacer");
810
811 RichTextWidget toolbarSelectIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("SelectIcon"));
812 RichTextWidget toolbarBackIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon"));
813
814 string selectAction;
815 string backAction;
816 int controllerID;
817
818 if (g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer() && g_Game.GetInput().GetCurrentInputDevice() == EInputDeviceType.MOUSE_AND_KEYBOARD)
819 {
820 selectAction = "UAMenuSelect";
821 backAction = "UAMenuBack";
822 controllerID = EUAINPUT_DEVICE_KEYBOARDMOUSE;
823 }
824 else
825 {
826 selectAction = "UAUISelect";
827 backAction = "UAUIBack";
828 controllerID = EUAINPUT_DEVICE_CONTROLLER;
829 }
830
831 toolbarSelectIcon.SetText(InputUtils.GetRichtextButtonIconFromInputAction(selectAction, "", controllerID, InputUtils.ICON_SCALE_TOOLBAR));
832 toolbarBackIcon.SetText(InputUtils.GetRichtextButtonIconFromInputAction(backAction, "", controllerID, InputUtils.ICON_SCALE_TOOLBAR));
833 toolbarBackSpacer.Show(m_CurrentCategory != RadialQuickbarCategory.DEFAULT);
834 }
835
836 override void OnPlayerDeath()
837 {
838 super.OnPlayerDeath();
839
840 // Close inventory menu when this menu got closed by the character death event as player could be assigning a item to the quickbar
841 // in the moment he dies and the inventory menu is opened too.
842 MissionGameplay missionGameplay = MissionGameplay.Cast(g_Game.GetMission());
843 if (missionGameplay && missionGameplay.GetInventory())
844 {
845 missionGameplay.HideInventory();
846 }
847 }
848}
DetachActionData m_ItemName
ItemBase m_Item
Definition actioninput.c:16
class ServerBrowserHelperFunctions m_Id
void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
Super root of all classes in Enforce script.
Definition enscript.c:11
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Definition inpututils.c:167
static const float ICON_SCALE_TOOLBAR
Definition inpututils.c:15
Definition enmath.c:7
Mission class.
Definition gameplay.c:686
void CreateContent(int selected_item_id=-1)
override bool OnMouseEnter(Widget w, int x, int y)
override void OnShow()
void UpdateQuickbarItemCard(GestureMenuItem gesture_item)
static EntityAI m_ItemToAssign
const string TEXT_ITEM_TITLE
void UpdateQuickbarItemCard(RadialQuickbarItem quickbar_item)
static void CloseMenu()
override bool UseMouse()
const string TEXT_ITEM_NAME
void MarkSelected(Widget w)
static void SetItemToAssign(EntityAI item)
void OnControllerPressSelect(Widget w)
void CheckForLightsAndNVG(out array< ref RadialQuickbarItem > items, int last_idx)
ref array< ref RadialQuickbarItem > m_Items
void RefreshQuickbar(bool reset_selection=true)
override void OnHide()
void OnControlsChanged(RadialMenuControlType type)
void OnMousePressRight(Widget w)
RMB.
void OnMouseExecute(Widget w)
void OnControllerDeselect(Widget w)
override bool UseGamepad()
void UnmarkSelected(Widget w)
void OnControllerSelect(Widget w)
static RadialQuickbarMenu GetMenuInstance()
void GetItems(out array< ref RadialQuickbarItem > items)
void HandleLights(RadialQuickbarItem quickbar_item)
static GesturesMenu instance
void PrimaryAction(Widget w)
void HandleNVG(RadialQuickbarItem quickbar_item)
void OnMouseDeselect(Widget w)
Widget m_SelectedItem
void OnControllerPressBack(Widget w)
override Widget Init()
override bool OnController(Widget w, int control, int value)
void SetMenuClosing(bool state)
void OnMousePressLeft(Widget w)
LMB.
void OnMouseSelect(Widget w)
override void OnPlayerDeath()
static void OpenMenu(UIScriptedMenu parent=NULL)
Widget m_ToolbarPanel
static EntityAI GetItemToAssign()
void OnInputPresetChanged()
void ChangeCurrentCategory(int category)
void SecondaryAction(Widget w)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame g_Game
Definition dayzgame.c:3942
Mission mission
Widget m_RadialMenuSelector
void SetRadialItemCard(Widget widget)
Widget m_RadialMenuItemCard
Widget GetRadialItemCard()
@ DEFAULT
const int QUANTITY_PROGRESS
Definition constants.c:521
const int QUANTITY_COUNT
Definition constants.c:520
const int QUANTITY_HIDDEN
Definition constants.c:519
string m_Category
folder structure eg. StaticEntities/Walls
Definition enentity.c:846
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
const int MENU_RADIAL_QUICKBAR
Definition constants.c:198
WidgetFlags
Definition enwidgets.c:58
Icon x
Icon y
EInputDeviceType
Definition input.c:3
void RefreshQuickbar()
void UpdateControlsElements()
RadialMenuControlType
Definition radialmenu.c:2
void RadialMenu()
Definition radialmenu.c:84
RadialQuickbarCategory
@ SPECIALIZED_LIGHTS
bool IsNVGExtra()
string GetItemName()
bool IsLightSourceExtra()
enum RadialQuickbarCategory m_IsLightSourceExtra
void RadialQuickbarItem(int id, EntityAI item, string item_name, int category=RadialQuickbarCategory.DEFAULT, int category_switch=-1)
void SetItem(EntityAI item)
int GetItemCategory()
int m_CategorySwitchID
EntityAI GetItem()
int GetCategorySwitchID()
int GetId()
bool m_IsNVG