internal void HandleFetchResponse(FetchResponseCollector collector, FetchResponse resp) { if (resp.Status() == CommonErrorStatus.ResponseStatus.VALID || resp.Status() == CommonErrorStatus.ResponseStatus.VALID_BUT_STALE) { NativePlayer player = resp.GetPlayer(); collector.results.Add(player); } collector.pendingCount--; if (collector.pendingCount == 0) { collector.callback(collector.results.ToArray()); } }
internal void FetchList(string[] userIds, Action <NativePlayer[]> callback) { FetchResponseCollector coll = new FetchResponseCollector(); coll.pendingCount = userIds.Length; coll.callback = callback; foreach (string player_id in userIds) { GooglePlayGames.Native.Cwrapper.PlayerManager.PlayerManager_Fetch(mGameServices.AsHandle(), Types.DataSource.CACHE_OR_NETWORK, player_id, InternalFetchCallback, Callbacks.ToIntPtr(delegate(FetchResponse rsp) { HandleFetchResponse(coll, rsp); }, FetchResponse.FromPointer)); } }
internal void FetchList(string[] userIds, Action <NativePlayer[]> callback) { FetchResponseCollector coll = new FetchResponseCollector(); coll.pendingCount = userIds.Length; coll.callback = callback; foreach (string id in userIds) { C.PlayerManager_Fetch(mGameServices.AsHandle(), Types.DataSource.CACHE_OR_NETWORK, id, InternalFetchCallback, Callbacks.ToIntPtr <FetchResponse>( (rsp) => HandleFetchResponse(coll, rsp), FetchResponse.FromPointer) ); } }