DayZ 1.24
Loading...
Searching...
No Matches
ServerBrowserTabConsolePages Class Reference

Protected Member Functions

override void Construct (Widget parent, ServerBrowserMenuNew menu, TabType type)
 
override void OnLoadServersAsyncFinished ()
 
override void LoadEntries (int cur_page_index, GetServersResultRowArray page_entries)
 
override void LoadExtraEntries (int index)
 
override void RefreshList ()
 
override bool PassFilter (GetServersResultRow result)
 
override void PressY ()
 
override void PressX ()
 
override void SetFocusFilters ()
 

Detailed Description

Definition at line 1 of file ServerBrowserFavoritesTabConsolePages.c.

Member Function Documentation

◆ Construct()

override void ServerBrowserTabConsolePages::Construct ( Widget parent,
ServerBrowserMenuNew menu,
TabType type )
inlineprotected

Definition at line 3 of file ServerBrowserFavoritesTabConsolePages.c.

4 {
5 super.Construct(parent, menu, type);
6
7 // disabling filter section
8 m_Root.FindAnyWidget("filters_content").Show(false);
9 m_Root.FindAnyWidget("reset_filter_button").Show(false);
10 }
Widget m_Root
Definition SizeToChild.c:85

References m_Root.

◆ LoadEntries()

override void ServerBrowserTabConsolePages::LoadEntries ( int cur_page_index,
GetServersResultRowArray page_entries )
inlineprotected

Definition at line 20 of file ServerBrowserFavoritesTabConsolePages.c.

21 {
22 if (cur_page_index == 1)
23 m_OnlineFavServers.Clear();
24
25 super.LoadEntries(cur_page_index, page_entries);
26 }
ref set< string > m_OnlineFavServers

References m_OnlineFavServers.

Referenced by ServerBrowserTab::OnLoadServersAsyncConsole().

◆ LoadExtraEntries()

override void ServerBrowserTabConsolePages::LoadExtraEntries ( int index)
inlineprotected

Definition at line 28 of file ServerBrowserFavoritesTabConsolePages.c.

29 {
30 if (!m_Menu || m_Menu.GetServersLoadingTab() != m_TabType)
31 return;
32
33 // m_PagesCount for FAVORITES tab is determined by total number of favorited servers
34 TStringArray favIds = m_Menu.GetFavoritedServerIds();
35 m_PagesCount = Math.Ceil((float)favIds.Count() / SERVER_BROWSER_PAGE_SIZE);
36
37 // offlineFavIds will always have same order, even across pages,
38 // to ensure we display only fav servers that HAVEN'T been displayed yet
40 offlineFavIds.Reserve(favIds.Count() - m_OnlineFavServers.Count());
41 foreach (string ipPort : favIds)
42 {
43 if (m_OnlineFavServers.Find(ipPort) == -1)
44 offlineFavIds.Insert(ipPort);
45 }
46
47 // appending offline servers to server list
50 for (int i = startingIndex; i < offlineFavIds.Count(); ++i)
51 {
52 string favServerId = offlineFavIds[i];
53
54 // only append server if there is a free entry left on the page
56 break;
57
58 if (m_OnlineFavServers.Find(favServerId) > -1)
59 continue;
60
62 favServerId.Split(":", parts);
63
64 // ensure server id has correct format
65 if (parts.Count() != 2)
66 continue;
67
69 offlineRow.m_Name = favServerId;
71 offlineRow.m_HostIp = parts[0];
72 offlineRow.m_HostPort = parts[1].ToInt();
73 offlineRow.m_SteamQueryPort = offlineRow.m_HostPort;
74 offlineRow.m_Favorite = true;
75
76 ServerBrowserEntry entry = GetServerEntryByIndex(index);
77 entry.SetIsOnline(false);
78 entry.FillInfo(offlineRow);
79 entry.UpdateEntry();
80
81 m_EntryWidgets.Insert(favServerId, entry);
83
84 index++;
85 }
86 }
const int SERVER_BROWSER_PAGE_SIZE
ref map< ESortType, ref array< ref GetServersResultRow > > m_EntriesSorted
TabType m_TabType
ref map< string, ref ServerBrowserEntry > m_EntryWidgets
ServerBrowserMenuNew m_Menu
ESortType m_SortType
int GetCurrentPage()
Definition EnMath.c:7
array< string > TStringArray
Definition EnScript.c:666
static proto float Ceil(float f)
Returns ceil of value.

