using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using Steamworks.Data; namespace Steamworks { /// /// Functions that provide information about Steam Remote Play sessions, streaming your game content to another computer or to a Steam Link app or hardware. /// public class SteamRemotePlay : SteamClientClass { internal static ISteamRemotePlay? Internal => Interface as ISteamRemotePlay; internal override bool InitializeInterface( bool server ) { SetInterface( server, new ISteamRemotePlay( server ) ); if ( Interface is null || Interface.Self == IntPtr.Zero ) return false; InstallEvents( server ); return true; } internal void InstallEvents( bool server ) { Dispatch.Install( x => OnSessionConnected?.Invoke( x.SessionID ), server ); Dispatch.Install( x => OnSessionDisconnected?.Invoke( x.SessionID ), server ); } /// /// Invoked when a session is connected. /// public static event Action? OnSessionConnected; /// /// Invoked when a session becomes disconnected. /// public static event Action? OnSessionDisconnected; /// /// Gets the number of currently connected Steam Remote Play sessions /// public static int SessionCount => (int)(Internal?.GetSessionCount() ?? 0); /// /// Get the currently connected Steam Remote Play session ID at the specified index. /// IsValid will return if it's out of bounds /// public static RemotePlaySession GetSession( int index ) => Internal?.GetSessionID( index ).Value ?? default; /// /// Invite a friend to Remote Play Together. /// This returns if the invite can't be sent /// public static bool SendInvite( SteamId steamid ) => Internal != null && Internal.BSendRemotePlayTogetherInvite( steamid ); } }