onlineservices.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. class OnlineServices
  2. {
  3. static ref ScriptInvoker m_FriendsAsyncInvoker = new ScriptInvoker();
  4. static ref ScriptInvoker m_PermissionsAsyncInvoker = new ScriptInvoker();
  5. static ref ScriptInvoker m_ServersAsyncInvoker = new ScriptInvoker();
  6. static ref ScriptInvoker m_ServerAsyncInvoker = new ScriptInvoker();
  7. static ref ScriptInvoker m_MuteUpdateAsyncInvoker = new ScriptInvoker(); // DEPRECATED
  8. static ref ScriptInvoker m_ServerModLoadAsyncInvoker = new ScriptInvoker();
  9. static BiosClientServices m_ClientServices;
  10. static ref TrialService m_TrialService;
  11. protected static string m_InviteServerIP;
  12. protected static int m_InviteServerPort;
  13. protected static string m_CurrentServerIP;
  14. protected static int m_CurrentServerPort;
  15. protected static ref GetServersResultRow m_CurrentServerInfo;
  16. protected static ref map<string, ref BiosFriendInfo> m_FriendsList;
  17. protected static ref map<string, bool> m_MuteList;
  18. protected static ref map<string, ref BiosPrivacyPermissionResultArray> m_PermissionsList;
  19. protected static bool m_FirstFriendsLoad = true;
  20. protected static bool m_MultiplayState = false;
  21. protected static ref array<string> m_PendingInvites;
  22. protected static ref BiosUser m_BiosUser;
  23. static void Init()
  24. {
  25. #ifdef PLATFORM_CONSOLE
  26. #ifndef PLATFORM_WINDOWS // if app is not on Windows with -XBOX parameter
  27. if ( !m_TrialService )
  28. m_TrialService = new TrialService;
  29. if ( !m_FriendsList )
  30. m_FriendsList = new map<string, ref BiosFriendInfo>;
  31. if ( !m_MuteList )
  32. m_MuteList = new map<string, bool>;
  33. if ( !m_PermissionsList )
  34. m_PermissionsList = new map<string, ref BiosPrivacyPermissionResultArray>;
  35. m_FriendsList.Clear();
  36. m_PermissionsList.Clear();
  37. m_MuteList.Clear();
  38. #endif
  39. #endif
  40. GetClientServices();
  41. }
  42. static bool IsInitialized()
  43. {
  44. return ( m_ClientServices != null );
  45. }
  46. static void GetClientServices()
  47. {
  48. BiosUserManager user_manager = GetGame().GetUserManager();
  49. if ( user_manager )
  50. {
  51. BiosUser selected_user = user_manager.GetSelectedUser();
  52. if ( selected_user )
  53. {
  54. m_ClientServices = selected_user.GetClientServices();
  55. }
  56. #ifdef PLATFORM_WINDOWS
  57. array<ref BiosUser> user_list = new array<ref BiosUser>;
  58. user_manager.GetUserList( user_list );
  59. if ( user_list.Count() > 0 )
  60. {
  61. m_ClientServices = user_list.Get( 0 ).GetClientServices();
  62. }
  63. #endif
  64. }
  65. else
  66. {
  67. Error( "BiosClientServices Error: Usermanager does not exist." );
  68. }
  69. }
  70. static bool ErrorCaught( EBiosError error )
  71. {
  72. switch ( error )
  73. {
  74. case EBiosError.OK:
  75. {
  76. return false;
  77. }
  78. }
  79. DebugPrint.LogErrorAndTrace( string.Format("BiosClientServices Error: %1", ErrorModuleHandler.GetClientMessage(ErrorCategory.BIOSError, error)) );
  80. return true;
  81. }
  82. static void LoadServers( notnull GetServersInput inputValues )
  83. {
  84. GetClientServices();
  85. if ( m_ClientServices )
  86. {
  87. m_ClientServices.GetLobbyService().GetServers( inputValues );
  88. }
  89. else
  90. {
  91. DebugPrint.LogErrorAndTrace( "BiosClientServices Error: Service reference does not exist." );
  92. }
  93. }
  94. static void GetFavoriteServers(TStringArray favServers)
  95. {
  96. m_ClientServices.GetLobbyService().GetFavoriteServers(favServers);
  97. }
  98. static void GetCachedFavServerInfo(array<ref CachedServerInfo> favServersInfoCache)
  99. {
  100. m_ClientServices.GetLobbyService().GetCachedFavoriteServerInfo(favServersInfoCache);
  101. }
  102. static void SetServerFavorited(string ipAddress, int port, int steamQueryPort, bool is_favorited )
  103. {
  104. GetClientServices();
  105. if ( m_ClientServices )
  106. {
  107. if ( is_favorited )
  108. {
  109. m_ClientServices.GetLobbyService().AddServerFavorite( ipAddress, port, steamQueryPort );
  110. }
  111. else
  112. {
  113. m_ClientServices.GetLobbyService().RemoveServerFavorite( ipAddress, port, steamQueryPort );
  114. }
  115. }
  116. else
  117. {
  118. DebugPrint.LogErrorAndTrace( "BiosClientServices Error: Service reference does not exist." );
  119. }
  120. }
  121. static void GetCurrentServerInfo( string ip, int port )
  122. {
  123. GetClientServices();
  124. m_CurrentServerIP = ip;
  125. m_CurrentServerPort = port;
  126. GetServersInput inputValues = new GetServersInput;
  127. inputValues.SetHostIp( ip );
  128. inputValues.SetHostPort( port );
  129. inputValues.m_Page = 0;
  130. inputValues.m_RowsPerPage = 10;
  131. inputValues.m_Platform = 1;
  132. #ifdef PLATFORM_XBOX
  133. inputValues.m_Platform = 2;
  134. #endif
  135. #ifdef PLATFORM_PS4
  136. inputValues.m_Platform = 3;
  137. #endif
  138. if ( m_ClientServices )
  139. {
  140. m_ClientServices.GetLobbyService().GetServers( inputValues );
  141. }
  142. }
  143. static GetServersResultRow GetCurrentServerInfo()
  144. {
  145. if (m_CurrentServerInfo)
  146. return m_CurrentServerInfo;
  147. else
  148. return g_Game.GetHostData();
  149. }
  150. static void ClearCurrentServerInfo()
  151. {
  152. m_CurrentServerInfo = null;
  153. m_CurrentServerIP = "";
  154. m_CurrentServerPort = 0;
  155. }
  156. static void SetInviteServerInfo( string ip, int port )
  157. {
  158. m_InviteServerIP = ip;
  159. m_InviteServerPort = port;
  160. }
  161. static void GetInviteServerInfo( out string ip, out int port )
  162. {
  163. ip = m_InviteServerIP;
  164. port = m_InviteServerPort;
  165. }
  166. static void OnLoadServersAsync( GetServersResult result_list, EBiosError error, string response )
  167. {
  168. if ( !ErrorCaught( error ) )
  169. {
  170. if ( m_CurrentServerIP != "" && m_CurrentServerPort > 0 )
  171. {
  172. foreach ( GetServersResultRow result : result_list.m_Results )
  173. {
  174. if ( result.m_HostIp == m_CurrentServerIP && result.m_HostPort == m_CurrentServerPort )
  175. {
  176. m_CurrentServerInfo = result;
  177. m_CurrentServerIP = "";
  178. m_CurrentServerPort = 0;
  179. }
  180. }
  181. }
  182. // todo: remove
  183. //foreach( GetServersResultRow res : result_list.m_Results )
  184. //{
  185. // Print("OnLoadServersAsync: result id: " + res.m_Id + "modded: " + res.m_Modded);
  186. //}
  187. // just for example execute the retrieving of extended info for the first server entry in the list
  188. //if (result_list.m_Results.Count() > 0)
  189. //{
  190. //GetServersResultRow re = result_list.m_Results[0];
  191. //EBiosError er = m_ClientServices.GetLobbyService().GetServerModList(re.m_Id);
  192. //Print("OnLoadServersAsync GetServerModList returns:" + er);
  193. //}
  194. m_ServersAsyncInvoker.Invoke( result_list, error, response );
  195. }
  196. else
  197. {
  198. m_ServersAsyncInvoker.Invoke( null, error, "" );
  199. }
  200. }
  201. static void LoadFriends()
  202. {
  203. GetClientServices();
  204. if ( m_ClientServices )
  205. {
  206. m_ClientServices.GetSocialService().GetFriendsAsync();
  207. }
  208. else
  209. {
  210. DebugPrint.LogErrorAndTrace( "BiosClientServices Error: Service reference does not exist." );
  211. }
  212. }
  213. static void ShowUserProfile( string uid )
  214. {
  215. GetClientServices();
  216. if ( m_ClientServices )
  217. {
  218. m_ClientServices.GetSocialService().ShowUserProfileAsync( uid );
  219. }
  220. else
  221. {
  222. DebugPrint.LogErrorAndTrace( "BiosClientServices Error: Service reference does not exist." );
  223. }
  224. }
  225. static void OnUserProfileAsync(EBiosError error)
  226. {
  227. ErrorCaught( error );
  228. }
  229. static void OnFriendsAsync( BiosFriendInfoArray friend_list, EBiosError error )
  230. {
  231. if ( !ErrorCaught( error ) )
  232. {
  233. m_FriendsAsyncInvoker.Invoke( friend_list );
  234. array<string> friends_simple = new array<string>;
  235. for ( int i = 0; i < friend_list.Count(); ++i )
  236. {
  237. string uid = friend_list[i].m_Uid;
  238. BiosFriendInfo storedBfi = m_FriendsList[uid];
  239. BiosFriendInfo newBfi = friend_list[i];
  240. if (storedBfi)
  241. {
  242. if ( !BiosFriendInfo.Compare( storedBfi, newBfi ) )
  243. {
  244. friends_simple.Insert( newBfi.m_Uid );
  245. }
  246. m_FriendsList.Set( uid, newBfi );
  247. }
  248. else
  249. {
  250. m_FriendsList.Insert( uid, newBfi );
  251. friends_simple.Insert( newBfi.m_Uid );
  252. }
  253. }
  254. if ( !m_FirstFriendsLoad )
  255. {
  256. if ( ClientData.m_LastNewPlayers && ClientData.m_LastNewPlayers.m_PlayerList.Count() > 0 )
  257. {
  258. foreach ( SyncPlayer player : ClientData.m_LastNewPlayers.m_PlayerList )
  259. {
  260. if ( m_FriendsList.Contains( player.m_UID ) )
  261. {
  262. NotificationSystem.AddNotification( NotificationType.FRIEND_CONNECTED, NotificationSystem.DEFAULT_TIME_DISPLAYED, player.m_PlayerName + " " + "#ps4_invite_has_joined_your_session" );
  263. }
  264. }
  265. ClientData.m_LastNewPlayers.m_PlayerList.Clear();
  266. }
  267. }
  268. m_FirstFriendsLoad = false;
  269. }
  270. }
  271. static void LoadPermissions( array<string> player_list )
  272. {
  273. GetClientServices();
  274. if ( m_ClientServices )
  275. {
  276. array<EBiosPrivacyPermission> perms = new array<EBiosPrivacyPermission>;
  277. perms.Insert( EBiosPrivacyPermission.COMMUNICATE_VOICE );
  278. ErrorCaught( m_ClientServices.GetPrivacyService().GetPermissionsAsync( player_list, perms ) );
  279. }
  280. else
  281. {
  282. DebugPrint.LogErrorAndTrace( "BiosClientServices Error: Service reference does not exist." );
  283. }
  284. }
  285. static void OnPermissionsAsync( BiosPrivacyUidResultArray result_list, EBiosError error )
  286. {
  287. if ( !ErrorCaught( error ) )
  288. {
  289. BiosPrivacyUidResultArray new_list = new BiosPrivacyUidResultArray;
  290. for ( int i = 0; i < result_list.Count(); i++ )
  291. {
  292. BiosPrivacyUidResult result = result_list.Get( i );
  293. string uid = result.m_Uid;
  294. BiosPrivacyPermissionResultArray result_array = m_PermissionsList.Get( uid );
  295. BiosPrivacyPermissionResultArray result_array2 = result.m_Results;
  296. if ( result_array && result_array2 )
  297. {
  298. if ( !BiosPrivacyPermissionResult.Compare( result_array.Get( 0 ), result_array2.Get( 0 ) ) )
  299. {
  300. new_list.Insert( result );
  301. m_PermissionsList.Set( uid, result_array2 );
  302. }
  303. }
  304. else
  305. {
  306. m_PermissionsList.Insert( uid, result_array2 );
  307. new_list.Insert( result );
  308. }
  309. }
  310. m_PermissionsAsyncInvoker.Invoke( new_list );
  311. }
  312. }
  313. static bool IsPlayerMuted( string id )
  314. {
  315. if ( m_MuteList.Contains( id ) )
  316. {
  317. return m_MuteList.Get( id );
  318. }
  319. return false;
  320. }
  321. static bool MutePlayer( string id, bool mute )
  322. {
  323. if ( m_MuteList.Contains( id ) )
  324. {
  325. m_MuteList.Set( id, mute );
  326. }
  327. else
  328. {
  329. m_MuteList.Insert( id, mute );
  330. }
  331. // notify server
  332. ScriptInputUserData ctx = new ScriptInputUserData();
  333. ctx.Write( INPUT_UDT_USER_MUTE_XBOX );
  334. ctx.Write( id );
  335. ctx.Write( mute );
  336. ctx.Send();
  337. return true;
  338. }
  339. static map<string, bool> GetMuteList()
  340. {
  341. return m_MuteList;
  342. }
  343. static void ShowInviteScreen()
  344. {
  345. #ifdef PLATFORM_CONSOLE
  346. GetClientServices();
  347. if ( m_ClientServices )
  348. {
  349. string addr;
  350. int port;
  351. if ( GetGame().GetHostAddress( addr, port ) )
  352. {
  353. ErrorCaught( m_ClientServices.GetSessionService().ShowInviteToGameplaySessionAsync( addr, port ) );
  354. }
  355. }
  356. else
  357. {
  358. DebugPrint.LogErrorAndTrace( "BiosClientServices Error: Service reference does not exist." );
  359. }
  360. #endif
  361. }
  362. static void LoadMPPrivilege()
  363. {
  364. #ifdef PLATFORM_CONSOLE
  365. GetClientServices();
  366. if ( m_ClientServices )
  367. {
  368. ErrorCaught( m_ClientServices.GetPrivacyService().GetPrivilegeAsync( EBiosPrivacyPrivilege.MULTIPLAYER_GAMEPLAY, true ) );
  369. }
  370. else
  371. {
  372. DebugPrint.LogErrorAndTrace( "BiosClientServices Error: Service reference does not exist." );
  373. }
  374. #else
  375. OnLoadMPPrivilege( EBiosError.OK );
  376. #endif
  377. }
  378. static void LoadVoicePrivilege()
  379. {
  380. GetClientServices();
  381. if ( m_ClientServices )
  382. {
  383. ErrorCaught( m_ClientServices.GetPrivacyService().GetPrivilegeAsync( EBiosPrivacyPrivilege.COMMUNICATE_VOICE, true ) );
  384. }
  385. else
  386. {
  387. DebugPrint.LogErrorAndTrace( "BiosClientServices Error: Service reference does not exist." );
  388. }
  389. }
  390. static void OnLoadMPPrivilege( EBiosError err )
  391. {
  392. if ( !ErrorCaught( err ) )
  393. {
  394. g_Game.TryConnect();
  395. }
  396. else
  397. {
  398. if ( g_Game.GetGameState() != DayZGameState.MAIN_MENU )
  399. {
  400. g_Game.MainMenuLaunch();
  401. }
  402. else
  403. {
  404. g_Game.SetLoadState( DayZLoadState.MAIN_MENU_START );
  405. g_Game.GamepadCheck();
  406. }
  407. }
  408. }
  409. static void OnLoadVoicePrivilege( EBiosError err )
  410. {
  411. if ( g_Game.GetGameState() == DayZGameState.IN_GAME )
  412. {
  413. #ifdef PLATFORM_PS4
  414. GetGame().GetWorld().DisableReceiveVoN( ErrorCaught( err ) );
  415. #endif
  416. GetGame().GetWorld().DisableTransmitVoN( ErrorCaught( err ) );
  417. }
  418. }
  419. static void SetSessionHandle( string handle )
  420. {
  421. GetClientServices();
  422. if ( m_ClientServices )
  423. {
  424. m_ClientServices.GetSessionService().m_CurrentHandle = handle;
  425. }
  426. }
  427. static string GetSessionHandle()
  428. {
  429. GetClientServices();
  430. if ( m_ClientServices )
  431. {
  432. return m_ClientServices.GetSessionService().m_CurrentHandle;
  433. }
  434. return "";
  435. }
  436. static void GetSession()
  437. {
  438. GetClientServices();
  439. if ( m_ClientServices )
  440. {
  441. m_ClientServices.GetSessionService().TryGetSession( GetSessionHandle() );
  442. }
  443. }
  444. static BiosUser GetBiosUser()
  445. {
  446. return m_BiosUser;
  447. }
  448. static void SetBiosUser(BiosUser user)
  449. {
  450. m_BiosUser = user;
  451. }
  452. static bool GetMultiplayState()
  453. {
  454. return m_MultiplayState;
  455. }
  456. static void SetMultiplayState( bool state )
  457. {
  458. m_MultiplayState = state;
  459. bool is_multiplay;
  460. if ( ClientData.GetSimplePlayerList() )
  461. is_multiplay = state && ( ClientData.GetSimplePlayerList().Count() > 1 );
  462. if ( m_ClientServices )
  463. m_ClientServices.GetSessionService().SetMultiplayState(is_multiplay);
  464. }
  465. static void EnterGameplaySession()
  466. {
  467. string addr;
  468. int port;
  469. if ( GetGame().GetHostAddress( addr, port ) )
  470. {
  471. GetClientServices();
  472. if ( m_ClientServices )
  473. {
  474. m_ClientServices.GetSessionService().EnterGameplaySessionAsync( addr, port );
  475. SetMultiplayState(true);
  476. }
  477. }
  478. }
  479. static void LeaveGameplaySession()
  480. {
  481. GetClientServices();
  482. if ( m_ClientServices )
  483. {
  484. GetServersResultRow currentServerInfo = GetCurrentServerInfo();
  485. if ( currentServerInfo )
  486. m_ClientServices.GetSessionService().LeaveGameplaySessionAsync(currentServerInfo.m_HostIp, currentServerInfo.m_HostPort);
  487. else if ( m_CurrentServerIP != "" )
  488. m_ClientServices.GetSessionService().LeaveGameplaySessionAsync(m_CurrentServerIP, m_CurrentServerPort);
  489. SetMultiplayState(false);
  490. m_FirstFriendsLoad = true;
  491. if ( m_FriendsList )
  492. m_FriendsList.Clear();
  493. }
  494. }
  495. static void SetGameplayActivity()
  496. {
  497. string addr;
  498. int port;
  499. if ( GetGame().GetHostAddress( addr, port ) )
  500. {
  501. GetClientServices();
  502. if ( m_ClientServices )
  503. {
  504. m_ClientServices.GetSessionService().SetGameplayActivityAsync( addr, port );
  505. }
  506. }
  507. }
  508. static void SetPendingInviteList( array<string> invitees )
  509. {
  510. string addr;
  511. int port;
  512. if ( GetGame().GetHostAddress( addr, port ) )
  513. {
  514. GetClientServices();
  515. if ( m_ClientServices )
  516. {
  517. m_PendingInvites = invitees;
  518. m_ClientServices.GetSessionService().InviteToGameplaySessionAsync( addr, port, GetPendingInviteList() );
  519. }
  520. }
  521. else
  522. {
  523. m_PendingInvites = invitees;
  524. }
  525. }
  526. static array<string> GetPendingInviteList()
  527. {
  528. array<string> already_on_server = ClientData.GetSimplePlayerList();
  529. if ( already_on_server && m_PendingInvites )
  530. {
  531. array<string> new_to_server = new array<string>;
  532. foreach ( string invitee : m_PendingInvites )
  533. {
  534. if ( already_on_server.Find( invitee ) == -1 )
  535. {
  536. new_to_server.Insert( invitee );
  537. }
  538. }
  539. return new_to_server;
  540. }
  541. else
  542. {
  543. return m_PendingInvites;
  544. }
  545. }
  546. static void ClearPendingInviteList( array<string> invitees )
  547. {
  548. delete m_PendingInvites;
  549. }
  550. static int m_AutoConnectTries = 0;
  551. static void AutoConnectToEmptyServer()
  552. {
  553. GetClientServices();
  554. if ( m_ClientServices && m_AutoConnectTries == 0 )
  555. {
  556. m_AutoConnectTries = 1;
  557. GetFirstServerWithEmptySlotInput input = new GetFirstServerWithEmptySlotInput;
  558. input.SetOfficial( true );
  559. m_ClientServices.GetLobbyService().GetFirstServerWithEmptySlot( input );
  560. }
  561. }
  562. static GetServersResultRow GetRandomFreeResult( GetFirstServerWithEmptySlotResult results )
  563. {
  564. GetServersResultRow result;
  565. array<ref GetServersResultRow> results_free = new array<ref GetServersResultRow>;
  566. if ( results && results.m_Result && results.m_Result.m_Results && results.m_Result.m_Results.Count() > 0 )
  567. {
  568. foreach ( GetServersResultRow result_temp : results.m_Result.m_Results )
  569. {
  570. if ( result_temp.m_FreeSlots > 0 )
  571. {
  572. results_free.Insert( result_temp );
  573. }
  574. }
  575. }
  576. return results_free.GetRandomElement();
  577. }
  578. static void OnAutoConnectToEmptyServer( GetFirstServerWithEmptySlotResult result_list, EBiosError error )
  579. {
  580. if ( !ErrorCaught( error ) )
  581. {
  582. GetServersResultRow result = GetRandomFreeResult( result_list );
  583. if ( result )
  584. {
  585. g_Game.ConnectFromServerBrowser( result.m_HostIp, result.m_HostPort );
  586. m_AutoConnectTries = 0;
  587. return;
  588. }
  589. else
  590. {
  591. GetGame().GetUIManager().ShowDialog( "#str_xbox_authentification_fail_title", "#str_xbox_authentification_fail", 232, DBT_OK, DBB_NONE, DMT_INFO, GetGame().GetUIManager().GetMenu() );
  592. }
  593. }
  594. if ( m_AutoConnectTries < 3 )
  595. {
  596. m_AutoConnectTries++;
  597. GetFirstServerWithEmptySlotInput input = new GetFirstServerWithEmptySlotInput;
  598. input.SetOfficial( true );
  599. m_ClientServices.GetLobbyService().GetFirstServerWithEmptySlot( input );
  600. }
  601. else
  602. {
  603. GetGame().GetUIManager().ShowDialog( "#str_xbox_authentification_fail_title", "#xbox_authentification_fail", 232, DBT_OK, DBB_NONE, DMT_INFO, GetGame().GetUIManager().GetMenu() );
  604. }
  605. }
  606. static void GetServerModList( string server_id )
  607. {
  608. GetClientServices();
  609. if ( m_ClientServices )
  610. {
  611. m_ClientServices.GetLobbyService().GetServerModList( server_id );
  612. }
  613. }
  614. static void OnGetServerModList( GetServerModListResult result_list, EBiosError error )
  615. {
  616. if ( !ErrorCaught( error ) )
  617. {
  618. m_ServerModLoadAsyncInvoker.Invoke( result_list );
  619. }
  620. }
  621. static bool IsGameTrial( bool sim )
  622. {
  623. #ifdef PLATFORM_XBOX
  624. #ifndef PLATFORM_WINDOWS
  625. if ( m_TrialService )
  626. return m_TrialService.IsGameTrial( sim );
  627. #endif
  628. #endif
  629. return false;
  630. }
  631. static bool IsGameActive( bool sim )
  632. {
  633. #ifdef PLATFORM_XBOX
  634. #ifndef PLATFORM_WINDOWS
  635. if ( m_TrialService )
  636. return m_TrialService.IsGameActive( sim );
  637. #endif
  638. #endif
  639. return false;
  640. }
  641. static bool CheckUpdate()
  642. {
  643. GetClientServices();
  644. if ( m_ClientServices )
  645. {
  646. EBiosError error = m_ClientServices.GetPackageService().CheckUpdateAsync();
  647. if ( !error )
  648. {
  649. return true;
  650. }
  651. }
  652. return false;
  653. }
  654. static void PromptUpdate()
  655. {
  656. GetClientServices();
  657. if ( m_ClientServices )
  658. {
  659. m_ClientServices.GetPackageService().PromptUpdateAsync();
  660. }
  661. }
  662. }