Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ConfigurableDialogUI.c
Go to the documentation of this file.
1 //-------------------------------------------------------------------------------------------
7 #define DEBUG_CONFIGURABLE_DIALOGS
8 
11 typedef ScriptInvokerBase<ScriptInvokerConfigurableDialogMethod> ScriptInvokerConfigurableDialog;
12 
13 class SCR_ConfigurableDialogUi: ScriptedWidgetComponent
14 {
15  static const ResourceName NAVIGATION_BUTTON_LAYOUT = "{87037226B1A2064B}UI/layouts/WidgetLibrary/Buttons/WLib_NavigationButtonSuperSmall.layout";
16 
17  // Attributes
18  [Attribute((1/UIConstants.FADE_RATE_FAST).ToString(), UIWidgets.Auto, "Duration of fade in and fade out animations")]
19  protected float m_fFadeInTime;
20 
21  [Attribute(NAVIGATION_BUTTON_LAYOUT, UIWidgets.ResourceNamePicker, "Layout of the navigation button", params: "layout")]
22  protected ResourceName m_sNavigationButtonLayout;
23 
24  [Attribute("ButtonsLeft", UIWidgets.Auto, "Widget name of left buttons layout")]
25  protected string m_sWidgetNameButtonsLeft;
26 
27  [Attribute("ButtonsRight", UIWidgets.Auto, "Widget name of right buttons layout")]
28  protected string m_sWidgetNameButtonsRight;
29 
30  [Attribute("ButtonsCenter", UIWidgets.Auto, "Widget name of center buttons layout")]
31  protected string m_sWidgetNameButtonsCenter;
32 
33  // Script Invokers
34  ref ScriptInvoker m_OnConfirm = new ScriptInvoker(); // (SCR_ConfigurableDialogUi dlg) - Called when Confirm button was clicked, if you don't override OnConfirm of this class
35  ref ScriptInvoker m_OnCancel = new ScriptInvoker(); // (SCR_ConfigurableDialogUi dlg) - Called when Cancel button was clicked, if you don't override OnConfirm of this class
36  ref ScriptInvoker m_OnClose = new ScriptInvoker(); // (SCR_ConfigurableDialogUi dlg) - Called when dialog is closed, AFTER the fade out animation is over
37  ref ScriptInvoker m_OnCloseStart = new ScriptInvoker(); // (SCR_ConfigurableDialogUi dlg) - Called when dialog is closed, as soon as the fade out animation STARTS
38  ref ScriptInvoker m_OnButtonPressed = new ScriptInvoker(); // (SCR_ConfigurableDialogUi dlg, string tag) - Generic delegate called by all the buttons, returning their tag
39 
40  // Widgets
41  protected ImageWidget m_wImgTopLine;
42  protected ImageWidget m_wImgTitleIcon;
43  protected TextWidget m_wTitle;
44  protected TextWidget m_wMessage;
45  protected VerticalLayoutWidget m_wContentVerticalLayout;
46 
47  // Other
48  protected ref map<string, SCR_InputButtonComponent> m_aButtonComponents = new map<string, SCR_InputButtonComponent>;
49  protected Widget m_wRoot;
50  protected OverlayWidget m_wDialogBase;
51 
52  protected SCR_DynamicFooterComponent m_DynamicFooter;
53 
54  // Menu handler which performs menu-specific actions.
55  protected MenuBase m_ProxyMenu;
56 
57  // Current dialog preset for data
58  protected ref SCR_ConfigurableDialogUiPreset m_DialogPreset;
59 
60  // Tag of the last button Button pressed
61  protected string m_sLastPressedButtonTag;
62 
63  // Prevents Close() to be called multiple times
64  protected bool m_bIsClosing;
65 
66  protected static SCR_ConfigurableDialogUi m_CurrentDialog;
67 
68  static const string BUTTON_CONFIRM = "confirm";
69  static const string BUTTON_CANCEL = "cancel";
70 
71 
72  //-------------------------------------------------------------------------------------------------------------------------
73  // P U B L I C A P I
74  //-------------------------------------------------------------------------------------------------------------------------
75  //-----------------------------------------------------------------------
77  static SCR_ConfigurableDialogUi CreateFromPreset(ResourceName presetsResourceName, string tag, SCR_ConfigurableDialogUi customDialogObj = null)
78  {
79  // Create presets
80  Resource rsc = BaseContainerTools.LoadContainer(presetsResourceName);
81  BaseContainer container = rsc.GetResource().ToBaseContainer();
82  SCR_ConfigurableDialogUiPresets presets = SCR_ConfigurableDialogUiPresets.Cast(BaseContainerTools.CreateInstanceFromContainer(container));
83 
84  // Find preset
85  SCR_ConfigurableDialogUiPreset preset = presets.FindPreset(tag);
86 
87  // Bail if preset is not found
88  if (!preset)
89  {
90  Print(string.Format("[SCR_ConfigurableDialogUi] Preset was not found: %1, %2", presets, tag), LogLevel.ERROR);
91  return null;
92  }
93 
94 
95  SCR_ConfigurableDialogUi dialog = CreateByPreset(preset, customDialogObj);
96 
97  #ifdef DEBUG_CONFIGURABLE_DIALOGS
98  Print(string.Format("[SCR_ConfigurableDialogUi] presetsResourceName: %1, tag: %2, customDialogObj: %3", presetsResourceName, tag, customDialogObj));
99  #endif
100 
101  return dialog;
102  }
103 
104  //------------------------------------------------------------------------------------------------
105  static SCR_ConfigurableDialogUi CreateByPreset(SCR_ConfigurableDialogUiPreset preset, SCR_ConfigurableDialogUi customDialogObj = null)
106  {
107  // Open the proxy dialog
108  SCR_ConfigurableDialogUiProxy proxyComp = SCR_ConfigurableDialogUiProxy.Cast(GetGame().GetMenuManager().OpenDialog(ChimeraMenuPreset.ConfigurableDialog));
109 
110  // Create the base configurable dialog layout inside proxy
111  Widget internalWidget = GetGame().GetWorkspace().CreateWidgets(preset.m_sLayout, proxyComp.GetRootWidget());
112 
113  if (!internalWidget)
114  {
115  Print(string.Format("[SCR_ConfigurableDialogUi] internalWidget wans't created"), LogLevel.ERROR);
116  return null;
117  }
118 
119  // Create the content layout inside the content area of the base layout, if there should be one
120  if(!preset.m_sContentLayout.IsEmpty())
121  {
122  Widget contentContainer = GetContentWidget(internalWidget);
123 
124  if(!contentContainer)
125  {
126  Print(string.Format("[SCR_ConfigurableDialogUi] CreateByPreset() contentContainer wasn't found"), LogLevel.ERROR);
127  return null;
128  }
129 
130  Widget contentWidget = GetGame().GetWorkspace().CreateWidgets(preset.m_sContentLayout, contentContainer);
131 
132  AlignableSlot.SetHorizontalAlign(contentWidget, LayoutHorizontalAlign.Stretch);
133  }
134 
135  SCR_ConfigurableDialogUi dialog = SCR_ConfigurableDialogUi.Cast(internalWidget.FindHandler(SCR_ConfigurableDialogUi));
136 
137  // Create a new dialog object, or apply the provided one, if the dialog obj was not found in the layout.
138  if (!dialog)
139  {
140  if (customDialogObj)
141  dialog = customDialogObj;
142  else
143  dialog = new SCR_ConfigurableDialogUi();
144  dialog.InitAttributedVariables();
145  internalWidget.AddHandler(dialog);
146  }
147 
148  dialog.Init(internalWidget, preset, proxyComp);
149  proxyComp.Init(dialog);
150 
151  // Set action context
152  if (!preset.m_sActionContext.IsEmpty())
153  proxyComp.SetActionContext(preset.m_sActionContext);
154 
155  // Call dialog's events manually
156  dialog.OnMenuOpen(preset);
157 
158  m_CurrentDialog = dialog;
159  return dialog;
160  }
161 
162  //------------------------------------------------------------------------------------------------
163  static void InitFromPreset(ResourceName presetsResourceName, string tag, Widget widget)
164  {
165  // Create presets
166  Resource rsc = BaseContainerTools.LoadContainer(presetsResourceName);
167  BaseContainer container = rsc.GetResource().ToBaseContainer();
168  SCR_ConfigurableDialogUiPresets presets = SCR_ConfigurableDialogUiPresets.Cast(BaseContainerTools.CreateInstanceFromContainer(container));
169 
170  // Find preset
171  SCR_ConfigurableDialogUiPreset preset = presets.FindPreset(tag);
172 
173  // Bail if preset is not found
174  if (!preset)
175  {
176  Print(string.Format("[SCR_ConfigurableDialogUi] Preset was not found: %1, %2", presets, tag), LogLevel.ERROR);
177  return;
178  }
179 
180  InitByPreset(preset, widget);
181  }
182 
183  //------------------------------------------------------------------------------------------------
184  static void InitByPreset(SCR_ConfigurableDialogUiPreset preset, Widget widget)
185  {
186  MenuBase menu;
187  Widget parent = widget;
188  while (parent)
189  {
190  menu = MenuBase.Cast(parent.FindHandler(MenuBase));
191  if (menu)
192  break;
193 
194  parent = parent.GetParent();
195  }
196 
198  dialog.InitAttributedVariables();
199  dialog.Init(widget, preset, menu);
200  }
201 
202  //------------------------------------------------------------------------------------------------
203  static SCR_ConfigurableDialogUi GetCurrentDialog()
204  {
205  return m_CurrentDialog;
206  }
207 
208  //------------------------------------------------------------------------------------------------
209  static string GetCurrentDialogTag()
210  {
211  if (m_CurrentDialog)
212  return m_CurrentDialog.GetDialogPreset().m_sTag;
213 
214  return string.Empty;
215  }
216 
217  //------------------------------------------------------------------------------------------------
218  static bool IsPresetValid(ResourceName presetsResourceName, string tag)
219  {
220  // Create presets
221  Resource rsc = BaseContainerTools.LoadContainer(presetsResourceName);
222  BaseContainer container = rsc.GetResource().ToBaseContainer();
223  SCR_ConfigurableDialogUiPresets presets = SCR_ConfigurableDialogUiPresets.Cast(BaseContainerTools.CreateInstanceFromContainer(container));
224 
225  // Find preset
226  return presets.FindPreset(tag);
227  }
228 
229  //------------------------------------------------------------------------------------------------
230  // Closes the dialogue with a fade-out animation
231  void Close()
232  {
233  if (m_bIsClosing)
234  return;
235 
236  m_bIsClosing = true;
237  //AnimateWidget.Opacity(GetRootWidget(), 0, 1 / m_fFadeInTime);
238  //GetGame().GetCallqueue().CallLater(Internal_Close, m_fFadeInTime * 1000.0);
239  m_OnCloseStart.Invoke(this);
240  Internal_Close();
241  }
242 
243 
244  //------------------------------------------------------------------------------------------------
245  void SetTitle(string text)
246  {
247  if (m_wTitle)
248  m_wTitle.SetText(text);
249  }
250 
251 
252  //------------------------------------------------------------------------------------------------
253  void SetMessage(string text)
254  {
255  if (m_wMessage)
256  {
257  m_wMessage.SetVisible(true);
258  m_wMessage.SetText(text);
259  }
260  }
261 
262  //------------------------------------------------------------------------------------------------
263  void SetMessageColor(Color color)
264  {
265  if (m_wMessage)
266  m_wMessage.SetColor(color);
267  }
268 
269  //------------------------------------------------------------------------------------------------
270  TextWidget GetMessageWidget() { return m_wMessage; }
271 
272  //------------------------------------------------------------------------------------------------
273  string GetMessageStr()
274  {
275  if (m_wMessage)
276  return m_wMessage.GetText();
277 
278  return "";
279  }
280 
281 
282  //------------------------------------------------------------------------------------------------
284  void SetTitleIcon(ResourceName image, string imageName)
285  {
286  if (!m_wImgTitleIcon)
287  return;
288 
289  // Set image by input
290  if (image.EndsWith("imageset"))
291  m_wImgTitleIcon.LoadImageFromSet(0, image, imageName);
292  else
293  m_wImgTitleIcon.LoadImageTexture(0, image);
294  }
295 
296  //------------------------------------------------------------------------------------------------
298  void SetIconColor(Color color)
299  {
300  if (!m_wImgTitleIcon)
301  return;
302 
303  m_wImgTitleIcon.SetColor(color);
304  }
305 
306  //------------------------------------------------------------------------------------------------
308  void SetStyle(EConfigurableDialogStyle type)
309  {
310  // Check widgets
311  if (!m_wImgTopLine || !m_wImgTitleIcon)
312  return;
313 
314  // Select color
315  Color color = Color.FromInt(Color.WHITE);
316 
317  switch (type)
318  {
319  case EConfigurableDialogStyle.ACTION:
320  color = Color.FromInt(UIColors.CONTRAST_COLOR.PackToInt());
321  break;
322 
323  case EConfigurableDialogStyle.WARNING:
324  color = Color.FromInt(UIColors.WARNING.PackToInt());
325  break;
326 
327  case EConfigurableDialogStyle.POSITIVE:
328  color = Color.FromInt(UIColors.CONFIRM.PackToInt());
329  break;
330 
331  case EConfigurableDialogStyle.ONLINE:
332  color = Color.FromInt(UIColors.ONLINE.PackToInt());
333  break;
334  }
335 
336  // Set colors
337  m_wImgTopLine.SetColor(color);
338  m_wImgTitleIcon.SetColor(color);
339  }
340 
341  //----------------------------------------------------------------------------------------
343  static Widget GetContentWidget(Widget baseWidget)
344  {
345  if(!baseWidget)
346  {
347  Print(string.Format("[SCR_ConfigurableDialogUi] GetContentWidet(): invalid base Widget"), LogLevel.ERROR);
348  return null;
349  }
350 
351  Widget contentContainer = baseWidget.FindAnyWidget("ContentLayoutContainer");
352 
353  if(!contentContainer)
354  {
355  Print(string.Format("[SCR_ConfigurableDialogUi] GetContentWidet(): couldn't find ContentLayoutContainer widget in base layout"), LogLevel.ERROR);
356  return null;
357  }
358 
359  return contentContainer;
360  }
361 
362  //----------------------------------------------------------------------------------------
364  static Widget GetContentLayoutRoot(Widget baseWidget)
365  {
366  return GetContentWidget(baseWidget).GetChildren();
367  }
368 
369  //----------------------------------------------------------------------------------------
371  OverlayWidget GetDialogBaseOverlay()
372  {
373  return m_wDialogBase;
374  }
375 
376  //----------------------------------------------------------------------------------------
378  void BindButtonConfirm(SCR_InputButtonComponent button)
379  {
380  if (!button)
381  return;
382 
383  button.m_OnActivated.Insert(OnConfirm);
384 
386  if(m_aButtonComponents.Contains(BUTTON_CONFIRM))
387  m_aButtonComponents.Set(BUTTON_CONFIRM, button);
388  else
389  m_aButtonComponents.Insert(BUTTON_CONFIRM, button);
390  }
391 
392 
393  //----------------------------------------------------------------------------------------
395  void BindButtonCancel(SCR_InputButtonComponent button)
396  {
397  if (!button)
398  return;
399 
400  button.m_OnActivated.Insert(OnCancel);
401 
403  if(m_aButtonComponents.Contains(BUTTON_CANCEL))
404  m_aButtonComponents.Set(BUTTON_CANCEL, button);
405  else
406  m_aButtonComponents.Insert(BUTTON_CANCEL, button);
407  }
408 
409 
410  //----------------------------------------------------------------------------------------
412  void BindButtonGeneric(SCR_InputButtonComponent button, string tag = string.Empty)
413  {
414  if (!button)
415  return;
416 
417  button.m_OnActivated.Insert(OnButtonPressed);
418 
420  Widget root = button.GetRootWidget();
421  string buttonTag = tag;
422  if (root && buttonTag.IsEmpty())
423  buttonTag = root.GetName();
424 
425  if(m_aButtonComponents.Contains(buttonTag))
426  m_aButtonComponents.Set(buttonTag, button);
427  else
428  m_aButtonComponents.Insert(buttonTag, button);
429  }
430 
431  //-------------------------------------------------------------------------------------------------------------------------
432  // P R O T E C T E D M E T H O D S
433  //-------------------------------------------------------------------------------------------------------------------------
434  //-------------------------------------------------------------------------------------------------------------------------
435  // C A N B E O V E R R I D E N I N I N H E R I T E D C L A S S E S
436  //-------------------------------------------------------------------------------------------------------------------------
437  //----------------------------------------------------------------------------------------
438  protected void OnConfirm()
439  {
440  Close();
441  m_OnConfirm.Invoke(this);
442  }
443 
444 
445  //----------------------------------------------------------------------------------------
446  protected void OnCancel()
447  {
448  Close();
449  m_OnCancel.Invoke(this);
450  }
451 
452 
453  //----------------------------------------------------------------------------------------
454  protected void OnButtonPressed(SCR_InputButtonComponent button)
455  {
456  m_sLastPressedButtonTag = GetButtonTag(button);
457  m_OnButtonPressed.Invoke(this, m_sLastPressedButtonTag);
458  }
459 
460  //----------------------------------------------------------------------------------------
463  protected void OnMenuOpen(SCR_ConfigurableDialogUiPreset preset);
464 
465  //----------------------------------------------------------------------------------------
466  void OnMenuUpdate(float tDelta);
467 
468  //----------------------------------------------------------------------------------------
469  void OnMenuFocusGained();
470 
471  //----------------------------------------------------------------------------------------
472  void OnMenuFocusLost();
473 
474  //----------------------------------------------------------------------------------------
475  void OnMenuShow();
476 
477  //----------------------------------------------------------------------------------------
478  void OnMenuHide();
479 
480  //----------------------------------------------------------------------------------------
481  void OnMenuClose();
482 
483  //----------------------------------------------------------------------------------------
485  {
486  HorizontalLayoutWidget wLayout;
487  float padding, paddingLeft, paddingRight;
488  switch (buttonPreset.m_eAlign)
489  {
491  wLayout = HorizontalLayoutWidget.Cast(GetRootWidget().FindAnyWidget(m_sWidgetNameButtonsLeft));
492  break;
493 
495  wLayout = HorizontalLayoutWidget.Cast(GetRootWidget().FindAnyWidget(m_sWidgetNameButtonsRight));
496  break;
497 
498  default:
499  wLayout = HorizontalLayoutWidget.Cast(GetRootWidget().FindAnyWidget(m_sWidgetNameButtonsCenter)); break;
500  }
501 
502  Widget wButton = GetGame().GetWorkspace().CreateWidgets(m_sNavigationButtonLayout, wLayout);
503 
505  float left, top, bottom;
506  AlignableSlot.GetPadding(wButton, left, top, padding, bottom);
507  switch (buttonPreset.m_eAlign)
508  {
510  paddingRight = padding;
511  break;
512 
514  paddingLeft = padding;
515  break;
516 
517  default: break;
518  }
519 
520  AlignableSlot.SetPadding(wButton, paddingLeft, 0.0, paddingRight, 0.0);
521 
524 
525  if (!comp)
526  return null;
527 
528  comp.SetVisible(buttonPreset.m_bShowButton, false);
529  comp.SetLabel(buttonPreset.m_sLabel);
530  comp.SetAction(buttonPreset.m_sActionName);
531 
532  comp.SetHoverSound(buttonPreset.m_sSoundHovered);
533  comp.SetClickedSound(buttonPreset.m_sSoundClicked);
534 
535  comp.m_OnActivated.Insert(OnButtonPressed);
536 
538  m_aButtonComponents.Insert(buttonPreset.m_sTag, comp);
539 
540  return comp;
541  }
542 
543  //----------------------------------------------------------------------------------------
545  SCR_InputButtonComponent FindButton(string tag)
546  {
547  return m_aButtonComponents.Get(tag);
548  }
549 
550  //----------------------------------------------------------------------------------------
552  string GetButtonTag(SCR_InputButtonComponent button)
553  {
554  if(!button)
555  return string.Empty;
556 
557  return m_aButtonComponents.GetKeyByValue(button);
558  }
559 
560  //----------------------------------------------------------------------------------------
561  void ClearButtons()
562  {
563  m_aButtonComponents.Clear();
564  }
565 
566  //----------------------------------------------------------------------------------------
567  protected void Init(Widget root, SCR_ConfigurableDialogUiPreset preset, MenuBase proxyMenu)
568  {
569  m_ProxyMenu = proxyMenu;
570  m_DialogPreset = preset;
571  m_wRoot = root;
572 
573  InitWidgets();
574 
575  // Set title
576  SetTitle(preset.m_sTitle);
577 
578  // Set message
579  if (!preset.m_sMessage.IsEmpty())
580  {
581  SetMessage(preset.m_sMessage);
582  }
583 
584  // Set style
585  SetStyle(preset.m_eVisualStyle);
586 
587  // Set title image
588  if(m_wImgTitleIcon)
589  m_wImgTitleIcon.SetVisible(preset.m_bShowIcon);
590 
591  if (!preset.m_sTitleIconTexture.IsEmpty())
592  {
593  SetTitleIcon(preset.m_sTitleIconTexture, preset.m_sTitleIconImageName);
594  }
595 
596  // Footer
597  m_DynamicFooter = SCR_DynamicFooterComponent.FindComponentInHierarchy(GetRootWidget());
598 
599  // Create buttons
600  HorizontalLayoutWidget wLeft = HorizontalLayoutWidget.Cast(GetRootWidget().FindAnyWidget(m_sWidgetNameButtonsLeft));
601  HorizontalLayoutWidget wRight = HorizontalLayoutWidget.Cast(GetRootWidget().FindAnyWidget(m_sWidgetNameButtonsRight));
602  HorizontalLayoutWidget wCenter = HorizontalLayoutWidget.Cast(GetRootWidget().FindAnyWidget(m_sWidgetNameButtonsCenter));
603 
604  foreach (SCR_ConfigurableDialogUiButtonPreset buttonPreset : preset.m_aButtons)
605  {
606  CreateButton(buttonPreset);
607  }
608 
609  // Bind actions to default buttons (if they were created)
610  SCR_InputButtonComponent buttonConfirm = FindButton(BUTTON_CONFIRM);
611  BindButtonConfirm(buttonConfirm);
612 
613  SCR_InputButtonComponent buttonCancel = FindButton(BUTTON_CANCEL);
614  BindButtonCancel(buttonCancel);
615  }
616 
617 
618  //----------------------------------------------------------------------------------------
619  protected void InitWidgets()
620  {
621  Widget w = m_wRoot;
622 
623  // Images
624  m_wImgTopLine = ImageWidget.Cast(w.FindAnyWidget("Separator"));
625  m_wImgTitleIcon = ImageWidget.Cast(w.FindAnyWidget("ImgTitleIcon"));
626 
627  // Texts
628  m_wTitle = TextWidget.Cast(w.FindAnyWidget("Title"));
629  m_wMessage = TextWidget.Cast(w.FindAnyWidget("Message"));
630 
631  // Verical layout widget
632  m_wContentVerticalLayout = VerticalLayoutWidget.Cast(w.FindAnyWidget("ContentVerticalLayout"));
633 
634  // Base Overlay
635  m_wDialogBase = OverlayWidget.Cast(w.FindAnyWidget("DialogBase"));
636 
637  /*
638  // Play animation
639  w.SetOpacity(0);
640  AnimateWidget.Opacity(w, 1, 1 / m_fFadeInTime);*/
641  }
642 
643 
644  //----------------------------------------------------------------------------------------
645  Widget GetRootWidget()
646  {
647  return m_wRoot;
648  }
649 
650  //----------------------------------------------------------------------------------------
651  SCR_ConfigurableDialogUiPreset GetDialogPreset()
652  {
653  return m_DialogPreset;
654  }
655 
656  //----------------------------------------------------------------------------------------
657  protected void Internal_Close()
658  {
659  if (!m_ProxyMenu)
660  return;
661 
662  m_ProxyMenu.Close();
663  m_OnClose.Invoke(this);
664  }
665 
666  //----------------------------------------------------------------------------------------
669  protected void InitAttributedVariables()
670  {
671  if (m_sNavigationButtonLayout.IsEmpty())
672  m_sNavigationButtonLayout = NAVIGATION_BUTTON_LAYOUT;
673 
674  if (m_sWidgetNameButtonsLeft.IsEmpty())
675  m_sWidgetNameButtonsLeft = "ButtonsLeft";
676 
677  if (m_sWidgetNameButtonsRight.IsEmpty())
678  m_sWidgetNameButtonsRight = "ButtonsRight";
679 
680  if (m_sWidgetNameButtonsCenter.IsEmpty())
681  m_sWidgetNameButtonsCenter = "ButtonsCenter";
682 
683  if (m_fFadeInTime == 0)
684  m_fFadeInTime = 1/UIConstants.FADE_RATE_FAST;
685  }
686 };
687 
688 
689 //-------------------------------------------------------------------------------------------
692 {
693  protected SCR_ConfigurableDialogUi m_Dlg;
694 
695  void Init(SCR_ConfigurableDialogUi dlg)
696  {
697  m_Dlg = dlg;
698  }
699 
700  //-------------------------------------------------------------------------------------------
701  override void OnMenuUpdate(float tDelta)
702  {
703  super.OnMenuUpdate(tDelta);
704  m_Dlg.OnMenuUpdate(tDelta);
705  }
706 
707  //-------------------------------------------------------------------------------------------
708  override void OnMenuFocusGained()
709  {
710  super.OnMenuFocusGained();
711 
712  if (m_Dlg)
713  m_Dlg.OnMenuFocusGained();
714  }
715 
716  //-------------------------------------------------------------------------------------------
717  override void OnMenuFocusLost()
718  {
719  super.OnMenuFocusLost();
720 
721  if (m_Dlg)
722  m_Dlg.OnMenuFocusLost();
723  }
724 
725  //-------------------------------------------------------------------------------------------
726  override void OnMenuShow()
727  {
728  super.OnMenuShow();
729 
730  if (m_Dlg)
731  m_Dlg.OnMenuShow();
732  }
733 
734  //-------------------------------------------------------------------------------------------
735  override void OnMenuHide()
736  {
737  super.OnMenuHide();
738 
739  if (m_Dlg)
740  m_Dlg.OnMenuHide();
741  }
742 
743  //-------------------------------------------------------------------------------------------
744  override void OnMenuClose()
745  {
746  super.OnMenuClose();
747 
748  if (m_Dlg)
749  m_Dlg.OnMenuClose();
750  }
751 };
752 
753 
754 //-------------------------------------------------------------------------------------------
757 {
758  LEFT = 0,
761 };
762 
763 
764 //------------------------------------------------------------------------------------------------
767 {
773 };
774 
775 
776 //-------------------------------------------------------------------------------------------
777 // C O N F I G U R A T I O N C L A S S E S
778 //-------------------------------------------------------------------------------------------
779 //-------------------------------------------------------------------------------------------
783 {
784  [Attribute("", UIWidgets.Auto, "Custom tag, used for finding this button at run time")]
785  string m_sTag;
786 
787  [Attribute("", UIWidgets.Auto, "Action name the button will listen to")]
788  string m_sActionName;
789 
790  [Attribute("", UIWidgets.Auto, "Label of the button")]
791  string m_sLabel;
792 
793  [Attribute("0", UIWidgets.ComboBox, "Alignment of the button", "", ParamEnumArray.FromEnum(EConfigurableDialogUiButtonAlign))]
795 
796  [Attribute(SCR_SoundEvent.SOUND_FE_BUTTON_HOVER, UIWidgets.EditBox, "")]
797  string m_sSoundHovered;
798 
799  [Attribute(SCR_SoundEvent.CLICK, UIWidgets.EditBox, "")]
800  string m_sSoundClicked;
801 
802  [Attribute("1", UIWidgets.CheckBox)]
803  bool m_bShowButton;
804 };
805 
806 //-------------------------------------------------------------------------------------------
810 {
811  [Attribute("{E6B607B27BCC1477}UI/layouts/Menus/Dialogs/ConfigurableDialog.layout", UIWidgets.ResourceNamePicker, ".layout for the base of the dialog", params: "layout")]
812  ResourceName m_sLayout;
813 
814  [Attribute("", UIWidgets.ResourceNamePicker, ".layout for the content of the dialog", params: "layout")]
815  ResourceName m_sContentLayout;
816 
817  [Attribute("", UIWidgets.Auto, "Custom tag, used for finding this preset at run time.")]
818  string m_sTag;
819 
820  [Attribute("0", UIWidgets.ComboBox, "Visual style. Affects color of elements.", "", ParamEnumArray.FromEnum(EDialogType))]
821  EDialogType m_eVisualStyle;
822 
823  [Attribute(UIConstants.ICONS_IMAGE_SET, UIWidgets.ResourcePickerThumbnail, "Texture or imageset for title icon", "edds imageset")]
824  ResourceName m_sTitleIconTexture;
825 
826  [Attribute("1")]
827  bool m_bShowIcon;
828 
829  [Attribute("misc", UIWidgets.Auto)]
830  string m_sTitleIconImageName;
831 
832  [Attribute("", UIWidgets.Auto, "Message to be displayed inside, if messaage widget is present.")]
833  string m_sMessage;
834 
835  [Attribute("", UIWidgets.Auto, "Title of the dialog")]
836  string m_sTitle;
837 
838  [Attribute()]
839  ref array<ref SCR_ConfigurableDialogUiButtonPreset> m_aButtons;
840 
841  [Attribute(string.Empty, UIWidgets.EditBox, "Action context of the menu. If empty, MenuContext is used, same as in standard menu manager.")]
842  string m_sActionContext;
843 };
844 
845 
846 //-------------------------------------------------------------------------------------------
848 [BaseContainerProps(configRoot : true)]
850 {
851  [Attribute()]
852  ref array<ref SCR_ConfigurableDialogUiPreset> m_aPresets;
853 
854 
855  //-------------------------------------------------------------------------------------------
857  SCR_ConfigurableDialogUiPreset FindPreset(string tag)
858  {
859  foreach (auto i : m_aPresets)
860  {
861  if (i.m_sTag == tag)
862  return i;
863  }
864 
865  return null;
866  }
867 };
EDialogType
EDialogType
Definition: DialogUI.c:236
ACTION
@ ACTION
Definition: SCR_ConfigurableDialogUI.c:769
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
NEUTRAL
@ NEUTRAL
Definition: SCR_ConfigurableDialogUI.c:768
SCR_ConfigurableDialogUiButtonPreset
Configuration for a button.
Definition: SCR_ConfigurableDialogUI.c:782
UIConstants
Definition: Constants.c:130
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
ONLINE
@ ONLINE
Definition: SCR_ConfigurableDialogUI.c:772
m_aButtonComponents
protected ref map< string, SCR_InputButtonComponent > m_aButtonComponents
Definition: SCR_BrowserHoverTooltipComponent.c:27
EConfigurableDialogUiButtonAlign
EConfigurableDialogUiButtonAlign
Configuration for button alignment.
Definition: SCR_ConfigurableDialogUI.c:756
LEFT
@ LEFT
Definition: SCR_ConfigurableDialogUI.c:758
m_wMessage
protected RichTextWidget m_wMessage
Definition: SCR_BrowserHoverTooltipComponent.c:24
ScriptInvokerConfigurableDialogMethod
func ScriptInvokerConfigurableDialogMethod
Definition: SCR_ConfigurableDialogUI.c:10
func
func
Definition: SCR_AIThreatSystem.c:5
SCR_ConfigurableDialogUiProxy
It is here to expose the Menu API to the configurable dialog instance.
Definition: SCR_ConfigurableDialogUI.c:691
SCR_ConfigurableDialogUiPresets
Class for a .conf file with multiple presets.
Definition: SCR_ConfigurableDialogUI.c:849
Attribute
typedef Attribute
Post-process effect of scripted camera.
UIColors
Definition: Constants.c:16
DialogUI
Definition: DialogUI.c:1
SCR_ConfigurableDialogUiPreset
Configuration for a dialog.
Definition: SCR_ConfigurableDialogUI.c:809
WARNING
@ WARNING
Definition: SCR_ConfigurableDialogUI.c:770
m_aPresets
ref array< ref SCR_ScriptedWidgetTooltipPreset > m_aPresets
Definition: SCR_ScriptedWidgetTooltip.c:407
RIGHT
@ RIGHT
Definition: SCR_ConfigurableDialogUI.c:759
ScriptInvokerConfigurableDialog
ScriptInvokerBase< ScriptInvokerConfigurableDialogMethod > ScriptInvokerConfigurableDialog
Definition: SCR_ConfigurableDialogUI.c:11
CENTER
@ CENTER
Definition: SCR_ConfigurableDialogUI.c:760
SCR_BaseContainerCustomTitleField
SCR_Faction ScriptedFaction SCR_BaseContainerCustomTitleField("m_sCallsign")
Definition: SCR_Faction.c:672
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition: ChimeraMenuBase.c:3
SCR_ConfigurableDialogUi
Definition: SCR_ConfigurableDialogUI.c:13
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
EConfigurableDialogStyle
EConfigurableDialogStyle
Style of the dialog.
Definition: SCR_ConfigurableDialogUI.c:766
POSITIVE
@ POSITIVE
Definition: SCR_ConfigurableDialogUI.c:771
SCR_InputButtonComponent
Definition: SCR_InputButtonComponent.c:1
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468