Dayz Explorer 1.28.160049
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 = GetGame().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 = GetGame().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"));
52 m_Favorites = new TStringArray;
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 GetGame().GetVersion(version);
63
64 #ifdef PLATFORM_CONSOLE
65 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
66 if (GetGame().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 GetGame().GetMission().GetOnInputPresetChanged().Insert(OnInputPresetChanged);
98 GetGame().GetMission().GetOnInputDeviceChanged().Insert(OnInputDeviceChanged);
99
100 #ifdef PLATFORM_WINDOWS
101 GetGame().GetInput().EnableGamepad(false);
102 #endif
103
104 return layoutRoot;
105 }
106
108 {
109 #ifdef PLATFORM_CONSOLE
111 #endif
112
113 #ifdef PLATFORM_WINDOWS
114 GetGame().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 layoutRoot.FindAnyWidget("PlayIcon0").Show(false);
145 layoutRoot.FindAnyWidget("BackIcon0").Show(false);
146 if (GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
147 {
148 GetGame().GetUIManager().ShowUICursor(false);
149 }
150 #endif
151 break;
152
153 default:
154 #ifdef PLATFORM_CONSOLE
155 if (GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
156 {
157 layoutRoot.FindAnyWidget("toolbar_bg").Show(false);
158 layoutRoot.FindAnyWidget("ConsoleControls").Show(false);
159 layoutRoot.FindAnyWidget("PlayIcon0").Show(true);
160 layoutRoot.FindAnyWidget("BackIcon0").Show(true);
161 GetGame().GetUIManager().ShowUICursor(true);
162 }
163 #endif
164 break;
165 }
166 }
167
168 override bool OnClick(Widget w, int x, int y, int button)
169 {
170 if (button == MouseState.LEFT)
171 {
172 if (w == m_Play)
173 {
174 Play();
175 return true;
176 }
177 else if (w == m_Back)
178 {
179 Back();
180 return true;
181 }
182 else if (w == m_CustomizeCharacter)
183 {
185 return true;
186 }
187 }
188 return false;
189 }
190
191 override bool OnMouseEnter(Widget w, int x, int y)
192 {
193 if (IsFocusable(w))
194 {
196 return true;
197 }
198 return false;
199 }
200
201 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
202 {
203 if (IsFocusable(w))
204 {
205 ColorNormal(w);
206 return true;
207 }
208 return false;
209 }
210
212 {
213 m_IsRefreshing = refreshing;
214
215 OnlineServices.m_ServersAsyncInvoker.Remove(OnLoadServersAsync);
216 OnlineServices.m_ServersAsyncInvoker.Insert(OnLoadServersAsync, EScriptInvokerInsertFlags.NONE);
217 }
218
220 {
221 return m_IsRefreshing;
222 }
223
225 {
226 foreach (string id : m_Favorites)
227 {
228 array<string> output = new array<string>;
229 id.Split(":", output);
230 if (output.Count() == 2)
231 {
232 string ip = output[0];
233 int port = output[1].ToInt();
234 input.AddFavourite(ip, port);
235 }
236 }
237 }
238
239 bool IsFavorited(string server_id)
240 {
241 int index = -1;
242 if (m_Favorites)
243 {
244 index = m_Favorites.Find(server_id);
245 }
246 return (index >= 0);
247 }
248
249 // Returns whether server was favorited or not
250 bool SetFavoriteConsoles(string ipAddress, int port, bool favorite)
251 {
252 if (favorite && m_Favorites.Count() >= MAX_FAVORITES)
253 {
254 g_Game.GetUIManager().ShowDialog("#layout_notification_info_warning", "#STR_MaxFavouriteReached", 0, DBT_OK, DBB_YES, DMT_EXCLAMATION, this);
255 return false;
256 }
257
258 AddFavorite(ipAddress, port, favorite);
260
261 return favorite;
262 }
263
264 void AddFavorite(string ipAddress, int port, bool favorite)
265 {
266 string serverId = ipAddress + ":" + port;
267 bool isFavorited = IsFavorited(serverId);
268
269 if (favorite && !isFavorited)
270 {
271 m_Favorites.Insert(serverId);
272 }
273 else if (isFavorited)
274 {
275 m_Favorites.RemoveItem(serverId);
276 m_OfficialTab.Unfavorite(serverId);
277 m_CommunityTab.Unfavorite(serverId);
278 m_FavoritesTab.Unfavorite(serverId);
279#ifndef PLATFORM_CONSOLE
280 m_LANTab.Unfavorite(serverId);
281#endif
282 }
283 }
284
285 void Back()
286 {
287 GetGame().GetUIManager().Back();
288 }
289
290 void ShowYButton(bool show)
291 {
292 RichTextWidget yIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ResetIcon"));
293 TextWidget yText = TextWidget.Cast(layoutRoot.FindAnyWidget("ResetText"));
294
295 if (yIcon)
296 {
297 yIcon.Show(show);
298 }
299
300 if (yText)
301 {
302 yText.Show(show);
303 }
304 }
305
306 void UpdateYButtonLabel(string text)
307 {
308 TextWidget yText = TextWidget.Cast(layoutRoot.FindAnyWidget("ResetText"));
309 if (yText)
310 {
311 yText.SetText(text);
312 yText.Update();
313 }
314 }
315
316 void ShowAButton(bool show)
317 {
318 RichTextWidget aIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ConnectIcon"));
319 TextWidget aText = TextWidget.Cast(layoutRoot.FindAnyWidget("ConnectText"));
320
321 if (aIcon)
322 {
323 aIcon.Show(show);
324 }
325
326 if (aText)
327 {
328 aText.Show(show);
329 }
330 }
331
332 void UpdateAButtonLabel(string text)
333 {
334 TextWidget aText = TextWidget.Cast(layoutRoot.FindAnyWidget("ConnectText"));
335 if (aText)
336 {
337 aText.SetText(text);
338 aText.Update();
339 }
340 }
341
342 void UpdateXButtonLabel(string text)
343 {
344 TextWidget xText = TextWidget.Cast(layoutRoot.FindAnyWidget("RefreshText"));
345 if (xText)
346 {
347 xText.SetText(text);
348 xText.Update();
349 }
350 }
351
352 void ShowThumbRButton(bool show)
353 {
354 RichTextWidget trIcon = RichTextWidget.Cast(layoutRoot.FindAnyWidget("SwitchIcon"));
355 TextWidget trText = TextWidget.Cast(layoutRoot.FindAnyWidget("SwitchText"));
356
357 if (trIcon)
358 {
359 trIcon.Show(show);
360 }
361
362 if (trText)
363 {
364 trText.Show(show);
365 }
366 }
367
368 void UpdateThumbRButtonLabel(string text)
369 {
370 TextWidget trText = TextWidget.Cast(layoutRoot.FindAnyWidget("SwitchText"));
371 if (trText)
372 {
373 trText.SetText(text);
374 trText.Update();
375 }
376 }
377
378 void FilterFocus(bool focus)
379 {
380 #ifdef PLATFORM_CONSOLE
381 if (focus)
382 {
383 ShowThumbRButton(false);
384 string aButtonLabel;
385 if (GetServersLoadingTab() == TabType.FAVORITE)
386 {
387 #ifdef PLATFORM_PS4
388 aButtonLabel = "#ps4_ingame_menu_select";
389 #else
390 aButtonLabel = "#layout_xbox_ingame_menu_select";
391 #endif
392 }
393 else
394 {
395 aButtonLabel = "#dialog_change";
396 }
397
398 UpdateAButtonLabel(aButtonLabel);
399 UpdateXButtonLabel("#server_browser_menu_refresh");
400 UpdateYButtonLabel("#server_details_header");
401 }
402 #endif
403 }
404
405 void DetailsFocus(bool focus)
406 {
407 #ifdef PLATFORM_CONSOLE
408 if (focus)
409 {
410 ShowThumbRButton(false);
411 UpdateYButtonLabel("#STR_server_browser_tab_root_details_show_server_filters");
412 string aButtonLabel;
413 #ifdef PLATFORM_PS4
414 aButtonLabel = "#ps4_ingame_menu_select";
415 #else
416 aButtonLabel = "#layout_xbox_ingame_menu_select";
417 #endif
418 UpdateAButtonLabel(aButtonLabel);
419 }
420 #endif
421 }
422
424 {
425 SetFocus(m_Back);
426 }
427
428 void ServerListFocus(bool focus, bool favorite)
429 {
430 #ifdef PLATFORM_CONSOLE
431 if (focus)
432 {
433 UpdateAButtonLabel("#server_browser_menu_connect");
434
435 string trText;
436 if (favorite)
437 {
438 trText = "#server_browser_menu_unfavorite";
439 }
440 else
441 {
442 trText = "#server_browser_menu_favorite";
443 }
444
446 }
447 #endif
448 }
449
450 override bool OnFocus(Widget w, int x, int y)
451 {
452 if (IsFocusable(w))
453 {
455 return true;
456 }
457 return false;
458 }
459
460 override bool OnFocusLost(Widget w, int x, int y)
461 {
462 if (IsFocusable(w))
463 {
464 ColorNormal(w);
465 return true;
466 }
467 return false;
468 }
469
470 override void Refresh()
471 {
472 string name;
473
474 #ifdef PLATFORM_CONSOLE
475 if (GetGame().GetUserManager() && GetGame().GetUserManager().GetSelectedUser())
476 {
477 name = GetGame().GetUserManager().GetSelectedUser().GetName();
478 if (name.LengthUtf8() > 18)
479 {
480 name = name.SubstringUtf8(0, 18);
481 name += "...";
482 }
483 }
484 #else
485 g_Game.GetPlayerNameShort(14, name);
486 #endif
487
488 if (m_PlayerName)
489 m_PlayerName.SetText(name);
490
491 string version;
492 GetGame().GetVersion(version);
493 #ifdef PLATFORM_CONSOLE
494 version = "#main_menu_version" + " " + version + " (" + g_Game.GetDatabaseID() + ")";
495 #else
496 version = "#main_menu_version" + " " + version;
497 #endif
498 }
499
500 override void Update(float timeslice)
501 {
502 if (!GetGame().GetUIManager().IsDialogVisible() && !GetDayZGame().IsConnecting())
503 {
504 if (GetUApi().GetInputByID(UAUIThumbRight).LocalPress())
505 {
507 }
508
509 if (GetUApi().GetInputByID(UAUITabLeft).LocalPress())
510 {
511 m_Tabber.PreviousTab();
512 }
513
514 if (GetUApi().GetInputByID(UAUITabRight).LocalPress())
515 {
516 m_Tabber.NextTab();
517 }
518
519 if (GetUApi().GetInputByID(UAUINextDown).LocalPress())
520 {
522 }
523
524 if (GetUApi().GetInputByID(UAUINextUp).LocalPress())
525 {
527 }
528
529 if (GetUApi().GetInputByID(UAUISelect).LocalPress())
530 {
532 }
533
534 if (GetUApi().GetInputByID(UAUICtrlX).LocalPress())
535 {
537 }
538
539 if (GetUApi().GetInputByID(UAUICtrlY).LocalPress())
540 {
542 }
543
544 if (GetUApi().GetInputByID(UAUILeft).LocalPress())
545 {
547 }
548
549 // LEFT HOLD
550 if (GetUApi().GetInputByID(UAUILeft).LocalHold())
551 {
553 }
554
555 // LEFT RELEASE
556 if (GetUApi().GetInputByID(UAUILeft).LocalRelease())
557 {
559 }
560
561 if (GetUApi().GetInputByID(UAUIRight).LocalPress())
562 {
564 }
565
566 // RIGHT HOLD
567 if (GetUApi().GetInputByID(UAUIRight).LocalHold())
568 {
570 }
571
572 // RIGHT RELEASE
573 if (GetUApi().GetInputByID(UAUIRight).LocalRelease())
574 {
576 }
577
578 if (GetUApi().GetInputByID(UAUIUp).LocalPress())
579 {
580 GetSelectedTab().Up();
581 }
582
583 if (GetUApi().GetInputByID(UAUIDown).LocalPress())
584 {
585 GetSelectedTab().Down();
586 }
587
588 if (GetUApi().GetInputByID(UAUIBack).LocalPress())
589 {
590 Back();
591 }
592 }
593
594 super.Update(timeslice);
595 }
596
597 bool IsFocusable(Widget w)
598 {
599 if (w)
600 {
601 return (w == m_Play || w == m_CustomizeCharacter || w == m_Back);
602 }
603 return false;
604 }
605
607 {
608 m_Favorites = new TStringArray;
609
610#ifdef PLATFORM_WINDOWS
612#else
613 GetGame().GetProfileStringList("SB_Favorites", m_Favorites);
614
615 // ignore any ids that do not follow correct IP:PORT format
616 for (int i = 0; i < m_Favorites.Count(); ++i)
617 {
618 string id = m_Favorites[i];
619 array<string> output = new array<string>;
620
621 id.Split(":", output);
622 if (output.Count() != 2)
623 {
624 m_Favorites.Remove(i);
625 --i;
626 }
627 }
628
629 // only handle MAX_FAVORITES on consoles
630 if (m_Favorites.Count() > MAX_FAVORITES)
631 {
632 // favorites are ordered by when they were favorited
633 // so keep most recent favorites and ignore oldest favorites
634 m_Favorites.Invert();
635 m_Favorites.Resize(MAX_FAVORITES);
636 m_Favorites.Invert();
637 }
638#endif
639 }
640
642 {
643 GetGame().SetProfileStringList("SB_Favorites", m_Favorites);
644 GetGame().SaveProfile();
645 }
646
647 void SelectServer(ServerBrowserEntry server)
648 {
650 {
651 m_SelectedServer.Deselect();
652 }
653
654 m_SelectedServer = server;
655
656 string mapNM = m_SelectedServer.GetMapToRun();
657 if (!g_Game.VerifyWorldOwnership(mapNM))
658 {
659 m_PlayButtonLabel.Show(false);
660 m_OpenStoreButtonLabel.Show(true);
661 }
662 else
663 {
664 m_PlayButtonLabel.Show(true);
665 m_OpenStoreButtonLabel.Show(false);
666 }
667 }
668
670 {
672 m_SelectedServer.Deselect();
673
674 m_SelectedServer = null;
675 }
676
677 void Connect(ServerBrowserEntry server)
678 {
679 SelectServer(server);
680 #ifdef PLATFORM_CONSOLE
682 #endif
683 Play();
684 }
685
686 void Play()
687 {
689 {
690 string mapNM = m_SelectedServer.GetMapToRun();
691
692 if (!g_Game.VerifyWorldOwnership(mapNM))
693 {
694 /*JsonDataDLCList data = DlcDataLoader.GetData();
695 foreach (JsonDataDLCInfo dlcInfo : data.DLCs)
696 {
697 // fetch mod info
698 // if server runs this dlcInfo && !info.GetIsOwned()
699 //info.GoToStore();
700 }*/
701
702 GetGame().GetUIManager().ShowDialog("#server_browser_connect_label", "#mod_detail_info_warning", 232, DBT_OK, DBB_NONE, DMT_INFO, GetGame().GetUIManager().GetMenu());
703 g_Game.GoBuyWorldDLC(mapNM);
704 return;
705 }
706
707 string ip = m_SelectedServer.GetIP();
708 int port = m_SelectedServer.GetPort();
709 int steamQueryPort = m_SelectedServer.GetSteamQueryPort();
710 g_Game.ConnectFromServerBrowserEx(ip, port, steamQueryPort, "");
711 }
712 }
713
715 {
716 PPERequesterBank.GetRequester(PPERequester_ServerBrowserBlur).Stop();
717 EnterScriptedMenu(MENU_CHARACTER);
718 }
719
720 // Unused?!
722 {
723
724 }
725
726 // Unused?!
728 {
729
730 }
731
733 {
734 switch (m_Tabber.GetSelectedIndex())
735 {
736 case 0:
737 {
738 return m_FavoritesTab;
739 }
740 case 1:
741 {
742 return m_OfficialTab;
743 }
744 case 2:
745 {
746 return m_CommunityTab;
747 }
748 case 3:
749 {
750 return m_LANTab;
751 }
752 }
753 return null;
754 }
755
757 {
758 #ifdef PLATFORM_CONSOLE
759 ShowThumbRButton(false);
760 #endif
761
764
766 {
768 }
769
771
772 #ifdef PLATFORM_CONSOLE
774 if (GetSelectedTab().GetTabType() != TabType.FAVORITE)
775 {
776 ShowYButton(true);
777 }
778 else
779 {
780 ShowYButton(false);
781 }
782 #endif
783 }
784
785 void OnLoadServerModsAsync(GetServerModListResult result_list)
786 {
787 if (GetSelectedTab())
788 {
789 GetSelectedTab().OnLoadServerModsAsync(result_list.m_Id, result_list.m_Mods);
790 }
791 }
792
793 void OnLoadServersAsync(GetServersResult result_list, EBiosError error, string response)
794 {
795 #ifdef PLATFORM_WINDOWS
796 #ifdef PLATFORM_CONSOLE
797 GetSelectedTab().OnLoadServersAsyncConsole(result_list, error, response);
798 #else
799 GetSelectedTab().OnLoadServersAsyncPC(result_list, error, response);
800 #endif
801 #else
802 GetSelectedTab().OnLoadServersAsyncConsole(result_list, error, response);
803 #endif
804 }
805
806 //Coloring functions (Until WidgetStyles are useful)
807 void ColorHighlight(Widget w)
808 {
809 if (!w)
810 return;
811
812 int color_pnl = ARGB(255, 0, 0, 0);
813 int color_lbl = ARGB(255, 255, 0, 0);
814
815 #ifdef PLATFORM_CONSOLE
816 color_pnl = ARGB(255, 200, 0, 0);
817 color_lbl = ARGB(255, 255, 255, 255);
818 #endif
819
820 ButtonSetColor(w, color_pnl);
821 ButtonSetTextColor(w, color_lbl);
822 }
823
824 void ColorNormal(Widget w)
825 {
826 if (!w)
827 return;
828
829 int color_pnl = ARGB(0, 0, 0, 0);
830 int color_lbl = ARGB(255, 255, 255, 255);
831
832 ButtonSetColor(w, color_pnl);
833 ButtonSetTextColor(w, color_lbl);
834 }
835
836 void ButtonSetText(Widget w, string text)
837 {
838 if (!w)
839 return;
840
841 TextWidget label = TextWidget.Cast(w.FindWidget(w.GetName() + "_label"));
842
843 if (label)
844 {
845 label.SetText(text);
846 }
847
848 }
849
850 void ButtonSetColor(Widget w, int color)
851 {
852 if (!w)
853 return;
854
855 Widget panel = w.FindWidget(w.GetName() + "_panel");
856
857 if (panel)
858 {
859 panel.SetColor(color);
860 }
861 }
862
863 void ButtonSetTextColor(Widget w, int color)
864 {
865 if (!w)
866 return;
867
868 TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
869 TextWidget text = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
870 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
871
872 if (label)
873 {
874 label.SetColor(color);
875 }
876
877 if (text)
878 {
879 text.SetColor(color);
880 }
881
882 if (text2)
883 {
884 text2.SetColor(color);
885 }
886 }
887
888 protected void UpdateControlsElements()
889 {
890 RichTextWidget toolbar_a = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ConnectIcon"));
891 RichTextWidget toolbar_b = RichTextWidget.Cast(layoutRoot.FindAnyWidget("BackIcon"));
892 RichTextWidget toolbar_x = RichTextWidget.Cast(layoutRoot.FindAnyWidget("RefreshIcon"));
893 RichTextWidget toolbar_y = RichTextWidget.Cast(layoutRoot.FindAnyWidget("ResetIcon"));
894 RichTextWidget toolbar_tr = RichTextWidget.Cast(layoutRoot.FindAnyWidget("SwitchIcon"));
895 toolbar_a.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUISelect", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
896 toolbar_b.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIBack", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
897 toolbar_x.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlX", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
898 toolbar_y.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUICtrlY", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
899 toolbar_tr.SetText(InputUtils.GetRichtextButtonIconFromInputAction("UAUIThumbRight", "", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
900 }
901
902 override void OnShow()
903 {
904 super.OnShow();
905 OnInputDeviceChanged(GetGame().GetInput().GetCurrentInputDevice());
906 }
907
908 override void OnHide()
909 {
910 super.OnHide();
911 PPERequesterBank.GetRequester(PPERequester_ServerBrowserBlur).Stop();
912 }
913}
EScriptInvokerInsertFlags
Definition tools.c:130
void OnInputPresetChanged()
Definition inventory.c:168
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
Definition inventory.c:175
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
proto native BiosUserManager GetUserManager()
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)
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 ButtonSetTextColor(Widget w, int color)
void UpdateYButtonLabel(string text)
TextWidget m_PlayerName
Definition mainmenu.c:9
void AddFavoritesToFilter(GetServersInput input)
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)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
ButtonWidget m_Back
DayZGame g_Game
Definition dayzgame.c:3868
DayZGame GetDayZGame()
Definition dayzgame.c:3870
proto native CGame GetGame()
array< string > TStringArray
Definition enscript.c:709
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()
ServerBrowserEntry m_SelectedServer
TabType
bool IsNotInitialized()
void OnLoadServerModsAsync(string server_id, array< string > mods)
void Refresh()
proto native UAInputAPI GetUApi()