7#define DEBUG_CONFIGURABLE_DIALOGS
18 static const ResourceName NAVIGATION_BUTTON_LAYOUT =
"{87037226B1A2064B}UI/layouts/WidgetLibrary/Buttons/WLib_NavigationButtonSuperSmall.layout";
24 [
Attribute(NAVIGATION_BUTTON_LAYOUT,
UIWidgets.ResourceNamePicker,
"Layout of the navigation button",
params:
"layout")]
98 BaseContainer container = rsc.GetResource().ToBaseContainer();
107 Print(
string.Format(
"[SCR_ConfigurableDialogUi] Preset was not found: %1, %2", presets, tag),
LogLevel.ERROR);
113 #ifdef DEBUG_CONFIGURABLE_DIALOGS
114 Print(
string.Format(
"[SCR_ConfigurableDialogUi] presetsResourceName: %1, tag: %2, customDialogObj: %3", presetsResourceName, tag, customDialogObj));
140 BaseContainer container = rsc.GetResource().ToBaseContainer();
144 return presets.FindPreset(tag);
151 SCR_ConfigurableDialogUiProxy proxyComp = SCR_ConfigurableDialogUiProxy.Cast(
GetGame().GetMenuManager().OpenDialog(
ChimeraMenuPreset.ConfigurableDialog));
154 Widget internalWidget =
GetGame().GetWorkspace().CreateWidgets(preset.m_sLayout, proxyComp.GetRootWidget());
158 Print(
string.Format(
"[SCR_ConfigurableDialogUi] internalWidget wans't created"),
LogLevel.ERROR);
163 if(!preset.m_sContentLayout.IsEmpty())
167 if(!contentContainer)
169 Print(
string.Format(
"[SCR_ConfigurableDialogUi] CreateByPreset() contentContainer wasn't found"),
LogLevel.ERROR);
173 Widget contentWidget =
GetGame().GetWorkspace().CreateWidgets(preset.m_sContentLayout, contentContainer);
184 dialog = customDialogObj;
188 internalWidget.AddHandler(dialog);
191 dialog.
Init(internalWidget, preset, proxyComp);
192 proxyComp.Init(dialog);
195 if (!preset.m_sActionContext.IsEmpty())
196 proxyComp.SetActionContext(preset.m_sActionContext);
211 Print(
string.Format(
"[SCR_ConfigurableDialogUi] GetContentWidet(): invalid base Widget"),
LogLevel.ERROR);
215 Widget contentContainer = baseWidget.FindAnyWidget(
"ContentLayoutContainer");
217 if(!contentContainer)
219 Print(
string.Format(
"[SCR_ConfigurableDialogUi] GetContentWidet(): couldn't find ContentLayoutContainer widget in base layout"),
LogLevel.ERROR);
223 return contentContainer;
313 if (image.EndsWith(
"imageset"))
406 Widget root = button.GetRootWidget();
407 string buttonTag = tag;
408 if (root && buttonTag.IsEmpty())
409 buttonTag = root.GetName();
431 return SCR_MapHelper<string, SCR_InputButtonComponent>.GetKeyByValue(
m_aButtonComponents, button);
484 if (!preset.m_sMessage.IsEmpty())
496 if (!preset.m_sTitleIconTexture.IsEmpty())
498 SetTitleIcon(preset.m_sTitleIconTexture, preset.m_sTitleIconImageName);
546 float padding, paddingLeft, paddingRight;
547 switch (buttonPreset.m_eAlign)
562 wButton.SetName(buttonPreset.m_sTag);
566 float left, top, bottom;
567 AlignableSlot.GetPadding(wButton, left, top, padding, bottom);
568 switch (buttonPreset.m_eAlign)
571 paddingRight = padding;
575 paddingLeft = padding;
581 AlignableSlot.SetPadding(wButton, paddingLeft, 0.0, paddingRight, 0.0);
589 comp.SetVisible(buttonPreset.m_bShowButton,
false);
590 comp.
SetLabel(buttonPreset.m_sLabel);
591 comp.
SetAction(buttonPreset.m_sActionName);
593 comp.SetHoverSound(buttonPreset.m_sSoundHovered);
594 comp.SetClickedSound(buttonPreset.m_sSoundClicked);
641class SCR_ConfigurableDialogUiProxy :
DialogUI
654 m_Dlg.OnMenuUpdate(tDelta);
660 super.OnMenuFocusGained();
663 m_Dlg.OnMenuFocusGained();
669 super.OnMenuFocusLost();
672 m_Dlg.OnMenuFocusLost();
738 [
Attribute(
"",
UIWidgets.Auto,
"Custom tag, used for finding this button at run time")]
742 string m_sActionName;
751 string m_sSoundHovered;
754 string m_sSoundClicked;
765 [
Attribute(
"{E6B607B27BCC1477}UI/layouts/Menus/Dialogs/ConfigurableDialog.layout",
UIWidgets.ResourceNamePicker,
".layout for the base of the dialog",
params:
"layout")]
771 [
Attribute(
"",
UIWidgets.Auto,
"Custom tag, used for finding this preset at run time.")]
784 string m_sTitleIconImageName;
786 [
Attribute(
"",
UIWidgets.Auto,
"Message to be displayed inside, if messaage widget is present.")]
793 ref array<ref SCR_ConfigurableDialogUiButtonPreset> m_aButtons;
795 [
Attribute(
string.Empty,
UIWidgets.EditBox,
"Action context of the menu. If empty, MenuContext is used, same as in standard menu manager.")]
796 string m_sActionContext;
806 ref array<ref SCR_ConfigurableDialogUiPreset> m_aPresets;
813 foreach (
auto i : m_aPresets)
ArmaReforgerScripted GetGame()
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
func ScriptInvokerConfigurableDialogMethod
ScriptInvokerBase< ScriptInvokerConfigurableDialogMethod > ScriptInvokerConfigurableDialog
SCR_ConfigurableDialogUi m_Dlg
It is here to expose the Menu API to the configurable dialog instance.
EConfigurableDialogStyle
Style of the dialog.
EConfigurableDialogUiButtonAlign
Configuration for button alignment.
SCR_Faction ScriptedFaction SCR_BaseContainerCustomTitleField("m_sCallsign")
Widget GetContentWidget()
enum SCR_EServicePointType ONLINE
override void OnMenuClose()
override void OnMenuUpdate(float tDelta)
Object holding reference to resource. In destructor release the resource.
ref ScriptInvoker m_OnCancel
string m_sWidgetNameButtonsLeft
SCR_InputButtonComponent CreateButton(SCR_ConfigurableDialogUiButtonPreset buttonPreset)
SCR_DynamicFooterComponent m_DynamicFooter
static Widget GetContentWidget(Widget baseWidget)
Returns the container in which to place the content layout. Container must be called ContentLayoutCon...
static SCR_ConfigurableDialogUi CreateFromPreset(ResourceName presetsResourceName, string tag, SCR_ConfigurableDialogUi customDialogObj=null)
Creates a dialog from preset.
string GetButtonTag(SCR_InputButtonComponent button)
Returns a button's tag.
Widget GetContentLayoutRoot()
Returns the root of the content layout.
string m_sWidgetNameButtonsCenter
ref SCR_ConfigurableDialogUiPreset m_DialogPreset
static SCR_ConfigurableDialogUi GetCurrentDialog()
TextWidget GetMessageWidget()
void OnMenuOpen(SCR_ConfigurableDialogUiPreset preset)
void BindButtonCancel(SCR_InputButtonComponent button)
Allows to register a custom button to call OnCancel (i.e. one not in the conf files but placed by han...
ref map< string, SCR_InputButtonComponent > m_aButtonComponents
ref ScriptInvoker m_OnButtonPressed
ref ScriptInvoker m_OnCloseStart
static string GetCurrentDialogTag()
void BindButtonConfirm(SCR_InputButtonComponent button)
Allows to register a custom button to call OnConfirm (i.e. one not in the conf files but placed by ha...
SCR_InputButtonComponent FindButton(string tag)
Returns a button with given tag.
ResourceName m_sNavigationButtonLayout
static SCR_ConfigurableDialogUi CreateByPreset(SCR_ConfigurableDialogUiPreset preset, SCR_ConfigurableDialogUi customDialogObj=null)
static SCR_ConfigurableDialogUi m_CurrentDialog
static const string BUTTON_CANCEL
void SetMessage(string text)
void SetTitleIcon(ResourceName image, string imageName)
Set title icons with custom image.
void SetTitle(string text)
VerticalLayoutWidget m_wContentVerticalLayout
void InitAttributedVariables()
void OnButtonPressed(SCR_InputButtonComponent button)
ref ScriptInvoker m_OnConfirm
void Init(Widget root, SCR_ConfigurableDialogUiPreset preset, MenuBase proxyMenu)
SCR_ConfigurableDialogUiPreset GetDialogPreset()
OverlayWidget GetDialogBaseOverlay()
Returns the base dialog overlay (the rectangle covered by the background). Useful for dialog wide dar...
void BindButtonGeneric(SCR_InputButtonComponent button, string tag=string.Empty)
Allows to register a custom button to call OnButtonPressed (i.e. one not in the conf files but placed...
ref ScriptInvoker m_OnClose
ImageWidget m_wImgTopLine
void SetStyle(EConfigurableDialogStyle type)
Sets colors based on style.
string m_sWidgetNameButtonsRight
void SetIconColor(Color color)
Set title icons with custom image.
static const string BUTTON_CONFIRM
void SetMessageColor(Color color)
string m_sLastPressedButtonTag
ImageWidget m_wImgTitleIcon
void OnMenuUpdate(float tDelta)
static bool IsPresetValid(ResourceName presetsResourceName, string tag)
OverlayWidget m_wDialogBase
Configuration for a dialog.
Class for a .conf file with multiple presets.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
@ CENTER
Text will be centered.
SCR_FieldOfViewSettings Attribute