DayZ 1.24
Loading...
Searching...
No Matches
ServerBrowserTabPc.c
Go to the documentation of this file.
2{
3 protected const int SERVERS_VISIBLE_COUNT = 24;
4 protected const int PAGES_BUTTONS_COUNT = 10;
5
6 protected int m_TotalServersCount; //UNUSED
7 protected int m_PageIndex;
8 protected int m_PageStartNum;
9 protected int m_PageEndNum;
10 protected int m_PagesCount;
11 protected int m_ServersEstimateCount;
12
13 protected Widget m_PnlPagesPanel;
14 protected TextWidget m_PnlPagesLoadingText;
17
22
25
26 protected ref TStringArray m_TempTime = new TStringArray;
27
28 protected override void Construct(Widget parent, ServerBrowserMenuNew menu, TabType type)
29 {
30#ifdef PLATFORM_CONSOLE
31 m_Root = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/server_browser/xbox/server_browser_tab.layout", parent);
32#else
33#ifdef PLATFORM_WINDOWS
34 m_Root = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/server_browser/pc/server_browser_tab_pages.layout", parent);
35#endif
36#endif
37
38 m_ServerListScroller = ScrollWidget.Cast(m_Root.FindAnyWidget("server_list_scroller"));
39 m_ServerList = SpacerBaseWidget.Cast(m_ServerListScroller.FindAnyWidget("server_list_content"));
40 m_ServerListScroller.VScrollToPos01(0);
41
42 m_ServerListEntries = new array<ref ServerBrowserEntry>;
47
55
56 m_Menu = menu;
57 m_TabType = type;
58
59 m_ApplyFilter = m_Root.FindAnyWidget("apply_filter_button");
60 m_RefreshList = m_Root.FindAnyWidget("refresh_list_button");
61 m_FiltersChanged = m_Root.FindAnyWidget("unapplied_filters_notify");
62 m_HostSort = m_Root.FindAnyWidget("server_list_content_header_host");
63 m_TimeSort = m_Root.FindAnyWidget("server_list_content_header_time");
64 m_PopulationSort = m_Root.FindAnyWidget("server_list_content_header_population");
65 m_SlotsSort = m_Root.FindAnyWidget("server_list_content_header_slots");
66 m_PingSort = m_Root.FindAnyWidget("server_list_content_header_ping");
67
68 m_FilterSearchText = m_Root.FindAnyWidget("search_name_setting");
69 m_FilterSearchTextBox = m_Root.FindAnyWidget("search_name_setting_option");
70 m_FilterSearchIP = m_Root.FindAnyWidget("search_ip_setting");
71 m_FilterSearchIPBox = m_Root.FindAnyWidget("search_ip_setting_option");
72
73 m_FilterPanelAccTime = m_Root.FindAnyWidget("accelerated_time_setting");
74 m_FilterPanelPing = m_Root.FindAnyWidget("ping_setting");
75 //m_FilterPanelPing.SetHandler( this );
76
77 m_LoadingText = TextWidget.Cast(m_Root.FindAnyWidget("loading_servers_info"));
78
80
81 if (type == TabType.LAN)
82 DisableFilters();
83
84 m_Filters = new ServerBrowserFilterContainer(m_Root.FindAnyWidget("filters_content"), this);
85
86 m_Root.SetHandler(this);
87
88 SetSort(ESortType.HOST, ESortOrder.ASCENDING);
89
90 m_BtnPages = new array<ButtonWidget>();
91
92 int page_button_num = 1;
93 ButtonWidget page_button = ButtonWidget.Cast(m_Root.FindAnyWidget("servers_navigation_page" + page_button_num));
94
96 {
97 Error("ServerBrowserTabPage->PAGES_BUTTONS_COUNT must be in range 3 - 10!");
98 return;
99 }
100
101 while (page_button)
102 {
103 page_button.Show(false);
104
105 if (page_button_num <= PAGES_BUTTONS_COUNT)
106 m_BtnPages.Insert(page_button);
107
109 page_button = ButtonWidget.Cast(m_Root.FindAnyWidget("servers_navigation_page" + page_button_num));
110 }
111
112 m_ResetFilters = ButtonWidget.Cast(m_Root.FindAnyWidget("reset_filter_button")) ;
113
114 m_PnlPagesPanel = m_Root.FindAnyWidget("servers_navigation_spacer");
115 m_BtnPagePrev = ButtonWidget.Cast(m_Root.FindAnyWidget("servers_navigation_prev")) ;
116 m_BtnPageNext = ButtonWidget.Cast(m_Root.FindAnyWidget("servers_navigation_next")) ;
117 m_BtnPagesFirst = ButtonWidget.Cast(m_Root.FindAnyWidget("servers_navigation_page_first")) ;
118 m_BtnPagesLast = ButtonWidget.Cast(m_Root.FindAnyWidget("servers_navigation_page_last")) ;
119 m_PageIndex = 0;
120 m_PnlPagesPanel.Show(true);
121
122 UpdatePageButtons();
123 }
124
126 {
127
128 }
129
131 {
132 m_Root.FindAnyWidget("filters_content").Show(false);
133 m_Root.FindAnyWidget("spacer").Show(false);
134 m_Root.FindAnyWidget("spacer2").Show(false);
135 m_Root.FindAnyWidget("reset_filter_button").Show(false);
136 m_ApplyFilter.Show(false);
137 m_FiltersChanged.Show(false);
138 }
139
140 override void RefreshList()
141 {
142 for (int i = 0; i < m_EntriesSorted.Count(); i++)
143 m_EntriesSorted.GetElement(i).Clear();
144
146
147 m_LoadingFinished = false;
148 m_Loading = true;
149 m_TotalServersCount = 0;
151 m_ServersEstimateCount = 0;
152 m_PageIndex = 0;
153
154 super.RefreshList();
155
156 m_ServerListScroller.VScrollToPos01(0);
157 ButtonRefreshToCancel();
158 UpdateServerList();
159 UpdatePageButtons();
160 UpdateStatusBar();
161 }
162
163 override void ResetFilters()
164 {
165 m_Filters.ResetFilters();
166
168
169 if (!m_Loading)
171 }
172
173 override void ApplyFilters()
174 {
175 m_Filters.SaveFilters();
176 //m_CurrentFilterInput = m_Filters.GetFilterOptionsPC();
177 RefreshList();
180 }
181
183 {
184 OnlineServices.m_ServersAsyncInvoker.Remove(m_Menu.OnLoadServersAsync);
185
186 m_LoadingFinished = true;
187 m_Loading = false;
188
189 ButtonCancelToRefresh();
190
191 UpdateServerList();
192 UpdateStatusBar();
193 }
194
196 {
197 if (result_list)
198 {
199 int count = result_list.m_Results.Count();
200 if (count > 0)
201 {
202 for (int i = 0; i < count; i++)
203 {
205 m_TotalServersCount++;
206
207 result.m_SortName = result.m_Name.ToInt();
208 result.m_SortTime = GetTimeOfDayEnum(result.m_TimeOfDay);
209
210 if (PassFilter(result))
211 {
213 if (sorted_index < (m_PageIndex * SERVERS_VISIBLE_COUNT + SERVERS_VISIBLE_COUNT))
214 {
215 UpdateServerList();
216 UpdatePageButtons();
217 }
218 }
219
220 if (!m_Menu || m_Menu.GetServersLoadingTab() != m_TabType)
221 return;
222 }
223 }
224 else
225 m_Menu.SetServersLoadingTab(TabType.NONE);
226
227 }
228 else
229 m_Menu.SetServersLoadingTab(TabType.NONE);
230
231 if (response == "thelastone")
232 OnLoadServersAsyncPCFinished();
233 else
234 m_ServersEstimateCount = result_list.m_NumServers;
235
236 UpdateServerList();
237 UpdateStatusBar();
238 }
239
241 {
242 LoadingServersStop();
243 }
244
245 override bool OnClick(Widget w, int x, int y, int button)
246 {
247 super.OnClick(w, x, y, button);
248
249 if (button == MouseState.LEFT)
250 {
251 if (w == m_ResetFilters)
252 ResetFilters();
253 else if (w == m_ApplyFilter)
254 {
255 ApplyFilters();
256 return true;
257 }
258 else if (w == m_RefreshList)
259 {
261 LoadingServersStop();
262 else
263 RefreshList();
264
265 return true;
266 }
267 else if (w == m_BtnPagePrev)
268 {
269 OnClickPagePrev();
270 return true;
271 }
272 else if (w == m_BtnPageNext)
273 {
274 OnClickPageNext();
275 return true;
276 }
277 else if (w == m_BtnPagesLast)
278 {
279 OnClickPageEnd();
280 return true;
281 }
282 else if (w == m_BtnPagesFirst)
283 {
284 OnClickPageFirst();
285 return true;
286 }
287 else
288 {
289 bool click = OnClickPage(w);
290
291 if (click)
292 return true;
293
294 return false;
295 }
296 }
297 return false;
298 }
299
300 override bool OnMouseEnter(Widget w, int x, int y)
301 {
302 if (IsFocusable(w))
303 {
305
306 if (w == m_FilterSearchText)
307 {
309 return true;
310 }
311 else if (w == m_FilterSearchIP)
312 {
313 SetFocus(m_FilterSearchIPBox);
314 return true;
315 }
316
317 return true;
318 }
319 return false;
320 }
321
322 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
323 {
324 if (IsFocusable(w))
325 {
326 ColorNormal(w);
327
328 if (w == m_FilterSearchText || w == m_FilterSearchIP)
329 SetFocus(null);
330
331 return true;
332 }
333 return false;
334 }
335
336 override bool OnMouseButtonUp(Widget w, int x, int y, int button)
337 {
338 //Print("SG OnMouseButtonUp: "+ w.GetName());
339
340 if (button == MouseState.LEFT)
341 {
342 if (w == m_HostSort)
343 {
344 ToggleSort(ESortType.HOST);
345 UpdateServerList();
346 return true;
347 }
348 else if (w == m_TimeSort)
349 {
350 ToggleSort(ESortType.TIME);
351 UpdateServerList();
352 return true;
353 }
354 else if (w == m_PopulationSort)
355 {
356 ToggleSort(ESortType.POPULATION);
357 UpdateServerList();
358 return true;
359 }
360 else if (w == m_SlotsSort)
361 {
362 ToggleSort(ESortType.SLOTS);
363 UpdateServerList();
364 return true;
365 }
366 else if (w == m_PingSort)
367 {
368 ToggleSort(ESortType.PING);
369 UpdateServerList();
370 return true;
371 }
372 }
373 return false;
374 }
375
376 override void OnFilterChanged()
377 {
378 //m_FiltersChanged.Show( true );
379
381
382 if (!m_Loading)
384 }
385
387 {
388 if (m_PageIndex > 0)
389 SetPageIndex(m_PageIndex - 1);
390 else
391 SetPageIndex(m_PagesCount - 1);
392 }
393
395 {
396 if (m_PageIndex < (m_PagesCount - 1))
397 SetPageIndex(m_PageIndex + 1);
398 else
399 SetPageIndex(0);
400 }
401
403 {
404 SetPageIndex(m_PagesCount - 1);
405 }
406
408 {
409 SetPageIndex(0);
410 }
411
413 {
414 for (int i = 0; i < m_BtnPages.Count(); ++i)
415 {
416 if (m_BtnPages[i] == w)
417 {
418 SetPageIndex(m_PageStartNum + i - 1);
419 return true;
420 }
421 }
422
423 return false;
424 }
425
427 {
429 UpdateServerList();
430 UpdatePageButtons();
431 }
432
434 {
435 ESortOrder order = ESortOrder.ASCENDING;
436
437 if (m_SortType != type)
438 {
439 if (m_SortInverted[type] == true)
440 m_EntriesSorted[type].Invert();
441
442 m_SortInverted[type] = false;
443 }
444 else
445 {
446 if (m_SortOrder == ESortOrder.ASCENDING)
447 {
448 m_EntriesSorted[type].Invert();
449 m_SortInverted[type] = true;
450 order = ESortOrder.DESCENDING;
451 }
452 else
453 {
454 m_EntriesSorted[type].Invert();
455 m_SortInverted[type] = false;
456 }
457 }
458
459 SetSort(type, order);
460 }
461
462 override void SetSort(ESortType type, ESortOrder order)
463 {
464 super.SetSort(type, order);
465
466#ifdef PLATFORM_WINDOWS
467 m_Root.FindAnyWidget("host_sort").Show(false);
468 m_Root.FindAnyWidget("population_sort").Show(false);
469 m_Root.FindAnyWidget("slots_sort").Show(false);
470
471 m_Root.FindAnyWidget("time_sort").Show(false);
472 m_Root.FindAnyWidget("ping_sort").Show(false);
473
475 root = TextWidget.Cast(m_Root.FindAnyWidget("server_list_content_header_host_label"));
476 root.SetColor(ARGBF(1, 1, 1, 1));
477 root = TextWidget.Cast(m_Root.FindAnyWidget("server_list_content_header_population_label"));
478 root.SetColor(ARGBF(1, 1, 1, 1));
479 root = TextWidget.Cast(m_Root.FindAnyWidget("server_list_content_header_slots_label"));
480 root.SetColor(ARGBF(1, 1, 1, 1));
481
482 root = TextWidget.Cast(m_Root.FindAnyWidget("server_list_content_header_ping_label"));
483 root.SetColor(ARGBF(1, 1, 1, 1));
484 root = TextWidget.Cast(m_Root.FindAnyWidget("server_list_content_header_time_label"));
485 root.SetColor(ARGBF(1, 1, 1, 1));
486
487 string r_name;
488 string w_name;
489
490 switch (type)
491 {
492 case ESortType.HOST:
493 {
494 r_name = "server_list_content_header_host_label";
495 w_name = "host_sort";
496 break;
497 }
498 case ESortType.TIME:
499 {
500 r_name = "server_list_content_header_time_label";
501 w_name = "time_sort";
502 break;
503 }
504 case ESortType.POPULATION:
505 {
506 r_name = "server_list_content_header_population_label";
507 w_name = "population_sort";
508 break;
509 }
510 case ESortType.SLOTS:
511 {
512 r_name = "server_list_content_header_slots_label";
513 w_name = "slots_sort";
514 break;
515 }
516 case ESortType.PING:
517 {
518 r_name = "server_list_content_header_ping_label";
519 w_name = "ping_sort";
520 break;
521 }
522 }
523
524 root = TextWidget.Cast(m_Root.FindAnyWidget(r_name));
525 root.SetColor(ARGBF(1, 1, 0, 0));
526
527 m_Root.FindAnyWidget(w_name).Show(true);
528 m_Root.FindAnyWidget(w_name + "_asc").Show(!m_SortOrder);
529 m_Root.FindAnyWidget(w_name + "_dsc").Show(m_SortOrder);
530#endif
531 }
532
534 {
535 m_TempTime.Clear();
536
537 time_of_day.Split(":", m_TempTime);
538
539 int minutes = 0;
540
541 if (m_TempTime.Count() > 0)
542 {
543 int h = m_TempTime[0].ToInt();
544
545 if (h >= 5)
546 h -= 5;
547 else
548 h += 24;
549
550 minutes = h * 60;
551 }
552
553 if (m_TempTime.Count() > 1)
554 {
555 int m = m_TempTime[0].ToInt();
556 minutes += m;
557 }
558
559 return minutes;
560 }
561
562 // Return sorted index
563 override int AddSorted(GetServersResultRow entry)
564 {
565 int index_host = SortedInsert(entry, ESortType.HOST);
566 int index_time = SortedInsert(entry, ESortType.TIME);
567 int index_popu = SortedInsert(entry, ESortType.POPULATION);
568 int index_slot = SortedInsert(entry, ESortType.SLOTS);
569 int index_ping = SortedInsert(entry, ESortType.PING);
570 int index_favo = SortedInsert(entry, ESortType.FAVORITE);
571 int index_pass = SortedInsert(entry, ESortType.PASSWORDED);
572
573 switch (m_SortType)
574 {
575 case ESortType.HOST:
576 return index_host;
577 case ESortType.TIME:
578 return index_time;
579 case ESortType.POPULATION:
580 return index_popu;
581 case ESortType.SLOTS:
582 return index_slot;
583 case ESortType.PING:
584 return index_ping;
585 case ESortType.FAVORITE:
586 return index_favo;
587 case ESortType.PASSWORDED:
588 return index_pass;
589 }
590
591 return 0;
592 }
593
594 override void SelectServer(ServerBrowserEntry server)
595 {
596 super.SelectServer(server);
597
598#ifdef PLATFORM_CONSOLE
600#endif
601
603
604 if (!m_Menu)
605 return;
606
607 m_Menu.SelectServer(server);
608 }
609
611 {
612 return SortedInsertEx(entry, sort_type, m_SortInverted[sort_type]);
613 }
614
616 {
618 int indexMax = list.Count() - 1;
619 int indexMin = 0;
620 int targetIndex = Math.Floor(indexMax / 2);
621 int comparisonMultiplier = 1;
622
623 // if order is descending, then invert comparison results
624 if (isDescending == true)
626
627 if (indexMax == -1)
628 {
629 list.Insert(entry);
630 return 0;
631 }
632
633 while (true)
634 {
636
637 if ((indexMax - indexMin) <= 1)
638 {
639 for (int i = indexMin; i <= indexMax; i++)
640 {
641 comparisonResult = comparisonMultiplier * entry.CompareTo(list[i], sortType);
642
643 if (comparisonResult > 0)
644 {
645 list.InsertAt(entry, i);
646 return i;
647 }
648 }
649
650 // adding entry AFTER indexMax
651 targetIndex = Math.Min(indexMax + 1, list.Count());
652 list.InsertAt(entry, targetIndex);
653 return targetIndex;
654 }
655
656 if (comparisonResult == 0)
657 {
658 list.InsertAt(entry, targetIndex);
659 return targetIndex;
660 }
661
662 if (comparisonResult > 0)
664
665 else if (comparisonResult < 0)
667
669 }
670
671 return 0;
672 }
673
674 // DEPRECATED
676 {
678
679 int i;
680 int index_min = 0;
681 int index_max = list.Count() - 1;
682 int target_index = Math.Floor(index_max / 2);
683
684 if (index_max == -1)
685 {
686 list.Insert(entry);
687 return 0;
688 }
689
690 if (sort_type == ESortType.HOST)
691 {
692 string entry_value_str = entry.GetValueStr(ESortType.HOST);
693
694 while (true)
695 {
696 string target_value_str = list[target_index].GetValueStr(ESortType.HOST);
697
699 {
700 for (i = index_min; i <= index_max; i++)
701 {
703 {
704 list.InsertAt(entry, i);
705 return i;
706 }
707 }
708
709 index_max++;
710 list.InsertAt(entry, index_max);
711 return target_index;
712 }
714 {
717 }
719 {
722 }
723 }
724 }
725 else
726 {
727 int entry_value_int = entry.GetValueInt(sort_type);
728
729 while (true)
730 {
731 int target_value_int = list[target_index].GetValueInt(sort_type);
732
734 {
735 for (i = index_min; i <= index_max; i++)
736 {
738 {
739 list.InsertAt(entry, i);
740 return i;
741 }
742 }
743
744 index_max++;
745 list.InsertAt(entry, index_max);
746 return target_index;
747 }
749 {
752 }
754 {
757 }
758 }
759 }
760
761 return target_index;
762 }
763
764 // DEPRECATED
766 {
768
769 int i;
770 int index_min = 0;
771 int index_max = list.Count() - 1;
772 int target_index = Math.Floor(index_max / 2);
773
774 if (index_max == -1)
775 {
776 list.Insert(entry);
777 return 0;
778 }
779
780 if (sort_type == ESortType.HOST)
781 {
782 string entry_value_str = entry.GetValueStr(ESortType.HOST);
783
784 while (true)
785 {
786 string target_value_str = list[target_index].GetValueStr(ESortType.HOST);
787
789 {
790 for (i = index_min; i <= index_max; i++)
791 {
793 {
794 list.InsertAt(entry, i);
795 return i;
796 }
797 }
798
799 index_max++;
800 list.InsertAt(entry, index_max);
801 return target_index;
802 }
804 {
807 }
809 {
812 }
813 }
814 }
815 else
816 {
817 int entry_value_int = entry.GetValueInt(sort_type);
818
819 while (true)
820 {
821 int target_value_int = list[target_index].GetValueInt(sort_type);
822
824 {
825 for (i = index_min; i <= index_max; i++)
826 {
828 {
829 list.InsertAt(entry, i);
830 return i;
831 }
832 }
833
834 index_max++;
835 list.InsertAt(entry, index_max);
836 return target_index;
837 }
839 {
842 }
844 {
847 }
848 }
849 }
850
851 return target_index;
852 }
853
855 {
856 m_PagesCount = Math.Ceil(m_TotalLoadedServers / SERVERS_VISIBLE_COUNT);
857 if (m_PagesCount > 1)
858 {
859 m_PnlPagesPanel.Show(true);
860
861 int i;
862 int btn_index_center = Math.Round(PAGES_BUTTONS_COUNT / 2) - 1;
863 m_PageStartNum = 1;
864 m_PageEndNum = PAGES_BUTTONS_COUNT;
865
866 if (m_PagesCount <= PAGES_BUTTONS_COUNT)
867 {
868 m_PageEndNum = m_PagesCount;
869
870 // Pages are less like buttons - changing selected button
871 for (i = 1; i <= m_BtnPages.Count(); ++i)
872 {
873 bool is_page_button_enable = (i <= m_PagesCount);
874
875 int page_index = (i - 1);
876 m_BtnPages[page_index].Show(is_page_button_enable);
877 m_BtnPages[page_index].SetText(i.ToString());
878
879 if (m_PageIndex == page_index)
880 m_BtnPages[page_index].SetState(true);
881 else
882 m_BtnPages[page_index].SetState(false);
883 }
884 }
885 else
886 {
887 // Pages are more like buttons
889 {
890 //Left side (start of pages)
891 //m_PageStartNum = 1;
892 //m_PageEndNum = PAGES_BUTTONS_COUNT;
893 }
894 else
895 {
896 m_PageStartNum = m_PageIndex - btn_index_center + 1;
897 m_PageEndNum = m_PageIndex + (PAGES_BUTTONS_COUNT - btn_index_center);
898
899 if (m_PageEndNum > m_PagesCount)
900 {
901 // Right side (end of pages)
902 m_PageStartNum -= m_PageEndNum - m_PagesCount;
903 m_PageEndNum -= m_PageEndNum - m_PagesCount;
904 }
905 }
906
907
908 // Button Selection
911 {
912 if (m_PageEndNum == m_PagesCount)
913 {
914 //Right
915 selected_btn_index = PAGES_BUTTONS_COUNT - (m_PagesCount - m_PageIndex);
916 }
917 else
918 {
919 //Center
921 }
922 }
923
924
925 for (i = 0; i < m_BtnPages.Count(); ++i)
926 {
927 m_BtnPages[i].SetText((m_PageStartNum + i).ToString());
928 m_BtnPages[i].SetState((i == selected_btn_index));
929 }
930 }
931
932 // Button GoTo Prev Page
933 if (m_PageIndex > 0)
934 {
935 m_BtnPagePrev.SetText("<");
936 m_BtnPagePrev.Enable(true);
937 }
938 else
939 {
940 m_BtnPagePrev.SetText("");
941 m_BtnPagePrev.Enable(false);
942 }
943
944 // Button GoTo Next Page
945 if (m_PageIndex < (m_PagesCount - 1))
946 {
947 m_BtnPageNext.SetText(">");
948 m_BtnPageNext.Enable(true);
949 }
950 else
951 {
952 m_BtnPageNext.SetText("");
953 m_BtnPageNext.Enable(false);
954 }
955
956 // Button GoTo First Page
957 if (m_PageStartNum == 1)
958 {
959 m_BtnPagesFirst.SetText("");
960 m_BtnPagesFirst.Enable(false);
961 }
962 else
963 {
964 m_BtnPagesFirst.SetText("<<");
965 m_BtnPagesFirst.Enable(true);
966 }
967
968 // Button GoTo Last Page
969 if (m_PageEndNum == m_PagesCount)
970 {
971 m_BtnPagesLast.SetText("");
972 m_BtnPagesLast.Enable(false);
973 }
974 else
975 {
976 m_BtnPagesLast.SetText(">>");
977 m_BtnPagesLast.Enable(true);
978 }
979 }
980 else
981 m_PnlPagesPanel.Show(false);
982 }
983
985 {
986 int lastFilledIndexOnPage = 0;
988 ServerBrowserEntry entry;
989
990 m_EntryWidgets.Clear();
991
992 for (int i = 0; i < SERVERS_VISIBLE_COUNT; ++i)
993 {
994 int serverIndex = i + (SERVERS_VISIBLE_COUNT * m_PageIndex);
995
997 {
999
1000 if (server_info.m_Favorite)
1001 m_OnlineFavServers.Insert(server_info.m_Id);
1002
1003 entry = GetServerEntryByIndex(i, server_info.m_Id);
1004 entry.Show(true);
1005 entry.SetIsOnline(true);
1006 entry.FillInfo(server_info);
1007 entry.SetMods(m_EntryMods.Get(server_info.m_Id));
1008 entry.UpdateEntry();
1009
1010 if (GetRootMenu() && GetRootMenu().GetServersLoadingTab() != TabType.NONE)
1011 entry.SetName("#dayz_game_loading");
1012
1014 }
1015 else
1016 {
1017 entry = GetServerEntryByIndex(i, "-1");
1018
1019 if (entry)
1020 entry.Show(false);
1021 }
1022 }
1024
1025 m_ServerList.Update();
1026 }
1027
1029 {
1030 string serversFound = string.Format("#servers_found: %1", m_TotalLoadedServers);
1032 m_LoadingText.SetText(serversFound);
1033 else
1034 m_LoadingText.SetText(string.Format("#dayz_game_loading %1", serversFound));
1035 }
1036
1038 {
1039 super.OnLoadServerModsAsync(server_id, mods);
1040
1041 if (m_EntryWidgets.Contains(server_id))
1042 m_EntryWidgets.Get(server_id).SetMods(mods);
1043 }
1044
1045 protected ServerBrowserEntry GetServerEntryByIndex(int index, string server_id)
1046 {
1047 ref ServerBrowserEntry entry;
1048
1049 if (index >= 0)
1050 {
1051 if (index < m_ServerListEntries.Count())
1052 entry = m_ServerListEntries[index];
1053 else
1054 {
1055 entry = new ServerBrowserEntry(null, index, this);
1056 m_ServerList.AddChild(entry.GetRoot(), false);
1057
1058 m_ServerListEntries.Insert(entry);
1059 }
1060 }
1061 else
1062 return null;
1063
1064 // Refresh list
1065 m_EntryWidgets.Insert(server_id, entry);
1066
1067 return entry;
1068 }
1069
1070 override bool IsFocusable(Widget w)
1071 {
1072 if (w)
1073 {
1074 if (super.IsFocusable(w))
1075 return true;
1076
1077 if (w == m_ServerListScroller)
1078 return false;
1079
1080 if (w == m_HostSort || w == m_TimeSort || w == m_PopulationSort || w == m_SlotsSort || w == m_PingSort || w == m_FilterSearchIP)
1081 return true;
1082
1083 if (w == m_FilterPanelAccTime || m_FilterPanelPing)
1084 return true;
1085
1086 return false;
1087 }
1088 return false;
1089 }
1090
1092 {
1094 btn.SetText("#menu_cancel");
1095 }
1096
1098 {
1100 btn.SetText("#STR_server_browser_tab_root_filters_root_filters_content_refresh_list_button0");
1101 }
1102}
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....
ESortOrder
ESortType
int GetValueInt(ESortType sort_type)
string GetValueStr(ESortType sort_type)
Icon x
Icon y
ref ServerBrowserFilterContainer m_Filters
ref map< ESortType, ref array< ref GetServersResultRow > > m_EntriesSorted
TabType m_TabType
Widget m_FilterSearchText
Widget m_FiltersChanged
void ApplyFilters()
Widget m_SlotsSort
bool m_LoadingFinished
ServerBrowserEntry m_SelectedServer
void ButtonDisable(Widget w)
ButtonWidget m_BtnPageNext
ref map< ESortType, ESortOrder > m_SortInverted
ref map< string, ref ServerBrowserEntry > m_EntryWidgets
void ScrollToEntry(ServerBrowserEntry entry)
TabType
ScrollWidget m_ServerListScroller
bool PassFilter(GetServersResultRow result)
Widget m_PingSort
int m_TotalLoadedServers
Widget m_ApplyFilter
ServerBrowserMenuNew m_Menu
void ResetFilters()
ref map< string, ref array< string > > m_EntryMods
bool m_Loading
void ColorNormal(Widget w)
ESortType m_SortType
TextWidget m_LoadingText
Widget m_PopulationSort
Widget m_HostSort
ButtonWidget m_BtnPagePrev
void ButtonEnable(Widget w)
ESortOrder m_SortOrder
SpacerBaseWidget m_ServerList
Widget m_FilterSearchTextBox
bool IsFocusable(Widget w)
Widget m_ResetFilters
void ColorHighlight(Widget w)
Widget m_RefreshList
Widget m_TimeSort
ref set< string > m_OnlineFavServers
int AddSorted(GetServersResultRow entry)
ServerBrowserMenuNew GetRootMenu()
Widget m_Root
Definition SizeToChild.c:85
int m_PageIndex
GetServersResult the output structure of the GetServers operation.
Definition EnMath.c:7
static ref ScriptInvoker m_ServersAsyncInvoker
int GetTimeOfDayEnum(string time_of_day)
override void OnLoadServersAsyncPC(ref GetServersResult result_list, EBiosError error, string response)
override bool IsFocusable(Widget w)
override void ApplyFilters()
override bool OnClick(Widget w, int x, int y, int button)
void ToggleSort(ESortType type)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
override void SetSort(ESortType type, ESortOrder order)
override void SelectServer(ServerBrowserEntry server)
int SortedInsertDesc(GetServersResultRow entry, ESortType sort_type)
void SetPageIndex(int page_index)
override int AddSorted(GetServersResultRow entry)
ref array< ButtonWidget > m_BtnPages
ref array< ref ServerBrowserEntry > m_ServerListEntries
override void ResetFilters()
int SortedInsertAsc(GetServersResultRow entry, ESortType sort_type)
ButtonWidget m_BtnPagesFirst
override void RefreshList()
ServerBrowserEntry GetServerEntryByIndex(int index, string server_id)
override void OnFilterChanged()
override bool OnMouseEnter(Widget w, int x, int y)
int SortedInsertEx(GetServersResultRow entry, ESortType sortType, bool isDescending)
int SortedInsert(GetServersResultRow entry, ESortType sort_type)
override void OnLoadServerModsAsync(string server_id, array< string > mods)
override void Construct(Widget parent, ServerBrowserMenuNew menu, TabType type)
ButtonWidget m_BtnPagesLast
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
bool OnClickPage(Widget w)
override void LoadExtraEntries(int index)
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
array< string > TStringArray
Definition EnScript.c:666
static proto float Floor(float f)
Returns floor of value.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Round(float f)
Returns mathematical round of value.
static proto float Ceil(float f)
Returns ceil of value.
MouseState
Definition EnSystem.c:311
proto native void SetFocus(Widget w)
proto native void SetSort(int sort, bool immedUpdate=true)
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Definition proto.c:332