Dayz Explorer 1.29.162510
Loading...
Searching...
No Matches
serverbrowsermenunew.c
Go to the documentation of this file.
1const int MAX_FAVORITES = 25;
2
3#ifdef PLATFORM_CONSOLE
4const int SERVER_BROWSER_PAGE_SIZE = 22;
5#else
7#endif
8
9class ServerBrowserMenuNew extends UIScriptedMenu
10{
11 protected Widget m_Play;
12 protected TextWidget m_PlayButtonLabel;
13 protected TextWidget m_OpenStoreButtonLabel;
14
15 protected Widget m_Back;
16 protected Widget m_CustomizeCharacter;
17 protected TextWidget m_PlayerName;
18
19 protected TabberUI m_Tabber;
24
25 protected TabType m_IsRefreshing = TabType.NONE;
27 protected ServerBrowserEntry m_SelectedServer;
28
29 override Widget Init()
30 {
31 #ifdef PLATFORM_CONSOLE
32 layoutRoot = g_Game.GetWorkspace().CreateWidgets("gui/layouts/new_ui/server_browser/xbox/server_browser.layout");
33 m_FavoritesTab = new ServerBrowserFavoritesTabConsolePages(layoutRoot.FindAnyWidget("Tab_0"), this, TabType.FAVORITE);
34 m_OfficialTab = new ServerBrowserTabConsolePages(layoutRoot.FindAnyWidget("Tab_1"), this, TabType.OFFICIAL);
35 m_CommunityTab = new ServerBrowserTabConsolePages(layoutRoot.FindAnyWidget("Tab_2"), this, TabType.COMMUNITY);
36 #else
37 layoutRoot = g_Game.GetWorkspace().CreateWidgets("gui/layouts/new_ui/server_browser/pc/server_browser.layout");
38 m_FavoritesTab = new ServerBrowserFavoritesTabPc(layoutRoot.FindAnyWidget("Tab_0"), this, TabType.FAVORITE);
39 m_OfficialTab = new ServerBrowserTabPc(layoutRoot.FindAnyWidget("Tab_1"), this, TabType.OFFICIAL);
40 m_CommunityTab = new ServerBrowserTabPc(layoutRoot.FindAnyWidget("Tab_2"), this, TabType.COMMUNITY);
41 m_LANTab = new ServerBrowserTabPc(layoutRoot.FindAnyWidget("Tab_3"), this, TabType.LAN);
42 #endif
43
44 layoutRoot.FindAnyWidget("Tabber").GetScript(m_Tabber);
45
46 m_Play = layoutRoot.FindAnyWidget("play");
47 m_PlayButtonLabel = TextWidget.Cast(m_Play.FindAnyWidget("play_label"));
48 m_OpenStoreButtonLabel = TextWidget.Cast(m_Play.FindAnyWidget("open_store_label"));
49 m_Back = layoutRoot.FindAnyWidget("back_button");
50 m_CustomizeCharacter = layoutRoot.FindAnyWidget("customize_character");
51 m_PlayerName = TextWidget.Cast(layoutRoot.FindAnyWidget("character_name_text"));
53
54 #ifndef PLATFORM_CONSOLE
55 layoutRoot.FindAnyWidget("customize_character").Show(false);
56 layoutRoot.FindAnyWidget("character").Show(false);
57 #endif
58
59 Refresh();
60
61 string version;
62 g_Game.GetVersion(version);
63
64 #ifdef PLATFORM_CONSOLE
65 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
66 if (g_Game.GetInput().IsEnabledMouseAndKeyboard())
67 {
68 layoutRoot.FindAnyWidget("toolbar_bg").Show(false);
69 }
70
71 RichTextWidget playPanelBack = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon0"));
72 playPanelBack.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_NORMAL));
73
74 RichTextWidget playPanelPlay = RichTextWidget.Cast(layoutRoot.FindAnyWidget("PlayIcon0"));
75 playPanelPlay.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_NORMAL));
76 #else
77 version = "#main_menu_version" + " " + version;
78 #endif
79
80 OnlineServices.m_ServersAsyncInvoker.Insert(OnLoadServersAsync);
81 OnlineServices.m_ServerModLoadAsyncInvoker.Insert(OnLoadServerModsAsync);
83
84 m_Tabber.m_OnTabSwitch.Insert(OnTabSwitch);
85
86 m_FavoritesTab.RefreshList();
87
88 #ifdef PLATFORM_CONSOLE
90 //Sort init
91 TextWidget sort_text = TextWidget.Cast(layoutRoot.FindAnyWidget("SortText"));
92 sort_text.SetText("#str_serverbrowserroot_toolbar_bg_consoletoolbar_sort_sorttext0");
93 #endif
94
95 PPERequesterBank.GetRequester(PPERequester_ServerBrowserBlur).Start(new Param1<float>(0.5));
96
97 g_Game.GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
98 g_Game.GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
99
100 #ifdef PLATFORM_WINDOWS
101 g_Game.GetInput().EnableGamepad(false);
102 #endif
103
104 return layoutRoot;
105 }
106
108 {
109 #ifdef PLATFORM_CONSOLE
111 #endif
112
113 #ifdef PLATFORM_WINDOWS
114 g_Game.GetInput().EnableGamepad(true);
115 #endif
116
117 OnlineServices.m_ServersAsyncInvoker.Remove(OnLoadServersAsync);
118 OnlineServices.m_ServerModLoadAsyncInvoker.Remove(OnLoadServerModsAsync);
119 m_Tabber.m_OnTabSwitch.Remove(OnTabSwitch);
120 PPERequesterBank.GetRequester(PPERequester_ServerBrowserBlur).Stop();
121 }
122
127
128 protected void OnInputPresetChanged()
129 {
130 #ifdef PLATFORM_CONSOLE
132 #endif
133 }
134
135 protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
136 {
137 switch (pInputDeviceType)
138 {
139 case EInputDeviceType.CONTROLLER:
140 #ifdef PLATFORM_CONSOLE
142 layoutRoot.FindAnyWidget("toolbar_bg").Show(true);
143 layoutRoot.FindAnyWidget("ConsoleControls").Show(true);
144 #ifdef PLATFORM_MSSTORE
145 layoutRoot.FindAnyWidget("PlayIcon0").Show(true);
146 layoutRoot.FindAnyWidget("BackIcon0").Show(true);
147 #else
148 layoutRoot.FindAnyWidget("PlayIcon0").Show(false);
149 layoutRoot.FindAnyWidget("BackIcon0").Show(false);
150 #endif
151 if (g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
152 {
153 g_Game.GetUIManager().ShowUICursor(false);
154 }
155 #endif
156 break;
157
158 default:
159 #ifdef PLATFORM_CONSOLE
160 if (g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
161 {
162 layoutRoot.FindAnyWidget("toolbar_bg").Show(false);
163 layoutRoot.FindAnyWidget("ConsoleControls").Show(false);
164 #ifdef PLATFORM_MSSTORE
165 layoutRoot.FindAnyWidget("PlayIcon0").Show(false); // Not sure why these are inverted on consoles. Let's keep it safe per-platform.
166 layoutRoot.FindAnyWidget("BackIcon0").Show(false);
167 #else
168 layoutRoot.FindAnyWidget("PlayIcon0").Show(true);
169 layoutRoot.FindAnyWidget("BackIcon0").Show(true);
170 #endif
171 g_Game.GetUIManager().ShowUICursor(true);
172 }
173 #endif
174 break;
175 }
176 }
177
178 override bool OnClick(Widget w, int x, int y, int button)
179 {
180 if (button == MouseState.LEFT)
181 {
182 if (w == m_Play)
183 {
184 Play();
185 return true;
186 }
187 else if (w == m_Back)
188 {
189 Back();
190 return true;
191 }
192 else if (w == m_CustomizeCharacter)
193 {
195 return true;
196 }
197 }
198 return false;
199 }
200
201 override bool OnMouseEnter(Widget w, int x, int y)
202 {
203 if (IsFocusable(w))
204 {
206 return true;
207 }
208 return false;
209 }
210
211 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
212 {
213 if (IsFocusable(w))
214 {
215 ColorNormal(w);
216 return true;
217 }
218 return false;
219 }
220
222 {
223 m_IsRefreshing = refreshing;
224
225 OnlineServices.m_ServersAsyncInvoker.Remove(OnLoadServersAsync);
226 OnlineServices.m_ServersAsyncInvoker.Insert(OnLoadServersAsync, EScriptInvokerInsertFlags.NONE);
227 }
228
230 {
231 return m_IsRefreshing;
232 }
233
235 {
236 foreach (string id : m_Favorites)
237 {
238 array<string> output = new array<string>;
239 id.Split(":", output);
240 if (output.Count() == 2)
241 {
242 string ip = output[0];
243 int port = output[1].ToInt();
244 input.AddFavourite(ip, port);
245 }
246 }
247 }
248
249 bool IsFavorited(string server_id)
250 {
251 int index = -1;
252 if (m_Favorites)
253 {
254 index = m_Favorites.Find(server_id);
255 }
256 return (index >= 0);
257 }
258
259 // Returns whether server was favorited or not
260 bool SetFavoriteConsoles(string ipAddress, int port, bool favorite)
261 {
262 if (favorite && m_Favorites.Count() >= MAX_FAVORITES)
263 {
264 g_Game.GetUIManager().ShowDialog("#layout_notification_info_warning", "#STR_MaxFavouriteReached", 0, DBT_OK, DBB_YES, DMT_EXCLAMATION, this);
265 return false;
266 }
267
268 AddFavorite(ipAddress, port, favorite);
270
271 return favorite;
272 }
273
274 void AddFavorite(string ipAddress, int port, bool favorite)
275 {
276 string serverId = ipAddress + ":" + port;
277 bool isFavorited = IsFavorited(serverId);
278
279 if (favorite && !isFavorited)
280 {
281 m_Favorites.Insert(serverId);
282 }
283 else if (isFavorited)
284 {
285 m_Favorites.RemoveItem(serverId);
286 m_OfficialTab.Unfavorite(serverId);
287 m_CommunityTab.Unfavorite(serverId);
288 m_FavoritesTab.Unfavorite(serverId);
289 #ifndef PLATFORM_CONSOLE
290 m_LANTab.Unfavorite(serverId);
291 #endif
292 }
293 }
294
295 void Back()
296 {
297 g_Game.GetUIManager().Back();
298 }
299
300 void ShowYButton(bool show)
301 {
302 RichTextWidget yIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ResetIcon"));
303 TextWidget yText = TextWidget.Cast(layoutRoot.FindAnyWidget("ResetText"));
304
305 if (yIcon)
306 {
307 yIcon.Show(show);
308 }
309
310 if (yText)
311 {
312 yText.Show(show);
313 }
314 }
315
316 void UpdateYButtonLabel(string text)
317 {
318 TextWidget yText = TextWidget.Cast(layoutRoot.FindAnyWidget("ResetText"));
319 if (yText)
320 {
321 yText.SetText(text);
322 yText.Update();
323 }
324 }
325
326 void ShowAButton(bool show)
327 {
328 RichTextWidget aIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ConnectIcon"));
329 TextWidget aText = TextWidget.Cast(layoutRoot.FindAnyWidget("ConnectText"));
330
331 if (aIcon)
332 {
333 aIcon.Show(show);
334 }
335
336 if (aText)
337 {
338 aText.Show(show);
339 }
340 }
341
342 void UpdateAButtonLabel(string text)
343 {
344 TextWidget aText = TextWidget.Cast(layoutRoot.FindAnyWidget("ConnectText"));
345 if (aText)
346 {
347 aText.SetText(text);
348 aText.Update();
349 }
350 }
351
352 void UpdateXButtonLabel(string text)
353 {
354 TextWidget xText = TextWidget.Cast(layoutRoot.FindAnyWidget("RefreshText"));
355 if (xText)
356 {
357 xText.SetText(text);
358 xText.Update();
359 }
360 }
361
362 void ShowThumbRButton(bool show)
363 {
364 RichTextWidget trIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("SwitchIcon"));
365 TextWidget trText = TextWidget.Cast(layoutRoot.FindAnyWidget("SwitchText"));
366
367 if (trIcon)
368 {
369 trIcon.Show(show);
370 }
371
372 if (trText)
373 {
374 trText.Show(show);
375 }
376 }
377
378 void UpdateThumbRButtonLabel(string text)
379 {
380 TextWidget trText = TextWidget.Cast(layoutRoot.FindAnyWidget("SwitchText"));
381 if (trText)
382 {
383 trText.SetText(text);
384 trText.Update();
385 }
386 }
387
388 void FilterFocus(bool focus)
389 {
390 #ifdef PLATFORM_CONSOLE
391 if (focus)
392 {
393 ShowThumbRButton(false);
394 string aButtonLabel;
395 if (GetServersLoadingTab() == TabType.FAVORITE)
396 {
397 #ifdef PLATFORM_PS4
398 aButtonLabel = "#ps4_ingame_menu_select";
399 #else
400 aButtonLabel = "#layout_xbox_ingame_menu_select";
401 #endif
402 }
403 else
404 {
405 aButtonLabel = "#dialog_change";
406 }
407
408 UpdateAButtonLabel(aButtonLabel);
409 UpdateXButtonLabel("#server_browser_menu_refresh");
410 UpdateYButtonLabel("#server_details_header");
411 }
412 #endif
413 }
414
415 void DetailsFocus(bool focus)
416 {
417 #ifdef PLATFORM_CONSOLE
418 if (focus)
419 {
420 ShowThumbRButton(false);
421 UpdateYButtonLabel("#STR_server_browser_tab_root_details_show_server_filters");
422 string aButtonLabel;
423 #ifdef PLATFORM_PS4
424 aButtonLabel = "#ps4_ingame_menu_select";
425 #else
426 aButtonLabel = "#layout_xbox_ingame_menu_select";
427 #endif
428 UpdateAButtonLabel(aButtonLabel);
429 }
430 #endif
431 }
432
434 {
435 SetFocus(m_Back);
436 }
437
438 void ServerListFocus(bool focus, bool favorite)
439 {
440 #ifdef PLATFORM_CONSOLE
441 if (focus)
442 {
443 UpdateAButtonLabel("#server_browser_menu_connect");
444
445 string trText;
446 if (favorite)
447 {
448 trText = "#server_browser_menu_unfavorite";
449 }
450 else
451 {
452 trText = "#server_browser_menu_favorite";
453 }
454
456 }
457 #endif
458 }
459
460 override bool OnFocus(Widget w, int x, int y)
461 {
462 if (IsFocusable(w))
463 {
465 return true;
466 }
467 return false;
468 }
469
470 override bool OnFocusLost(Widget w, int x, int y)
471 {
472 if (IsFocusable(w))
473 {
474 ColorNormal(w);
475 return true;
476 }
477 return false;
478 }
479
480 override void Refresh()
481 {
482 string name;
483
484 #ifdef PLATFORM_CONSOLE
485 if (g_Game.GetUserManager() && g_Game.GetUserManager().GetSelectedUser())
486 {
487 name = g_Game.GetUserManager().GetSelectedUser().GetName();
488 if (name.LengthUtf8() > 18)
489 {
490 name = name.SubstringUtf8(0, 18);
491 name += "...";
492 }
493 }
494 #else
495 g_Game.GetPlayerNameShort(14, name);
496 #endif
497
498 if (m_PlayerName)
499 m_PlayerName.SetText(name);
500
501 string version;
502 g_Game.GetVersion(version);
503 #ifdef PLATFORM_CONSOLE
504 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
505 #else
506 version = "#main_menu_version" + " " + version;
507 #endif
508 }
509
510 override void Update(float timeslice)
511 {
512 if (!g_Game.GetUIManager().IsDialogVisible() && !GetDayZGame().IsConnecting())
513 {
514 if (GetUApi().GetInputByID(UAUIThumbRight).LocalPress())
515 {
517 }
518
519 if (GetUApi().GetInputByID(UAUITabLeft).LocalPress())
520 {
521 m_Tabber.PreviousTab();
522 }
523
524 if (GetUApi().GetInputByID(UAUITabRight).LocalPress())
525 {
526 m_Tabber.NextTab();
527 }
528
529 if (GetUApi().GetInputByID(UAUINextDown).LocalPress())
530 {
532 }
533
534 if (GetUApi().GetInputByID(UAUINextUp).LocalPress())
535 {
537 }
538
539 if (GetUApi().GetInputByID(UAUISelect).LocalPress())
540 {
542 }
543
544 if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
545 {
547 }
548
549 if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
550 {
552 }
553
554 if (GetUApi().GetInputByID(UAUILeft).LocalPress())
555 {
557 }
558
559 // LEFT HOLD
560 if (GetUApi().GetInputByID(UAUILeft).LocalHold())
561 {
563 }
564
565 // LEFT RELEASE
566 if (GetUApi().GetInputByID(UAUILeft).LocalRelease())
567 {
569 }
570
571 if (GetUApi().GetInputByID(UAUIRight).LocalPress())
572 {
574 }
575
576 // RIGHT HOLD
577 if (GetUApi().GetInputByID(UAUIRight).LocalHold())
578 {
580 }
581
582 // RIGHT RELEASE
583 if (GetUApi().GetInputByID(UAUIRight).LocalRelease())
584 {
586 }
587
588 if (GetUApi().GetInputByID(UAUIUp).LocalPress())
589 {
590 GetSelectedTab().Up();
591 }
592
593 if (GetUApi().GetInputByID(UAUIDown).LocalPress())
594 {
595 GetSelectedTab().Down();
596 }
597
598 if (GetUApi().GetInputByID(UAUIBack).LocalPress())
599 {
600 Back();
601 }
602 }
603
604 super.Update(timeslice);
605 }
606
607 bool IsFocusable(Widget w)
608 {
609 if (w)
610 {
611 return (w == m_Play || w == m_CustomizeCharacter || w == m_Back);
612 }
613 return false;
614 }
615
617 {
619
620 #ifdef PLATFORM_WINDOWS
622 #else
623 g_Game.GetProfileStringList("SB_Favorites", m_Favorites);
624
625 // ignore any ids that do not follow correct IP:PORT format
626 for (int i = 0; i < m_Favorites.Count(); ++i)
627 {
628 string id = m_Favorites[i];
629 array<string> output = new array<string>;
630
631 id.Split(":", output);
632 if (output.Count() != 2)
633 {
634 m_Favorites.Remove(i);
635 --i;
636 }
637 }
638
639 // only handle MAX_FAVORITES on consoles
640 if (m_Favorites.Count() > MAX_FAVORITES)
641 {
642 // favorites are ordered by when they were favorited
643 // so keep most recent favorites and ignore oldest favorites
644 m_Favorites.Invert();
646 m_Favorites.Invert();
647 }
648 #endif
649 }
650
651 protected void SwitchToOfficalTab()
652 {
653 if (GetTabberUI())
654 GetTabberUI().PerformSwitchTab(TabType.OFFICIAL);
655 }
656
658 {
659 g_Game.SetProfileStringList("SB_Favorites", m_Favorites);
660 g_Game.SaveProfile();
661 }
662
663 void SelectServer(ServerBrowserEntry server)
664 {
666 {
667 m_SelectedServer.Deselect();
668 }
669
670 m_SelectedServer = server;
671
672 string mapNM = m_SelectedServer.GetMapToRun();
673 if (!g_Game.VerifyWorldOwnership(mapNM))
674 {
675 m_PlayButtonLabel.Show(false);
676 m_OpenStoreButtonLabel.Show(true);
677 }
678 else
679 {
680 m_PlayButtonLabel.Show(true);
681 m_OpenStoreButtonLabel.Show(false);
682 }
683 }
684
686 {
688 m_SelectedServer.Deselect();
689
690 m_SelectedServer = null;
691 }
692
693 void Connect(ServerBrowserEntry server)
694 {
695 SelectServer(server);
696 #ifdef PLATFORM_CONSOLE
698 #endif
699 Play();
700 }
701
702 void Play()
703 {
705 {
706 string mapNM = m_SelectedServer.GetMapToRun();
707
708 if (!g_Game.VerifyWorldOwnership(mapNM))
709 {
710 /*JsonDataDLCList data = DlcDataLoader.GetData();
711 foreach (JsonDataDLCInfo dlcInfo : data.DLCs)
712 {
713 // fetch mod info
714 // if server runs this dlcInfo && !info.GetIsOwned()
715 //info.GoToStore();
716 }*/
717
718 g_Game.GetUIManager().ShowDialog("#server_browser_connect_label", "#mod_detail_info_warning", 232, DBT_OK, DBB_NONE, DMT_INFO, g_Game.GetUIManager().GetMenu());
719 g_Game.GoBuyWorldDLC(mapNM);
720 return;
721 }
722
723 string ip = m_SelectedServer.GetIP();
724 int port = m_SelectedServer.GetPort();
725 int steamQueryPort = m_SelectedServer.GetSteamQueryPort();
726 g_Game.ConnectFromServerBrowserEx(ip, port, steamQueryPort, "");
727 }
728 }
729
731 {
732 PPERequesterBank.GetRequester(PPERequester_ServerBrowserBlur).Stop();
733 EnterScriptedMenu(MENU_CHARACTER);
734 }
735
736 // Unused?!
738 {
739
740 }
741
742 // Unused?!
744 {
745
746 }
747
749 {
750 switch (m_Tabber.GetSelectedIndex())
751 {
752 case 0:
753 {
754 return m_FavoritesTab;
755 }
756 case 1:
757 {
758 return m_OfficialTab;
759 }
760 case 2:
761 {
762 return m_CommunityTab;
763 }
764 case 3:
765 {
766 return m_LANTab;
767 }
768 }
769 return null;
770 }
771
773 {
774 #ifdef PLATFORM_CONSOLE
775 ShowThumbRButton(false);
776 #endif
777
780
783
784 #ifdef PLATFORM_CONSOLE
786 if (GetSelectedTab().GetTabType() != TabType.FAVORITE)
787 {
788 ShowYButton(true);
789 }
790 else
791 {
792 ShowYButton(false);
793 }
794 #endif
795 }
796
797 void OnLoadServerModsAsync(GetServerModListResult result_list)
798 {
799 if (GetSelectedTab())
800 {
801 GetSelectedTab().OnLoadServerModsAsync(result_list.m_Id, result_list.m_Mods);
802 }
803 }
804
805 void OnLoadServersAsync(GetServersResult result_list, EBiosError error, string response)
806 {
807 #ifdef PLATFORM_WINDOWS
808 #ifdef PLATFORM_CONSOLE
809 GetSelectedTab().OnLoadServersAsyncConsole(result_list, error, response);
810 #else
811 GetSelectedTab().OnLoadServersAsyncPC(result_list, error, response);
812 #endif
813 #else
814 GetSelectedTab().OnLoadServersAsyncConsole(result_list, error, response);
815 #endif
816 }
817
818 //Coloring functions (Until WidgetStyles are useful)
819 void ColorHighlight(Widget w)
820 {
821 if (!w)
822 return;
823
824 int color_pnl = ARGB(255, 0, 0, 0);
825 int color_lbl = ARGB(255, 255, 0, 0);
826
827 #ifdef PLATFORM_CONSOLE
828 color_pnl = ARGB(255, 200, 0, 0);
829 color_lbl = ARGB(255, 255, 255, 255);
830 #endif
831
832 ButtonSetColor(w, color_pnl);
833 ButtonSetTextColor(w, color_lbl);
834 }
835
836 void ColorNormal(Widget w)
837 {
838 if (!w)
839 return;
840
841 int color_pnl = ARGB(0, 0, 0, 0);
842 int color_lbl = ARGB(255, 255, 255, 255);
843
844 ButtonSetColor(w, color_pnl);
845 ButtonSetTextColor(w, color_lbl);
846 }
847
848 void ButtonSetText(Widget w, string text)
849 {
850 if (!w)
851 return;
852
853 TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() + "_label"));
854
855 if (label)
856 {
857 label.SetText(text);
858 }
859
860 }
861
862 void ButtonSetColor(Widget w, int color)
863 {
864 if (!w)
865 return;
866
867 Widget panel = w.FindWidget(w.GetName() + "_panel");
868
869 if (panel)
870 {
871 panel.SetColor(color);
872 }
873 }
874
875 void ButtonSetTextColor(Widget w, int color)
876 {
877 if (!w)
878 return;
879
880 TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
881 TextWidget text = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
882 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
883
884 if (label)
885 {
886 label.SetColor(color);
887 }
888
889 if (text)
890 {
891 text.SetColor(color);
892 }
893
894 if (text2)
895 {
896 text2.SetColor(color);
897 }
898 }
899
900 protected void UpdateControlsElements()
901 {
902 RichTextWidget toolbar_a = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ConnectIcon"));
903 RichTextWidget toolbar_b = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon"));
904 RichTextWidget toolbar_x = RichTextWidget.Cast(layoutRoot.FindAnyWidget("RefreshIcon"));
905 RichTextWidget toolbar_y = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ResetIcon"));
906 RichTextWidget toolbar_tr = RichTextWidget.Cast(layoutRoot.FindAnyWidget("SwitchIcon"));
907 toolbar_a.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
908 toolbar_b.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
909 toolbar_x.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
910 toolbar_y.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
911 toolbar_tr.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIThumbRight", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
912 }
913
914 override void OnShow()
915 {
916 super.OnShow();
917 OnInputDeviceChanged(g_Game.GetInput().GetCurrentInputDevice());
918 }
919
920 override void OnHide()
921 {
922 super.OnHide();
923 PPERequesterBank.GetRequester(PPERequester_ServerBrowserBlur).Stop();
924 }
925
926 TabberUI GetTabberUI()
927 {
928 return m_Tabber;
929 }
930
935}
EScriptInvokerInsertFlags
Definition tools.c:130
EBiosError
Possible Error codes for bios API. This is the list of errors that can be returned from bios API....
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
GetServersInput the input structure of the GetServers operation.
GetServersResult the output structure of the GetServers operation.
static const float ICON_SCALE_NORMAL
Definition inpututils.c:14
static string GetRichtextButtonIconFromInputAction(notnull UAInput pInput, string pLocalizedDescription, int pInputDeviceType=EUAINPUT_DEVICE_CONTROLLER, float pScale=ICON_SCALE_NORMAL, bool pVertical=false)
Definition inpututils.c:167
static const float ICON_SCALE_TOOLBAR
Definition inpututils.c:15
static void GetFavoriteServers(TStringArray favServers)
override void PressSholderRight()
override void OnLoadServersAsyncConsole(GetServersResult result_list, EBiosError error, string response)
override void PressSholderLeft()
override void OnLoadServersAsyncPC(GetServersResult result_list, EBiosError error, string response)
ref ServerBrowserTab m_OfficialTab
override bool OnMouseEnter(Widget w, int x, int y)
void ServerListFocus(bool focus, bool favorite)
override void OnShow()
bool SetFavoriteConsoles(string ipAddress, int port, bool favorite)
TextWidget m_OpenStoreButtonLabel
void FilterFocus(bool focus)
override bool OnFocus(Widget w, int x, int y)
override void Update(float timeslice)
void UpdateAButtonLabel(string text)
void ShowThumbRButton(bool show)
TextWidget m_PlayButtonLabel
override void Refresh()
void UpdateXButtonLabel(string text)
void SelectServer(ServerBrowserEntry server)
ServerBrowserTab GetOfficalTab()
void Connect(ServerBrowserEntry server)
void ColorHighlight(Widget w)
bool IsFocusable(Widget w)
ServerBrowserEntry m_SelectedServer
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
void ButtonSetText(Widget w, string text)
void ShowAButton(bool show)
override void OnHide()
void OnLoadServerModsAsync(GetServerModListResult result_list)
override bool OnFocusLost(Widget w, int x, int y)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
void SetServersLoadingTab(TabType refreshing)
void OnLoadServersAsync(GetServersResult result_list, EBiosError error, string response)
void DetailsFocus(bool focus)
ref ServerBrowserTab m_LANTab
ButtonWidget m_Play
void UpdateControlsElements()
Widget m_CustomizeCharacter
Definition mainmenu.c:16
void OnTabSwitch(int tab)
void ButtonSetTextColor(Widget w, int color)
void UpdateYButtonLabel(string text)
TextWidget m_PlayerName
Definition mainmenu.c:9
void AddFavoritesToFilter(GetServersInput input)
ButtonWidget m_Back
override Widget Init()
void UpdateThumbRButtonLabel(string text)
ref ServerBrowserTab m_CommunityTab
ref TStringArray m_Favorites
TStringArray GetFavoritedServerIds()
void AddFavorite(string ipAddress, int port, bool favorite)
override bool OnClick(Widget w, int x, int y, int button)
bool IsFavorited(string server_id)
void ButtonSetColor(Widget w, int color)
void ColorNormal(Widget w)
ref ServerBrowserTab m_FavoritesTab
ServerBrowserTab GetSelectedTab()
void ShowYButton(bool show)
void OnInputPresetChanged()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame g_Game
Definition dayzgame.c:3942
DayZGame GetDayZGame()
Definition dayzgame.c:3944
array< string > TStringArray
Definition enscript.c:712
const int MENU_CHARACTER
Definition constants.c:174
MouseState
Definition ensystem.c:311
Icon x
Icon y
EInputDeviceType
Definition input.c:3
int ARGB(int a, int r, int g, int b)
Definition proto.c:322
const int MAX_FAVORITES
const int SERVER_BROWSER_PAGE_SIZE
TabType GetTabType()
void SelectServer(ServerBrowserEntry server)
TabType
proto native UAInputAPI GetUApi()