Dayz Explorer 1.28.160049
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 NotificationSystem.AddNotification(NotificationType.GENERIC_ERROR, NotificationSystem.DEFAULT_TIME_DISPLAYED);
106 }
107
108 return success;
109 }
110
112
116 void OnUserDatabaseId(string dbID, EBiosError error)
117 {
118 if ( !OnlineServices.ErrorCaught( error ) )
119 {
120 g_Game.SetDatabaseID( dbID );
121 }
122 }
123
125
128 void OnUserLoggedOn(EBiosError error)
129 {
130 if ( OnlineServices.ErrorCaught( error ) )
131 {
132 GetGame().GetInput().ResetActiveGamepad();
133 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_FORCE);
134 }
135 }
136
138
142 void OnUserPicked(BiosUser user, EBiosError error)
143 {
144 if ( !user )
145 {
146 GetGame().GetInput().ResetActiveGamepad();
147 g_Game.GamepadCheck();
148 }
149 else if ( !OnlineServices.ErrorCaught( error ) )
150 {
151 if (SelectUserEx( user ))
152 {
153 if ( GetGame().GetMission() )
154 GetGame().GetMission().Reset();
155 OnGameNameChanged( user );
156 g_Game.SelectUser(GetGame().GetInput().GetUserGamepad(user));
157 }
158 }
159 }
160
162 void OnLoggedOn(BiosUser user)
163 {
164 if ( user && GetSelectedUser() == user )
165 g_Game.SelectUser(GetGame().GetInput().GetUserGamepad(user));
166 }
167
169 void OnLoggedOff(BiosUser user)
170 {
171 OnSignedOut( user );
172 }
173
175
180 void OnSignedIn(BiosUser user)
181 {
182
183 }
184
186
191 void OnSignedOut(BiosUser user)
192 {
193 if ( user == GetSelectedUser() )
194 {
195 SelectUserEx( null );
196 GetGame().GetInput().ResetActiveGamepad();
197 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_FORCE & ~DisconnectSessionFlags.SELECT_USER);
198 }
199 }
200
202
211 void OnJoin(EBiosJoinType type, BiosUser joiner, string handle, string joinee, EBiosError error)
212 {
213 if ( !OnlineServices.ErrorCaught( error ) )
214 {
215 OnlineServices.SetBiosUser( joiner );
216
217 SelectUserEx( joiner );
219
220 if ( g_Game.GetGameState() == DayZGameState.IN_GAME )
221 {
222 g_Game.SetLoadState( DayZLoadState.JOIN_START );
224 }
225 else
226 {
227 if ( GetGame().GetUIManager() && GetGame().GetInput().IsActiveGamepadSelected() )
228 {
229 GetGame().GetUIManager().CloseMenu( MENU_TITLE_SCREEN );
230 GetGame().GetInput().IdentifyGamepad( GamepadButton.BUTTON_NONE );
231 }
232 g_Game.SetLoadState( DayZLoadState.JOIN_START );
233 g_Game.GamepadCheck();
234 }
235 }
236 else
237 {
238 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_JOIN);
239 }
240 }
241
243
250 void OnPartyHost(BiosUser host, array<string> invitee_list, EBiosError error)
251 {
252 #ifdef PLATFORM_PS4
253 if (host)
254 #endif
255 {
256 SelectUserEx(host);
257
258 #ifdef PLATFORM_PS4
259 if (!host.IsOnline())
260 {
261 LogOnUserAsync( host );
262 }
263 #endif
264 }
265
266
267 if (GetGame().GetUIManager())
268 {
269 GetGame().GetUIManager().CloseMenu(MENU_TITLE_SCREEN);
270 }
271
272 OnlineServices.SetPendingInviteList( invitee_list );
273 if (g_Game.GetGameState() != DayZGameState.IN_GAME && g_Game.GetGameState() != DayZGameState.CONNECTING)
274 {
275 if (!GetGame().GetUIManager().GetMenu() || GetGame().GetUIManager().GetMenu().GetID() != MENU_MAIN)
276 {
277 GetGame().GetUIManager().EnterScriptedMenu(MENU_MAIN, GetGame().GetUIManager().GetMenu());
278 }
279 g_Game.SetGameState( DayZGameState.PARTY );
280 g_Game.SetLoadState( DayZLoadState.PARTY_START );
281 g_Game.GamepadCheck();
282 }
283 }
284
286
291 void OnGameNameChanged(BiosUser user)
292 {
293 if ( user == GetSelectedUser() )
294 {
295 g_Game.SetPlayerName( user.GetName() );
296 #ifdef PLATFORM_CONSOLE
297 g_Game.SetPlayerGameName( user.GetName() );
298 #endif
299 if ( GetGame().GetUIManager().GetMenu() )
300 {
301 GetGame().GetUIManager().GetMenu().Refresh();
302 }
303 }
304 }
305
306 BiosUser GetUser( string user_id )
307 {
309 GetUserList( user_list );
310 foreach ( BiosUser user : user_list )
311 {
312 if ( user.GetUid() == user_id )
313 {
314 return user;
315 }
316 }
317 return null;
318 }
319};
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.
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:3868
DisconnectSessionFlags
Definition dayzgame.c:2
const int DISCONNECT_SESSION_FLAGS_JOIN
Definition dayzgame.c:14
int GetID()
Get the ID registered in SEffectManager.
Definition effect.c:561
proto native CGame GetGame()
GamepadButton
Definition ensystem.c:341
const int MENU_TITLE_SCREEN
Definition constants.c:196
const int MENU_MAIN
Definition constants.c:182
NotificationType
DEPRECATED (moved into NotificationSystem)