///<summary></summary> /// <seealso cref="GooglePlayGames.BasicApi.IPlayGamesClient.GetPlayerStats"/> public void GetPlayerStats(Action <CommonStatusCodes, PlayerStats> callback) { mServices.StatsManager().FetchForPlayer((playerStatsResponse) => { // Translate native errors into CommonStatusCodes. CommonStatusCodes responseCode = ConversionUtils.ConvertResponseStatusToCommonStatus(playerStatsResponse.Status()); // Log errors. if (responseCode != CommonStatusCodes.Success && responseCode != CommonStatusCodes.SuccessCached) { GooglePlayGames.OurUtils.Logger.e("Error loading PlayerStats: " + playerStatsResponse.Status().ToString()); } // Fill in the stats & call the callback. if (callback != null) { if (playerStatsResponse.PlayerStats() != null) { // Copy the object out of the native interface so // it will not be deleted before the callback is // executed on the UI thread. PlayerStats stats = playerStatsResponse.PlayerStats().AsPlayerStats(); PlayGamesHelperObject.RunOnGameThread(() => callback(responseCode, stats)); } else { PlayGamesHelperObject.RunOnGameThread(() => callback(responseCode, new PlayerStats())); } } }); }
///<summary></summary> /// <seealso cref="GooglePlayGames.BasicApi.IPlayGamesClient.GetPlayerStats"/> public void GetPlayerStats(Action <CommonStatusCodes, PlayerStats> callback) { mServices.StatsManager().FetchForPlayer((playerStatsResponse) => { // Translate native errors into CommonStatusCodes. CommonStatusCodes responseCode = ConversionUtils.ConvertResponseStatusToCommonStatus(playerStatsResponse.Status()); // Log errors. if (responseCode != CommonStatusCodes.Success && responseCode != CommonStatusCodes.SuccessCached) { GooglePlayGames.OurUtils.Logger.e("Error loading PlayerStats: " + playerStatsResponse.Status().ToString()); } // Fill in the stats & call the callback. if (callback != null) { if (playerStatsResponse.PlayerStats() != null) { callback(responseCode, playerStatsResponse.PlayerStats().AsPlayerStats()); } else { callback(responseCode, new PlayerStats()); } } }); }
private VideoCaptureState FromNativeVideoCaptureState(NativeVideoCaptureState captureState) { return(new VideoCaptureState(captureState.IsCapturing(), ConversionUtils.ConvertNativeVideoCaptureMode(captureState.CaptureMode()), ConversionUtils.ConvertNativeVideoQualityLevel(captureState.QualityLevel()), captureState.IsOverlayVisible(), captureState.IsPaused())); }
public void RegisterCaptureOverlayStateChangedListener(CaptureOverlayStateListener listener) { Misc.CheckNotNull(listener); GooglePlayGames.Native.PInvoke.CaptureOverlayStateListenerHelper helper = GooglePlayGames.Native.PInvoke.CaptureOverlayStateListenerHelper.Create().SetOnCaptureOverlayStateChangedCallback(delegate(Types.VideoCaptureOverlayState response) { listener.OnCaptureOverlayStateChanged(ConversionUtils.ConvertNativeVideoCaptureOverlayState(response)); }); mManager.RegisterCaptureOverlayStateChangedListener(helper); }
public void RegisterCaptureOverlayStateChangedListener(CaptureOverlayStateListener listener) { Misc.CheckNotNull(listener); CaptureOverlayStateListenerHelper helper = CaptureOverlayStateListenerHelper.Create() .SetOnCaptureOverlayStateChangedCallback( response => { listener.OnCaptureOverlayStateChanged(ConversionUtils.ConvertNativeVideoCaptureOverlayState(response)); }); mManager.RegisterCaptureOverlayStateChangedListener(helper); }
public void FetchMatchingState(DataSource source, QuestFetchFlags flags, Action <ResponseStatus, List <IQuest> > callback) { Misc.CheckNotNull(callback); callback = CallbackUtils.ToOnGameThread(callback); mManager.FetchList(ConversionUtils.AsDataSource(source), (int)flags, delegate(GooglePlayGames.Native.PInvoke.QuestManager.FetchListResponse response) { ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(arg, null); } else { callback(arg, response.Data().Cast <IQuest>().ToList()); } }); }
public void IsCaptureAvailable(VideoCaptureMode captureMode, Action <ResponseStatus, bool> callback) { Misc.CheckNotNull(callback); callback = CallbackUtils.ToOnGameThread(callback); mManager.IsCaptureAvailable(ConversionUtils.ConvertVideoCaptureMode(captureMode), delegate(IsCaptureAvailableResponse response) { ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.GetStatus()); if (!response.RequestSucceeded()) { callback(arg, false); } else { callback(arg, response.IsCaptureAvailable()); } }); }
public void FetchEvent(DataSource source, string eventId, Action <ResponseStatus, IEvent> callback) { Misc.CheckNotNull <string>(eventId); Misc.CheckNotNull <Action <ResponseStatus, IEvent> >(callback); this.mEventManager.Fetch(ConversionUtils.AsDataSource(source), eventId, (Action <EventManager.FetchResponse>)(response => { ResponseStatus responseStatus = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(responseStatus, (IEvent)null); } else { callback(responseStatus, (IEvent)response.Data()); } })); }
public void FetchAllEvents(DataSource source, Action <ResponseStatus, List <IEvent> > callback) { Misc.CheckNotNull(callback); callback = CallbackUtils.ToOnGameThread(callback); mEventManager.FetchAll(ConversionUtils.AsDataSource(source), delegate(EventManager.FetchAllResponse response) { ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(arg, new List <IEvent>()); } else { callback(arg, response.Data().Cast <IEvent>().ToList()); } }); }
public void FetchEvent(DataSource source, string eventId, Action <ResponseStatus, IEvent> callback) { Misc.CheckNotNull(eventId); Misc.CheckNotNull(callback); mEventManager.Fetch(ConversionUtils.AsDataSource(source), eventId, delegate(EventManager.FetchResponse response) { ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(arg, null); } else { callback(arg, response.Data()); } }); }
public void FetchMatchingState(GooglePlayGames.BasicApi.DataSource source, QuestFetchFlags flags, Action <GooglePlayGames.BasicApi.ResponseStatus, List <IQuest> > callback) { Misc.CheckNotNull <Action <GooglePlayGames.BasicApi.ResponseStatus, List <IQuest> > >(callback); callback = CallbackUtils.ToOnGameThread <GooglePlayGames.BasicApi.ResponseStatus, List <IQuest> >(callback); this.mManager.FetchList(ConversionUtils.AsDataSource(source), (int)flags, (Action <GooglePlayGames.Native.PInvoke.QuestManager.FetchListResponse>)(response => { GooglePlayGames.BasicApi.ResponseStatus responseStatus = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(responseStatus, (List <IQuest>)null); } else { callback(responseStatus, response.Data().Cast <IQuest>().ToList <IQuest>()); } })); }
public void FetchAllEvents(DataSource source, Action <ResponseStatus, List <IEvent> > callback) { Misc.CheckNotNull <Action <ResponseStatus, List <IEvent> > >(callback); callback = CallbackUtils.ToOnGameThread <ResponseStatus, List <IEvent> >(callback); this.mEventManager.FetchAll(ConversionUtils.AsDataSource(source), (Action <EventManager.FetchAllResponse>)(response => { ResponseStatus responseStatus = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(responseStatus, new List <IEvent>()); } else { callback(responseStatus, response.Data().Cast <IEvent>().ToList <IEvent>()); } })); }
public void GetCaptureState(Action <ResponseStatus, GooglePlayGames.BasicApi.Video.VideoCaptureState> callback) { Misc.CheckNotNull(callback); callback = CallbackUtils.ToOnGameThread(callback); mManager.GetCaptureState(delegate(GetCaptureStateResponse response) { ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.GetStatus()); if (!response.RequestSucceeded()) { callback(arg, null); } else { callback(arg, FromNativeVideoCaptureState(response.GetData())); } }); }
public void GetCaptureState(Action <ResponseStatus, VideoCaptureState> callback) { Misc.CheckNotNull(callback); callback = CallbackUtils.ToOnGameThread(callback); mManager.GetCaptureState( response => { var status = ConversionUtils.ConvertResponseStatus(response.GetStatus()); if (!response.RequestSucceeded()) { callback(status, null); } else { callback(status, FromNativeVideoCaptureState(response.GetData())); } }); }
public void Fetch(DataSource source, string questId, Action <ResponseStatus, IQuest> callback) { Misc.CheckNotNull(questId); Misc.CheckNotNull(callback); callback = CallbackUtils.ToOnGameThread(callback); mManager.Fetch(ConversionUtils.AsDataSource(source), questId, delegate(GooglePlayGames.Native.PInvoke.QuestManager.FetchResponse response) { ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(arg, null); } else { callback(arg, response.Data()); } }); }
public void Fetch(GooglePlayGames.BasicApi.DataSource source, string questId, Action <GooglePlayGames.BasicApi.ResponseStatus, IQuest> callback) { Misc.CheckNotNull <string>(questId); Misc.CheckNotNull <Action <GooglePlayGames.BasicApi.ResponseStatus, IQuest> >(callback); callback = CallbackUtils.ToOnGameThread <GooglePlayGames.BasicApi.ResponseStatus, IQuest>(callback); this.mManager.Fetch(ConversionUtils.AsDataSource(source), questId, (Action <GooglePlayGames.Native.PInvoke.QuestManager.FetchResponse>)(response => { GooglePlayGames.BasicApi.ResponseStatus responseStatus = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(responseStatus, (IQuest)null); } else { callback(responseStatus, (IQuest)response.Data()); } })); }
public void IsCaptureAvailable(VideoCaptureMode captureMode, Action <ResponseStatus, bool> callback) { bubble.CheckNotNull(callback); callback = CallbackUtils.ToOnGameThread(callback); mManager.IsCaptureAvailable(ConversionUtils.ConvertVideoCaptureMode(captureMode), response => { var status = ConversionUtils.ConvertResponseStatus(response.GetStatus()); if (!response.RequestSucceeded()) { callback(status, false); } else { callback(status, response.IsCaptureAvailable()); } }); }
/// <summary> /// Asynchronously retrieves the server auth code for this client. /// </summary> /// <remarks>Note: This function is currently only implemented for Android.</remarks> /// <param name="serverClientId">The Client ID.</param> /// <param name="callback">Callback for response.</param> public void GetServerAuthCode(string serverClientId, Action <CommonStatusCodes, string> callback) { mServices.FetchServerAuthCode(serverClientId, (serverAuthCodeResponse) => { // Translate native errors into CommonStatusCodes. CommonStatusCodes responseCode = ConversionUtils.ConvertResponseStatusToCommonStatus(serverAuthCodeResponse.Status()); // Log errors. if (responseCode != CommonStatusCodes.Success && responseCode != CommonStatusCodes.SuccessCached) { OurUtils.Logger.e("Error loading server auth code: " + serverAuthCodeResponse.Status().ToString()); } // Fill in the code & call the callback. if (callback != null) { callback(responseCode, serverAuthCodeResponse.Code()); } }); }
public void Fetch(DataSource source, string questId, Action <ResponseStatus, IQuest> callback) { Misc.CheckNotNull(questId); Misc.CheckNotNull(callback); callback = CallbackUtils.ToOnGameThread(callback); mManager.Fetch(ConversionUtils.AsDataSource(source), questId, response => { var status = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(status, null); } else { callback(status, response.Data()); } }); }
public void FetchMatchingState(DataSource source, QuestFetchFlags flags, Action <ResponseStatus, List <IQuest> > callback) { Misc.CheckNotNull(callback); callback = CallbackUtils.ToOnGameThread(callback); mManager.FetchList(ConversionUtils.AsDataSource(source), (int)flags, response => { var status = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(status, null); } else { callback(status, response.Data().Cast <IQuest>().ToList()); } }); }
public void FetchEvent(DataSource source, string eventId, Action <ResponseStatus, IEvent> callback) { bubble.CheckNotNull(eventId); bubble.CheckNotNull(callback); mEventManager.Fetch(ConversionUtils.AsDataSource(source), eventId, response => { var responseStatus = ConversionUtils.ConvertResponseStatus(response.ResponseStatus()); if (!response.RequestSucceeded()) { callback(responseStatus, null); } else { callback(responseStatus, response.Data()); } }); }
/// <summary> /// Asynchronously retrieves the server auth code for this client. /// </summary> /// <remarks>Note: This function is currently only implemented for Android.</remarks> /// <param name="serverClientId">The Client ID.</param> /// <param name="callback">Callback for response.</param> public void GetServerAuthCode(string serverClientId, Action <CommonStatusCodes, string> callback) { mServices.FetchServerAuthCode(serverClientId, (serverAuthCodeResponse) => { // Translate native errors into CommonStatusCodes. CommonStatusCodes responseCode = ConversionUtils.ConvertResponseStatusToCommonStatus(serverAuthCodeResponse.Status()); // Log errors. if (responseCode != CommonStatusCodes.Success && responseCode != CommonStatusCodes.SuccessCached) { OurUtils.Logger.e("Error loading server auth code: " + serverAuthCodeResponse.Status().ToString()); } // Fill in the code & call the callback. if (callback != null) { // copy the auth code into managed memory before posting // the callback. string authCode = serverAuthCodeResponse.Code(); PlayGamesHelperObject.RunOnGameThread(() => callback(responseCode, authCode)); } }); }
private GooglePlayGames.BasicApi.Video.VideoCaptureState FromNativeVideoCaptureState(NativeVideoCaptureState captureState) => new GooglePlayGames.BasicApi.Video.VideoCaptureState(captureState.IsCapturing(), ConversionUtils.ConvertNativeVideoCaptureMode(captureState.CaptureMode()), ConversionUtils.ConvertNativeVideoQualityLevel(captureState.QualityLevel()), captureState.IsOverlayVisible(), captureState.IsPaused());