public static IEnumerator GetCounter( Client client, GameSession session, string limitNamespaceName, EzLimitModel limitModel, string counterName, GetCounterEvent onGetCounter, ErrorEvent onError ) { AsyncResult <EzGetCounterResult> result = null; yield return(client.Limit.GetCounter( r => { result = r; }, session, limitNamespaceName, limitModel.Name, counterName )); if (result.Error != null) { onError.Invoke( result.Error ); yield break; } var counter = result.Result.Item; onGetCounter.Invoke(limitModel, counter); }
public static IEnumerator ListCounters( Client client, GameSession session, string limitNamespaceName, EzLimitModel limitModel, GetCounterEvent onGetCounter, ErrorEvent onError ) { var counters = new List <EzCounter>(); string pageToken = null; while (true) { AsyncResult <EzListCountersResult> result = null; yield return(client.Limit.ListCounters( r => { result = r; }, session, limitNamespaceName, limitModel.Name, pageToken, 30 )); if (result.Error != null) { onError.Invoke( result.Error ); yield break; } counters.AddRange(result.Result.Items); pageToken = result.Result.NextPageToken; if (pageToken == null) { break; } } foreach (var counter in counters) { onGetCounter.Invoke(limitModel, counter); } }