Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
gesturesmenu.c
Go to the documentation of this file.
2 {
3  CATEGORIES, //special category selection
10 }
11 
12 class GestureMenuItem
13 {
14  protected int m_ID;
15  protected string m_Name;
18  protected bool m_CanPerformEmote;
19  //radial menu
22 
23  void GestureMenuItem(int id, string name, GestureCategories category)
24  {
25  m_ID = id;
26  m_Name = name;
27  m_Category = category;
28  m_CanPerformEmote = true;
29 
30  PlayerBase player;
31  if (Class.CastTo(player,GetGame().GetPlayer()) && category != GestureCategories.CATEGORIES)
32  {
33  m_EmoteClass = player.GetEmoteManager().GetNameEmoteMap().Get(id);
34  }
35  }
36 
37  string GetName()
38  {
39  return m_Name;
40  }
41 
43  {
44  string ret = "";
45  if (GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() && m_EmoteClass && m_EmoteClass.GetInputActionName() != "")
46  {
47  map<int,ref TStringArray> button_map = InputUtils.GetComboButtonNamesFromInput(m_EmoteClass.GetInputActionName(), EInputDeviceType.MOUSE_AND_KEYBOARD);
48 
49  if (button_map && button_map.Count() > 0)
50  {
51  TStringArray buttons;
52  for (int j = 0; j < button_map.Count(); j++)
53  {
54  if (j > 0)
55  {
56  ret += "; ";
57  }
58 
59  buttons = button_map.GetElement(j);
60  for (int i = 0; i < buttons.Count(); i++)
61  {
62  if (i > 0)
63  {
64  ret += " + ";
65  }
66  ret += buttons[i];
67  }
68  }
69 
70  }
71  }
72  return ret;
73  }
74 
75  int GetID()
76  {
77  return m_ID;
78  }
79 
81  {
82  return m_Category;
83  }
84 
86  {
87  return m_RadialMenuItemCard;
88  }
89 
90  void SetRadialItemCard( Widget widget )
91  {
92  m_RadialMenuItemCard = widget;
93  }
94 
95  void SetCanPerformEmote(bool state)
96  {
97  m_CanPerformEmote = state;
98  }
99 
101  {
102  return m_CanPerformEmote;
103  }
104 }
105 
106 class GesturesMenu extends UIScriptedMenu
107 {
108  protected Widget m_GestureItemCardPanel;
109  protected ref array<ref GestureMenuItem> m_GestureItems;
110  protected Widget m_ToolbarPanel;
111 
112  protected TextWidget m_CategoryNameText;
113 
114  //
115  const string RADIAL_TEXT = "RadialText";
116  const string GESTURE_TEXT = "GestureNameText";
117  const string INPUT_TEXT = "InputActionText";
118  const string CATEGORY_NAME = "CategoryName";
119  //selections
120  protected Widget m_SelectedItem;
121  protected bool m_IsCategorySelected;
122  protected bool m_IsMenuClosing;
123  protected int m_CurrentCategory;
124 
125  //instance
126  static GesturesMenu instance;
127 
128  //============================================
129  // GesturesMenu
130  //============================================
131  void GesturesMenu()
132  {
133  m_GestureItems = new ref array<ref GestureMenuItem>;
134 
135  if ( !instance )
136  {
137  instance = this;
138  }
139 
140  GetGame().GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
141  }
142 
143  void ~GesturesMenu()
144  {
145  if (GetGame() && GetGame().GetMission())
146  {
147  GetGame().GetMission().RemoveActiveInputExcludes({"radialmenu"},false);
148  }
149  }
150 
151  //============================================
152  // Menu Controls
153  //============================================
154  static void OpenMenu()
155  {
156  GetGame().GetUIManager().EnterScriptedMenu( MENU_GESTURES, NULL );
157  }
158 
159  static void CloseMenu()
160  {
161  //execute on menu release
162  instance.OnMenuRelease();
163 
164  GetGame().GetUIManager().Back();
165 
166  //GetGame().GetMission().RemoveActiveInputExcludes({"radialmenu"},false);
167  }
168 
169  protected void OnInputPresetChanged()
170  {
171  #ifdef PLATFORM_CONSOLE
173  #endif
174  }
175 
176  //============================================
177  // Init & Widget Events
178  //============================================
179  override Widget Init()
180  {
181  m_CurrentCategory = -1;
182 
183  layoutRoot = GetGame().GetWorkspace().CreateWidgets( "gui/layouts/radial_menu/radial_gestures/day_z_gestures.layout" );
184  m_GestureItemCardPanel = layoutRoot.FindAnyWidget( RadialMenu.RADIAL_ITEM_CARD_CONTAINER );
185 
186  //register gestures menu
187  RadialMenu.GetInstance().RegisterClass( this );
188 
189  //delay updates until fully initialized
190  RadialMenu.GetInstance().SetWidgetInitialized(false);
191 
192  //set radial menu properties
193  RadialMenu.GetInstance().SetWidgetProperties( "gui/layouts/radial_menu/radial_gestures/day_z_gesture_delimiter.layout" );
194 
195  //create content (widgets) for items
196  RefreshGestures();
197 
198  m_ToolbarPanel = layoutRoot.FindAnyWidget( "toolbar_bg" );
199  m_ToolbarPanel.Show( true );
200 
201  //clear category name text
202  UpdateCategoryName( "" );
203 
204  return layoutRoot;
205  }
206 
207  override void OnShow()
208  {
209  super.OnShow();
210 
211  Mission mission = GetGame().GetMission();
212  if (mission)
213  {
214  IngameHud hud = IngameHud.Cast(mission.GetHud());
215  if (hud)
216  {
217  hud.ShowQuickbarUI(false);
218  }
219  }
220 
221  SetFocus(layoutRoot);
222  m_IsMenuClosing = false;
223  }
224 
225  override void OnHide()
226  {
227  super.OnHide();
228 
229  Mission mission = GetGame().GetMission();
230  if (mission)
231  {
232  IngameHud hud = IngameHud.Cast(mission.GetHud());
233  if (hud)
234  {
235  hud.ShowQuickbarUI(true);
236  }
237  }
238 
239  m_IsMenuClosing = true;
240  }
241 
242  override bool OnController( Widget w, int control, int value )
243  {
244  super.OnController( w, control, value );
245 
246  RadialMenu.GetInstance().SetControlType( RadialMenuControlType.CONTROLLER );
247 
248  return false;
249  }
250 
251  override bool OnMouseEnter( Widget w, int x, int y )
252  {
253  super.OnMouseEnter( w, x, y );
254 
255  RadialMenu.GetInstance().SetControlType( RadialMenuControlType.MOUSE );
256 
257  return false;
258  }
259 
260  override bool UseMouse()
261  {
262  return true;
263  }
264 
265  override bool UseGamepad()
266  {
267  return true;
268  }
269 
270  override void Update(float timeslice)
271  {
272  super.Update(timeslice);
273 
274  //RefreshGestures(m_CurrentCategory);
275  PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
276  if (m_CurrentCategory != GestureCategories.CATEGORIES && m_CurrentCategory != -1 && player)
277  {
278  for (int i = 0; i < m_GestureItems.Count(); i++)
279  {
280  UpdateQuickbarItemCard(m_GestureItems[i]);
281  }
282  }
283  }
284 
285  void ProcessEmoteConditionRequest(GestureMenuItem gesture_item)
286  {
287  PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
288  if (player && m_CurrentCategory != -1)
289  {
290  bool can = player.GetEmoteManager().CanPlayEmote(gesture_item.GetID()) && !player.GetEmoteManager().IsEmotePlaying();
291  gesture_item.SetCanPerformEmote(can);
292  }
293  }
294 
295  //============================================
296  // Gestures
297  //============================================
298  protected void RefreshGestures( GestureCategories category_id = -1 )
299  {
300  //create gestures content (widgets) based on categories
301  if ( category_id > -1 )
302  {
303  GetGestureItems( m_GestureItems, category_id);
304  m_CurrentCategory = category_id;
305  }
306  else
307  {
308  GetGestureItems( m_GestureItems, GestureCategories.CATEGORIES );
309  m_CurrentCategory = -1;
310  instance.m_IsCategorySelected = false;
311  }
312 
313  CreateGestureContent();
315  }
316 
317  protected void GetGestureItems( out ref array<ref GestureMenuItem> gesture_items, GestureCategories category )
318  {
319  gesture_items.Clear();
320 
321  //PC PLATFORM
322  //All categories
323  if ( category == GestureCategories.CATEGORIES )
324  {
325  gesture_items.Insert( new GestureMenuItem( GestureCategories.CATEGORY_1, "#STR_USRACT_EMOTE_CATEGORY_COMMS", category ) );
326  gesture_items.Insert( new GestureMenuItem( GestureCategories.CATEGORY_2, "#STR_USRACT_EMOTE_CATEGORY_INTERACTIONS", category ) );
327  gesture_items.Insert( new GestureMenuItem( GestureCategories.CATEGORY_3, "#STR_USRACT_EMOTE_CATEGORY_POSES", category ) );
328  gesture_items.Insert( new GestureMenuItem( GestureCategories.CATEGORY_4, "#STR_USRACT_EMOTE_CATEGORY_MISC", category ) );
329  }
330  //Category 1 - commands
331  else if ( category == GestureCategories.CATEGORY_1 )
332  {
333  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_POINT, "#STR_USRACT_ID_EMOTE_POINT", category ) );
334  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_MOVE, "#STR_USRACT_ID_EMOTE_MOVE", category ) );
335  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_HOLD, "#STR_USRACT_ID_EMOTE_HOLD", category ) );
336  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_LISTENING, "#STR_USRACT_ID_EMOTE_LISTENING", category ) );
337  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_DOWN, "#STR_USRACT_ID_EMOTE_DOWN", category ) );
338  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_SILENT, "#STR_USRACT_ID_EMOTE_SILENT", category ) );
339  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_WATCHING, "#STR_USRACT_ID_EMOTE_WATCHING", category ) );
340  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_POINTSELF, "#STR_USRACT_ID_EMOTE_POINTSELF", category ) );
341  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_COME, "#STR_USRACT_ID_EMOTE_COME", category ) );
342  }
343  //Category 2 - interaction
344  else if ( category == GestureCategories.CATEGORY_2 )
345  {
346  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_GREETING, "#STR_USRACT_ID_EMOTE_GREETING", category ) );
347  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_TAUNT, "#STR_USRACT_ID_EMOTE_TAUNT", category ) );
348  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_SHAKE, "#STR_USRACT_ID_EMOTE_SHAKE", category ) );
349  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_NOD, "#STR_USRACT_ID_EMOTE_NOD", category ) );
350  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_LOOKATME, "#STR_USRACT_ID_EMOTE_LOOKATME", category ) );
351  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_TAUNTELBOW, "#STR_USRACT_ID_EMOTE_TAUNTELBOW", category ) );
352  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_THUMB, "#STR_USRACT_ID_EMOTE_THUMB", category ) );
353  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_THUMBDOWN, "#STR_USRACT_ID_EMOTE_THUMBDOWN", category ) );
354  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_CLAP, "#STR_USRACT_ID_EMOTE_CLAP", category ) );
355  }
356  //Category 3 - poses
357  else if ( category == GestureCategories.CATEGORY_3 )
358  {
359  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_SUICIDE, "#STR_USRACT_ID_EMOTE_SUICIDE", category ) );
360  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_SURRENDER, "#STR_USRACT_ID_EMOTE_SURRENDER", category ) );
361  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_SALUTE, "#STR_USRACT_ID_EMOTE_SALUTE", category ) );
362  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_SITB, "#STR_USRACT_ID_EMOTE_SITB", category ) );
363  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_LYINGDOWN, "#STR_USRACT_ID_EMOTE_LYINGDOWN", category ) );
364  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_SITA, "#STR_USRACT_ID_EMOTE_SITA", category ) );
365  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_CAMPFIRE, "#STR_USRACT_ID_EMOTE_CAMPFIRE", category ) );
366  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_SHRUG, "#STR_USRACT_ID_EMOTE_SHRUG", category ) );
367  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_SOS, "#STR_USRACT_ID_EMOTE_SOS", category ) );
368  }
369  //Category 4 - special
370  else if ( category == GestureCategories.CATEGORY_4 )
371  {
372  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_DANCE, "#STR_USRACT_ID_EMOTE_DANCE", category ) );
373  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_HEART, "#STR_USRACT_ID_EMOTE_HEART", category ) );
374  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_FACEPALM, "#STR_USRACT_ID_EMOTE_FACEPALM", category ) );
375  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_TIMEOUT, "#STR_USRACT_ID_EMOTE_TIMEOUT", category ) );
376  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_THROAT, "#STR_USRACT_ID_EMOTE_THROAT", category ) );
377  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_VOMIT, "#STR_USRACT_ID_EMOTE_VOMIT", category ) );
378  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_RPS, "#STR_USRACT_ID_EMOTE_RPS", category ) );
379  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_TAUNTTHINK, "#STR_USRACT_ID_EMOTE_TAUNTTHINK", category ) );
380  gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_TAUNTKISS, "#STR_USRACT_ID_EMOTE_TAUNTKISS", category ) );
381  //gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_RPS_R, "#STR_USRACT_ID_EMOTE_RPS_R", category ) );
382  //gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_RPS_P, "#STR_USRACT_ID_EMOTE_RPS_P", category ) );
383  //gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_RPS_S, "#STR_USRACT_ID_EMOTE_RPS_S", category ) );
384  //gesture_items.Insert( new GestureMenuItem( EmoteConstants.ID_EMOTE_DEBUG, "ID_EMOTE_DEBUG", category ) );
385  }
386  }
387 
388  protected void CreateGestureContent()
389  {
390  //delete existing gesture widgets
391  DeleteGestureItems();
392 
393  for ( int i = 0; i < m_GestureItems.Count(); ++i )
394  {
395  GestureMenuItem gesture_item = m_GestureItems.Get( i );
396 
397  //create item card
398  Widget gesture_item_card_widget = Widget.Cast( GetGame().GetWorkspace().CreateWidgets( "gui/layouts/radial_menu/radial_gestures/day_z_gesture_item_card.layout", m_GestureItemCardPanel ) );
399  gesture_item.SetRadialItemCard( gesture_item_card_widget );
400 
401  //update item card widget
402  UpdateQuickbarItemCard( gesture_item );
403 
404  //set data
405  gesture_item_card_widget.SetUserData( gesture_item );
406  }
407 
408  //set radial parameters for content
409  if ( m_GestureItems.Count() > 0 )
410  {
411  RadialMenu radial_menu = RadialMenu.GetInstance();
412  radial_menu.SetRadiusOffset( 0 );
413  radial_menu.SetExecuteDistOffset( 0.5 );
414  radial_menu.SetOffsetFromTop( 0 );
415  radial_menu.SetItemCardRadiusOffset( 0.25 );
416  radial_menu.ActivateControllerTimeout( false );
417  }
418 
419  //refresh radial menu
420  RadialMenu.GetInstance().Refresh();
421  }
422 
423  protected void UpdateQuickbarItemCard( GestureMenuItem gesture_item )
424  {
425  Widget gesture_item_card_widget = gesture_item.GetRadialItemCard();
426  //texts
427  RichTextWidget gesture_text = RichTextWidget.Cast( gesture_item_card_widget.FindAnyWidget( GESTURE_TEXT ) );
428  RichTextWidget input_text = RichTextWidget.Cast( gesture_item_card_widget.FindAnyWidget( INPUT_TEXT ) );
429  gesture_text.SetText( gesture_item.GetName() );
430  bool input_name_available = gesture_item.GetBoundButtonText() != "";
431  input_text.Show(input_name_available);
432  if (input_name_available)
433  {
434  input_text.SetText(gesture_item.GetBoundButtonText());
435  }
436  //coloring
437  ProcessEmoteConditionRequest(gesture_item);
438  if (gesture_item.GetCanPerformEmote())
439  {
440  gesture_item_card_widget.SetFlags(WidgetFlags.DISABLED); //flag just seems to be...'there', useful for showing radial selector. Still...
441  gesture_text.SetColor(ARGB(255,255,255,255));
442  input_text.SetColor(ARGB(255,255,255,255));
443  }
444  else
445  {
446  gesture_item_card_widget.ClearFlags(WidgetFlags.DISABLED);
447  gesture_text.SetColor(ARGB(255,150,150,150));
448  input_text.SetColor(ARGB(255,150,150,150));
449  }
450  }
451 
452  protected void DeleteGestureItems()
453  {
454  Widget child;
455  Widget child_to_destroy;
456 
457  child = m_GestureItemCardPanel.GetChildren();
458  while ( child )
459  {
460  child_to_destroy = child;
461  child = child.GetSibling();
462 
463  delete child_to_destroy;
464  }
465  }
466 
468  protected void UpdateToolbar() {}
469 
470  protected void UpdateCategoryName( string name )
471  {
472  if ( !m_CategoryNameText )
473  {
474  m_CategoryNameText = TextWidget.Cast( layoutRoot.FindAnyWidget( CATEGORY_NAME ) );
475  }
476 
477  m_CategoryNameText.SetText( name );
478  }
479 
480  //============================================
481  // Radial Menu Events
482  //============================================
483  //Common
484  void OnControlsChanged( RadialMenuControlType type )
485  {
486  }
487 
488  //Mouse
489  void OnMouseSelect( Widget w )
490  {
491  MarkSelected( w );
492  }
493 
494  void OnMouseDeselect( Widget w )
495  {
496  UnmarkSelected( w );
497  }
498 
499  void OnMouseExecute( Widget w )
500  {
501  }
502 
504  void OnMousePressLeft( Widget w )
505  {
506  if (instance.m_IsCategorySelected)
507  {
508  ExecuteSelectedItem();
509  }
510  else
511  {
512  ExecuteSelectedCategory( w );
513  }
514  }
515 
517  void OnMousePressRight( Widget w )
518  {
519  BackOneLevel();
520  }
521 
522  //Controller
523  void OnControllerSelect( Widget w )
524  {
525  MarkSelected( w );
526  }
527 
528  void OnControllerDeselect( Widget w )
529  {
530  UnmarkSelected( w );
531  }
532 
533  void OnControllerExecute( Widget w )
534  {
535  }
536 
537  void OnControllerPressSelect( Widget w )
538  {
539  if (instance.m_IsCategorySelected)
540  {
541  ExecuteSelectedItem();
542  }
543  else
544  {
545  ExecuteSelectedCategory( w );
546  }
547  }
548 
549  void OnControllerPressBack( Widget w )
550  {
551  BackOneLevel();
552  }
553 
554  //Actions
555  protected void MarkSelected( Widget w )
556  {
557  instance.m_SelectedItem = w;
558 
559  if ( w )
560  {
561  GestureMenuItem gesture_item;
562  w.GetUserData( gesture_item );
563 
564  //is not category
565  /*
566  if ( gesture_item && gesture_item.GetCategory() != GestureCategories.CATEGORIES )
567  {
568  //alter item visual
569  //TextWidget text_widget = TextWidget.Cast( gesture_item.GetRadialItemCard().FindAnyWidget( RADIAL_TEXT ) );
570  //text_widget.SetColor( ARGB( 255, 66, 175, 95 ) );
571  }
572  */
573  }
574  }
575 
576  protected void UnmarkSelected( Widget w )
577  {
578  instance.m_SelectedItem = NULL;
579 
580  if ( w )
581  {
582  GestureMenuItem gesture_item;
583  w.GetUserData( gesture_item );
584 
585  //is not category
586  /*
587  if ( gesture_item && gesture_item.GetCategory() != GestureCategories.CATEGORIES )
588  {
589  //alter item visual
590  //TextWidget text_widget = TextWidget.Cast( gesture_item.GetRadialItemCard().FindAnyWidget( RADIAL_TEXT ) );
591  //text_widget.SetColor( ARGB( 255, 255, 255, 255 ) );
592  }
593  */
594  }
595  }
596 
597  protected void ExecuteSelectedCategory( Widget w )
598  {
599  //only when category is not picked yet
600  if ( w )
601  {
602  GestureMenuItem gesture_item;
603  w.GetUserData( gesture_item );
604 
605  //is category
606  if ( !instance.m_IsCategorySelected && gesture_item.GetCategory() == GestureCategories.CATEGORIES )
607  {
608  //set category selected
609  instance.m_IsCategorySelected = true;
610 
611  //show selected category gestures
612  GetGestureItems( m_GestureItems, gesture_item.GetID() );
613  CreateGestureContent();
614  RefreshGestures( gesture_item.GetID() );
615 
616  //update category name text
617  UpdateCategoryName( gesture_item.GetName() );
618  }
619  /*else
620  {
621  ExecuteSelectedItem();
622  }*/
623  }
624  }
625 
626  protected void ExecuteSelectedItem()
627  {
628  if ( instance.m_IsCategorySelected && instance.m_SelectedItem )
629  {
630  if ( !GetGame().IsDedicatedServer() )
631  {
632  PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
633 
634  GestureMenuItem gesture_item;
635  instance.m_SelectedItem.GetUserData( gesture_item );
636 
637  if ( gesture_item )
638  {
639  if( player.GetEmoteManager() )
640  {
641  player.GetEmoteManager().CreateEmoteCBFromMenu( gesture_item.GetID() );
642  }
643  }
644  }
645  }
646  }
647 
648  //only moves to the GestureCategories.CATEGORIES for now
649  protected void BackOneLevel()
650  {
651  RefreshGestures();
652  UpdateCategoryName( "" );
653  }
654 
655  bool IsMenuClosing()
656  {
657  return m_IsMenuClosing;
658  }
659 
660  void SetMenuClosing(bool state)
661  {
662  m_IsMenuClosing = state;
663  }
664 
665  protected void UpdateControlsElements()
666  {
667  Widget toolbarBackSpacer = layoutRoot.FindAnyWidget("BackSpacer");
668 
669  RichTextWidget toolbarSelectIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("SelectIcon"));
670  RichTextWidget toolbarBackIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon"));
671 
672  string selectAction;
673  string backAction;
674  int controllerID;
675 
676  if (GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer() && GetGame().GetInput().GetCurrentInputDevice() == EInputDeviceType.MOUSE_AND_KEYBOARD)
677  {
678  selectAction = "UAMenuSelect";
679  backAction = "UAMenuBack";
680  controllerID = EUAINPUT_DEVICE_KEYBOARDMOUSE;
681  }
682  else
683  {
684  selectAction = "UAUISelect";
685  backAction = "UAUIBack";
686  controllerID = EUAINPUT_DEVICE_CONTROLLER;
687  }
688 
689  toolbarSelectIcon.SetText(InputUtils.GetRichtextButtonIconFromInputAction(selectAction, "", controllerID, InputUtils.ICON_SCALE_TOOLBAR));
690  toolbarBackIcon.SetText(InputUtils.GetRichtextButtonIconFromInputAction(backAction, "", controllerID, InputUtils.ICON_SCALE_TOOLBAR));
691  toolbarBackSpacer.Show(instance.m_IsCategorySelected);
692  }
693 
694  //-----------------------------------------------------------------
696  protected void OnMenuRelease();
697 }
GetGame
proto native CGame GetGame()
UIScriptedMenu
Definition: dayzgame.c:63
mission
Mission mission
Definition: displaystatus.c:28
GetCategory
GestureCategories GetCategory()
Definition: gesturesmenu.c:80
GetBoundButtonText
string GetBoundButtonText()
Definition: gesturesmenu.c:42
InputUtils
Definition: inpututils.c:1
CATEGORY_2
@ CATEGORY_2
Definition: gesturesmenu.c:5
Mission
Mission class.
Definition: gameplay.c:670
OnController
override bool OnController(Widget w, int control, int value)
Definition: inventorymenu.c:129
CATEGORY_1
@ CATEGORY_1
Definition: gesturesmenu.c:4
RadialMenu
void RadialMenu()
Definition: radialmenu.c:84
UpdateControlsElements
protected void UpdateControlsElements()
Definition: itemdropwarningmenu.c:92
GetName
string GetName()
Gets the name which is set for the ParticleManager, default is "ParticleSourceManager".
Definition: gesturesmenu.c:37
OnHide
override void OnHide()
Definition: inventorymenu.c:141
y
Icon y
m_ID
enum GestureCategories m_ID
SetRadialItemCard
void SetRadialItemCard(Widget widget)
Definition: gesturesmenu.c:90
GestureCategories
GestureCategories
Definition: gesturesmenu.c:1
CATEGORY_4
@ CATEGORY_4
Definition: gesturesmenu.c:7
EmoteBase
Definition: emotebase.c:1
EInputDeviceType
EInputDeviceType
Definition: input.c:2
RichTextWidget
Definition: gameplay.c:315
PlayerBase
Definition: playerbaseclient.c:1
map
map
Definition: controlsxboxnew.c:3
MENU_GESTURES
const int MENU_GESTURES
Definition: constants.c:184
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
TextWidget
Definition: enwidgets.c:219
CATEGORIES
@ CATEGORIES
Definition: gesturesmenu.c:3
CATEGORY_5
@ CATEGORY_5
Definition: gesturesmenu.c:8
EmoteConstants
Definition: constants.c:348
m_CanPerformEmote
protected bool m_CanPerformEmote
Definition: gesturesmenu.c:18
m_EmoteClass
protected EmoteBase m_EmoteClass
Definition: gesturesmenu.c:17
m_RadialMenuItemCard
protected Widget m_RadialMenuItemCard
Definition: gesturesmenu.c:21
GetID
int GetID()
Definition: gesturesmenu.c:75
SetCanPerformEmote
void SetCanPerformEmote(bool state)
Definition: gesturesmenu.c:95
m_Category
protected GestureCategories m_Category
Definition: gesturesmenu.c:16
array< string >
Update
proto native volatile void Update()
Definition: playersoundmanager.c:125
SetFocus
proto native void SetFocus(Widget w)
name
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
x
Icon x
GetPlayer
protected void GetPlayer()
Definition: crosshairselector.c:127
m_RadialMenuSelector
protected Widget m_RadialMenuSelector
Definition: gesturesmenu.c:20
CATEGORY_3
@ CATEGORY_3
Definition: gesturesmenu.c:6
WidgetFlags
WidgetFlags
Definition: enwidgets.c:57
OnInputPresetChanged
protected void OnInputPresetChanged()
Definition: inventory.c:160
m_Name
protected string m_Name
Definition: gesturesmenu.c:15
OnShow
override void OnShow()
Definition: controlsxbox.c:349
Widget
Definition: enwidgets.c:189
GetRadialItemCard
Widget GetRadialItemCard()
Definition: gesturesmenu.c:85
GetInput
ActionInput GetInput()
Definition: actionbase.c:1066
CONSOLE_GESTURES
@ CONSOLE_GESTURES
Definition: gesturesmenu.c:9
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition: uihintpanel.c:267
RadialMenuControlType
RadialMenuControlType
Definition: radialmenu.c:1
GestureMenuItem
void GestureMenuItem(int id, string name, GestureCategories category)
Definition: gesturesmenu.c:23
ARGB
int ARGB(int a, int r, int g, int b)
Definition: proto.c:322
GetCanPerformEmote
bool GetCanPerformEmote()
Definition: gesturesmenu.c:100