29 #ifdef PLATFORM_CONSOLE
31 m_FavoritesTab =
new ServerBrowserFavoritesTabConsolePages(layoutRoot.FindAnyWidget(
"Tab_0"),
this,
TabType.FAVORITE);
36 m_FavoritesTab =
new ServerBrowserFavoritesTabPc(layoutRoot.FindAnyWidget(
"Tab_0"),
this,
TabType.FAVORITE);
42 layoutRoot.FindAnyWidget(
"Tabber").GetScript(m_Tabber);
44 m_Play = layoutRoot.FindAnyWidget(
"play");
45 m_Back = layoutRoot.FindAnyWidget(
"back_button");
46 m_CustomizeCharacter = layoutRoot.FindAnyWidget(
"customize_character");
47 m_PlayerName =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"character_name_text"));
48 m_Version =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"version"));
51 #ifndef PLATFORM_CONSOLE
52 layoutRoot.FindAnyWidget(
"customize_character").Show(
false);
53 layoutRoot.FindAnyWidget(
"character").Show(
false);
61 #ifdef PLATFORM_CONSOLE
62 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
65 layoutRoot.FindAnyWidget(
"play_panel_root").Show(
true);
66 layoutRoot.FindAnyWidget(
"MouseAndKeyboardWarning").Show(
true);
67 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(
false);
70 version =
"#main_menu_version" +
" " + version;
72 m_Version.SetText(version);
78 m_Tabber.m_OnTabSwitch.Insert(OnTabSwitch);
80 m_FavoritesTab.RefreshList();
82 #ifdef PLATFORM_CONSOLE
86 sort_text.SetText(
"#str_serverbrowserroot_toolbar_bg_consoletoolbar_sort_sorttext0");
89 PPERequesterBank.GetRequester(PPERequester_ServerBrowserBlur).Start(
new Param1<float>(0.5));
100 #ifdef PLATFORM_CONSOLE
106 m_Tabber.m_OnTabSwitch.Remove(OnTabSwitch);
107 PPERequesterBank.GetRequester(PPERequester_ServerBrowserBlur).Stop();
117 #ifdef PLATFORM_CONSOLE
124 switch (pInputDeviceType)
127 #ifdef PLATFORM_CONSOLE
129 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(
true);
130 layoutRoot.FindAnyWidget(
"ConsoleControls").Show(
true);
135 #ifdef PLATFORM_CONSOLE
138 layoutRoot.FindAnyWidget(
"toolbar_bg").Show(
false);
139 layoutRoot.FindAnyWidget(
"ConsoleControls").Show(
false);
160 else if (w == m_CustomizeCharacter)
191 m_IsRefreshing = refreshing;
207 id.Split(
":", output);
208 if (output.Count() == 2)
210 string ip = output[0];
211 int port = output[1].ToInt();
222 index = m_Favorites.Find(server_id);
232 g_Game.GetUIManager().ShowDialog(
"#layout_notification_info_warning",
"#STR_MaxFavouriteReached", 0, DBT_OK, DBB_YES, DMT_EXCLAMATION,
this);
244 string serverId = ipAddress +
":" + port;
247 if (favorite && !isFavorited)
249 m_Favorites.Insert(serverId);
251 else if (isFavorited)
253 m_Favorites.RemoveItem(serverId);
254 m_OfficialTab.Unfavorite(serverId);
255 m_CommunityTab.Unfavorite(serverId);
256 m_FavoritesTab.Unfavorite(serverId);
257#ifndef PLATFORM_CONSOLE
258 m_LANTab.Unfavorite(serverId);
303 #ifdef PLATFORM_CONSOLE
310 con_text.SetText(
"#dialog_change");
311 ref_text.SetText(
"#server_browser_menu_refresh");
312 res_text.SetText(
"#server_browser_menu_reset_filters");
328 #ifdef PLATFORM_CONSOLE
335 con_text.SetText(
"#server_browser_menu_connect");
338 res_text.GetSize(
x,
y);
341 res_text.SetText(
"#server_browser_menu_unfavorite");
345 res_text.SetText(
"#server_browser_menu_favorite");
377 #ifdef PLATFORM_CONSOLE
378 if (
GetGame().GetUserManager() &&
GetGame().GetUserManager().GetSelectedUser())
392 m_PlayerName.SetText(
name);
396 #ifdef PLATFORM_CONSOLE
397 version =
"#main_menu_version" +
" " + version +
" (" +
g_Game.GetDatabaseID() +
")";
399 version =
"#main_menu_version" +
" " + version;
401 m_Version.SetText(version);
408 if (
GetUApi().GetInputByID(UAUITabLeft).LocalPress())
410 m_Tabber.PreviousTab();
413 if (
GetUApi().GetInputByID(UAUITabRight).LocalPress())
418 if (
GetUApi().GetInputByID(UAUINextDown).LocalPress())
423 if (
GetUApi().GetInputByID(UAUINextUp).LocalPress())
428 if (
GetUApi().GetInputByID(UAUISelect).LocalPress())
433 if (
GetUApi().GetInputByID(UAUICtrlX).LocalPress())
438 if (
GetUApi().GetInputByID(UAUICtrlY).LocalPress())
443 if (
GetUApi().GetInputByID(UAUILeft).LocalPress())
449 if (
GetUApi().GetInputByID(UAUILeft).LocalHold())
455 if (
GetUApi().GetInputByID(UAUILeft).LocalRelease())
460 if (
GetUApi().GetInputByID(UAUIRight).LocalPress())
466 if (
GetUApi().GetInputByID(UAUIRight).LocalHold())
472 if (
GetUApi().GetInputByID(UAUIRight).LocalRelease())
477 if (
GetUApi().GetInputByID(UAUIUp).LocalPress())
482 if (
GetUApi().GetInputByID(UAUIDown).LocalPress())
487 if (
GetUApi().GetInputByID(UAUIBack).LocalPress())
493 super.Update(timeslice);
500 return (w == m_Play || w == m_CustomizeCharacter || w ==
m_Back);
509#ifdef PLATFORM_WINDOWS
515 for (
int i = 0; i < m_Favorites.Count(); ++i)
517 string id = m_Favorites[i];
520 id.Split(
":", output);
521 if (output.Count() != 2)
523 m_Favorites.Remove(i);
533 m_Favorites.Invert();
535 m_Favorites.Invert();
557#ifdef PLATFORM_CONSOLE
562 aButton.Show(server.IsOnline());
563 connectText.Show(server.IsOnline());
570#ifdef PLATFORM_CONSOLE
581 if (!
g_Game.VerifyWorldOwnership(mapNM))
584 g_Game.GoBuyWorldDLC(mapNM);
590 g_Game.ConnectFromServerBrowser(ip, port,
"");
596 PPERequesterBank.GetRequester(PPERequester_ServerBrowserBlur).Stop();
612 switch (m_Tabber.GetSelectedIndex())
657 #ifdef PLATFORM_WINDOWS
658 #ifdef PLATFORM_CONSOLE
674 int color_pnl =
ARGB(255, 0, 0, 0);
675 int color_lbl =
ARGB(255, 255, 0, 0);
677 #ifdef PLATFORM_CONSOLE
678 color_pnl =
ARGB(255, 200, 0, 0);
679 color_lbl =
ARGB(255, 255, 255, 255);
691 int color_pnl =
ARGB(0, 0, 0, 0);
692 int color_lbl =
ARGB(255, 255, 255, 255);
717 Widget panel = w.FindWidget(w.GetName() +
"_panel");
721 panel.SetColor(color);
736 label.SetColor(color);
741 text.SetColor(color);
746 text2.SetColor(color);
protected void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
protected void OnInputPresetChanged()
EBiosError
Possible Error codes for bios API. This is the list of errors that can be returned from bios API....
protected ButtonWidget m_Back
protected ServerBrowserEntry m_SelectedServer
void OnLoadServerModsAsync(string server_id, array< string > mods)
proto native owned string GetName()
proto native BiosUser GetSelectedUser()
Returns the currently selected user.
proto void GetVersion(out string version)
proto native Mission GetMission()
proto native void GetProfileStringList(string name, out TStringArray values)
Gets array of strings from profile variable.
proto native BiosUserManager GetUserManager()
proto native UIManager GetUIManager()
proto native WorkspaceWidget GetWorkspace()
proto native void SaveProfile()
Saves profile on disk.
proto native void SetProfileStringList(string name, TStringArray values)
Sets array of strings to profile variable.
GetServersResult the output structure of the GetServers operation.
ScriptInvoker GetOnInputPresetChanged()
ScriptInvoker GetOnInputDeviceChanged()
static void GetFavoriteServers(TStringArray favServers)
static ref ScriptInvoker m_ServerModLoadAsyncInvoker
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
override void OnLoadServersAsyncPC(ref GetServersResult result_list, EBiosError error, string response)
override void RefreshList()
override void PressSholderLeft()
override void PressSholderRight()
override void OnLoadServerModsAsync(string server_id, array< string > mods)
override void RightRelease()
override void LeftRelease()
override void RightHold()
override void OnLoadServersAsyncConsole(GetServersResult result_list, EBiosError error, string response)
proto native void ShowDialog(string caption, string text, int id, int butts, int def, int type, UIScriptedMenu handler)
Shows message dialog.
bool Back()
Close top window on windows stack, returns true when any window is closed.
proto native CGame GetGame()
array< string > TStringArray
proto native int LengthUtf8()
Returns number of characters in UTF8 string.
proto string SubstringUtf8(int startChar, int len)
Substring of 'str' from 'startChar' position 'len' number of characters for UTF8 strings with multiby...
int ARGB(int a, int r, int g, int b)