mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Added Friends.OnInvitedToGame callback
This commit is contained in:
parent
2587643b25
commit
dd31847990
@ -40,6 +40,23 @@ internal Friends( Client c )
|
||||
client = c;
|
||||
|
||||
client.RegisterCallback<SteamNative.PersonaStateChange_t>( OnPersonaStateChange );
|
||||
client.RegisterCallback<SteamNative.GameRichPresenceJoinRequested_t>( OnGameJoinRequested );
|
||||
}
|
||||
|
||||
public delegate void JoinRequestedDelegate( SteamFriend friend, string connect );
|
||||
|
||||
//
|
||||
// Called when a friend has invited you to their game (using InviteToGame)
|
||||
//
|
||||
public event JoinRequestedDelegate OnInvitedToGame;
|
||||
|
||||
|
||||
private void OnGameJoinRequested( GameRichPresenceJoinRequested_t data )
|
||||
{
|
||||
if ( OnInvitedToGame != null )
|
||||
{
|
||||
OnInvitedToGame( Get( data.SteamIDFriend ), data.Connect );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -226,6 +243,9 @@ private class PersonaCallback
|
||||
|
||||
public SteamFriend Get( ulong steamid )
|
||||
{
|
||||
var friend = All.Where( x => x.Id == steamid ).FirstOrDefault();
|
||||
if ( friend != null ) return friend;
|
||||
|
||||
var f = new SteamFriend()
|
||||
{
|
||||
Id = steamid,
|
||||
|
Loading…
Reference in New Issue
Block a user