/// <param name="onListRetrieved">If called with null, retrieval was unsuccessful. Else, this will be given a list of contents to display, as pairs of a lobby code and a display string for that lobby.</param>
public async Task < QueryResponse > RetrieveLobbyListAsync ( LobbyColor limitToColor = LobbyColor . None )
{
if ( ! await m_rateLimitQuery . WaitInQueueUntilTaskIsFirst (
RetrieveLobbyListAsync ( limitToColor ) ) )
return null ;
await m_rateLimitQuery . WaitUntilCooldown ( ) ;
Debug . Log ( "Retrieving Lobby List" ) ;
var filters = LobbyColorToFilters ( limitToColor ) ;
public async Task UpdatePlayerDataAsync ( Dictionary < string , string > data )
{
if ( ! await m_rateLimitQuery . WaitInQueueUntilTaskIsFirst (
UpdatePlayerDataAsync ( data ) ) )
return ;
await m_rateLimitQuery . WaitUntilCooldown ( ) ;
string playerId = Locator . Get . Identity . GetSubIdentity ( Auth . IIdentityType . Auth ) . GetContent ( "id" ) ;
Dictionary < string , PlayerDataObject > dataCurr = new Dictionary < string , PlayerDataObject > ( ) ;
foreach ( var dataNew in data )
public async Task UpdatePlayerRelayInfoAsync ( string allocationId , string connectionInfo )
{
if ( ! await m_rateLimitQuery . WaitInQueueUntilTaskIsFirst (
UpdatePlayerRelayInfoAsync ( allocationId , connectionInfo ) ) )
return ;
await m_rateLimitQuery . WaitUntilCooldown ( ) ;
await AwaitRemoteLobby ( ) ;
string playerId = Locator . Get . Identity . GetSubIdentity ( Auth . IIdentityType . Auth ) . GetContent ( "id" ) ;
/// <param name="data">Key-value pairs, which will overwrite any existing data for these keys. Presumed to be available to all lobby members but not publicly.</param>
public async Task UpdateLobbyDataAsync ( Dictionary < string , string > data )
{
if ( await m_rateLimitQuery . WaitInQueueUntilTaskIsFirst ( UpdateLobbyDataAsync ( data ) ) )
return ;
await m_rateLimitQuery . WaitUntilCooldown ( ) ;
Dictionary < string , DataObject > dataCurr = m_RemoteLobby . Data ? ? new Dictionary < string , DataObject > ( ) ;
}
public async Task < bool > WaitInQueueUntilTaskIsFirst ( Task newTask )
public async Task WaitUntilCooldown ( ) //TODO YAGNI Handle Multiple commands? Return bool if already waiting?
//Task is already in the queue
if ( m_TaskQueue . Contains ( newTask ) )
return false ;
Debug . Log ( $"Enqueing Task: {newTask.Id} - {newTask.Status}" ) ;
return true ;
Debug . LogWarning ( "Hit the rate limit. Queueing..." ) ;
return ;
m_TaskQueue . Enqueue ( newTask ) ;
if ( m_DequeuedTask = = newTask )
break ;
//Got to the part of the queue that was the Task'
return true ;
}
bool CanCall ( )