28 g_Game.GetPlayerName(player_name);
31 array<string> character_name_options ={
"#server_browser_disabled", player_name};
32 array<string> region_options = {
"#server_browser_all",
"#server_browser_americas",
"#server_browser_europe",
"#server_browser_asia"};
33 array<string> sort_options = {
"#server_browser_column_host A-Z",
"#server_browser_column_host Z-A",
"#players_title >",
"#players_title <"};
34 array<string> ping_options = {
"#server_browser_disabled",
"<30",
"<50",
"<100",
"<200",
"<300",
"<500"};
35 array<string> two_options = {
"#server_browser_disabled",
"#server_browser_show"};
39 m_RefreshList = ButtonWidget.Cast(root.GetParent().FindAnyWidget(
"refresh_list_button"));
41 m_RegionFilter =
new OptionSelectorMultistate(root.FindAnyWidget(
"region_setting_option"), 0,
this,
false, region_options);
42 m_PingFilter =
new OptionSelectorMultistate(root.FindAnyWidget(
"ping_setting_option"), 0,
this,
false, ping_options);
43 #ifdef PLATFORM_CONSOLE
44 m_FavoritedFilter =
new OptionSelectorMultistate(root.FindAnyWidget(
"favorites_setting_option"), 0,
this,
false, two_options);
49 m_MapFilter =
new OptionSelectorMultistate(root.FindAnyWidget(
"map_setting_option"), 0,
this,
false, map_options);
69 #ifdef PLATFORM_CONSOLE
70 m_SortingFilter =
new OptionSelectorMultistate(root.FindAnyWidget(
"sort_setting_option"), 0,
this,
false, sort_options);
81 #ifdef PLATFORM_WINDOWS
82 #ifndef PLATFORM_CONSOLE
88 m_CharacterAliveFilter =
new OptionSelectorMultistate(root.FindAnyWidget(
"restrict_char_setting_option"), 0,
this,
false, character_name_options);
111 m_Tab.OnFilterChanged();
116 m_Tab.OnFilterChanged();
125 g_Game.GetProfileString(
"SB_Filter_" +
m_Tab.GetTabType(), data);
149 #ifdef PLATFORM_CONSOLE
158 #ifdef PLATFORM_WINDOWS
159 #ifndef PLATFORM_CONSOLE
184 #ifdef PLATFORM_CONSOLE
191 #ifdef PLATFORM_WINDOWS
192 #ifndef PLATFORM_CONSOLE
199 string data, errorMessage;
203 g_Game.SetProfileString(
"SB_Filter_" +
m_Tab.GetTabType(), data);
220 #ifdef PLATFORM_CONSOLE
225 #ifdef PLATFORM_WINDOWS
226 #ifndef PLATFORM_CONSOLE
253 bool was_text_changed =
false;
254 int length = potential_ip.Length();
257 for (
int i = length - 1 ; i >= 0; --i)
259 string character = potential_ip.Get(i);
261 if (character.
ToInt() == 0 && character !=
"0" && character !=
"." && character !=
":")
263 potential_ip = potential_ip.SubstringInverted(potential_ip, i, i + 1);
264 was_text_changed =
true;
270 return (was_text_changed || text_was_shortened);
276 int length = text.Length();
277 bool was_text_changed =
false;
279 if (length > max_length)
281 text = text.Substring(0, max_length);
282 was_text_changed =
true;
285 return was_text_changed;
291 string correct_ip_format;
294 potential_ip.
Split(
":", array_ip_and_port);
299 if(array_ip_and_port.Count() > 0)
301 ip_entries = array_ip_and_port.Get(0);
303 ip_entries.
Split(
".", array_ip);
306 int ip_entries_count = array_ip.Count();
308 if (ip_entries_count <= 3 || ip_entries_count > 4)
311 for (
int i = 0; i < 4; i++)
313 int ip_entry = array_ip.Get(i).ToInt();
316 if (ip_entry > 255 || ip_entry < 0)
319 ip_string = ip_string + ip_entry.ToString();
321 if (i < ip_entries_count - 1)
322 ip_string = ip_string +
".";
326 correct_ip_format = ip_string;
331 correct_ip_format = ip_entries;
334 if (correct_ip_format ==
"")
339 if(array_ip_and_port.Count() > 1)
341 port = array_ip_and_port.Get(1).ToInt();
343 if (port > 65535 | port < 0)
348 correct_ip_format = correct_ip_format +
":" + port.ToString();
354 correct_ip_format = correct_ip_format +
":" + port.ToString();
357 return correct_ip_format;
395 #ifdef PLATFORM_CONSOLE
396 switch (
m_Tab.GetTabType())
411 #ifdef PLATFORM_WINDOWS
450 m_Tab.OnFilterFocus(w);
457 return m_Tab.OnMouseEnter(w,
x,
y);
462 return m_Tab.OnMouseLeave(w, enterW,
x,
y);
504 if (internalMapName !=
"")
508 #ifndef PLATFORM_CONSOLE
550 #ifdef PLATFORM_MSSTORE
613 if (internalMapName !=
"")
626 string GetSearchByNameFilterText()
633 string text = m_SearchByName.GetText();
639 string GetSearchByIPFilterText()
641 #ifdef PLATFORM_WINDOWS
644 string text = m_SearchByIP.GetText();
654 string GetMapFilterInternalName()
656 if (!m_MapFilter || !m_MapFilter.IsSet())
661 string internalMapName = ServerBrowserHelperFunctions.GetInternalMapName(m_MapFilter.GetStringValue());
663 return internalMapName;
static ServerBrowserHelperFunctions GetInstance()
static ref map< string, string > INTERNAL_MAP_NAMES
static string GetInternalMapName(string mapName)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
array< string > TStringArray
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
proto native int ToInt()
Converts string to integer.
proto int ToLower()
Changes string to lowercase.
proto native int Length()
Returns length of string.
proto int TrimInPlace()
Removes leading and trailing whitespaces in string.