mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-08-01 08:18:20 -04:00
* Async version of LoadAllGameResources Can't move this off the main thread but we can time slice it so it's not blocking for a longer duration. * Time slice Package.Download too * Add a bunch of yields when compiling packages * Add more loading screen titles and subtitles
35 lines
819 B
C#
35 lines
819 B
C#
using Sandbox.Engine;
|
|
|
|
namespace Sandbox.Network;
|
|
|
|
|
|
internal partial class NetworkSystem
|
|
{
|
|
internal GameNetworkSystem GameSystem { get; set; }
|
|
|
|
public void InitializeGameSystem()
|
|
{
|
|
// If we are unit testing we dont want to do any of this for now, this only works with a gamepackage loaded
|
|
if ( IGameInstanceDll.Current is null || Application.IsUnitTest )
|
|
return;
|
|
|
|
GameSystem = IGameInstanceDll.Current.CreateGameNetworking( this );
|
|
GameSystem?.OnInitialize();
|
|
|
|
if ( GameSystem is null )
|
|
Disconnect();
|
|
}
|
|
|
|
public async Task InitializeGameSystemAsync()
|
|
{
|
|
if ( IGameInstanceDll.Current is null || Application.IsUnitTest )
|
|
return;
|
|
|
|
GameSystem = await IGameInstanceDll.Current.CreateGameNetworkingAsync( this );
|
|
GameSystem?.OnInitialize();
|
|
|
|
if ( GameSystem is null )
|
|
Disconnect();
|
|
}
|
|
}
|