Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AddonLineDSConfigComponent.c
Go to the documentation of this file.
1//----------------------------------------------------------------------------------------------
3{
4 protected const string BUTTON_UP = "m_UpButton";
5 protected const string BUTTON_DOWN = "m_DownButton";
6 protected const string BUTTON_SORT_CONFIRM = "m_SortConfirmButton";
7 protected const string BUTTON_DISABLE_REQUIRED = "m_DisableRequiredButton";
8
9 // Marks the addon as enabled in the hosting menu, but does NOT actually enable the addon. It's a flag for the creation of the server config
10 protected bool m_bWidgetEnabled;
11
12 // Marks which addons must be added to the server config to play a specific scenario
13 protected bool m_bRequired;
14
15 // Sort buttons
16 protected SCR_ModularButtonComponent m_ButtonUp;
17 protected SCR_ModularButtonComponent m_ButtonDown;
18 protected SCR_ModularButtonComponent m_ButtonSortConfirm;
19 protected SCR_ModularButtonComponent m_ButtonDisableRequired;
20
21 protected bool m_bOnBottom;
22 protected bool m_bIsSorting;
23
28
29 //----------------------------------------------------------------------------------------------
30 override void Init(SCR_WorkshopItem item)
31 {
32 // Sorting buttons
33 // Up
34 Widget wButtonUp = m_wRoot.FindAnyWidget(BUTTON_UP);
35 if (wButtonUp)
36 m_ButtonUp = SCR_ModularButtonComponent.FindComponent(wButtonUp);
37
38 if (m_ButtonUp)
39 {
40 m_ButtonUp.m_OnClicked.Insert(InvokeEventOnButtonUp);
42 }
43
44 // Down
45 Widget wButtonDown = m_wRoot.FindAnyWidget(BUTTON_DOWN);
46 if (wButtonDown)
47 m_ButtonDown = SCR_ModularButtonComponent.FindComponent(wButtonDown);
48
49 if (m_ButtonDown)
50 {
51 m_ButtonDown.m_OnClicked.Insert(InvokeEventOnButtonDown);
53 }
54
55 // Confirm
56 Widget sortConfirm = m_wRoot.FindAnyWidget(BUTTON_SORT_CONFIRM);
57 if (sortConfirm)
58 m_ButtonSortConfirm = SCR_ModularButtonComponent.FindComponent(sortConfirm);
59
61 {
62 m_ButtonSortConfirm.m_OnClicked.Insert(OnSortConfirm);
64 }
65
66 // Disable required
67 Widget disableRequired = m_wRoot.FindAnyWidget(BUTTON_DISABLE_REQUIRED);
68 if (disableRequired)
69 m_ButtonDisableRequired = SCR_ModularButtonComponent.FindComponent(disableRequired);
70
72 m_ButtonDisableRequired.m_OnClicked.Insert(OnDisableButton);
73
74 // Setup rest
75 super.Init(item);
76
78 }
79
80 //----------------------------------------------------------------------------------------------
81 override void UpdateAllWidgets()
82 {
83 super.UpdateAllWidgets();
84
87
88 // Hide action buttons
89 m_Widgets.m_DeleteButtonComponent0.SetVisible(false);
90
91 m_Widgets.m_wHorizontalState.SetVisible(false);
92 m_Widgets.m_UpdateButtonComponent0.SetVisible(false);
93 }
94
95 //------------------------------------------------------------------------------------------------
96 override void HandleEnableButtons(bool addonEnabled, bool forceHidden = false)
97 {
98 super.HandleEnableButtons(addonEnabled, forceHidden);
99
101 m_Widgets.m_wSizeMoveLeft.SetVisible(false);
102
105 }
106
107 //------------------------------------------------------------------------------------------------
108 override void OnDisableButton()
109 {
110 if (!m_bRequired)
111 {
112 super.OnDisableButton();
113 return;
114 }
115
116 SCR_ConfigurableDialogUi dialog = SCR_ServerHostingDialogs.CreateRequiredDisableDialog();
117 if (dialog)
119 }
120
121 //----------------------------------------------------------------------------------------------
122 override bool IsEnabled()
123 {
124 return m_bWidgetEnabled;
125 }
126
127 // Display oredering buttons if enabled
128 //------------------------------------------------------------------------------------------------
129 protected void HandleSortingButtons()
130 {
131 bool onTop = m_wRoot.GetZOrder() == 0;
132 bool visible = m_bIsSorting || (m_bFocused && GetGame().GetInputManager().GetLastUsedInputDevice() == EInputDeviceType.MOUSE);
133
134 if (m_ButtonUp)
135 m_ButtonUp.SetVisible(!onTop && m_bWidgetEnabled && visible);
136
137 if (m_ButtonDown)
138 m_ButtonDown.SetVisible(!m_bOnBottom && m_bWidgetEnabled && visible);
139
142 }
143
144 //------------------------------------------------------------------------------------------------
146 {
148 m_OnRequiredDisabled.Invoke(this);
149
150 super.OnDisableButton();
151 }
152
153 //------------------------------------------------------------------------------------------------
154 protected void OnSortConfirm()
155 {
156 if (m_OnSortConfirm)
157 m_OnSortConfirm.Invoke(this);
158 }
159
160 //------------------------------------------------------------------------------------------------
161 protected void InvokeEventOnButtonUp()
162 {
164 Event_OnButtonUp.Invoke(this);
165 }
166
167 //------------------------------------------------------------------------------------------------
168 protected void InvokeEventOnButtonDown()
169 {
171 Event_OnButtonDown.Invoke(this);
172 }
173
174 //----------------------------------------------------------------------------------------------
175 // API
176 //----------------------------------------------------------------------------------------------
177 //----------------------------------------------------------------------------------------------
178 void SetWidgetEnabled(bool enabled)
179 {
180 if (m_bRequired)
181 enabled = true;
182
183 m_bWidgetEnabled = enabled;
185 }
186
187 //----------------------------------------------------------------------------------------------
188 void SetRequired(bool required)
189 {
190 m_bRequired = required;
192 }
193
194 //----------------------------------------------------------------------------------------------
196 {
197 return m_bRequired;
198 }
199
200 //----------------------------------------------------------------------------------------------
201 void SetOnBottom(bool onBottom)
202 {
203 m_bOnBottom = onBottom;
204 }
205
206 //----------------------------------------------------------------------------------------------
207 void NotifySorting(bool sorting)
208 {
209 m_bIsSorting = sorting;
212 }
213
214 //------------------------------------------------------------------------------------------------
222
223 //------------------------------------------------------------------------------------------------
231
232 //------------------------------------------------------------------------------------------------
240
241 //------------------------------------------------------------------------------------------------
249}
ArmaReforgerScripted GetGame()
Definition game.c:1398
ScriptInvokerBase< ScriptInvokerScriptedWidgetComponentMethod > ScriptInvokerScriptedWidgetComponent
ref SCR_AddonLineBaseWidgets m_Widgets
ref ScriptInvokerScriptedWidgetComponent m_OnRequiredDisabled
ref ScriptInvokerScriptedWidgetComponent Event_OnButtonDown
ScriptInvokerScriptedWidgetComponent GetOnSortConfirm()
SCR_ModularButtonComponent m_ButtonDisableRequired
ScriptInvokerScriptedWidgetComponent GetEventOnButtonDown()
ScriptInvokerScriptedWidgetComponent GetEventOnButtonUp()
ref ScriptInvokerScriptedWidgetComponent m_OnSortConfirm
override void HandleEnableButtons(bool addonEnabled, bool forceHidden=false)
ref ScriptInvokerScriptedWidgetComponent Event_OnButtonUp
ScriptInvokerScriptedWidgetComponent GetOnRequiredDisabled()
override void Init(SCR_WorkshopItem item)
bool m_bFocused
ref array< SCR_ModularButtonComponent > m_aMouseButtons