mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 23:25:55 +03:00
Added OnSteamServerConnectFailure
This commit is contained in:
parent
33830e274e
commit
253c206f71
@ -40,7 +40,8 @@ internal static void InstallEvents()
|
|||||||
|
|
||||||
ValidateAuthTicketResponse_t.Install( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true );
|
ValidateAuthTicketResponse_t.Install( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true );
|
||||||
SteamServersConnected_t.Install( x => OnSteamServersConnected?.Invoke(), true );
|
SteamServersConnected_t.Install( x => OnSteamServersConnected?.Invoke(), true );
|
||||||
SteamServerConnectFailure_t.Install( x => OnSteamServerConnectFailure?.Invoke(), true );
|
SteamServerConnectFailure_t.Install( x => OnSteamServerConnectFailure?.Invoke( x.Result, x.StillRetrying ), true );
|
||||||
|
SteamServersDisconnected_t.Install( x => OnSteamServersDisconnected?.Invoke( x.Result ), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -55,9 +56,14 @@ internal static void InstallEvents()
|
|||||||
public static event Action OnSteamServersConnected;
|
public static event Action OnSteamServersConnected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when a connection attempt has failed.
|
/// This will occur periodically if the Steam client is not connected, and has failed when retrying to establish a connection (result, stilltrying)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static event Action OnSteamServerConnectFailure;
|
public static event Action<Result, bool> OnSteamServerConnectFailure;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnected from Steam
|
||||||
|
/// </summary>
|
||||||
|
public static event Action<Result> OnSteamServersDisconnected;
|
||||||
|
|
||||||
public static void Init( AppId appid, SteamServerInit init )
|
public static void Init( AppId appid, SteamServerInit init )
|
||||||
{
|
{
|
||||||
@ -86,14 +92,14 @@ public static void Init( AppId appid, SteamServerInit init )
|
|||||||
//
|
//
|
||||||
// Initial settings
|
// Initial settings
|
||||||
//
|
//
|
||||||
Internal.EnableHeartbeats( true );
|
AutomaticHeartbeats = true;
|
||||||
MaxPlayers = 32;
|
MaxPlayers = 32;
|
||||||
BotCount = 0;
|
BotCount = 0;
|
||||||
Product = $"{appid.Value}";
|
Product = $"{appid.Value}";
|
||||||
ModDir = init.ModDir;
|
ModDir = init.ModDir;
|
||||||
GameDescription = init.GameDescription;
|
GameDescription = init.GameDescription;
|
||||||
Passworded = false;
|
Passworded = false;
|
||||||
DedicatedServer = true;
|
DedicatedServer = init.DedicatedServer;
|
||||||
|
|
||||||
InstallEvents();
|
InstallEvents();
|
||||||
|
|
||||||
@ -140,8 +146,8 @@ internal static async void RunCallbacksAsync()
|
|||||||
{
|
{
|
||||||
while ( IsValid )
|
while ( IsValid )
|
||||||
{
|
{
|
||||||
await Task.Delay( 16 );
|
|
||||||
RunCallbacks();
|
RunCallbacks();
|
||||||
|
await Task.Delay( 16 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +266,12 @@ public static bool Passworded
|
|||||||
public static string GameTags
|
public static string GameTags
|
||||||
{
|
{
|
||||||
get => _gametags;
|
get => _gametags;
|
||||||
set { if ( _gametags == value ) return; Internal.SetGameTags( value ); _gametags = value; }
|
set
|
||||||
|
{
|
||||||
|
if ( _gametags == value ) return;
|
||||||
|
Internal.SetGameTags( value );
|
||||||
|
_gametags = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private static string _gametags = "";
|
private static string _gametags = "";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user