Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
biosusermanager.c
Go to the documentation of this file.
1
7
9{
10 proto native owned string GetName();
11 proto native owned string GetUid();
13 proto native bool IsOnline();
14};
15
17{
19
23
25
33
36
38
43 proto native EBiosError PickUserAsync();
44
45
47
56 proto native EBiosError ParseJoinAsync(string join_data);
57
59
68 proto native EBiosError ParsePartyAsync(string party_data);
69
71
76 proto native bool SelectUser(BiosUser user);
77
79
82 proto native BiosUser GetSelectedUser();
83
85
89
91 {
92 bool success = false;
93
94 BiosUser selectedUser = GetSelectedUser();
95 if (selectedUser && selectedUser != user && g_Game.GetGameState() != DayZGameState.MAIN_MENU)
96 {
97 success = SelectUser(user);
98 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_FORCE & ~DisconnectSessionFlags.SELECT_USER);
99 }
100 else
101 success = SelectUser(user);
102
103 if (!success)
104 {
105 // Give it a moment and check again (there's a brief moment where the services become unavailable during the user transition)
106 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(CheckUserSwitchResult, 100, false, user);
107 }
108
109 return success;
110 }
111
113 {
114 if (GetSelectedUser() != expectedUser)
115 {
117 }
118 }
119
121
125 void OnUserDatabaseId(string dbID, EBiosError error)
126 {
127 if ( !OnlineServices.ErrorCaught( error ) )
128 {
129 g_Game.SetDatabaseID( dbID );
130 }
131 }
132
134
138 {
139 if ( OnlineServices.ErrorCaught( error ) )
140 {
141 g_Game.GetInput().ResetActiveGamepad();
142 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_FORCE);
143 }
144 }
145
147
152 {
153 if ( !user )
154 {
155 g_Game.GetInput().ResetActiveGamepad();
156 g_Game.GamepadCheck();
157 }
158 else if ( !OnlineServices.ErrorCaught( error ) )
159 {
160 if (SelectUserEx( user ))
161 {
162 Mission mission = g_Game.GetMission();
163 if ( mission )
164 mission.Reset();
165 OnGameNameChanged( user );
166 g_Game.SelectUser(g_Game.GetInput().GetUserGamepad(user));
167 }
168 }
169 }
170
173 {
174 if ( user && GetSelectedUser() == user )
175 g_Game.SelectUser(g_Game.GetInput().GetUserGamepad(user));
176 }
177
180 {
181 OnSignedOut( user );
182 }
183
185
191 {
192
193 }
194
196
202 {
203 if ( user == GetSelectedUser() )
204 {
205 SelectUserEx( null );
206 g_Game.GetInput().ResetActiveGamepad();
207 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_FORCE & ~DisconnectSessionFlags.SELECT_USER);
208 }
209 }
210
212
221 void OnJoin(EBiosJoinType type, BiosUser joiner, string handle, string joinee, EBiosError error)
222 {
223 if ( !OnlineServices.ErrorCaught( error ) )
224 {
225 OnlineServices.SetBiosUser( joiner );
226
227 SelectUserEx( joiner );
229
230 if ( g_Game.GetGameState() == DayZGameState.IN_GAME )
231 {
232 g_Game.SetLoadState( DayZLoadState.JOIN_START );
234 }
235 else
236 {
237 if ( g_Game.GetUIManager() && g_Game.GetInput().IsActiveGamepadSelected() )
238 {
239 g_Game.GetUIManager().CloseMenu( MENU_TITLE_SCREEN );
240 g_Game.GetInput().IdentifyGamepad( GamepadButton.BUTTON_NONE );
241 }
242 g_Game.SetLoadState( DayZLoadState.JOIN_START );
243 g_Game.GamepadCheck();
244 }
245 }
246 else
247 {
248 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_JOIN);
249 }
250 }
251
253
260 void OnPartyHost(BiosUser host, array<string> invitee_list, EBiosError error)
261 {
262 #ifdef PLATFORM_PS4
263 if (host)
264 #endif
265 {
266 SelectUserEx(host);
267
268 #ifdef PLATFORM_PS4
269 if (!host.IsOnline())
270 {
271 LogOnUserAsync( host );
272 }
273 #endif
274 }
275
276
277 if (g_Game.GetUIManager())
278 {
279 g_Game.GetUIManager().CloseMenu(MENU_TITLE_SCREEN);
280 }
281
282 OnlineServices.SetPendingInviteList( invitee_list );
283 if (g_Game.GetGameState() != DayZGameState.IN_GAME && g_Game.GetGameState() != DayZGameState.CONNECTING)
284 {
285 if (!g_Game.GetUIManager().GetMenu() || g_Game.GetUIManager().GetMenu().GetID() != MENU_MAIN)
286 {
287 g_Game.GetUIManager().EnterScriptedMenu(MENU_MAIN, g_Game.GetUIManager().GetMenu());
288 }
289 g_Game.SetGameState( DayZGameState.PARTY );
290 g_Game.SetLoadState( DayZLoadState.PARTY_START );
291 g_Game.GamepadCheck();
292 }
293 }
294
296
302 {
303 if ( user == GetSelectedUser() )
304 {
305 g_Game.SetPlayerName( user.GetName() );
306 #ifdef PLATFORM_CONSOLE
307 g_Game.SetPlayerGameName( user.GetName() );
308 #endif
309 if ( g_Game.GetUIManager().GetMenu() )
310 {
311 g_Game.GetUIManager().GetMenu().Refresh();
312 }
313 }
314 }
315
316 BiosUser GetUser( string user_id )
317 {
319 GetUserList( user_list );
320 foreach ( BiosUser user : user_list )
321 {
322 if ( user.GetUid() == user_id )
323 {
324 return user;
325 }
326 }
327 return null;
328 }
329};
EBiosError
Possible Error codes for bios API.
EBiosJoinType
@ ACTIVITY
@ INVITE
BiosClientServices class provides individual online services.
proto native bool IsOnline()
proto native BiosClientServices GetClientServices()
proto native owned string GetName()
proto native owned string GetUid()
proto native EBiosError ParsePartyAsync(string party_data)
Parse the party data from from command line parameters.
proto native EBiosError LogOnUserAsync(BiosUser user)
Display a system dependant ui for log-on.
void OnUserLoggedOn(EBiosError error)
Callback function.
BiosUser GetUser(string user_id)
void OnUserPicked(BiosUser user, EBiosError error)
Callback function.
void OnGameNameChanged(BiosUser user)
Callback function.
void CheckUserSwitchResult(BiosUser expectedUser)
void OnSignedOut(BiosUser user)
Callback function.
proto native bool SelectUser(BiosUser user)
Informs the engine about the current selected user.
void OnPartyHost(BiosUser host, array< string > invitee_list, EBiosError error)
Callback function.
void OnJoin(EBiosJoinType type, BiosUser joiner, string handle, string joinee, EBiosError error)
Callback function.
void OnLoggedOn(BiosUser user)
Callback function.
proto native EBiosError ParseJoinAsync(string join_data)
Parse the join data from from command line parameters.
void OnSignedIn(BiosUser user)
Callback function.
proto native BiosUser GetTitleInitiator()
Gets the initiatior of the title.
proto native BiosUser GetSelectedUser()
Returns the currently selected user.
void OnUserDatabaseId(string dbID, EBiosError error)
Callback function.
bool SelectUserEx(BiosUser user)
void OnLoggedOff(BiosUser user)
Callback function.
proto native EBiosError PickUserAsync()
Display a system dependant account picket.
proto native EBiosError GetUserList(array< ref BiosUser > user_list)
Gets the currently present list of users.
proto native EBiosError GetUserDatabaseIdAsync()
Call async function to get database ID.
Mission class.
Definition gameplay.c:686
static void AddNotification(NotificationType type, float show_time, string detail_text="")
Send notification from default types to local player.
static void SetSessionHandle(string handle)
static void GetSession()
static void SetPendingInviteList(array< string > invitees)
static void SetBiosUser(BiosUser user)
static bool ErrorCaught(EBiosError error)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
enum DisconnectSessionFlags DISCONNECT_SESSION_FLAGS_FORCE
DayZGame g_Game
Definition dayzgame.c:3942
DisconnectSessionFlags
Definition dayzgame.c:2
const int DISCONNECT_SESSION_FLAGS_JOIN
Definition dayzgame.c:14
Mission mission
DayZGame GetGame()
Definition gameplay.c:636
GamepadButton
Definition ensystem.c:341
const int MENU_TITLE_SCREEN
Definition constants.c:196
const int MENU_MAIN
Definition constants.c:182
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
NotificationType
DEPRECATED (moved into NotificationSystem).