using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using Steamworks.Data; namespace Steamworks { public static class SteamParties { static ISteamParties _internal; internal static ISteamParties Internal { get { if ( _internal == null ) { _internal = new ISteamParties(); _internal.Init(); } return _internal; } } internal static void Shutdown() { _internal = null; } internal static void InstallEvents() { AvailableBeaconLocationsUpdated_t.Install( x => OnBeaconLocationsUpdated?.Invoke() ); ActiveBeaconsUpdated_t.Install( x => OnActiveBeaconsUpdated?.Invoke() ); } /// /// 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 ) }; } } } /// /// Create a new party beacon and activate it in the selected location. /// When people begin responding to your beacon, Steam will send you /// OnPartyReservation callbacks to let you know who is on the way. /// //public async Task CreateBeacon( int slots, string connectString, string meta ) //{ // var result = await Internal.CreateBeacon( (uint)slots, null, connectString, meta ); // if ( !result.HasValue ) return null; //} // TODO - is this useful to anyone, or is it a load of shit? } }