3 protected const int SERVERS_VISIBLE_COUNT = 24;
30 #ifdef PLATFORM_CONSOLE
31 m_Root =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/server_browser/xbox/server_browser_tab.layout", parent);
33 #ifdef PLATFORM_WINDOWS
34 m_Root =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/server_browser/pc/server_browser_tab_pages.layout", parent);
91 m_Filters =
new ServerBrowserFilterContainer(
m_Root.FindAnyWidget(
"filters_content"),
this);
99 int page_button_num = 1;
100 ButtonWidget page_button = ButtonWidget.Cast(
m_Root.FindAnyWidget(
"servers_navigation_page" + page_button_num));
102 if (PAGES_BUTTONS_COUNT < 3 || PAGES_BUTTONS_COUNT > 10)
104 Error(
"ServerBrowserTabPage->PAGES_BUTTONS_COUNT must be in range 3 - 10!");
110 page_button.Show(
false);
118 page_button = ButtonWidget.Cast(
m_Root.FindAnyWidget(
"servers_navigation_page"+ page_button_num));
133 m_Details =
new ServerBrowserDetailsContainer(
m_Root.FindAnyWidget(
"details_content"),
this);
137 m_Root.FindAnyWidget(
"filters_content").Show(
false);
138 m_Root.FindAnyWidget(
"reset_filter_button").Show(
false);
140 m_Root.FindAnyWidget(
"spacer").Show(
false);
141 m_Root.FindAnyWidget(
"spacer1").Show(
false);
142 m_Root.FindAnyWidget(
"spacer5").Show(
false);
156 #ifdef DIAG_DEVELOPER
163 #ifdef DIAG_DEVELOPER
164 if (m_DummyServersEnabled)
172 for (
int i = 0; i < entriesSortedCount; ++i )
242 #ifdef DIAG_DEVELOPER
243 if (m_DummyServersEnabled)
249 int count = result_list.
m_Results.Count();
252 for (
int i = 0; i < count; i++)
286 if (response ==
"thelastone")
306 super.OnClick(w,
x,
y, button);
504 for (
int i = 0; i <
m_BtnPages.Count(); ++i )
557 super.SetSort( type, order);
559 #ifdef PLATFORM_WINDOWS
560 m_Root.FindAnyWidget(
"host_sort" ).Show(
false );
561 m_Root.FindAnyWidget(
"population_sort" ).Show(
false );
562 m_Root.FindAnyWidget(
"slots_sort" ).Show(
false );
564 m_Root.FindAnyWidget(
"time_sort" ).Show(
false );
565 m_Root.FindAnyWidget(
"ping_sort" ).Show(
false );
566 m_Root.FindAnyWidget(
"map_sort" ).Show(
false );
569 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_host_label" ) );
570 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
571 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_population_label" ) );
572 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
573 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_slots_label" ) );
574 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
576 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_ping_label" ) );
577 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
578 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_time_label" ) );
579 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
588 r_name =
"server_list_content_header_host_label";
589 w_name =
"host_sort";
594 r_name =
"server_list_content_header_time_label";
595 w_name =
"time_sort";
600 r_name =
"server_list_content_header_population_label";
601 w_name =
"population_sort";
606 r_name =
"server_list_content_header_slots_label";
607 w_name =
"slots_sort";
612 r_name =
"server_list_content_header_ping_label";
613 w_name =
"ping_sort";
618 r_name =
"server_list_content_header_map_label";
625 root.SetColor(
ARGBF( 1, 1, 0, 0 ) );
627 m_Root.FindAnyWidget( w_name ).Show(
true );
709 int indexMax = list.Count() - 1;
711 int targetIndex =
Math.
Floor( indexMax / 2 );
712 int comparisonMultiplier = 1;
715 if (isDescending ==
true)
717 comparisonMultiplier = -1;
720 if ( indexMax == -1 )
722 list.Insert( entry );
728 int comparisonResult = comparisonMultiplier * entry.
CompareTo(list[targetIndex], sortType);
730 if ((indexMax - indexMin) <= 1)
732 for (
int i = indexMin; i <= indexMax; i++ )
734 comparisonResult = comparisonMultiplier * entry.
CompareTo(list[i], sortType);
736 if ( comparisonResult > 0 )
738 list.InsertAt( entry, i );
744 targetIndex =
Math.
Min(indexMax + 1, list.Count());
745 list.InsertAt(entry, targetIndex);
749 if (comparisonResult == 0)
751 list.InsertAt(entry, targetIndex);
755 if (comparisonResult > 0)
757 indexMax = targetIndex;
760 else if (comparisonResult < 0)
762 indexMin = targetIndex;
765 targetIndex = indexMin +
Math.
Floor((indexMax - indexMin) / 2);
778 int index_max = list.Count() - 1;
779 int target_index =
Math.
Floor( index_max / 2 );
781 if ( index_max == -1 )
783 list.Insert( entry );
793 string target_value_str = list[target_index].GetValueStr(
ESortType.HOST);
795 if ( entry_value_str == target_value_str || ((index_max - index_min) <= 1) )
797 for ( i = index_min; i <= index_max; i++ )
799 if ( entry_value_str <= list[i].GetValueStr(
ESortType.HOST) )
801 list.InsertAt( entry, i );
807 list.InsertAt( entry, index_max );
810 else if ( entry_value_str < target_value_str )
812 index_max = target_index;
813 target_index =
Math.
Floor( target_index / 2 );
815 else if ( entry_value_str > target_value_str )
817 index_min = target_index;
818 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
824 int entry_value_int = entry.
GetValueInt( sort_type );
828 int target_value_int = list[target_index].GetValueInt( sort_type );
830 if ( entry_value_int == target_value_int || ((index_max - index_min) <= 1) )
832 for ( i = index_min; i <= index_max; i++ )
834 if ( entry_value_int <= list[i].GetValueInt( sort_type ) )
836 list.InsertAt( entry, i );
842 list.InsertAt( entry, index_max );
845 else if ( entry_value_int < target_value_int )
847 index_max = target_index;
848 target_index =
Math.
Floor( target_index / 2 );
850 else if ( entry_value_int > target_value_int )
852 index_min = target_index;
853 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
885 int page_index = (i - 1);
886 m_BtnPages[page_index].Show( is_page_button_enable );
887 m_BtnPages[page_index].SetText( i.ToString() );
934 selected_btn_index = btn_index_center;
942 m_BtnPages[i].SetState( ( i == selected_btn_index ) );
1002 int lastFilledIndexOnPage = 0;
1005 ServerBrowserEntry entry;
1026 entry.SetIsOnline(
true);
1027 entry.FillInfo(server_info);
1029 entry.UpdateEntry();
1031 lastFilledIndexOnPage++;
1057 m_LoadingText.SetText(
string.Format(
"#dayz_game_loading %1", serversFound) );
1063 super.OnLoadServerModsAsync( server_id, mods );
1073 ref ServerBrowserEntry entry;
1083 entry =
new ServerBrowserEntry( null, index,
this );
1104 if ( super.IsFocusable( w ) )
1132 btn.SetText(
"#menu_cancel" );
1138 btn.SetText(
"#STR_server_browser_tab_root_filters_root_filters_content_refresh_list_button0" );
1166 super.ShowServerDetails();
1175#ifdef DIAG_DEVELOPER
1176 protected void RefreshDummyList()
1183 m_ServerListEntries.Clear();
1197 m_TotalServersCount = 0;
1198 m_ServersEstimateCount = 0;
1202 m_Menu.DeselectCurrentServer();
1206 if (!m_DummyServers || !m_DummyServers.m_Results)
1212 UpdatePageButtons();
1217 int count = m_DummyServers.m_Results.Count();
1218 for (
int j = 0; j < count; ++j)
1220 GetServersResultRow result = m_DummyServers.m_Results[j];
1231 if (PassLocalFilters(result))
1235 m_TotalServersCount = m_DummyServers.m_NumServers;
1243 ButtonCancelToRefresh();
1249 UpdatePageButtons();
1261 override void OnDummyServersEnabledChanged()
1263 super.OnDummyServersEnabledChanged();
1268 override int GetServersVisibleCount()
1270 return SERVERS_VISIBLE_COUNT;
1282 int index_max = list.Count() - 1;
1283 int target_index =
Math.
Floor( index_max / 2 );
1285 if ( index_max == -1 )
1287 list.Insert( entry );
1297 string target_value_str = list[target_index].GetValueStr(
ESortType.HOST);
1299 if ( entry_value_str == target_value_str || ((index_max - index_min) <= 1) )
1301 for ( i = index_min; i <= index_max; i++ )
1303 if ( entry_value_str >= list[i].GetValueStr(
ESortType.HOST) )
1305 list.InsertAt( entry, i );
1311 list.InsertAt( entry, index_max );
1312 return target_index;
1314 else if ( entry_value_str > target_value_str )
1316 index_max = target_index;
1317 target_index =
Math.
Floor( target_index / 2 );
1319 else if ( entry_value_str < target_value_str )
1321 index_min = target_index;
1322 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
1328 int entry_value_int = entry.
GetValueInt( sort_type );
1332 int target_value_int = list[target_index].GetValueInt( sort_type );
1334 if ( entry_value_int == target_value_int || ((index_max - index_min) <= 1) )
1336 for ( i = index_min; i <= index_max; i++ )
1338 if ( entry_value_int >= list[i].GetValueInt( sort_type ) )
1340 list.InsertAt( entry, i );
1346 list.InsertAt( entry, index_max );
1347 return target_index;
1349 else if ( entry_value_int > target_value_int )
1351 index_max = target_index;
1352 target_index =
Math.
Floor( target_index / 2 );
1354 else if ( entry_value_int < target_value_int )
1356 index_min = target_index;
1357 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
1362 return target_index;
EBiosError
Possible Error codes for bios API. This is the list of errors that can be returned from bios API....
void ColorNormal(Widget w)
void ColorHighlight(Widget w)
ref ServerBrowserFilterContainer m_Filters
ref map< ESortType, ref array< ref GetServersResultRow > > m_EntriesSorted
Widget m_FilterSearchText
TextWidget m_RightAreaHeaderText
ServerBrowserEntry m_SelectedServer
void ButtonDisable(Widget w)
ref GetServersInput m_CurrentFilterInput
ButtonWidget m_BtnPageNext
ref map< ESortType, ESortOrder > m_SortInverted
ButtonWidget m_BtnShowFilters
ref map< string, ref ServerBrowserEntry > m_EntryWidgets
void SwitchToDetails(bool focus=true)
ScrollWidget m_ServerListScroller
bool PassFilter(GetServersResultRow result)
string m_CurrentSelectedServer
ServerBrowserMenuNew m_Menu
void SwitchToFilters(bool focus=true)
ref map< string, ref array< string > > m_EntryMods
ButtonWidget m_BtnPagePrev
void ButtonEnable(Widget w)
SpacerBaseWidget m_ServerList
Widget m_FilterSearchTextBox
bool IsFocusable(Widget w)
ref ServerBrowserDetailsContainer m_Details
ref set< string > m_OnlineFavServers
ButtonWidget m_BtnShowDetails
int AddSorted(GetServersResultRow entry)
ref GetServersResultRowArray m_Results
GetServersResult the output structure of the GetServers operation.
string GetValueStr(ESortType sort_type)
int CompareTo(GetServersResultRow other, ESortType sortType)
int GetValueInt(ESortType sort_type)
GetServersResultRow the output structure of the GetServers operation that represents one game server.
static ref ScriptInvoker m_ServersAsyncInvoker
proto bool Remove(func fn, int flags=EScriptInvokerRemoveFlags.ALL)
remove specific call from list
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
ref TStringArray m_TempTime
int GetTimeOfDayEnum(string time_of_day)
override bool IsFocusable(Widget w)
override void ShowServerDetails()
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)
void LoadingServersStop()
override void SwitchToDetails(bool focus=true)
ServerBrowserEntry GetServerEntryByIndex(int index)
override void SetSort(ESortType type, ESortOrder order)
TextWidget m_PnlPagesLoadingText
override void SwitchToFilters(bool focus=true)
int SortedInsertDesc(GetServersResultRow entry, ESortType sort_type)
void SetPageIndex(int page_index)
override int AddSorted(GetServersResultRow entry)
void ButtonCancelToRefresh()
ref array< ButtonWidget > m_BtnPages
ref array< ref ServerBrowserEntry > m_ServerListEntries
override void ResetFilters()
Widget m_FilterPanelAccTime
int m_ServersEstimateCount
int SortedInsertAsc(GetServersResultRow entry, ESortType sort_type)
ButtonWidget m_BtnPagesFirst
override void RefreshList()
Widget m_FilterSearchIPBox
ServerBrowserEntry GetServerEntryByIndex(int index, string server_id)
override void UpdateServerList()
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)
const int PAGES_BUTTONS_COUNT
ButtonWidget m_BtnPagesLast
void OnLoadServersAsyncPCFinished()
override void OnLoadServersAsyncPC(GetServersResult result_list, EBiosError error, string response)
const int SERVERS_VISIBLE_COUNT
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
void ButtonRefreshToCancel()
bool OnClickPage(Widget w)
override void RefreshList()
override void LoadExtraEntries(int index)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
void Error(string err)
Messagebox with error message.
class array< Class T > TStringArray
void Obsolete(string msg="")
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.
proto native int ToInt()
Converts string to integer.
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.