References Math::Ceil(), GetCurrentPage(), m_EntriesSorted, m_EntryWidgets, m_Menu, m_OnlineFavServers, m_SortType, m_TabType, and SERVER_BROWSER_PAGE_SIZE.

Referenced by ServerBrowserTab::LoadEntries().

◆ OnLoadServersAsyncFinished()

override void ServerBrowserTabConsolePages::OnLoadServersAsyncFinished ( )
inlineprotected

Definition at line 12 of file ServerBrowserFavoritesTabConsolePages.c.

13 {
14 // m_TotalLoadedServers for FAVORITES tab is determined by total number of favorited servers
15 TStringArray favIds = m_Menu.GetFavoritedServerIds();
17 super.OnLoadServersAsyncFinished();
18 }
int m_TotalLoadedServers

References m_Menu, and m_TotalLoadedServers.

Referenced by ServerBrowserTab::OnLoadServersAsyncConsole().

◆ PassFilter()

override bool ServerBrowserTabConsolePages::PassFilter ( GetServersResultRow result)
inlineprotected

Definition at line 98 of file ServerBrowserFavoritesTabConsolePages.c.

99 {
100 if (m_TabType == TabType.FAVORITE)
101 {
102 if (!m_Menu.IsFavorited(result.GetIpPort()))
103 return false;
104 }
105
106 return super.PassFilter(result);
107 }
TabType

References m_Menu, and m_TabType.

Referenced by ServerBrowserTab::LoadEntries().

◆ PressX()

override void ServerBrowserTabConsolePages::PressX ( )
inlineprotected

Definition at line 126 of file ServerBrowserFavoritesTabConsolePages.c.

127 {
128 if ((GetGame().GetTime() - m_TimeLastServerRefresh) > 1000)
129 {
131 super.PressX();
132 }
133 }
float GetTime()
void SetCurrentPage(int page_num)
proto native CGame GetGame()

References GetGame(), GetTime(), and SetCurrentPage().

Referenced by ServerBrowserTab::OnClick().

◆ PressY()

override void ServerBrowserTabConsolePages::PressY ( )
inlineprotected

Definition at line 109 of file ServerBrowserFavoritesTabConsolePages.c.

110 {
111 switch (m_SelectedPanel)
112 {
113 // filters are disabled for console FAVORITES tab, so do nothing
114 case SelectedPanel.FILTERS:
115 {
116 break;
117 }
118 default:
119 {
120 super.PressY();
121 break;
122 }
123 }
124 }
SelectedPanel m_SelectedPanel

References m_SelectedPanel.

◆ RefreshList()

override void ServerBrowserTabConsolePages::RefreshList ( )
inlineprotected

Definition at line 88 of file ServerBrowserFavoritesTabConsolePages.c.

89 {
90 super.RefreshList();
91#ifdef PLATFORM_WINDOWS
92 m_CurrentFilterInput.SetFavorited(true);
93#endif
96 }
ref GetServersInput m_CurrentFilterInput
void AddFavoritesToFilter(ref GetServersInput input)
static void LoadServers(notnull GetServersInput inputValues)

References AddFavoritesToFilter(), OnlineServices::LoadServers(), and m_CurrentFilterInput.

Referenced by ServerBrowserTab::ApplyFilters(), ServerBrowserTab::LeftRelease(), ServerBrowserTab::OnClick(), ServerBrowserTab::PressX(), and ServerBrowserTab::RightRelease().

◆ SetFocusFilters()

override void ServerBrowserTabConsolePages::SetFocusFilters ( )
inlineprotected

Definition at line 135 of file ServerBrowserFavoritesTabConsolePages.c.

136 {
137 super.SetFocusFilters();
138
139 m_Menu.ShowYButton(false);
140 m_Menu.ShowAButton(false);
141
142 // focus on the back button instead of filter section
143 m_Menu.BackButtonFocus();
144
145 UpdatePageButtons();
146 }

References m_Menu.

Referenced by ServerBrowserTab::Construct(), ServerBrowserTab::Focus(), ServerBrowserTab::OnLoadServersAsyncConsole(), ServerBrowserTab::PressSholderLeft(), and ServerBrowserTab::PressSholderRight().


The documentation for this class was generated from the following file: