DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ServerBrowserFavoritesTabPc.c
Go to the documentation of this file.
1class ServerBrowserFavoritesTabPc extends ServerBrowserTabPc
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 {
24 continue;
25 }
26
27 if (m_OnlineFavServers.Find(serverId) > -1)
28 {
29 continue;
30 }
31
32 relevantCachedInfo.Insert(new Param2<string, CachedServerInfo>(serverId, cachedInfo));
33 }
34
35 // adding FAVORITED, OFFLINE servers to favorites tab
36 int totalServersAlreadyShown = m_PageIndex * SERVERS_VISIBLE_COUNT + index;
37 int startingIndex = totalServersAlreadyShown - m_TotalLoadedServers;
38 m_TotalLoadedServers += relevantCachedInfo.Count();
39 for (int i = startingIndex; i < relevantCachedInfo.Count(); ++i)
40 {
41 if (index >= SERVERS_VISIBLE_COUNT)
42 {
43 break;
44 }
45
46 Param2<string, CachedServerInfo> relevantEntry = relevantCachedInfo[i];
47
48 cachedInfo = relevantEntry.param2;
49 string ip = cachedInfo.param1;
50 string cachedName = cachedInfo.param2;
51 int connPort = cachedInfo.param3;
52 int queryPort = cachedInfo.param4;
53
54 // do NOT insert offlineRow into m_EntriesSorted[m_SortType]!!
55 // we assume that rows already in m_EntriesSorted[m_SortType] are ONLINE,
56 // if we add offline info to m_EntriesSorted[m_SortType] then we cannot differente
57 // between online and offline servers
58 GetServersResultRow offlineRow = new GetServersResultRow();
59 offlineRow.m_Id = relevantEntry.param1;
60 offlineRow.m_Name = cachedName;
61 offlineRow.m_HostIp = ip;
62 offlineRow.m_SteamQueryPort = queryPort;
63 offlineRow.m_HostPort = connPort;
64 offlineRow.m_Favorite = true;
65
66 ServerBrowserEntry entry = GetServerEntryByIndex(index, offlineRow.m_Id);
67 entry.Show(true);
68 entry.FillInfo(offlineRow);
69 entry.SetIsOnline(false);
70 entry.UpdateEntry();
71
72 index++;
73 }
74 }
75
76 override void RefreshList()
77 {
78 OnlineServices.GetCachedFavServerInfo(m_CachedFavoriteServerInfo);
79
80 m_OnlineFavServers.Clear();
81 super.RefreshList();
82
86 }
87
88 private string GetConnEndPoint(CachedServerInfo cachedInfo)
89 {
90 string ip = cachedInfo.param1;
91 int connPort = cachedInfo.param3;
92 return ip + ":" + connPort;
93 }
94
95 private string GetQueryEndPoint(CachedServerInfo cachedInfo)
96 {
97 string ip = cachedInfo.param1;
98 int queryPort = cachedInfo.param4;
99 return ip + ":" + queryPort;
100 }
101}
Param4< string, string, int, int > CachedServerInfo
protected ServerBrowserMenuNew m_Menu
TabType
protected ref GetServersInput m_CurrentFilterInput
void AddFavoritesToFilter(ref GetServersInput input)
protected int m_TotalLoadedServers
protected ref set< string > m_OnlineFavServers
protected int m_PageIndex
void SetFavorited(bool show)
static void GetCachedFavServerInfo(array< ref CachedServerInfo > favServersInfoCache)
static void LoadServers(notnull GetServersInput inputValues)
private ref array< ref CachedServerInfo > m_CachedFavoriteServerInfo
private string GetConnEndPoint(CachedServerInfo cachedInfo)
protected override void Construct(Widget parent, ServerBrowserMenuNew menu, TabType type)
private string GetQueryEndPoint(CachedServerInfo cachedInfo)
protected override void LoadExtraEntries(int index)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.