public void AddMappingForcibly(string providerName, string forcingMappingKey, Dictionary <string, object> additionalInfo, int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI(this, callback, "AddMapping(additionalInfo)"); GamebaseCallbackHandler.UnregisterCallback(handle); }
public virtual void ShowAlert(string title, string message, int handle) { GamebaseErrorNotifier.FireNotSupportedAPI( this, "ShowAlert", GamebaseCallbackHandler.GetCallback <GamebaseCallback.VoidDelegate>(handle)); }
public override void Logout(int handle) { if (false == GamebaseUnitySDK.UseWebview) { base.Logout(handle); return; } if (false == CanLogout(handle)) { return; } var requestVO = AuthMessage.GetLogoutMessage(); WebSocket.Instance.Request(requestVO, (response, error) => { GamebaseSystemPopup.Instance.ShowErrorPopup(error); var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.ErrorDelegate>(handle); if (null == callback) { return; } GamebaseCallbackHandler.UnregisterCallback(handle); DataContainer.RemoveData(VOKey.Auth.LOGIN_INFO); Heartbeat.Instance.StopHeartbeat(); callback(null); }); }
public void RequestRetryTransaction(int handle) { GamebaseErrorNotifier.FireNotSupportedAPI( this, "RequestRetryTransaction", GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Purchase.PurchasableRetryTransactionResult> >(handle)); }
public void RequestItemListOfNotConsumed(int handle) { GamebaseErrorNotifier.FireNotSupportedAPI( this, "RequestItemListOfNotConsumed", GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <List <GamebaseResponse.Purchase.PurchasableReceipt> > >(handle)); }
public void RequestItemListAtIAPConsole(int handle) { GamebaseErrorNotifier.FireNotSupportedAPI( this, "RequestItemListAtIAPConsole", GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <List <GamebaseResponse.Purchase.PurchasableItem> > >(handle)); }
public static void SendGamebaseDelegate <T>(NativeMessage message) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <T> >(message.handle); if (callback == null) { return; } if (string.IsNullOrEmpty(message.jsonData)) { callback(default(T), message.GetGamebaseError()); return; } if (typeof(string) == typeof(T)) { callback((T)(object)message.jsonData, message.GetGamebaseError()); return; } var vo = JsonMapper.ToObject <T>(message.jsonData); callback(vo, message.GetGamebaseError()); }
public void AddMapping(Dictionary <string, object> credentialInfo, int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI(this, callback, "AddMapping(credentialInfo)"); GamebaseCallbackHandler.UnregisterCallback(handle); }
private void LoginFailedCallback(int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); GamebaseCallbackHandler.UnregisterCallback(handle); callback(null, new GamebaseError(GamebaseErrorCode.AUTH_IDP_LOGIN_FAILED)); }
public override void ShowWebView(string url, GamebaseRequest.Webview.GamebaseWebViewConfiguration configuration = null, int closeCallbackHandle = -1, List <string> schemeList = null, int schemeEventHandle = -1) { GamebaseCallback.ErrorDelegate closeCallback = null; if (-1 != closeCallbackHandle) { closeCallback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.ErrorDelegate>(closeCallbackHandle); GamebaseCallbackHandler.UnregisterCallback(closeCallbackHandle); } GamebaseCallback.GamebaseDelegate <string> schemeEvent = null; if (-1 != schemeEventHandle) { schemeEvent = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <string> >(schemeEventHandle); GamebaseCallbackHandler.UnregisterCallback(schemeEventHandle); } bool hasAdapter = WebviewAdapterManager.Instance.CreateWebviewAdapter("standalonewebviewadapter"); if (false == hasAdapter) { GamebaseLog.Warn(GamebaseStrings.WEBVIEW_ADAPTER_NOT_FOUND, this); if (null != closeCallback) { closeCallback(new GamebaseError(GamebaseErrorCode.WEBVIEW_UNKNOWN_ERROR, message: GamebaseStrings.WEBVIEW_ADAPTER_NOT_FOUND)); } return; } WebviewAdapterManager.Instance.ShowWebView(url, configuration, closeCallback, schemeList, schemeEvent); }
public void RenewTransferAccount(GamebaseRequest.Auth.TransferAccountRenewConfiguration configuration, int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.TransferAccountInfo> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI(this, callback); GamebaseCallbackHandler.UnregisterCallback(handle); }
public void RemoveMapping(string providerName, int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI(this, callback); GamebaseCallbackHandler.UnregisterCallback(handle); }
public void QueryPush(int handle) { GamebaseErrorNotifier.FireNotSupportedAPI( this, "QueryPush", GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Push.PushConfiguration> >(handle)); }
private IEnumerator Init() { yield return(DisplayLanguage.Instance.DisplayLanguageInitialize()); WebSocket.Instance.Initialize(); yield return(GamebaseCoroutineManager.StartCoroutine(GamebaseGameObjectManager.GameObjectType.CORE_TYPE, WebSocket.Instance.Connect((error) => { GamebaseSystemPopup.Instance.ShowErrorPopup(error); if (error == null) { GamebaseLaunchingImplementation.Instance.RequestLaunchingInfo(initializeHandle); return; } var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Launching.LaunchingInfo> >(initializeHandle); if (callback != null) { error.domain = Domain; callback(null, error); } GamebaseCallbackHandler.UnregisterCallback(initializeHandle); initializeHandle = -1; }))); }
public void RegisterPush(GamebaseRequest.Push.PushConfiguration pushConfiguration, int handle) { GamebaseErrorNotifier.FireNotSupportedAPI( this, "RegisterPush", GamebaseCallbackHandler.GetCallback <GamebaseCallback.ErrorDelegate>(handle)); }
private void LoginWithCredentialInfo(Dictionary <string, object> credentialInfo, int handle) { if (false == CanLogin(handle)) { return; } if (null == credentialInfo || false == credentialInfo.ContainsKey(GamebaseAuthProviderCredential.PROVIDER_NAME) || (false == credentialInfo.ContainsKey(GamebaseAuthProviderCredential.ACCESS_TOKEN) && false == credentialInfo.ContainsKey(GamebaseAuthProviderCredential.AUTHORIZATION_CODE))) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); callback(null, new GamebaseError(GamebaseErrorCode.AUTH_IDP_LOGIN_INVALID_IDP_INFO, Domain)); GamebaseCallbackHandler.UnregisterCallback(handle); return; } var providerName = (string)credentialInfo[GamebaseAuthProviderCredential.PROVIDER_NAME]; var accessToken = string.Empty; var authCode = string.Empty; if (true == credentialInfo.ContainsKey(GamebaseAuthProviderCredential.ACCESS_TOKEN)) { accessToken = (string)credentialInfo[GamebaseAuthProviderCredential.ACCESS_TOKEN]; } if (true == credentialInfo.ContainsKey(GamebaseAuthProviderCredential.AUTHORIZATION_CODE)) { authCode = (string)credentialInfo[GamebaseAuthProviderCredential.AUTHORIZATION_CODE]; } var requestVO = AuthMessage.GetIDPLoginMessage(providerName, accessToken, authCode); RequestGamebaseLogin(requestVO, handle); }
public void TransferAccountWithIdPLogin(string accountId, string accountPassword, int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI(this, callback); GamebaseCallbackHandler.UnregisterCallback(handle); }
public void QueryTransferAccount(int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.TransferAccountInfo> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI(this, callback); GamebaseCallbackHandler.UnregisterCallback(handle); }
private IEnumerator Init() { yield return(DisplayLanguage.Instance.DisplayLanguageInitialize()); WebSocket.Instance.Initialize(); yield return(GamebaseUnitySDKSettings.Instance.StartCoroutine(WebSocket.Instance.Connect((error) => { GamebaseSystemPopup.Instance.ShowErrorPopup(error); if (error == null) { GamebaseLaunchingImplementation.Instance.RequestLaunchingInfo(initializeHandle); return; } var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Launching.LaunchingInfo> >(initializeHandle); if (callback == null) { return; } error.domain = Domain; callback(null, error); }))); }
public void LoginForLastLoggedInProvider(int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI(this, callback); GamebaseCallbackHandler.UnregisterCallback(handle); }
protected bool CanLogin(int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); if (true == GamebaseUnitySDK.IsInitialized) { if (false == CommonGamebaseLaunching.IsPlayable()) { if (null == callback) { GamebaseLog.Warn(GamebaseStrings.AUTH_NOT_PLAYABLE, this); return(false); } GamebaseCallbackHandler.UnregisterCallback(handle); callback(null, new GamebaseError(GamebaseErrorCode.AUTH_NOT_PLAYABLE, Domain)); return(false); } } else { if (null == callback) { GamebaseLog.Warn(GamebaseStrings.NOT_INITIALIZED, this); return(false); } GamebaseCallbackHandler.UnregisterCallback(handle); callback(null, new GamebaseError(GamebaseErrorCode.NOT_INITIALIZED, Domain)); return(false); } if (true == string.IsNullOrEmpty(Gamebase.GetUserID())) { if (false == isAuthenticationAlreadyProgress) { return(true); } else { if (null == callback) { GamebaseLog.Warn(GamebaseStrings.AUTH_ALREADY_IN_PROGRESS_ERROR, this); return(false); } GamebaseCallbackHandler.UnregisterCallback(handle); callback(null, new GamebaseError(GamebaseErrorCode.AUTH_ALREADY_IN_PROGRESS_ERROR, Domain)); return(false); } } if (null == callback) { return(false); } GamebaseCallbackHandler.UnregisterCallback(handle); callback(null, new GamebaseError(GamebaseErrorCode.AUTH_IDP_LOGIN_FAILED, Domain, GamebaseStrings.ALREADY_LOGGED_IN)); return(false); }
private void LoginWithProviderName(string providerName, int handle) { if (false == AuthAdapterManager.Instance.IsSupportedIDP(providerName)) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI( this, callback, string.Format("Login({0})", providerName)); GamebaseCallbackHandler.UnregisterCallback(handle); return; } if (false == CanLogin(handle)) { return; } if (GamebaseAuthProvider.GUEST == providerName) { var requestVO = AuthMessage.GetIDPLoginMessage(providerName); RequestGamebaseLogin(requestVO, handle); return; } bool hasAdapter = AuthAdapterManager.Instance.CreateIDPAdapter(providerName); if (false == hasAdapter) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); callback(null, new GamebaseError(GamebaseErrorCode.AUTH_IDP_LOGIN_FAILED, message: GamebaseStrings.AUTH_ADAPTER_NOT_FOUND_NEED_SETUP)); GamebaseCallbackHandler.UnregisterCallback(handle); } AuthAdapterManager.Instance.IDPLogin((adapterError) => { if (Gamebase.IsSuccess(adapterError)) { var IDPAccessToken = AuthAdapterManager.Instance.GetIDPData <string>(providerName, AuthAdapterManager.MethodName.GET_IDP_ACCESS_TOKEN); var requestVO = AuthMessage.GetIDPLoginMessage(providerName, IDPAccessToken); RequestGamebaseLogin(requestVO, handle); return; } var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); if (null == callback) { return; } GamebaseCallbackHandler.UnregisterCallback(handle); callback(null, new GamebaseError(GamebaseErrorCode.AUTH_IDP_LOGIN_FAILED, Domain, error: adapterError)); AuthAdapterManager.Instance.IDPLogout(providerName); }); }
virtual protected void InvokeCredentialInfoMethod(string providerName, int handle, string methodName, string forcingMappingKey = null) { bool hasAdapter = AuthAdapterManager.Instance.CreateIDPAdapter(providerName); if (hasAdapter == true) { AuthAdapterManager.Instance.GetIDPCredentialInfo(providerName, (credentialInfo, adapterError) => { if (Gamebase.IsSuccess(adapterError) == true) { GamebaseExtraDataHandler.RegisterExtraData(handle, providerName); if (methodName.Equals("Login", StringComparison.Ordinal) == true) { Login(credentialInfo, handle); } else if (methodName.Equals("AddMapping", StringComparison.Ordinal) == true) { AddMapping(credentialInfo, handle); } else if (methodName.Equals("AddMappingForcibly", StringComparison.Ordinal) == true) { AddMappingForcibly(credentialInfo, forcingMappingKey, handle); } } else { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); if (callback == null) { return; } AuthAdapterManager.Instance.IDPLogout(providerName); callback(null, new GamebaseError(GamebaseErrorCode.AUTH_IDP_LOGIN_FAILED, "AndroidGamebaseAuth", error: adapterError)); } }); } else { GamebaseLog.Debug("Call native method", this); if (methodName.Equals("Login", StringComparison.Ordinal) == true) { CallNativeLogin(providerName, handle); } else if (methodName.Equals("AddMapping", StringComparison.Ordinal) == true) { CallNativeMapping(providerName, handle); } else if (methodName.Equals("AddMappingForcibly", StringComparison.Ordinal) == true) { CallNativeMappingForcibly(providerName, forcingMappingKey, handle); } } }
public void Login(Dictionary <string, object> credentialInfo, int handle) { CheckLaunchingStatusExpire(() => { GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> providerLoginCallback = (authToken, error) => { string providerName = string.Empty; if (credentialInfo.ContainsKey(GamebaseAuthProviderCredential.PROVIDER_NAME) == true) { providerName = (string)credentialInfo[GamebaseAuthProviderCredential.PROVIDER_NAME]; } if (Gamebase.IsSuccess(error) == true) { GamebaseIndicatorReport.SetLastLoggedInInfo(providerName, authToken.member.userId); GamebaseIndicatorReport.SendIndicatorData( GamebaseIndicatorReportType.LogType.AUTH, GamebaseIndicatorReportType.StabilityCode.GB_AUTH_LOGIN_SUCCESS, GamebaseIndicatorReportType.LogLevel.INFO, new Dictionary <string, string>() { { GamebaseIndicatorReportType.AdditionalKey.GB_SUB_CATEGORY1, GamebaseIndicatorReportType.SubCategory.LOGIN }, { GamebaseIndicatorReportType.AdditionalKey.GB_LOGIN_IDP, providerName }, { GamebaseIndicatorReportType.AdditionalKey.GB_CREDENTIAL, JsonMapper.ToJson(credentialInfo) } }); } else { GamebaseIndicatorReport.SendIndicatorData( GamebaseIndicatorReportType.LogType.AUTH, GamebaseIndicatorReportType.StabilityCode.GB_AUTH_LOGIN_CANCELED, GamebaseIndicatorReportType.LogLevel.DEBUG, new Dictionary <string, string>() { { GamebaseIndicatorReportType.AdditionalKey.GB_SUB_CATEGORY1, GamebaseIndicatorReportType.SubCategory.LOGIN }, { GamebaseIndicatorReportType.AdditionalKey.GB_LOGIN_IDP, providerName }, { GamebaseIndicatorReportType.AdditionalKey.GB_CREDENTIAL, JsonMapper.ToJson(credentialInfo) } }, error, true); } var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); if (callback != null) { callback(authToken, error); } GamebaseCallbackHandler.UnregisterCallback(handle); }; int providerLoginHandle = GamebaseCallbackHandler.RegisterCallback(providerLoginCallback); LoginWithCredentialInfo(credentialInfo, providerLoginHandle); }); }
public void RequestLaunchingStatus(int handle = -1) { GamebaseLog.Debug("Check Launching Status", this); statusElaspedTime = 0; requestVO.apiId = Lighthouse.API.Launching.ID.GET_LAUNCHING_STATUS; WebSocket.Instance.Request(requestVO, (response, error) => { GamebaseSystemPopup.Instance.ShowErrorPopup(error); if (null != error) { return; } var launchingInfo = DataContainer.GetData <LaunchingResponse.LaunchingInfo>(VOKey.Launching.LAUNCHING_INFO); var launchingStatus = JsonMapper.ToObject <LaunchingResponse.LaunchingStatus>(response); if (launchingInfo.launching.status.code == launchingStatus.launching.status.code) { OnLaunchingInfoCallback(handle); return; } GamebaseLog.Debug("Check Launching Info", this); GamebaseCallback.GamebaseDelegate <GamebaseResponse.Launching.LaunchingInfo> launchingInfoCallback = (launchingInfoTemp, errorTemp) => { var launchingStatusCallback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.DataDelegate <GamebaseResponse.Launching.LaunchingStatus> >(scheduleHandle); if (null != launchingStatusCallback) { var vo = new GamebaseResponse.Launching.LaunchingStatus(); vo.code = launchingStatus.launching.status.code; vo.message = launchingStatus.launching.status.message; launchingStatusCallback(vo); } var observerCallback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ObserverMessage> >(GamebaseObserverManager.Instance.Handle); if (null != observerCallback) { var vo = new GamebaseResponse.SDK.ObserverMessage(); vo.type = GamebaseObserverType.LAUNCHING; vo.data = new System.Collections.Generic.Dictionary <string, object>(); vo.data.Add("code", launchingStatus.launching.status.code); vo.data.Add("message", launchingStatus.launching.status.message); observerCallback(vo); } OnLaunchingInfoCallback(handle); }; int handleTemp = GamebaseCallbackHandler.RegisterCallback(launchingInfoCallback); GetLaunchingInfo(handleTemp); }); }
public static void SendErrorDelegate(NativeMessage message) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.ErrorDelegate>(message.handle); if (callback == null) { return; } callback(message.GetGamebaseError()); }
public void RequestTransfer(string transferKey, int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI( this, "RequestTransfer", callback); GamebaseCallbackHandler.UnregisterCallback(handle); }
public void IssueTransferKey(long expiresIn, int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.TransferKeyInfo> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI( this, "IssueTransferKey", callback); GamebaseCallbackHandler.UnregisterCallback(handle); }
public virtual void Login(string providerName, Dictionary <string, object> additionalInfo, int handle) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); GamebaseErrorNotifier.FireNotSupportedAPI( this, "Login(additionalInfo)", callback); GamebaseCallbackHandler.UnregisterCallback(handle); }
virtual protected void OnAddOnChangedStatusListener(NativeMessage message) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.DataDelegate <GamebaseNetworkType> >(message.handle); if (null == callback) { return; } callback((GamebaseNetworkType)Convert.ToInt32(message.jsonData)); }