30 #ifdef PLATFORM_CONSOLE
33 #ifdef PLATFORM_WINDOWS
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);
235 int count = result_list.
m_Results.Count();
238 for (
int i = 0; i < count; i++)
272 if (response ==
"thelastone")
292 super.OnClick(w,
x,
y, button);
490 for (
int i = 0; i <
m_BtnPages.Count(); ++i )
543 super.SetSort( type, order);
545 #ifdef PLATFORM_WINDOWS
546 m_Root.FindAnyWidget(
"host_sort" ).Show(
false );
547 m_Root.FindAnyWidget(
"population_sort" ).Show(
false );
548 m_Root.FindAnyWidget(
"slots_sort" ).Show(
false );
550 m_Root.FindAnyWidget(
"time_sort" ).Show(
false );
551 m_Root.FindAnyWidget(
"ping_sort" ).Show(
false );
552 m_Root.FindAnyWidget(
"map_sort" ).Show(
false );
555 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_host_label" ) );
556 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
557 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_population_label" ) );
558 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
559 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_slots_label" ) );
560 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
562 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_ping_label" ) );
563 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
564 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_time_label" ) );
565 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
574 r_name =
"server_list_content_header_host_label";
575 w_name =
"host_sort";
580 r_name =
"server_list_content_header_time_label";
581 w_name =
"time_sort";
586 r_name =
"server_list_content_header_population_label";
587 w_name =
"population_sort";
592 r_name =
"server_list_content_header_slots_label";
593 w_name =
"slots_sort";
598 r_name =
"server_list_content_header_ping_label";
599 w_name =
"ping_sort";
604 r_name =
"server_list_content_header_map_label";
611 root.SetColor(
ARGBF( 1, 1, 0, 0 ) );
613 m_Root.FindAnyWidget( w_name ).Show(
true );
695 int indexMax = list.Count() - 1;
697 int targetIndex =
Math.
Floor( indexMax / 2 );
698 int comparisonMultiplier = 1;
701 if (isDescending ==
true)
703 comparisonMultiplier = -1;
706 if ( indexMax == -1 )
708 list.Insert( entry );
714 int comparisonResult = comparisonMultiplier * entry.
CompareTo(list[targetIndex], sortType);
716 if ((indexMax - indexMin) <= 1)
718 for (
int i = indexMin; i <= indexMax; i++ )
720 comparisonResult = comparisonMultiplier * entry.
CompareTo(list[i], sortType);
722 if ( comparisonResult > 0 )
724 list.InsertAt( entry, i );
730 targetIndex =
Math.
Min(indexMax + 1, list.Count());
731 list.InsertAt(entry, targetIndex);
735 if (comparisonResult == 0)
737 list.InsertAt(entry, targetIndex);
741 if (comparisonResult > 0)
743 indexMax = targetIndex;
746 else if (comparisonResult < 0)
748 indexMin = targetIndex;
751 targetIndex = indexMin +
Math.
Floor((indexMax - indexMin) / 2);
764 int index_max = list.Count() - 1;
765 int target_index =
Math.
Floor( index_max / 2 );
767 if ( index_max == -1 )
769 list.Insert( entry );
779 string target_value_str = list[target_index].GetValueStr(
ESortType.HOST);
781 if ( entry_value_str == target_value_str || ((index_max - index_min) <= 1) )
783 for ( i = index_min; i <= index_max; i++ )
785 if ( entry_value_str <= list[i].GetValueStr(
ESortType.HOST) )
787 list.InsertAt( entry, i );
793 list.InsertAt( entry, index_max );
796 else if ( entry_value_str < target_value_str )
798 index_max = target_index;
799 target_index =
Math.
Floor( target_index / 2 );
801 else if ( entry_value_str > target_value_str )
803 index_min = target_index;
804 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
810 int entry_value_int = entry.
GetValueInt( sort_type );
814 int target_value_int = list[target_index].GetValueInt( sort_type );
816 if ( entry_value_int == target_value_int || ((index_max - index_min) <= 1) )
818 for ( i = index_min; i <= index_max; i++ )
820 if ( entry_value_int <= list[i].GetValueInt( sort_type ) )
822 list.InsertAt( entry, i );
828 list.InsertAt( entry, index_max );
831 else if ( entry_value_int < target_value_int )
833 index_max = target_index;
834 target_index =
Math.
Floor( target_index / 2 );
836 else if ( entry_value_int > target_value_int )
838 index_min = target_index;
839 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
854 int index_max = list.Count() - 1;
855 int target_index =
Math.
Floor( index_max / 2 );
857 if ( index_max == -1 )
859 list.Insert( entry );
869 string target_value_str = list[target_index].GetValueStr(
ESortType.HOST);
871 if ( entry_value_str == target_value_str || ((index_max - index_min) <= 1) )
873 for ( i = index_min; i <= index_max; i++ )
875 if ( entry_value_str >= list[i].GetValueStr(
ESortType.HOST) )
877 list.InsertAt( entry, i );
883 list.InsertAt( entry, index_max );
886 else if ( entry_value_str > target_value_str )
888 index_max = target_index;
889 target_index =
Math.
Floor( target_index / 2 );
891 else if ( entry_value_str < target_value_str )
893 index_min = target_index;
894 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
900 int entry_value_int = entry.
GetValueInt( sort_type );
904 int target_value_int = list[target_index].GetValueInt( sort_type );
906 if ( entry_value_int == target_value_int || ((index_max - index_min) <= 1) )
908 for ( i = index_min; i <= index_max; i++ )
910 if ( entry_value_int >= list[i].GetValueInt( sort_type ) )
912 list.InsertAt( entry, i );
918 list.InsertAt( entry, index_max );
921 else if ( entry_value_int > target_value_int )
923 index_max = target_index;
924 target_index =
Math.
Floor( target_index / 2 );
926 else if ( entry_value_int < target_value_int )
928 index_min = target_index;
929 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
958 int page_index = (i - 1);
959 m_BtnPages[page_index].Show( is_page_button_enable );
960 m_BtnPages[page_index].SetText( i.ToString() );
1007 selected_btn_index = btn_index_center;
1015 m_BtnPages[i].SetState( ( i == selected_btn_index ) );
1075 int lastFilledIndexOnPage = 0;
1077 ServerBrowserEntry entry;
1098 entry.SetIsOnline(
true);
1099 entry.FillInfo(server_info);
1101 entry.UpdateEntry();
1103 lastFilledIndexOnPage++;
1130 m_LoadingText.SetText(
string.Format(
"#dayz_game_loading %1", serversFound) );
1136 super.OnLoadServerModsAsync( server_id, mods );
1146 ref ServerBrowserEntry entry;
1156 entry =
new ServerBrowserEntry( null, index,
this );
1177 if ( super.IsFocusable( w ) )
1205 btn.SetText(
"#menu_cancel" );
1211 btn.SetText(
"#STR_server_browser_tab_root_filters_root_filters_content_refresh_list_button0" );
1239 super.ShowServerDetails();
EBiosError
Possible Error codes for bios API. This is the list of errors that can be returned from bios API....
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)
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
void ColorNormal(Widget w)
ButtonWidget m_BtnPagePrev
void ButtonEnable(Widget w)
SpacerBaseWidget m_ServerList
Widget m_FilterSearchTextBox
bool IsFocusable(Widget w)
ref ServerBrowserDetailsContainer m_Details
void ColorHighlight(Widget w)
ref set< string > m_OnlineFavServers
ButtonWidget m_BtnShowDetails
int AddSorted(GetServersResultRow entry)
proto native WorkspaceWidget GetWorkspace()
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)
void ~ServerBrowserTabPc()
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.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
array< string > TStringArray
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.
static proto float Ceil(float f)
Returns ceil 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.