18enum ServerBrowserRightAreaView
35 protected ref ServerBrowserFilterContainer
m_Filters;
37 protected ServerBrowserMenuNew
m_Menu;
87 protected ref ServerBrowserDetailsContainer
m_Details;
91 protected static bool m_DummyServersEnabled;
117 if (
GetGame().GetContentDLCService())
120 #ifdef DIAG_DEVELOPER
144 case EDLCId.DLC_FROSTLINE:
147 foreach (ServerBrowserEntry entry : serverEntries)
149 entry.RefreshDLCIcon();
167 Widget root = entry.GetRoot();
168 Widget first_child = root.GetParent().GetChildren();
169 Widget last_child = first_child;
172 if ( last_child.GetSibling() )
173 last_child = last_child.GetSibling();
178 root.GetParent().Update();
184 float bottom_pos =
y + y_s;
186 root.GetScreenPos( x_l, y_l );
187 root.GetScreenSize( x_s, y_s );
189 if ( root == first_child )
193 else if ( root == last_child )
197 else if ( y_l + y_s >= bottom_pos )
222 m_Menu.FilterFocus(
false);
234 m_Menu.DetailsFocus(
false);
240 m_Menu.DetailsFocus(
true);
250 m_Menu.ServerListFocus(focus, favorite);
267 #ifdef PLATFORM_CONSOLE
272 aButtonLabel =
"#ps4_ingame_menu_select";
274 aButtonLabel =
"#layout_xbox_ingame_menu_select";
276 m_Menu.UpdateAButtonLabel(aButtonLabel);
280 aButtonLabel =
"#dialog_change";
281 m_Menu.UpdateAButtonLabel(aButtonLabel);
285 m_Menu.ShowAButton(
false);
388 Widget sibling = focused.GetSibling();
392 if ( focused.GetName() ==
"server_browser_list_entry_root" )
397 SetFocus( focused.GetParent().GetSibling().GetChildren() );
404 if ( focused && focused.GetName() ==
"server_browser_list_entry_root" )
406 Widget sibling = focused.GetParent().GetChildren();
407 if ( focused == sibling )
412 if ( sibling && sibling.GetSibling() == focused )
418 sibling = sibling.GetSibling();
454 m_Menu.AddFavoritesToFilter( input );
470 m_Menu.DeselectCurrentServer();
474 #ifndef PLATFORM_WINDOWS
481 #ifdef PLATFORM_CONSOLE
523 #ifdef PLATFORM_CONSOLE
534 m_Menu.SelectServer(server);
605 return "currentNumberPlayers";
626 ServerBrowserEntry entry;
629 entry.SetFavorite(
false);
659 if ( w.IsInherited( ButtonWidget ) )
661 ButtonWidget button = ButtonWidget.Cast( w );
662 button.SetTextColor(
ARGB( 255, 200, 0, 0 ) );
665 w.SetColor(
ARGB( 255, 0, 0, 0) );
670 ImageWidget image = ImageWidget.Cast( w.FindAnyWidget( w.GetName() +
"_image" ) );
671 Widget option =
Widget.Cast( w.FindAnyWidget( w.GetName() +
"_option_wrapper" ) );
672 Widget option_label = w.FindAnyWidget(
"option_label" );
676 text1.SetColor(
ARGB( 255, 255, 0, 0 ) );
681 text2.SetColor(
ARGB( 255, 255, 0, 0 ) );
686 text3.SetColor(
ARGB( 255, 255, 0, 0 ) );
692 image.SetColor(
ARGB( 255, 200, 0, 0 ) );
697 option.SetColor(
ARGB( 255, 255, 0, 0 ) );
702 option_label.SetColor(
ARGB( 255, 255, 0, 0 ) );
713 if ( w.IsInherited( ButtonWidget ) )
715 ButtonWidget button = ButtonWidget.Cast( w );
716 button.SetTextColor(
ARGB( 255, 255, 255, 255 ) );
722 ImageWidget image = ImageWidget.Cast( w.FindAnyWidget( w.GetName() +
"_image" ) );
723 Widget option = w.FindAnyWidget( w.GetName() +
"_option_wrapper" );
724 Widget option_label = w.FindAnyWidget(
"option_label" );
728 text1.SetColor(
ARGB( 255, 255, 255, 255 ) );
733 text2.SetColor(
ARGB( 255, 255, 255, 255 ) );
738 text3.SetColor(
ARGB( 255, 255, 255, 255 ) );
744 image.SetColor(
ARGB( 255, 255, 255, 255 ) );
749 option.SetColor(
ARGB( 150, 255, 255, 255 ) );
754 option_label.SetColor(
ARGB( 255, 255, 255, 255 ) );
760 #ifdef PLATFORM_WINDOWS
766 ButtonWidget button = ButtonWidget.Cast( w );
778 case SelectedPanel.BROWSER:
790 case SelectedPanel.DETAILS:
795 case SelectedPanel.FILTERS:
809 m_Details.SetDetails(server_info, online);
836 protected void InitDummyServers()
838 m_DummyServersEnabled = DiagMenu.GetBool(
DiagMenuIDs.SERVER_BROWSER_DUMMY_SERVERS);
839 PluginDiagMenuClient.GetSBDummyServersInvoker().Insert(OnDummyServersEnabledChanged);
841 m_DummyServers =
new GetServersResult();
842 m_DummyServers.m_NumServers = 100;
844 int serversVisibleCount = GetServersVisibleCount();
845 m_DummyServers.m_Pages = (m_DummyServers.m_NumServers + serversVisibleCount - 1) / serversVisibleCount;
846 if (m_DummyServers.m_Pages < 1)
848 m_DummyServers.m_Pages = 1;
850 m_DummyServers.m_Page = 1;
853 TStringArray mapNames = {
"chernarusplus",
"enoch",
"sakhal"};
854 for (
int i = 0; i < m_DummyServers.m_NumServers; ++i)
856 GetServersResultRow row =
new GetServersResultRow();
858 string fakeIP =
"127.0.0." + ((i % 250) + 1).
ToString();
859 int fakePort = 2302 + (i % 10);
860 row.
m_Name =
string.
Format(
"[TEST] Dummy Server %1", i + 1);
861 row.
m_Id = fakeIP +
":" + fakePort.ToString();
862 #ifdef PLATFORM_CONSOLE
867 row.
m_Description =
string.
Format(
"Dummy server %1 description. Do not favorite me!", i + 1);
872 row.
m_Ping = 20 + (i % 180);
875 m_DummyServers.m_Results.
Insert(row);
879 protected void OnDummyServersEnabledChanged()
881 m_DummyServersEnabled = DiagMenu.GetBool(
DiagMenuIDs.SERVER_BROWSER_DUMMY_SERVERS);
888 protected int GetServersVisibleCount()
893 protected bool PassLocalFilters(GetServersResultRow result)
907 string searchName =
m_Filters.GetSearchByNameFilterText();
908 if (searchName !=
"")
910 string serverName = result.
m_Name;
913 if (serverName.
IndexOf(searchName) == -1)
920 #ifdef PLATFORM_WINDOWS
921 string searchIP =
m_Filters.GetSearchByIPFilterText();
930 if (hostIp.
IndexOf(searchIP) == -1 && ipPort.
IndexOf(searchIP) == -1)
938 string mapFilter =
m_Filters.GetMapFilterInternalName();
944 if (serverMap != mapFilter)
EBiosError
Possible Error codes for bios API.
array< ref GetServersResultRow > GetServersResultRowArray
static int COLOR_DISABLED_TEXT
GetServersResult the output structure of the GetServers operation.
GetServersResultRow the output structure of the GetServers operation that represents one game server.
int m_CurrentNumberPlayers
static void LoadServers(notnull GetServersInput inputValues)
void Remove(EntityAI item)
override bool IsFocusable(Widget w)
override void ColorDisable(Widget w)
override void OnFilterChanged()
override void OnFilterFocus(Widget w)
override void RefreshList()
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
override void UpdateServerList()
override void SetSort(ESortType type, ESortOrder order)
override void OnLoadServersAsyncPC(GetServersResult result_list, EBiosError error, string response)
override void OnFilterFocusLost(Widget w)
override void PressSholderLeft()
override int AddSorted(GetServersResultRow entry)
override void PressThumbRight()
override void PressSholderRight()
override void ColorNormal(Widget w)
override void SwitchToFilters(bool focus=true)
override void ApplyFilters()
override void OnLoadServerModsAsync(string server_id, array< string > mods)
override void ShowServerDetails()
override void RightRelease()
override void SwitchToDetails(bool focus=true)
override bool PassFilter(GetServersResultRow result)
override bool OnMouseEnter(Widget w, int x, int y)
override void LeftRelease()
override void RightHold()
override void Construct(Widget parent, ServerBrowserMenuNew menu, TabType type)
override void ResetFilters()
override void ColorHighlight(Widget w)
override void OnLoadServersAsyncConsole(GetServersResult result_list, EBiosError error, string response)
override void OnPressShoulder()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
array< string > TStringArray
@ NONE
body is not in simulation, nor in collision world
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto native int ToInt()
Converts string to integer.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
proto void Insert(int index, string input)
Inserts a string into the n-th index, increasing the string length by the size of the input.
proto native int IndexOf(string sample)
Finds 'sample' in 'str'.
proto int ToLower()
Changes string to lowercase.
proto native int Length()
Returns length of string.
int ARGB(int a, int r, int g, int b)
void LoadExtraEntries(int index)
void ServerBrowserTab(Widget parent, ServerBrowserMenuNew menu, TabType type)
ref ServerBrowserFilterContainer m_Filters
ref map< ESortType, ref array< ref GetServersResultRow > > m_EntriesSorted
void OnDetailsFocusLost(Widget w)
Widget m_FilterSearchText
void SelectServer(ServerBrowserEntry server)
TextWidget m_RightAreaHeaderText
ServerBrowserEntry m_SelectedServer
void ButtonDisable(Widget w)
ref GetServersInput m_CurrentFilterInput
void SwitchRightAreaView()
void ServerListFocus(bool focus, bool favorite)
ButtonWidget m_BtnPageNext
ref map< ESortType, ESortOrder > m_SortInverted
bool IsPingInRange(int ping, string max_ping)
ButtonWidget m_BtnShowFilters
ref map< string, ref ServerBrowserEntry > m_EntryWidgets
bool GetIsServerLoadingFinished()
void ScrollToEntry(ServerBrowserEntry entry)
void Connect(ServerBrowserEntry server)
ScrollWidget m_ServerListScroller
string m_CurrentSelectedServer
ServerBrowserMenuNew m_Menu
ref map< string, ref array< string > > m_EntryMods
SelectedPanel m_SelectedPanel
ServerBrowserEntry GetSelectedServer()
void Unfavorite(string uid)
ButtonWidget m_BtnPagePrev
void ButtonEnable(Widget w)
SpacerBaseWidget m_ServerList
void OnDetailsFocus(Widget w)
void AddFavoritesToFilter(GetServersInput input)
void SetServerDetails(GetServersResultRow server_info, bool online)
override bool OnFocusLost(Widget w, int x, int y)
Widget m_FilterSearchTextBox
ref ServerBrowserDetailsContainer m_Details
override bool OnFocus(Widget w, int x, int y)
ref set< string > m_OnlineFavServers
void SetCurrentPage(int page_num)
ButtonWidget m_BtnShowDetails
void OnDLCChange(EDLCId dlcId)
ServerBrowserMenuNew GetRootMenu()