using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using Facepunch.Steamworks.Data; namespace Facepunch.Steamworks { /// /// This API can be used to selectively advertise your multiplayer game session in a Steam chat room group. /// Tell Steam the number of player spots that are available for your party, and a join-game string, and it /// will show a beacon in the selected group and allow that many users to “follow” the beacon to your party. /// Adjust the number of open slots if other players join through alternate matchmaking methods. /// public class SteamParties : SteamClientClass { internal static ISteamParties Internal => Interface as ISteamParties; internal override void InitializeInterface( bool server ) { SetInterface( server, new ISteamParties( server ) ); InstallEvents( server ); } internal void InstallEvents( bool server ) { Dispatch.Install( x => OnBeaconLocationsUpdated?.Invoke(), server ); Dispatch.Install( x => OnActiveBeaconsUpdated?.Invoke(), server ); } /// /// The list of possible Party beacon locations has changed /// public static event Action OnBeaconLocationsUpdated; /// /// The list of active beacons may have changed /// public static event Action OnActiveBeaconsUpdated; public static int ActiveBeaconCount => (int) Internal.GetNumActiveBeacons(); public static IEnumerable ActiveBeacons { get { for ( uint i = 0; i < ActiveBeaconCount; i++ ) { yield return new PartyBeacon { Id = Internal.GetBeaconByIndex( i ) }; } } } } }