4 protected ref SCR_BackendServiceDisplayPresets m_ServicesPresets;
7 protected ref array<ref SCR_ServicesStatusDialogComponent_Status> m_aStatuses;
10 protected ref array<ref SCR_ServicesStatusDialogComponent_Status> m_aMainStatuses;
12 [
Attribute(defvalue:
"{D6EA742398E63066}UI/layouts/Menus/Dialogs/ServiceStatusLine.layout",
params:
"layout")]
13 protected ResourceName m_LineLayout;
17 protected string m_sNoPing;
20 protected string m_sUpdatingPing;
22 [
Attribute(defvalue:
"%1+",
desc:
"Can use %1 for Max Ping display (default \"%1+\" e.g \"999+\")")]
23 protected string m_sBigPing;
27 protected string m_sStatusesMessageInitializationError;
29 [
Attribute(defvalue:
"#AR-ServicesStatus_Message_AttemptingToConnect")]
30 protected string m_sStatusesMessageAttemptingToConnect;
32 [
Attribute(defvalue:
"#AR-Workshop_Dialog_NoConnection_CheckConnection")]
33 protected string m_sStatusesMessageNoConnection;
35 [
Attribute(defvalue:
"#AR-ServicesStatus_Message_AllServicesUp")]
36 protected string m_sStatusesMessageRunning;
38 [
Attribute(defvalue:
"#AR-ServicesStatus_Message_SomeServicesUp")]
39 protected string m_sStatusesMessageWarning;
41 [
Attribute(defvalue:
"#AR-ServicesStatus_Message_AllServicesDown")]
42 protected string m_sStatusesMessageError;
45 [
Attribute(defvalue:
"#AR-ServicesStatus_LastUpdate_Seconds_Condensed")]
46 protected string m_sLastUpdateMessageSeconds;
48 [
Attribute(defvalue:
"#AR-ServicesStatus_LastUpdate_Condensed")]
49 protected string m_sLastUpdateMessageMinutes;
52 protected string m_sLastUpdateMessageNoConnection;
56 protected string m_sTooltipTag;
58 [
Attribute(defvalue:
"#AR-ServicesStatus_Legend_Warning")]
59 protected string m_sLegendWarning;
61 [
Attribute(defvalue:
"#AR-ServicesStatus_Legend_Running")]
62 protected string m_sLegendRunning;
64 [
Attribute(defvalue:
"#AR-ServicesStatus_Legend_Error")]
65 protected string m_sLegendError;
68 protected TextWidget m_wPingWidget;
69 protected Widget m_wLinesParentWidget;
70 protected TextWidget m_wServicesMessage;
71 protected TextWidget m_wLastUpdate;
72 protected TextWidget m_wRefreshMessage;
74 protected string m_sPingText;
75 protected string m_sRefreshText;
80 override void HandlerAttached(Widget w)
82 super.HandlerAttached(w);
105 m_wLastUpdate = TextWidget.Cast(w.FindAnyWidget(
"LastUpdate"));
106 SetLastUpdateMessage(-1);
113 SetRefreshMessage(0,
false);
117 ArmaReforgerScripted game =
GetGame();
118 TextWidget buildInfo = TextWidget.Cast(w.FindAnyWidget(
"BuildInfo"));
120 buildInfo.SetTextFormat(buildInfo.GetText(), game.GetBuildVersion(), game.GetBuildTime());
126 override void HandlerDeattached(Widget w)
128 super.HandlerDeattached(w);
134 protected void CreateLines(Widget w)
139 SCR_ServicesStatusDialogComponent_Status status;
144 TextWidget titleWidget;
154 line.SetName(service.m_sId);
160 if (lineComp.m_wTitle)
161 lineComp.m_wTitle.SetText(service.m_sTitle);
163 lineComp.GetOnMouseEnter().Insert(OnLineMouseEnter);
164 lineComp.GetOnMouseLeave().Insert(OnLineMouseLeave);
167 SetServiceState(service.m_sId, status.m_Status);
174 void SetPing(
int pingInMs)
179 Color color = Color.FromInt(
UIColors.WARNING.PackToInt());
181 color = Color.FromInt(
UIColors.HIGHLIGHTED.PackToInt());
183 color = Color.FromInt(
UIColors.CONFIRM.PackToInt());
189 color = Color.FromInt(
UIColors.WARNING.PackToInt());
192 else if (pingInMs == 0)
195 color = Color.FromInt(
UIColors.NEUTRAL_ACTIVE_STANDBY.PackToInt());
201 color = Color.FromInt(
UIColors.WARNING.PackToInt());
206 sPing = pingInMs.ToString();
215 array<ref SCR_BackendServiceDisplay> GetAllServices()
217 array<ref SCR_BackendServiceDisplay> services = {};
218 if (m_ServicesPresets)
228 if (!m_ServicesPresets)
236 SetServiceState(serviceInfo.m_sId, status);
253 if (lineComp.m_wBackground)
254 SetStatusBackground(lineComp.m_wBackground, status);
256 if (lineComp.m_wIconWidget)
257 SetStatusImageAndColor(lineComp.m_wIconWidget, status);
259 if (lineComp.m_wTitle)
260 SetStatusText(lineComp.m_wTitle, status);
262 lineComp.CacheStatus(status);
296 switch(servicesStatus)
324 void SetLastUpdateMessage(
int pingAge)
336 int minutes = pingAge / 60000;
337 int seconds = (pingAge / 1000) - (60 * minutes);
348 void SetRefreshMessage(
int countdown,
bool visible =
true)
350 if (!m_wRefreshMessage)
361 protected void SetStatusBackground(ImageWidget backgroundWidget,
EServiceStatus serviceStatus)
363 SCR_ServicesStatusDialogComponent_Status status = GetStatus(serviceStatus,
m_aStatuses);
367 backgroundWidget.SetColor(status.m_sBackgroundColor);
371 protected void SetStatusText(Widget textWidget,
EServiceStatus serviceStatus)
373 SCR_ServicesStatusDialogComponent_Status status = GetStatus(serviceStatus,
m_aStatuses);
377 textWidget.SetColor(status.m_sTextColor);
384 void SetStatusImageAndColor(ImageWidget iconWidget,
EServiceStatus serviceStatus,
bool mainIcon =
false)
386 SCR_ServicesStatusDialogComponent_Status status;
389 status = GetStatus(serviceStatus, m_aMainStatuses);
391 status = GetStatus(serviceStatus, m_aStatuses);
396 iconWidget.LoadImageFromSet(0, status.m_sImageSet, status.m_sIcon);
397 iconWidget.SetColor(status.m_sIconColor);
401 protected SCR_ServicesStatusDialogComponent_Status GetStatus(
EServiceStatus serviceStatus, array<ref SCR_ServicesStatusDialogComponent_Status> statuses)
406 foreach (SCR_ServicesStatusDialogComponent_Status status : statuses)
408 if (status.m_Status == serviceStatus)
416 protected void OnLineMouseEnter()
422 protected void OnLineMouseLeave()
428 protected void OnTooltipShow(
SCR_ScriptedWidgetTooltip tooltipClass, Widget tooltipWidget, Widget hoverWidget, SCR_ScriptedWidgetTooltipPreset preset,
string tag)
468 SCR_ServicesStatusDialogComponent_Status statusPreset = GetStatus(status,
m_aStatuses);
470 m_Tooltip.SetMessageColor(statusPreset.m_sIconColor);
475 class SCR_ServicesStatusDialogComponent_Status
487 ref Color m_sIconColor;
490 ref Color m_sBackgroundColor;
493 ref Color m_sTextColor;
501 ImageWidget m_wBackground;
502 ImageWidget m_wIconWidget;
505 override void HandlerAttached(Widget w)
507 super.HandlerAttached(w);
509 m_wTitle = TextWidget.Cast(w.FindAnyWidget(
"Text"));
510 m_wBackground = ImageWidget.Cast(w.FindAnyWidget(
"Background"));
511 m_wIconWidget = ImageWidget.Cast(w.FindAnyWidget(
"Icon"));