DayZ 1.24
Loading...
Searching...
No Matches
ServerBrowserFavoritesTabPc.c
Go to the documentation of this file.
2{
3 // value = ip, name, connection port, query port
5
6 protected override void Construct(Widget parent, ServerBrowserMenuNew menu, TabType type)
7 {
8 m_CachedFavoriteServerInfo = new array<ref CachedServerInfo>();
9
10 super.Construct(parent, menu, type);
11 DisableFilters();
12 }
13
14 protected override void LoadExtraEntries(int index)
15 {
17 foreach (CachedServerInfo cachedInfo : m_CachedFavoriteServerInfo)
18 {
19 string serverId = GetConnEndPoint(cachedInfo);
20
21 // ensure the cached server is still favorited
22 if (!m_Menu.IsFavorited(GetQueryEndPoint(cachedInfo)))
23 continue;
24
25 if (m_OnlineFavServers.Find(serverId) > -1)
26 continue;
27
29 }
30
31 // adding FAVORITED, OFFLINE servers to favorites tab
32 int totalServersAlreadyShown = m_PageIndex * SERVERS_VISIBLE_COUNT + index;
35 for (int i = startingIndex; i < relevantCachedInfo.Count(); ++i)
36 {
37 if (index >= SERVERS_VISIBLE_COUNT)
38 break;
39
41
43 string ip = cachedInfo.param1;
44 string cachedName = cachedInfo.param2;
45 int connPort = cachedInfo.param3;
46 int queryPort = cachedInfo.param4;
47
48 // do NOT insert offlineRow into m_EntriesSorted[m_SortType]!!
49 // we assume that rows already in m_EntriesSorted[m_SortType] are ONLINE,
50 // if we add offline info to m_EntriesSorted[m_SortType] then we cannot differente
51 // between online and offline servers
53 offlineRow.m_Id = relevantEntry.param1;
54 offlineRow.m_Name = cachedName;
55 offlineRow.m_HostIp = ip;
56 offlineRow.m_SteamQueryPort = queryPort;
57 offlineRow.m_HostPort = connPort;
58 offlineRow.m_Favorite = true;
59
60 ServerBrowserEntry entry = GetServerEntryByIndex(index, offlineRow.m_Id);
61 entry.Show(true);
62 entry.SetIsOnline(false);
63 entry.FillInfo(offlineRow);
64 entry.UpdateEntry();
65
66 index++;
67 }
68 }
69
70 override void RefreshList()
71 {
72 OnlineServices.GetCachedFavServerInfo(m_CachedFavoriteServerInfo);
73
74 m_OnlineFavServers.Clear();
75 super.RefreshList();
76
77 m_CurrentFilterInput.SetFavorited(true);
80 }
81
83 {
84 string ip = cachedInfo.param1;
85 int connPort = cachedInfo.param3;
86 return ip + ":" + connPort;
87 }
88
90 {
91 string ip = cachedInfo.param1;
92 int queryPort = cachedInfo.param4;
93 return ip + ":" + queryPort;
94 }
95}
ref GetServersInput m_CurrentFilterInput
TabType
int m_TotalLoadedServers
ServerBrowserMenuNew m_Menu
void AddFavoritesToFilter(ref GetServersInput input)
ref set< string > m_OnlineFavServers
int m_PageIndex
static void LoadServers(notnull GetServersInput inputValues)
static void GetCachedFavServerInfo(array< ref CachedServerInfo > favServersInfoCache)
string GetQueryEndPoint(CachedServerInfo cachedInfo)
string GetConnEndPoint(CachedServerInfo cachedInfo)
ref array< ref CachedServerInfo > m_CachedFavoriteServerInfo
override void LoadExtraEntries(int index)
override void Construct(Widget parent, ServerBrowserMenuNew menu, TabType type)