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);
237 int totalVisibleEntries = 0;
238 foreach(
string serverID, ServerBrowserEntry entry:
m_EntryWidgets)
240 if (entry.GetRoot().IsVisible())
241 totalVisibleEntries++;
252 int count = result_list.
m_Results.Count();
255 for (
int i = 0; i < count; i++)
289 if (response ==
"thelastone")
309 super.OnClick(w,
x,
y, button);
507 for (
int i = 0; i <
m_BtnPages.Count(); ++i )
560 super.SetSort( type, order);
562 #ifdef PLATFORM_WINDOWS
563 m_Root.FindAnyWidget(
"host_sort" ).Show(
false );
564 m_Root.FindAnyWidget(
"population_sort" ).Show(
false );
565 m_Root.FindAnyWidget(
"slots_sort" ).Show(
false );
567 m_Root.FindAnyWidget(
"time_sort" ).Show(
false );
568 m_Root.FindAnyWidget(
"ping_sort" ).Show(
false );
569 m_Root.FindAnyWidget(
"map_sort" ).Show(
false );
572 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_host_label" ) );
573 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
574 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_population_label" ) );
575 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
576 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_slots_label" ) );
577 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
579 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_ping_label" ) );
580 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
581 root =
TextWidget.Cast(
m_Root.FindAnyWidget(
"server_list_content_header_time_label" ) );
582 root.SetColor(
ARGBF( 1, 1, 1, 1 ) );
591 r_name =
"server_list_content_header_host_label";
592 w_name =
"host_sort";
597 r_name =
"server_list_content_header_time_label";
598 w_name =
"time_sort";
603 r_name =
"server_list_content_header_population_label";
604 w_name =
"population_sort";
609 r_name =
"server_list_content_header_slots_label";
610 w_name =
"slots_sort";
615 r_name =
"server_list_content_header_ping_label";
616 w_name =
"ping_sort";
621 r_name =
"server_list_content_header_map_label";
628 root.SetColor(
ARGBF( 1, 1, 0, 0 ) );
630 m_Root.FindAnyWidget( w_name ).Show(
true );
712 int indexMax = list.Count() - 1;
714 int targetIndex =
Math.
Floor( indexMax / 2 );
715 int comparisonMultiplier = 1;
718 if (isDescending ==
true)
720 comparisonMultiplier = -1;
723 if ( indexMax == -1 )
725 list.Insert( entry );
731 int comparisonResult = comparisonMultiplier * entry.
CompareTo(list[targetIndex], sortType);
733 if ((indexMax - indexMin) <= 1)
735 for (
int i = indexMin; i <= indexMax; i++ )
737 comparisonResult = comparisonMultiplier * entry.
CompareTo(list[i], sortType);
739 if ( comparisonResult > 0 )
741 list.InsertAt( entry, i );
747 targetIndex =
Math.
Min(indexMax + 1, list.Count());
748 list.InsertAt(entry, targetIndex);
752 if (comparisonResult == 0)
754 list.InsertAt(entry, targetIndex);
758 if (comparisonResult > 0)
760 indexMax = targetIndex;
763 else if (comparisonResult < 0)
765 indexMin = targetIndex;
768 targetIndex = indexMin +
Math.
Floor((indexMax - indexMin) / 2);
781 int index_max = list.Count() - 1;
782 int target_index =
Math.
Floor( index_max / 2 );
784 if ( index_max == -1 )
786 list.Insert( entry );
796 string target_value_str = list[target_index].GetValueStr(
ESortType.HOST);
798 if ( entry_value_str == target_value_str || ((index_max - index_min) <= 1) )
800 for ( i = index_min; i <= index_max; i++ )
802 if ( entry_value_str <= list[i].GetValueStr(
ESortType.HOST) )
804 list.InsertAt( entry, i );
810 list.InsertAt( entry, index_max );
813 else if ( entry_value_str < target_value_str )
815 index_max = target_index;
816 target_index =
Math.
Floor( target_index / 2 );
818 else if ( entry_value_str > target_value_str )
820 index_min = target_index;
821 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
827 int entry_value_int = entry.
GetValueInt( sort_type );
831 int target_value_int = list[target_index].GetValueInt( sort_type );
833 if ( entry_value_int == target_value_int || ((index_max - index_min) <= 1) )
835 for ( i = index_min; i <= index_max; i++ )
837 if ( entry_value_int <= list[i].GetValueInt( sort_type ) )
839 list.InsertAt( entry, i );
845 list.InsertAt( entry, index_max );
848 else if ( entry_value_int < target_value_int )
850 index_max = target_index;
851 target_index =
Math.
Floor( target_index / 2 );
853 else if ( entry_value_int > target_value_int )
855 index_min = target_index;
856 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
871 int index_max = list.Count() - 1;
872 int target_index =
Math.
Floor( index_max / 2 );
874 if ( index_max == -1 )
876 list.Insert( entry );
886 string target_value_str = list[target_index].GetValueStr(
ESortType.HOST);
888 if ( entry_value_str == target_value_str || ((index_max - index_min) <= 1) )
890 for ( i = index_min; i <= index_max; i++ )
892 if ( entry_value_str >= list[i].GetValueStr(
ESortType.HOST) )
894 list.InsertAt( entry, i );
900 list.InsertAt( entry, index_max );
903 else if ( entry_value_str > target_value_str )
905 index_max = target_index;
906 target_index =
Math.
Floor( target_index / 2 );
908 else if ( entry_value_str < target_value_str )
910 index_min = target_index;
911 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
917 int entry_value_int = entry.
GetValueInt( sort_type );
921 int target_value_int = list[target_index].GetValueInt( sort_type );
923 if ( entry_value_int == target_value_int || ((index_max - index_min) <= 1) )
925 for ( i = index_min; i <= index_max; i++ )
927 if ( entry_value_int >= list[i].GetValueInt( sort_type ) )
929 list.InsertAt( entry, i );
935 list.InsertAt( entry, index_max );
938 else if ( entry_value_int > target_value_int )
940 index_max = target_index;
941 target_index =
Math.
Floor( target_index / 2 );
943 else if ( entry_value_int < target_value_int )
945 index_min = target_index;
946 target_index +=
Math.
Floor( (index_max - index_min) / 2 );
975 int page_index = (i - 1);
976 m_BtnPages[page_index].Show( is_page_button_enable );
977 m_BtnPages[page_index].SetText( i.ToString() );
1024 selected_btn_index = btn_index_center;
1032 m_BtnPages[i].SetState( ( i == selected_btn_index ) );
1092 int lastFilledIndexOnPage = 0;
1095 ServerBrowserEntry entry;
1116 entry.SetIsOnline(
true);
1117 entry.FillInfo(server_info);
1119 entry.UpdateEntry();
1121 lastFilledIndexOnPage++;
1147 m_LoadingText.SetText(
string.Format(
"#dayz_game_loading %1", serversFound) );
1153 super.OnLoadServerModsAsync( server_id, mods );
1163 ref ServerBrowserEntry entry;
1173 entry =
new ServerBrowserEntry( null, index,
this );
1194 if ( super.IsFocusable( w ) )
1222 btn.SetText(
"#menu_cancel" );
1228 btn.SetText(
"#STR_server_browser_tab_root_filters_root_filters_content_refresh_list_button0" );
1256 super.ShowServerDetails();
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)
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)
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.
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.