serverbrowsertab.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. enum TabType
  2. {
  3. OFFICIAL,
  4. COMMUNITY,
  5. LAN,
  6. FAVORITE,
  7. NONE
  8. }
  9. enum SelectedPanel
  10. {
  11. BROWSER,
  12. FILTERS,
  13. MENU,
  14. DETAILS
  15. }
  16. enum ServerBrowserRightAreaView
  17. {
  18. FILTERS,
  19. DETAILS
  20. }
  21. class ServerBrowserTab extends ScriptedWidgetEventHandler
  22. {
  23. protected Widget m_Root;
  24. protected ScrollWidget m_ServerListScroller;
  25. protected SpacerBaseWidget m_ServerList;
  26. //protected ref array<ref GetServersResultRow> m_Entries;
  27. protected ref map<string, ref ServerBrowserEntry> m_EntryWidgets;
  28. protected ref map<string, ref array<string>> m_EntryMods;
  29. protected ref ServerBrowserFilterContainer m_Filters;
  30. protected ServerBrowserMenuNew m_Menu;
  31. protected ServerBrowserEntry m_SelectedServer;
  32. protected TabType m_TabType;
  33. protected ESortType m_SortType;
  34. protected ESortOrder m_SortOrder;
  35. protected SelectedPanel m_SelectedPanel;
  36. protected bool m_Initialized;
  37. protected bool m_BegunLoading;
  38. protected bool m_Loading;
  39. protected int m_TotalServers; // UNUSED
  40. protected int m_TotalLoadedServers;
  41. protected int m_LastLoadedPage;
  42. protected int m_TotalPages;
  43. protected bool m_LoadingFinished;
  44. protected int m_CurrentPageNum;
  45. protected string m_CurrentSelectedServer;
  46. protected int m_CurrentLoadedPage;
  47. protected ref GetServersInput m_CurrentFilterInput;
  48. protected Widget m_ApplyFilter;
  49. protected Widget m_RefreshList;
  50. protected Widget m_ResetFilters;
  51. protected Widget m_FiltersChanged;
  52. protected Widget m_HostSort;
  53. protected Widget m_TimeSort;
  54. protected Widget m_PopulationSort;
  55. protected Widget m_SlotsSort;
  56. protected Widget m_PingSort;
  57. protected Widget m_MapSort;
  58. protected Widget m_FilterSearchText;
  59. protected Widget m_FilterSearchTextBox;
  60. protected TextWidget m_LoadingText;
  61. protected ButtonWidget m_BtnPagePrev;
  62. protected ButtonWidget m_BtnPageNext;
  63. protected ref map<ESortType, ref array<ref GetServersResultRow>> m_EntriesSorted;
  64. protected ref map<ESortType, ESortOrder> m_SortInverted;
  65. protected ref set<string> m_OnlineFavServers;
  66. protected TextWidget m_RightAreaHeaderText;
  67. protected Widget m_FilterRoot;
  68. protected Widget m_FilterContent;
  69. protected ButtonWidget m_BtnShowDetails;
  70. protected Widget m_DetailsRoot;
  71. protected ButtonWidget m_BtnShowFilters;
  72. protected ref ServerBrowserDetailsContainer m_Details;
  73. void ServerBrowserTab(Widget parent, ServerBrowserMenuNew menu, TabType type)
  74. {
  75. Construct(parent, menu, type);
  76. m_OnlineFavServers = new set<string>();
  77. GetGame().GetContentDLCService().m_OnChange.Insert(OnDLCChange);
  78. }
  79. protected void Construct(Widget parent, ServerBrowserMenuNew menu, TabType type)
  80. {
  81. m_SortInverted = new map<ESortType, ESortOrder>;
  82. m_EntriesSorted = new map<ESortType, ref array<ref GetServersResultRow>>;
  83. m_EntryMods = new map<string, ref array<string>>;
  84. m_LoadingText = TextWidget.Cast(m_Root.FindAnyWidget("loading_servers_info"));
  85. }
  86. void ~ServerBrowserTab()
  87. {
  88. if ( m_Filters )
  89. m_Filters.SaveFilters();
  90. if (m_Root)
  91. delete m_Root;
  92. if (GetGame().GetContentDLCService())
  93. GetGame().GetContentDLCService().m_OnChange.Remove(OnDLCChange);
  94. }
  95. ServerBrowserMenuNew GetRootMenu()
  96. {
  97. return m_Menu;
  98. }
  99. bool GetIsServerLoadingFinished()
  100. {
  101. return m_LoadingFinished;
  102. }
  103. void OnDLCChange(EDLCId dlcId)
  104. {
  105. switch (dlcId)
  106. {
  107. case EDLCId.DLC_FROSTLINE:
  108. {
  109. array<ServerBrowserEntry> serverEntries = m_EntryWidgets.GetValueArray();
  110. foreach (ServerBrowserEntry entry : serverEntries)
  111. {
  112. entry.RefreshDLCIcon();
  113. }
  114. break;
  115. }
  116. default:
  117. break;
  118. }
  119. }
  120. void ScrollToEntry( ServerBrowserEntry entry )
  121. {
  122. if ( entry )
  123. {
  124. float x, y;
  125. float x_s, y_s;
  126. float x_l, y_l;
  127. Widget root = entry.GetRoot();
  128. Widget first_child = root.GetParent().GetChildren();
  129. Widget last_child = first_child;
  130. while ( last_child )
  131. {
  132. if ( last_child.GetSibling() )
  133. last_child = last_child.GetSibling();
  134. else
  135. break;
  136. }
  137. root.GetParent().Update();
  138. root.Update();
  139. m_ServerListScroller.GetScreenPos( x, y );
  140. m_ServerListScroller.GetScreenSize( x_s, y_s );
  141. float bottom_pos = y + y_s;
  142. root.GetScreenPos( x_l, y_l );
  143. root.GetScreenSize( x_s, y_s );
  144. if ( root == first_child )
  145. {
  146. m_ServerListScroller.VScrollToPos01( 0 );
  147. }
  148. else if ( root == last_child )
  149. {
  150. m_ServerListScroller.VScrollToPos01( 1 );
  151. }
  152. else if ( y_l + y_s >= bottom_pos )
  153. {
  154. m_ServerListScroller.VScrollToPos( m_ServerListScroller.GetVScrollPos() + y_s );
  155. }
  156. else if ( y_l <= y )
  157. {
  158. m_ServerListScroller.VScrollToPos( m_ServerListScroller.GetVScrollPos() - y_s );
  159. }
  160. }
  161. }
  162. void Focus()
  163. {
  164. if (m_SelectedServer && m_EntryWidgets.Contains(m_CurrentSelectedServer))
  165. {
  166. UpdateServerList();
  167. m_EntryWidgets.Get(m_CurrentSelectedServer).Focus();
  168. ScrollToEntry(m_EntryWidgets.Get(m_CurrentSelectedServer));
  169. }
  170. }
  171. void OnFilterFocusLost(Widget w)
  172. {
  173. m_SelectedPanel = SelectedPanel.FILTERS;
  174. m_Menu.FilterFocus(false);
  175. }
  176. void OnFilterFocus(Widget w)
  177. {
  178. m_SelectedPanel = SelectedPanel.FILTERS;
  179. m_Menu.FilterFocus(true);
  180. }
  181. void OnDetailsFocusLost(Widget w)
  182. {
  183. m_SelectedPanel = SelectedPanel.DETAILS;
  184. m_Menu.DetailsFocus(false);
  185. }
  186. void OnDetailsFocus(Widget w)
  187. {
  188. m_SelectedPanel = SelectedPanel.DETAILS;
  189. m_Menu.DetailsFocus(true);
  190. }
  191. void OnFilterChanged();
  192. void ServerListFocus(bool focus, bool favorite)
  193. {
  194. if (!m_Menu)
  195. return;
  196. m_Menu.ServerListFocus(focus, favorite);
  197. }
  198. override bool OnFocus(Widget w, int x, int y)
  199. {
  200. if (IsFocusable(w))
  201. {
  202. if (w == m_FilterSearchTextBox)
  203. {
  204. ColorHighlight(m_FilterSearchText);
  205. return false;
  206. }
  207. else
  208. {
  209. ColorHighlight(w);
  210. }
  211. #ifdef PLATFORM_CONSOLE
  212. string aButtonLabel;
  213. if (w == m_RefreshList || w == m_ApplyFilter || w == m_ResetFilters || w == m_BtnShowDetails || w == m_BtnShowFilters)
  214. {
  215. #ifdef PLATFORM_PS4
  216. aButtonLabel = "#ps4_ingame_menu_select";
  217. #else
  218. aButtonLabel = "#layout_xbox_ingame_menu_select";
  219. #endif
  220. }
  221. else
  222. {
  223. aButtonLabel = "#dialog_change";
  224. }
  225. m_Menu.UpdateAButtonLabel(aButtonLabel);
  226. #endif
  227. return true;
  228. }
  229. return false;
  230. }
  231. override bool OnFocusLost(Widget w, int x, int y)
  232. {
  233. if (IsFocusable(w))
  234. {
  235. if (w == m_FilterSearchTextBox)
  236. {
  237. ColorNormal(m_FilterSearchText);
  238. return true;
  239. }
  240. else
  241. {
  242. ColorNormal(w);
  243. }
  244. return true;
  245. }
  246. return false;
  247. }
  248. override bool OnMouseEnter(Widget w, int x, int y)
  249. {
  250. if (IsFocusable(w))
  251. {
  252. ColorHighlight(w);
  253. if (w == m_FilterSearchText)
  254. {
  255. SetFocus(m_FilterSearchTextBox);
  256. return true;
  257. }
  258. return true;
  259. }
  260. return false;
  261. }
  262. override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
  263. {
  264. if (IsFocusable(w))
  265. {
  266. if (enterW == m_FilterSearchText || enterW == m_FilterSearchTextBox) //! WTF?
  267. {
  268. }
  269. else
  270. {
  271. ColorNormal(w);
  272. }
  273. return true;
  274. }
  275. return false;
  276. }
  277. bool IsFocusable(Widget w)
  278. {
  279. if (w)
  280. {
  281. return (w == m_ApplyFilter || w == m_RefreshList || w == m_ResetFilters || w == m_FilterSearchText || w == m_FilterSearchTextBox || w == m_BtnShowDetails || w == m_BtnShowFilters);
  282. }
  283. return false;
  284. }
  285. // Unused?!
  286. void SetPanelFocus();
  287. void PressA();
  288. void PressX()
  289. {
  290. if ( m_Menu.GetServersLoadingTab() == TabType.NONE )
  291. RefreshList();
  292. }
  293. void PressY();
  294. void PressSholderLeft();
  295. void PressSholderRight();
  296. void OnPressShoulder();
  297. void Left();
  298. void LeftHold();
  299. void LeftRelease();
  300. void Right();
  301. void RightHold();
  302. void RightRelease();
  303. void Up();
  304. void Down();
  305. void PressThumbRight();
  306. void OnLoadServerModsAsync(string server_id, array<string> mods)
  307. {
  308. m_EntryMods.Set( server_id, mods );
  309. }
  310. void GetNextEntry()
  311. {
  312. Widget focused = GetFocus();
  313. if ( !focused )
  314. return;
  315. Widget sibling = focused.GetSibling();
  316. if ( !sibling )
  317. return;
  318. if ( focused.GetName() == "server_browser_list_entry_root" )
  319. {
  320. if ( sibling )
  321. SetFocus( focused.GetSibling() );
  322. else
  323. SetFocus( focused.GetParent().GetSibling().GetChildren() );
  324. }
  325. }
  326. void GetPrevEntry()
  327. {
  328. Widget focused = GetFocus();
  329. if ( focused && focused.GetName() == "server_browser_list_entry_root" )
  330. {
  331. Widget sibling = focused.GetParent().GetChildren();
  332. if ( focused == sibling )
  333. return;
  334. while ( sibling )
  335. {
  336. if ( sibling && sibling.GetSibling() == focused )
  337. {
  338. SetFocus( sibling );
  339. }
  340. else
  341. {
  342. sibling = sibling.GetSibling();
  343. }
  344. }
  345. }
  346. }
  347. // Unused?!
  348. void GetNextFilter();
  349. // Unused?!
  350. void GetPrevFilter();
  351. void SetCurrentPage(int page_num)
  352. {
  353. m_CurrentPageNum = page_num;
  354. }
  355. int GetCurrentPage()
  356. {
  357. return m_CurrentPageNum;
  358. }
  359. bool IsNotInitialized()
  360. {
  361. return !m_Initialized || !m_LoadingFinished;
  362. }
  363. void ResetFilters()
  364. {
  365. m_Filters.ResetFilters();
  366. }
  367. void ApplyFilters();
  368. void AddFavoritesToFilter( ref GetServersInput input )
  369. {
  370. m_Menu.AddFavoritesToFilter( input );
  371. }
  372. void RefreshList()
  373. {
  374. m_Menu.SetServersLoadingTab( m_TabType );
  375. m_LoadingFinished = false;
  376. m_Initialized = true;
  377. m_BegunLoading = false;
  378. m_LastLoadedPage = 0;
  379. m_TotalPages = -1;
  380. m_TotalServers = 0;
  381. m_TotalLoadedServers = 0;
  382. m_CurrentLoadedPage = 0;
  383. m_Menu.DeselectCurrentServer();
  384. m_EntryWidgets.Clear();
  385. #ifndef PLATFORM_WINDOWS // XBOX OR PS
  386. m_CurrentFilterInput = m_Filters.GetFilterOptionsConsoles();
  387. m_CurrentFilterInput.m_Page = GetCurrentPage();
  388. m_CurrentFilterInput.m_SortBy = GetSortOption();
  389. m_CurrentFilterInput.m_SortOrder = m_SortOrder;
  390. #else // PLATFORM_WINDOWS
  391. m_CurrentFilterInput = m_Filters.GetFilterOptionsPC();
  392. #ifdef PLATFORM_CONSOLE // PC client with -XBOX flag
  393. m_CurrentFilterInput.m_Page = GetCurrentPage();
  394. #else
  395. m_CurrentFilterInput.m_Page = 0;
  396. #endif
  397. #endif
  398. m_Loading = true;
  399. switch ( m_TabType )
  400. {
  401. case TabType.OFFICIAL:
  402. {
  403. m_CurrentFilterInput.SetOfficialFilter( true );
  404. OnlineServices.LoadServers( m_CurrentFilterInput );
  405. break;
  406. }
  407. case TabType.COMMUNITY:
  408. {
  409. m_CurrentFilterInput.SetOfficialFilter( false );
  410. OnlineServices.LoadServers( m_CurrentFilterInput );
  411. break;
  412. }
  413. case TabType.LAN:
  414. {
  415. m_CurrentFilterInput.SetLAN();
  416. OnlineServices.LoadServers( m_CurrentFilterInput );
  417. break;
  418. }
  419. }
  420. }
  421. void GetNextPage()
  422. {
  423. if ( m_TotalPages > 0 && m_LastLoadedPage < m_TotalPages )
  424. {
  425. m_CurrentFilterInput.m_Page = m_LastLoadedPage + 1;
  426. OnlineServices.LoadServers( m_CurrentFilterInput );
  427. }
  428. }
  429. void SelectServer(ServerBrowserEntry server)
  430. {
  431. #ifdef PLATFORM_CONSOLE
  432. ScrollToEntry(server);
  433. #endif
  434. m_SelectedServer = server;
  435. m_CurrentSelectedServer = m_SelectedServer.GetServerData().m_Id;
  436. if (!m_Menu)
  437. return;
  438. m_Menu.SelectServer(server);
  439. }
  440. void OnLoadServersAsyncPC(ref GetServersResult result_list, EBiosError error, string response);
  441. void OnLoadServersAsyncConsole(GetServersResult result_list, EBiosError error, string response);
  442. void UpdateServerList();
  443. void SetSort( ESortType type, ESortOrder order )
  444. {
  445. m_SortOrder = order;
  446. m_SortType = type;
  447. }
  448. bool IsPingInRange( int ping, string max_ping )
  449. {
  450. int max = max_ping.Substring( 1, max_ping.Length() - 1 ).ToInt();
  451. if ( ping < max )
  452. return true;
  453. return false;
  454. }
  455. bool PassFilter( GetServersResultRow result )
  456. {
  457. if ( !m_Menu || m_Menu.GetServersLoadingTab() != m_TabType )
  458. {
  459. return false;
  460. }
  461. if ( m_Filters.m_PingFilter.IsSet() )
  462. {
  463. if ( !IsPingInRange( result.m_Ping, m_Filters.m_PingFilter.GetStringValue() ) )
  464. {
  465. return false;
  466. }
  467. }
  468. return true;
  469. }
  470. // Adds extra servers to the END of the list
  471. protected void LoadExtraEntries(int index);
  472. void Connect( ServerBrowserEntry server )
  473. {
  474. if ( !m_Menu )
  475. return;
  476. if ( m_Menu.GetServersLoadingTab() != TabType.NONE )
  477. return;
  478. m_SelectedServer = server;
  479. m_Menu.Connect( server );
  480. }
  481. string GetSortOption()
  482. {
  483. switch ( m_SortType )
  484. {
  485. case ESortType.HOST:
  486. {
  487. return "name";
  488. }
  489. case ESortType.TIME:
  490. {
  491. return "name";
  492. }
  493. case ESortType.POPULATION:
  494. {
  495. return "currentNumberPlayers";
  496. }
  497. case ESortType.SLOTS:
  498. {
  499. return "freeSlots";
  500. }
  501. case ESortType.PING:
  502. {
  503. return "name";
  504. }
  505. }
  506. return "";
  507. }
  508. int AddSorted( GetServersResultRow entry )
  509. {
  510. return -1;
  511. }
  512. void Unfavorite( string uid )
  513. {
  514. ServerBrowserEntry entry;
  515. if ( m_EntryWidgets.Find( uid, entry ) )
  516. {
  517. entry.SetFavorite( false );
  518. }
  519. }
  520. TabType GetTabType()
  521. {
  522. return m_TabType;
  523. }
  524. void ButtonEnable( Widget w )
  525. {
  526. w.ClearFlags( WidgetFlags.IGNOREPOINTER );
  527. ColorNormal(w);
  528. }
  529. void ButtonDisable( Widget w )
  530. {
  531. w.SetFlags( WidgetFlags.IGNOREPOINTER );
  532. ColorDisable(w);
  533. }
  534. //Coloring functions (Until WidgetStyles are useful)
  535. void ColorHighlight( Widget w )
  536. {
  537. if ( w.IsInherited( ButtonWidget ) )
  538. {
  539. ButtonWidget button = ButtonWidget.Cast( w );
  540. button.SetTextColor( ARGB( 255, 200, 0, 0 ) );
  541. }
  542. w.SetColor( ARGB( 255, 0, 0, 0) );
  543. TextWidget text1 = TextWidget.Cast(w.FindAnyWidget( w.GetName() + "_text" ) );
  544. TextWidget text2 = TextWidget.Cast(w.FindAnyWidget( w.GetName() + "_label" ) );
  545. TextWidget text3 = TextWidget.Cast(w.FindAnyWidget( w.GetName() + "_text_1" ) );
  546. ImageWidget image = ImageWidget.Cast( w.FindAnyWidget( w.GetName() + "_image" ) );
  547. Widget option = Widget.Cast( w.FindAnyWidget( w.GetName() + "_option_wrapper" ) );
  548. Widget option_label = w.FindAnyWidget( "option_label" );
  549. if ( text1 )
  550. {
  551. text1.SetColor( ARGB( 255, 255, 0, 0 ) );
  552. }
  553. if ( text2 )
  554. {
  555. text2.SetColor( ARGB( 255, 255, 0, 0 ) );
  556. }
  557. if ( text3 )
  558. {
  559. text3.SetColor( ARGB( 255, 255, 0, 0 ) );
  560. w.SetAlpha(1);
  561. }
  562. if ( image )
  563. {
  564. image.SetColor( ARGB( 255, 200, 0, 0 ) );
  565. }
  566. if ( option )
  567. {
  568. option.SetColor( ARGB( 255, 255, 0, 0 ) );
  569. }
  570. if ( option_label )
  571. {
  572. option_label.SetColor( ARGB( 255, 255, 0, 0 ) );
  573. }
  574. }
  575. void ColorNormal( Widget w )
  576. {
  577. if ( (w.GetFlags() & WidgetFlags.IGNOREPOINTER) == WidgetFlags.IGNOREPOINTER )
  578. {
  579. return;
  580. }
  581. if ( w.IsInherited( ButtonWidget ) )
  582. {
  583. ButtonWidget button = ButtonWidget.Cast( w );
  584. button.SetTextColor( ARGB( 255, 255, 255, 255 ) );
  585. }
  586. TextWidget text1 = TextWidget.Cast(w.FindAnyWidget( w.GetName() + "_text" ) );
  587. TextWidget text2 = TextWidget.Cast(w.FindAnyWidget( w.GetName() + "_text_1" ) );
  588. TextWidget text3 = TextWidget.Cast(w.FindAnyWidget( w.GetName() + "_label" ) );
  589. ImageWidget image = ImageWidget.Cast( w.FindAnyWidget( w.GetName() + "_image" ) );
  590. Widget option = w.FindAnyWidget( w.GetName() + "_option_wrapper" );
  591. Widget option_label = w.FindAnyWidget( "option_label" );
  592. if ( text1 )
  593. {
  594. text1.SetColor( ARGB( 255, 255, 255, 255 ) );
  595. }
  596. if ( text2 )
  597. {
  598. text2.SetColor( ARGB( 255, 255, 255, 255 ) );
  599. }
  600. if ( text3 )
  601. {
  602. text3.SetColor( ARGB( 255, 255, 255, 255 ) );
  603. w.SetAlpha(0);
  604. }
  605. if ( image )
  606. {
  607. image.SetColor( ARGB( 255, 255, 255, 255 ) );
  608. }
  609. if ( option )
  610. {
  611. option.SetColor( ARGB( 150, 255, 255, 255 ) );
  612. }
  613. if ( option_label )
  614. {
  615. option_label.SetColor( ARGB( 255, 255, 255, 255 ) );
  616. }
  617. }
  618. void ColorDisable( Widget w )
  619. {
  620. #ifdef PLATFORM_WINDOWS
  621. SetFocus( null );
  622. #endif
  623. if ( w )
  624. {
  625. ButtonWidget button = ButtonWidget.Cast( w );
  626. if ( button )
  627. {
  628. button.SetTextColor( ColorManager.COLOR_DISABLED_TEXT );
  629. }
  630. }
  631. }
  632. void SwitchRightAreaView()
  633. {
  634. switch (m_SelectedPanel)
  635. {
  636. case SelectedPanel.BROWSER:
  637. {
  638. if (m_DetailsRoot.IsVisible())
  639. {
  640. SwitchToFilters(false);
  641. }
  642. else if (m_FilterRoot.IsVisible())
  643. {
  644. SwitchToDetails(false);
  645. }
  646. break;
  647. }
  648. case SelectedPanel.DETAILS:
  649. {
  650. SwitchToFilters();
  651. break;
  652. }
  653. case SelectedPanel.FILTERS:
  654. {
  655. SwitchToDetails();
  656. break;
  657. }
  658. }
  659. }
  660. // Here for overrides in the classes that inherit from class ServerBrowserTab
  661. void SwitchToDetails(bool focus = true);
  662. void SwitchToFilters(bool focus = true);
  663. void SetServerDetails(GetServersResultRow server_info, bool online)
  664. {
  665. m_Details.SetDetails(server_info, online);
  666. }
  667. void ShowServerDetails()
  668. {
  669. m_DetailsRoot.Show(true);
  670. m_BtnShowDetails.Show(false);
  671. m_Root.FindAnyWidget("spacer1").Show(m_TabType != TabType.FAVORITE && m_TabType != TabType.LAN);
  672. m_RightAreaHeaderText.SetText("#STR_server_browser_menu_server_details");
  673. }
  674. Widget GetFilterRoot()
  675. {
  676. return m_FilterRoot;
  677. }
  678. Widget GetDetailsRoot()
  679. {
  680. return m_DetailsRoot;
  681. }
  682. ServerBrowserEntry GetSelectedServer()
  683. {
  684. return m_SelectedServer;
  685. }
  686. }