1class PlayerListScriptedWidget
extends ScriptedWidgetEventHandler
4 protected ScrollWidget m_ScrollContainer;
5 protected Widget m_Content;
6 protected ref map<string, ref PlayerListEntryScriptedWidget>
m_Entries;
8 protected int m_TotalEntries;
9 protected PlayerListEntryScriptedWidget m_SelectedEntry;
11 void PlayerListScriptedWidget( Widget parent,
string header_text =
"" )
13 m_Root =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/xbox/ingamemenu_xbox/players_info_panel.layout", parent );
14 m_ScrollContainer = ScrollWidget.Cast(
m_Root.FindAnyWidget(
"ScrollFrame" ) );
15 m_Content =
m_Root.FindAnyWidget(
"Content" );
17 m_Entries =
new map<string, ref PlayerListEntryScriptedWidget>;
19 m_ScrollContainer.VScrollToPos01( 0 );
22 void ~PlayerListScriptedWidget()
29 if ( m_Content && m_Content.GetChildren() )
30 SetFocus( m_Content.GetChildren().FindAnyWidget(
"Button" ) );
31 m_ScrollContainer.VScrollToPos01( 0 );
34 void Reload( SyncPlayerList player_list )
36 if ( player_list && player_list.m_PlayerList &&
m_Entries )
38 foreach (
string UID, PlayerListEntryScriptedWidget widget :
m_Entries )
40 SyncPlayer player_found;
41 foreach ( SyncPlayer player : player_list.m_PlayerList )
43 if ( player && player.m_UID ==
UID )
45 player_found = player;
55 for (
int i = 0; i < player_list.m_PlayerList.Count(); i++ )
57 SyncPlayer player2 = player_list.m_PlayerList.Get( i );
58 PlayerListEntryScriptedWidget player_widget;
59 m_Entries.Find( player2.m_UID, player_widget );
62 AddPlayer( player2.m_PlayerName, player2.m_UID,
true );
73 void OnLoadServersAsync( GetServersResult result_list,
EBiosError error,
string response )
82 foreach (
string UID, PlayerListEntryScriptedWidget widget :
m_Entries )
84 BiosFriendInfo player_found;
86 while ( !player_found && j < player_list.Count() )
88 if ( player_list[j].m_Uid ==
UID )
89 player_found = player_list[j];
99 for (
int i = 0; i < player_list.Count(); i++ )
101 BiosFriendInfo player2 = player_list.Get( i );
102 PlayerListEntryScriptedWidget player_widget;
103 m_Entries.Find( player2.m_Uid, player_widget );
104 if ( !player_widget )
106 AddPlayer( player2.m_DisplayName, player2.m_Uid,
false );
114 foreach ( BiosPrivacyUidResult result : player_list )
116 PlayerListEntryScriptedWidget player_widget;
117 m_Entries.Find( result.m_Uid, player_widget );
120 player_widget.LoadPermissions( result.m_Results );
125 void ReloadLocal( map<string, bool> player_list )
129 for (
int i = 0; i < player_list.Count(); i++ )
131 string uid = player_list.GetKey( i );
132 bool muted = OnlineServices.IsPlayerMuted( uid );
133 PlayerListEntryScriptedWidget player_widget;
137 player_widget.SetMute( muted );
143 PlayerListEntryScriptedWidget FindEntryByWidget( Widget button )
147 foreach (
string UID, PlayerListEntryScriptedWidget widget :
m_Entries )
149 if ( widget && widget.GetButtonWidget() == button )
159 string FindPlayerByWidget( Widget button )
163 foreach (
string UID, PlayerListEntryScriptedWidget widget :
m_Entries )
165 if ( widget && widget.GetButtonWidget() == button )
175 void AddPlayer(
string name,
string UID,
bool show_permissions )
179 m_Entries.Insert(
UID,
new PlayerListEntryScriptedWidget( m_Content,
name,
UID, show_permissions,
this ) );
184 void RemovePlayer(
string UID)
188 PlayerListEntryScriptedWidget next_entry;
191 for (
int i = 0; i <
m_Entries.Count() - 1; i++)
199 next_entry =
m_Entries.GetElement(i + 1);
217 SelectPlayer(next_entry);
222 m_SelectedEntry.Deselect();
229 bool IsMuted(
string UID )
238 bool IsGloballyMuted(
string UID )
247 void SetMute(
string UID,
bool mute )
255 void ToggleMute(
string UID )
263 PlayerListEntryScriptedWidget GetSelectedPlayer()
265 return m_SelectedEntry;
268 void SelectPlayer(PlayerListEntryScriptedWidget entry)
272 m_SelectedEntry.Deselect();
275 m_SelectedEntry = entry;
277 #ifdef PLATFORM_CONSOLE
279 m_SelectedEntry.Focus();
282 if (
g_Game.GetUIManager().GetMenu())
283 g_Game.GetUIManager().GetMenu().Refresh();
295 Widget root = entry.GetButtonWidget().GetParent();
296 Widget first_child = root.GetParent().GetChildren();
297 Widget last_child = first_child;
300 if ( last_child.GetSibling() )
301 last_child = last_child.GetSibling();
306 root.GetParent().Update();
309 m_ScrollContainer.GetScreenPos(
x,
y );
310 m_ScrollContainer.GetScreenSize( x_s, y_s );
312 float bottom_pos =
y + y_s;
314 root.GetScreenPos( x_l, y_l );
315 root.GetScreenSize( x_s, y_s );
317 if ( root == first_child )
319 m_ScrollContainer.VScrollToPos01( 0 );
321 else if ( root == last_child )
323 m_ScrollContainer.VScrollToPos01( 1 );
325 else if ( y_l + y_s >= bottom_pos )
327 m_ScrollContainer.VScrollToPos( m_ScrollContainer.GetVScrollPos() + y_s );
331 m_ScrollContainer.VScrollToPos( m_ScrollContainer.GetVScrollPos() - y_s );
EBiosError
Possible Error codes for bios API. This is the list of errors that can be returned from bios API....
array< ref BiosPrivacyUidResult > BiosPrivacyUidResultArray
array< ref BiosFriendInfo > BiosFriendInfoArray
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
ref array< ref HudDebugWinHealthEntry > m_Entries
void ScrollToEntry(ServerBrowserEntry entry)