8 [
Attribute(
"", UIWidgets.ResourceNamePicker,
"Layout",
"edds")]
9 protected string m_sDefaultScenarioImg;
12 protected const string WIDGET_MODS_COUNT =
"ModsCount";
13 protected const string WIDGET_MODS_LOADING =
"LoadingMods";
14 protected const string WIDGET_MODS_ICON =
"ModsSizeIcon";
15 protected const string WIDGET_MODS_SIZE =
"ModsSizeText";
16 protected const string WIDGET_MODS_LOCKED_ICON =
"ModsLockedIcon";
19 protected const string STR_VERSION_MISMATCH =
"#AR-ServerBrowser_JoinModVersionMissmatch";
20 protected const string STR_UNJOINABLE =
"#AR-ServerBrowser_NoneServers";
22 protected const string STR_DEFAULT_VERSION =
"v0.0.0.0";
25 protected ImageWidget m_wImgModsIcon;
26 protected ImageWidget m_wImgModsLocked;
27 protected TextWidget m_wTxtModsCount;
28 protected TextWidget m_wModsSizeText;
29 protected Widget m_wImageCrossplay;
34 protected Room m_Room;
36 protected bool m_bHideScenarioImg;
43 override void HandlerAttached(Widget w)
45 super.HandlerAttached(w);
48 m_wTxtModsCount = TextWidget.Cast(w.FindAnyWidget(WIDGET_MODS_COUNT));
49 m_wModsSizeText = TextWidget.Cast(w.FindAnyWidget(WIDGET_MODS_SIZE));
50 m_wImgModsIcon = ImageWidget.Cast(w.FindAnyWidget(WIDGET_MODS_ICON));
51 m_wImgModsLocked = ImageWidget.Cast(w.FindAnyWidget(WIDGET_MODS_LOCKED_ICON));
53 Widget wModsLoading = w.FindAnyWidget(WIDGET_MODS_LOADING);
63 SetDefaultScenario(
"");
68 override void SetScenario(MissionWorkshopItem scenario)
70 m_BackendImageComponent.GetEventOnImageSelected().Clear();
71 m_BackendImageComponent.GetEventOnImageSelected().Insert(OnScenarioBackendImageSelected);
73 DisplayRoomDataScenario(
m_Room);
88 string strVersion = STR_DEFAULT_VERSION;
91 strVersion = STR_UNJOINABLE +
"!";
93 else if (
m_Room.GameVersion())
95 strVersion =
"v" +
m_Room.GameVersion();
98 strVersion +=
" - " + STR_VERSION_MISMATCH +
"!";
107 protected void OnScenarioBackendImageSelected()
109 if (m_BackendImageComponent)
110 m_BackendImageComponent.GetEventOnImageSelected().Remove(OnScenarioBackendImageSelected);
116 void SetHideScenarioImg(
bool hideContent) { m_bHideScenarioImg = hideContent; }
120 override protected void UpdateAllWidgets()
122 super.UpdateAllWidgets();
124 if (m_bHideScenarioImg)
125 m_CommonWidgets.m_wImage.LoadImageTexture(0, m_sDefaultScenarioImg,
false,
true);
135 void SetDefaultScenario(
string contentTag)
142 Print(
"[SCR_ServerScenarioDeatilsPanelComponent] No fallback content was found!");
148 if (!content.m_sImage.IsEmpty())
166 string title = content.m_sTitle;
169 if (!content.m_sTitleImageName.IsEmpty())
186 if(m_wImageCrossplay)
187 m_wImageCrossplay.SetVisible(
false);
193 void DisplayRoomData(Room room,
bool showMods =
true)
195 DisplayRoomDataScenario(room);
201 bool show = room.IsModded() && showMods;
203 m_ModsLoading.SetShown(show);
204 m_wImgModsLocked.SetVisible(
false);
206 if (!room.IsModded())
210 if (!room.PasswordProtected())
212 m_ModsLoading.SetShown(show);
217 if (!room.IsAuthorized())
219 m_ModsLoading.SetShown(
false);
221 m_wImgModsIcon.SetVisible(
true);
222 m_wImgModsLocked.SetVisible(
true);
228 protected void DisplayRoomDataScenario(Room room)
240 string strVersion = STR_DEFAULT_VERSION;
241 if (room.GameVersion())
242 strVersion =
"v" + room.GameVersion();
245 string scenarioDescription =
"";
247 scenarioDescription =
m_Scenario.Description();
250 string title = room.ScenarioName();
257 if (room.GameVersion() ==
GetGame().GetBuildVersion() && room.Joinable())
267 text +=
" - " + STR_VERSION_MISMATCH +
"!";
274 if (m_wImageCrossplay)
275 m_wImageCrossplay.SetVisible(
m_Room.IsCrossPlatform());
279 void DisplayDefaultScenarioImage()
281 if (m_BackendImageComponent)
282 m_BackendImageComponent.SetScenarioAndImage(
null,
null);
290 protected void HideModsWidgets()
292 m_wTxtModsCount.SetVisible(
false);
293 m_wImgModsIcon.SetVisible(
false);
294 m_wModsSizeText.SetVisible(
false);
296 m_ModsLoading.SetShown(
false);
306 if (!m_wTxtModsCount)
310 array<ref SCR_WorkshopItem> allMods =
m_ModsManager.GetRoomItemsScripted();
312 int count = allMods.Count();
313 m_ModsLoading.SetShown(
false);
318 m_wModsSizeText.SetVisible(
true);
319 m_wModsSizeText.SetText(
"#AR-ServerBrowser_ContentNotAllowed");
320 m_wModsSizeText.SetColor(
UIColors.WARNING);
325 bool show = (count != 0);
327 m_wImgModsIcon.SetVisible(show);
328 m_wTxtModsCount.SetVisible(show);
329 m_wModsSizeText.SetVisible(show);
330 m_wModsSizeText.SetColor(
UIColors.NEUTRAL_ACTIVE_STANDBY);
335 string totalSize =
m_ModsManager.GetModListSizeString(allMods);
338 m_wTxtModsCount.SetText(count.ToString());
339 m_wModsSizeText.SetText(totalSize);
342 array<ref SCR_WorkshopItem> toUpdateMods =
m_ModsManager.GetRoomItemsToUpdate();
345 if (toUpdateMods.IsEmpty())
351 void DisplayModsCount(
int count)
354 bool show = (count != 0);
357 m_wTxtModsCount.SetVisible(
true);
358 m_wImgModsIcon.SetVisible(
true);
359 m_wModsSizeText.SetVisible(
false);
361 m_wTxtModsCount.SetText(count.ToString());