Dayz Explorer 1.29.162510
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();
12 proto native BiosClientServices GetClientServices();
13 proto native bool IsOnline();
14};
15
17{
19
22 proto native BiosUser GetTitleInitiator();
23
25
32 proto native EBiosError GetUserList(array<ref BiosUser> user_list);
33
35 proto native EBiosError LogOnUserAsync(BiosUser user);
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
88 proto native EBiosError GetUserDatabaseIdAsync();
89
90 bool SelectUserEx(BiosUser user)
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
112 void CheckUserSwitchResult(BiosUser expectedUser)
113 {
114 if (GetSelectedUser() != expectedUser)
115 {
116 NotificationSystem.AddNotification(NotificationType.GENERIC_ERROR, NotificationSystem.DEFAULT_TIME_DISPLAYED);
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
137 void OnUserLoggedOn(EBiosError error)
138 {
139 if ( OnlineServices.ErrorCaught( error ) )
140 {
141 g_Game.GetInput().ResetActiveGamepad();
142 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_FORCE);
143 }
144 }
145
147
151 void OnUserPicked(BiosUser user, EBiosError error)
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
172 void OnLoggedOn(BiosUser user)
173 {
174 if ( user && GetSelectedUser() == user )
175 g_Game.SelectUser(g_Game.GetInput().GetUserGamepad(user));
176 }
177
179 void OnLoggedOff(BiosUser user)
180 {
181 OnSignedOut( user );
182 }
183
185
190 void OnSignedIn(BiosUser user)
191 {
192
193 }
194
196
201 void OnSignedOut(BiosUser user)
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
301 void OnGameNameChanged(BiosUser user)
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. This is the list of errors that can be returned from bios API....
EBiosJoinType
@ ACTIVITY
@ INVITE
BiosClientServices class provides individual online services.
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 SetPendingInviteList(array< string > invitees)
static void GetSession()
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
proto string GetName()
Suite class name getter. Strictly for UI porposes!
Definition syncedvalue.c:50
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
NotificationType
DEPRECATED (moved into NotificationSystem).