public static WebSocketRequest.RequestVO GetLaunchingInfoMessage() { var vo = new LaunchingRequest.ReqLaunchingInfoVO(); vo.parameter.appId = GamebaseUnitySDK.AppID; if (string.IsNullOrEmpty(Gamebase.GetUserID())) { vo.parameter.userId = "0"; } else { vo.parameter.userId = Gamebase.GetUserID(); } vo.parameter.clientVersion = GamebaseUnitySDK.AppVersion; vo.parameter.sdkVersion = GamebaseUnitySDK.SDKVersion; vo.parameter.uuid = GamebaseUnitySDK.UUID; vo.parameter.deviceKey = GamebaseUnitySDK.DeviceKey; vo.parameter.osCode = GamebaseUnitySDK.Platform; vo.parameter.osVersion = GamebaseUnitySDK.OsVersion; vo.parameter.deviceModel = GamebaseUnitySDK.DeviceModel; vo.parameter.deviceLanguage = GamebaseUnitySDK.Language; vo.parameter.displayLanguage = GamebaseUnitySDK.DisplayLanguageCode; vo.parameter.deviceCountryCode = GamebaseUnitySDK.CountryCode; vo.parameter.usimCountryCode = "ZZ"; vo.parameter.lcnt = 0; var requestVO = new WebSocketRequest.RequestVO(Lighthouse.API.Launching.PRODUCT_ID, Lighthouse.API.VERSION, GamebaseUnitySDK.AppID); requestVO.parameters = vo.parameter; return(requestVO); }
public static WebSocketRequest.RequestVO GetHeartbeatMessage() { var vo = new LaunchingRequest.HeartBeatVO(); vo.parameter.appId = GamebaseUnitySDK.AppID; vo.payload.appId = GamebaseUnitySDK.AppID; vo.payload.clientVersion = GamebaseUnitySDK.AppVersion; vo.payload.deviceCountryCode = GamebaseUnitySDK.CountryCode; vo.payload.osCode = GamebaseUnitySDK.Platform; if (string.IsNullOrEmpty(Gamebase.GetUserID())) { vo.payload.userId = "0"; } else { vo.payload.userId = Gamebase.GetUserID(); } vo.payload.usimCountryCode = "ZZ"; vo.payload.storeCode = GamebaseUnitySDK.StoreCode; vo.payload.idpCode = GamebaseAnalytics.Instance.IdPCode; vo.payload.deviceModel = GamebaseUnitySDK.DeviceModel; var requestVO = new WebSocketRequest.RequestVO(Lighthouse.API.Presence.PRODUCT_ID, Lighthouse.API.VERSION, GamebaseUnitySDK.AppID); requestVO.apiId = Lighthouse.API.Presence.ID.HEARTBEAT; requestVO.parameters = vo.parameter; requestVO.payload = JsonMapper.ToJson(vo.payload); return(requestVO); }
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 bool IsLoggedin() { if (true == string.IsNullOrEmpty(Gamebase.GetUserID())) { return(false); } return(true); }
public void SetUserMeta(RequestType type) { if (string.IsNullOrEmpty(Gamebase.GetUserID()) == true) { GamebaseLog.Warn("Not LoggedIn", this, "SetUserMeta"); return; } GamebaseLog.Debug( string.Format("SetUserMeta Type : {0}", type.ToString()), this, "SetUserMeta"); AnalyticsRequest.UserMetaVO vo = new AnalyticsRequest.UserMetaVO(); vo.payload.appId = GamebaseUnitySDK.AppID; vo.parameter.userId = Gamebase.GetUserID(); switch (type) { case RequestType.USER_DATA: { vo.payload.userMetaData = MakeUserMetaData(); break; } case RequestType.LEVEL_UP: { vo.payload.userMetaData = MakeLevelUpData(); break; } } var requestVO = new WebSocketRequest.RequestVO(PRODUCT_ID, Lighthouse.API.VERSION, GamebaseUnitySDK.AppID); requestVO.apiId = ID.SET_USER_META; requestVO.payload = JsonMapper.ToJson(vo.payload); requestVO.parameters = vo.parameter; WebSocket.Instance.Request(requestVO, (response, error) => { if (Gamebase.IsSuccess(error) == false) { GamebaseLog.Warn( string.Format( "{0}\n{1}", "Failed request.", GamebaseJsonUtil.ToPrettyJsonString(error)), this, "SetUserMeta"); } }); }
private void SetIapExtraData(string providerName) { GamebaseLog.Debug("SetIapExtraData", this); ToastSdk.UserId = Gamebase.GetUserID(); var userId = Gamebase.GetAuthProviderUserID(providerName); PurchaseAdapterManager.Instance.SetExtraData( new Dictionary <string, string>() { { KEY_IAP_EXTRA_USER_ID, userId } }); }
protected bool CanLogout(int handle) { if (true == string.IsNullOrEmpty(Gamebase.GetUserID())) { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.ErrorDelegate>(handle); if (null == callback) { return(false); } GamebaseCallbackHandler.UnregisterCallback(handle); callback(new GamebaseError(GamebaseErrorCode.NOT_LOGGED_IN, Domain)); return(false); } return(true); }
public GamebaseResponse.Auth.AuthProviderProfile GetAuthProviderProfile(string providerName) { if (GamebaseAuthProvider.GUEST == providerName) { GamebaseLog.Debug("Guest does not have profile information.", this); return(null); } if (true == string.IsNullOrEmpty(Gamebase.GetUserID())) { GamebaseLog.Debug(GamebaseStrings.NOT_LOGGED_IN, this); return(null); } return(AuthAdapterManager.Instance.GetIDPData <GamebaseResponse.Auth.AuthProviderProfile>(providerName, AuthAdapterManager.MethodName.GET_IDP_PROFILE)); }
public static WebSocketRequest.RequestVO GetWithdrawMessage() { var vo = new AuthRequest.WithdrawVO(); vo.parameter.appId = GamebaseUnitySDK.AppID; vo.parameter.userId = Gamebase.GetUserID(); WebSocketRequest.RequestVO requestVO = new WebSocketRequest.RequestVO( Lighthouse.API.Gateway.PRODUCT_ID, Lighthouse.API.VERSION, GamebaseUnitySDK.AppID); requestVO.apiId = Lighthouse.API.Gateway.ID.WITHDRAW; requestVO.parameters = vo.parameter; return(requestVO); }
public static WebSocketRequest.RequestVO GetIssueShortTermTicketMessage(string purpose, int expiresIn) { AuthRequest.IssueShortTermTicketVO vo = new AuthRequest.IssueShortTermTicketVO(); vo.parameter.userId = Gamebase.GetUserID(); vo.parameter.purpose = purpose; vo.parameter.expiresIn = expiresIn; WebSocketRequest.RequestVO requestVO = new WebSocketRequest.RequestVO( Lighthouse.API.Gateway.PRODUCT_ID, Lighthouse.API.VERSION, GamebaseUnitySDK.AppID); requestVO.apiId = Lighthouse.API.Gateway.ID.ISSUE_SHORT_TERM_TICKET; requestVO.parameters = vo.parameter; return(requestVO); }
public void IssueShortTermTicket(int handle) { if (string.IsNullOrEmpty(Gamebase.GetUserID()) == true) { GamebaseLog.Warn("Not LoggedIn", this, "CompletePurchase"); return; } GamebaseLog.Debug("Start", this, "IssueShortTermTicket"); byte[] bytesForEncoding = Encoding.UTF8.GetBytes(ISSUE_SHORT_TERM_TICKET_PURPOSE); string encodedString = Convert.ToBase64String(bytesForEncoding); var requestVO = AuthMessage.GetIssueShortTermTicketMessage(encodedString, ISSUE_SHORT_TERM_TICKET_EXPIRESIN); WebSocket.Instance.Request(requestVO, (response, error) => { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <string> >(handle); if (callback == null) { return; } GamebaseCallbackHandler.UnregisterCallback(handle); if (error == null) { var vo = JsonMapper.ToObject <AuthResponse.IssueShortTermTicketInfo>(response); if (vo.header.isSuccessful == true) { } else { error = GamebaseErrorUtil.CreateGamebaseErrorByServerErrorCode(requestVO.transactionId, requestVO.apiId, vo.header, Domain); } callback(vo.ticket, error); } else { callback(null, error); } }); }
public void CompletePurchase(GamebaseResponse.Purchase.PurchasableReceipt purchasableReceipt) { if (string.IsNullOrEmpty(Gamebase.GetUserID()) == true) { GamebaseLog.Warn("Not LoggedIn", this, "CompletePurchase"); return; } GamebaseLog.Debug("Start", this, "CompletePurchase"); AnalyticsRequest.PurchaseVO vo = new AnalyticsRequest.PurchaseVO(); vo.parameter.userId = Gamebase.GetUserID(); vo.payload.appId = GamebaseUnitySDK.AppID; vo.payload.paySeq = purchasableReceipt.paymentSeq; vo.payload.clientVersion = GamebaseUnitySDK.AppVersion; vo.payload.idPCode = IdPCode; vo.payload.deviceModel = GamebaseUnitySDK.DeviceModel; vo.payload.osCode = GamebaseUnitySDK.Platform; vo.payload.usimCountryCode = "ZZ"; vo.payload.deviceCountryCode = GamebaseUnitySDK.CountryCode; vo.payload.userMetaData = MakeUserMetaData(); var requestVO = new WebSocketRequest.RequestVO(PRODUCT_ID, Lighthouse.API.VERSION, GamebaseUnitySDK.AppID); requestVO.apiId = ID.COMPLETE_PURCHASE; requestVO.parameters = vo.parameter; requestVO.payload = JsonMapper.ToJson(vo.payload); WebSocket.Instance.Request(requestVO, (response, error) => { if (Gamebase.IsSuccess(error) == false) { GamebaseLog.Warn( string.Format( "{0}\n{1}", "Failed request.", GamebaseJsonUtil.ToPrettyJsonString(error)), this, "CompletePurchase"); } }); }
public static WebSocketRequest.RequestVO MakeIntrospectMessage() { var vo = new LaunchingRequest.IntrospectVO(); if (string.IsNullOrEmpty(Gamebase.GetUserID()) == true) { vo.parameter.userId = "0"; } else { vo.parameter.userId = Gamebase.GetUserID(); } vo.parameter.idPCode = GamebaseImplementation.Instance.GetLastLoggedInProvider(); vo.parameter.accessToken = GamebaseImplementation.Instance.GetAccessToken();; var requestVO = new WebSocketRequest.RequestVO(Lighthouse.API.Gateway.PRODUCT_ID, Lighthouse.API.VERSION, GamebaseUnitySDK.AppID); requestVO.apiId = Lighthouse.API.Gateway.ID.INTROSPECT_ACCESS_TOKEN; requestVO.parameters = vo.parameter; return(requestVO); }
private void SetUserIdOfIndicatorReport() { GamebaseLogReport.Instance.SetUserId(Gamebase.GetUserID()); }