//Here we manage the response of the previous request private void HandleAsyncEvent(Sony.NP.NpCallbackEvent callbackEvent) { try { if (callbackEvent.Response != null) { //We got an error response if (callbackEvent.Response.ReturnCodeValue < 0) { Debug.LogError("Response : " + callbackEvent.Response.ConvertReturnCodeToString(callbackEvent.ApiCalled)); } else { //The callback of the event is a trophyUnlock event if (callbackEvent.ApiCalled == Sony.NP.FunctionTypes.TrophyUnlock) { Debug.LogError("Trophy Unlock : " + callbackEvent.Response.ConvertReturnCodeToString(callbackEvent.ApiCalled)); } } } } catch (Sony.NP.NpToolkitException e) { Debug.LogError("Main_OnAsyncEvent Exception = " + e.ExtendedMessage); } }
// NOTE : This is called on the "Sony NP" thread and is independent of the Behaviour update. // This thread is created by the SonyNP.dll when NpToolkit2 is initialised. private void Main_OnAsyncEvent(Sony.NP.NpCallbackEvent callbackEvent) { //Print some useful info on the current event: Debug.LogError("Event: Service = (" + callbackEvent.Service + ") : API Called = (" + callbackEvent.ApiCalled + ") : Request Id = (" + callbackEvent.NpRequestId + ") : Calling User Id = (" + callbackEvent.UserId + ")"); HandleAsyncEvent(callbackEvent); }
public void OnAsyncEvent(Sony.NP.NpCallbackEvent callbackEvent) { if (callbackEvent.Service == Sony.NP.ServiceTypes.Auth) { switch (callbackEvent.ApiCalled) { case Sony.NP.FunctionTypes.AuthGetAuthCode: OutputAuthCode(callbackEvent.Response as Sony.NP.Auth.AuthCodeResponse); break; default: break; } } }