void IAuth.Login(Action onComplete, Action onFailure) { GooglePlayLogin(); void GooglePlayLogin() { GooglePlayAuth.Login(PlayFabLogin, onFailure); } void PlayFabLogin() { GooglePlayAuth.GetServerAuthCode( serverAuthCode => { PlayFabSettings.TitleId = PlayFabAuth.TitleId; try { PlayFabClientAPI.LoginWithGoogleAccount( new LoginWithGoogleAccountRequest() { CreateAccount = true, InfoRequestParameters = new GetPlayerCombinedInfoRequestParams() { GetUserAccountInfo = true }, ServerAuthCode = serverAuthCode, TitleId = PlayFabAuth.TitleId }, result => { PlayFabAuth.LoginResult = result; onComplete(); }, error => { PlayFabErrorHandler.Process(error); onFailure(); }); } catch (Exception exception) { ExceptionHandler.Process(exception); onFailure(); } }, onFailure); } }
void IAuth.Logout(Action onComplete, Action onFailure) { PlayFabLogout(); void PlayFabLogout() { PlayFabAuth.Logout(GooglePlayLogout, onFailure); } void GooglePlayLogout() { GooglePlayAuth.Logout(onComplete, onFailure); } }