private void Start() { Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "06", "welcome"); PenguinName.text = Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayName; CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); if (!(SceneManager.GetActiveScene().name == "Boot")) { avatarRenderer = GetComponentInChildren <AvatarRenderTextureComponent>(); DataEntityHandle localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle; AvatarAnimationFrame avatarFrame = new AvatarAnimationFrame("Base Layer.Interactions.PassPortPoses_CelebrateAnimation", 0f); if (cPDataEntityCollection.TryGetComponent(localPlayerHandle, out AvatarDetailsData component)) { avatarRenderer.RenderAvatar(component, avatarFrame); } else { avatarRenderer.RenderAvatar(new DCustomEquipment[0], avatarFrame); } } AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); accountFlowData.SkipWelcome = true; StartCoroutine(AutoTransition()); }
public void OnLoginClicked() { AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); accountFlowData.LoginViaRestore = true; Service.Get <EventDispatcher>().AddListener <SessionEvents.ReturnToRestorePurchases>(checkMembership); LoginController.SkipAutoLogin = true; Service.Get <MixLoginCreateService>().LogoutLastSession(); Service.Get <GameStateController>().ShowAccountSystemLogin(); }
public void OnCreateClicked() { if (createController.CheckRegConfigReady()) { Service.Get <ICPSwrveService>().Action("game.account_creation", "submit_clicked"); CoroutineRunner.StopAllForOwner(this); CoroutineRunner.Start(submitActions(), this, "CreateFormSubmitValidation"); } AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); accountFlowData.FlowType = AccountFlowType.create; }
private void onSoftLoginSuccess(ISession session) { AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); accountFlowData.FlowType = AccountFlowType.autologin; if (base.IsInHandledState) { removeListeners(); nextAccountSystemEvent = gameStateController.LoginSuccessEvent; eventDispatcher.AddListener <NetworkControllerEvents.LocalPlayerDataReadyEvent>(onLocalPlayerDataReady); sessionManager.AddMixSession(session); } }
private bool onLocalPlayerDataReady(NetworkControllerEvents.LocalPlayerDataReadyEvent evt) { eventDispatcher.RemoveListener <NetworkControllerEvents.LocalPlayerDataReadyEvent>(onLocalPlayerDataReady); if (!base.IsInHandledState) { return(false); } gameStateController.ShowAccountSystem(nextAccountSystemEvent); AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); accountFlowData.FlowType = AccountFlowType.autologin; return(false); }
private void setDisplayName() { string text = DisplayNameInputField.TextInput.text; string text2 = null; if (referAFriendEnabled) { text2 = ReferrerDisplayNameField.TextInput.text; } AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); accountFlowData.Referrer = text2; createController.UpdateDisplayName(text, text2); }
public virtual void AddMixSession(ISession mixSession, bool canPrepopulateDisplayName = false) { if (mixSession == null) { throw new ArgumentException("Mix Session cannot be null!"); } if (this.mixSession != null) { clearSession(); } this.mixSession = mixSession; accessToken = mixSession.GuestControllerAccessToken; LocalUser = mixSession.LocalUser; localPlayerSwid = LocalUser.Id; setLanguage(); addListeners(); GameSettings gameSettings = Service.Get <GameSettings>(); if (!gameSettings.OfflineMode) { string username = LocalUser.RegistrationProfile.Username; if (string.IsNullOrEmpty(username)) { LocalUser.RefreshProfile(delegate { continueLoginWithOfflineDataCopy(); }); } else { continueLoginWithOfflineDataCopy(); } } else { eventDispatcher.DispatchEvent(new SessionEvents.SessionStartedEvent(accessToken, localPlayerSwid)); } if (LocalUser.RegistrationProfile.DisplayNameProposedStatus != DisplayNameProposedStatus.None || string.IsNullOrEmpty(LocalUser.RegistrationProfile.Username) || !canPrepopulateDisplayName) { return; } LocalUser.ValidateDisplayName(LocalUser.RegistrationProfile.Username, delegate(IValidateDisplayNameResult result) { if (result.Success) { AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); accountFlowData.PreValidatedDisplayNames.Add(LocalUser.RegistrationProfile.Username); } }); }
protected void performLogin(DLoginPayload loginPayload) { if (!isLoggingIn) { loginController.OnLoginError += onLoginError; this.loginPayload = loginPayload; toggleInteraction(isInteractable: false); showGeneralError(string.Empty); CoroutineRunner.StopAllForOwner(this); CoroutineRunner.Start(submitActions(loginPayload), this, "LoginFormSubmitValidation"); AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); accountFlowData.FlowType = AccountFlowType.login; } }
public void ShowGiftMessage(List <ServerAddedReward> rewards) { string text = ""; string bodyText = ""; string i18nText = ""; string tier = ""; if (rewards.Count > 1) { bodyText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B2"); foreach (ServerAddedReward reward in rewards) { ServerAddedReward current = reward; string str = string.Format(Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B2.Header"), current.instanceId); text = text + str + "\n"; } i18nText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B3"); tier = "thankyou_multiple"; } else if (rewards.Count == 1) { ServerAddedReward current = rewards[0]; if (current.instanceId == getCurrentDisplayName()) { AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); text = string.Format(Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referee.A"), accountFlowData.Referrer); bodyText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referee.A1"); i18nText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.PopUp.A"); tier = "welcome"; } else { text = string.Format(Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B.Header"), current.instanceId); bodyText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B.Body"); i18nText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B3"); tier = "thankyou_single"; } } DPrompt data = new DPrompt(text, bodyText, DPrompt.ButtonFlags.OK, null, isModal: true, autoClose: true, isTranslated: true); data.SetText(DPrompt.PROMPT_TEXT_INFO, i18nText, isTranslated: true); Service.Get <ICPSwrveService>().Action("refer_gift_award", tier); Content.LoadAsync(delegate(string path, GameObject prefab) { onFriendshipPromptLoaded(data, prefab); }, FriendshipPromptPrefabContentKey); }
public void OnStateChanged(string state) { if (state == HandledState && rootStateMachine != null) { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); if (cPDataEntityCollection == null || cPDataEntityCollection.LocalPlayerHandle.IsNull) { throw new Exception("Unable to resolve data entity collection"); } bool flag = false; MembershipData component2 = default(MembershipData); if (!cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out ProfileData component) || !cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out component2)) { throw new MissingReferenceException("No profile data or membership data found for local player"); } MembershipService membershipService = Service.Get <MembershipService>(); AccountFlowData accountFlowData = membershipService.GetAccountFlowData(); bool flag2 = Service.Get <SessionManager>().LocalUser.RegistrationProfile.AccountStatus == AccountStatus.AwaitingParentalConsent; bool flag3 = component2.MembershipType == MembershipType.Member; string text; if (!membershipService.IsPurchaseFunnelAvailable()) { text = SkipMembershipEvent; } else if (!flag3 && showAllAccess() && !membershipService.LoginViaMembership) { text = ShowAllAccessEvent; } else if (!flag3 && showAllAccessOver() && !membershipService.LoginViaMembership) { text = ShowAllAccessOverEvent; } else if (flag || (membershipService.LoginViaMembership && !flag3 && !flag2) || (component.IsFirstTimePlayer && !component2.IsMember && !accountFlowData.SkipMembership && !flag2)) { accountFlowData.SkipMembership = true; text = ((!component.IsFirstTimePlayer || membershipService.LoginViaMembership) ? ShowMembershipEvent : EndMembershipFlowEvent); } else { text = SkipMembershipEvent; } Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "22", "check_showmembership", text); rootStateMachine.SendEvent(text); } }
private void Start() { Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "05", "display_name"); createController = GetComponentInParent <AbstractCreateController>(); createController.OnUpdateDisplayNameError += OnUpdateDisplayNameError; referAFriendEnabled = true; if (Service.Get <SessionManager>().LocalUser != null && (Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayNameProposedStatus == DisplayNameProposedStatus.Rejected || (Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayNameProposedStatus == DisplayNameProposedStatus.Pending && Service.Get <SessionManager>().LocalUser.RegistrationProfile.ProposedDisplayName.StartsWith("DNAME-REJ-")))) { Instructions.text = Service.Get <Localizer>().GetTokenTranslation("Account.DisplayName.DisplayNameRejected"); referAFriendEnabled = false; } if (ReferAFriendSection != null) { ReferAFriendSection.SetActive(referAFriendEnabled); } else { referAFriendEnabled = false; } setDisplayNameValid = false; AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); SessionManager sessionManager = Service.Get <SessionManager>(); if (!string.IsNullOrEmpty(sessionManager.LocalUser.RegistrationProfile.Username) && accountFlowData.PreValidatedDisplayNames.Contains(sessionManager.LocalUser.RegistrationProfile.Username)) { DisplayNameInputField.TextInput.text = sessionManager.LocalUser.RegistrationProfile.Username; DisplayNameInputField.HasError = false; DisplayNameInputField.IsValidationComplete = true; setDisplayNameValid = true; } AvatarRenderTextureComponent componentInChildren = GetComponentInChildren <AvatarRenderTextureComponent>(); CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle; AvatarDetailsData component = default(AvatarDetailsData); if (!localPlayerHandle.IsNull && cPDataEntityCollection.TryGetComponent(localPlayerHandle, out component)) { componentInChildren.RenderAvatar(component); } else { componentInChildren.RenderAvatar(new DCustomEquipment[0]); } }
public override IEnumerator Execute(ScriptableActionPlayer player) { accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); if (!isWaiting) { setup(player); isBaseValidationDone = false; isNameSuggestionValidationDone = false; if (accountFlowData.PreValidatedUserNames == null || accountFlowData.PreValidatedUserNames.Count == 0) { numSuggestionRounds = 0; } } loginService = Service.Get <MixLoginCreateService>(); while (loginService.ValidationInProgress) { yield return(null); } loginService.ValidationInProgress = true; loginService.OnValidationSuccess += onValidationSuccess; loginService.OnValidationFailed += onValidationFailed; loginService.ValidateUsernamePassword(inputString, "testing123"); isWaiting = true; sw = new Stopwatch(); sw.Start(); maxTime = 30000; while ((!isBaseValidationDone || !isNameSuggestionValidationDone) && sw.ElapsedMilliseconds < maxTime) { yield return(null); } if (!isBaseValidationDone) { loginService.OnValidationSuccess -= onValidationSuccess; loginService.OnValidationFailed -= onValidationFailed; HasError = false; } if (!isNameSuggestionValidationDone) { loginService.OnValidationSuccess -= onSuggestionValidationSuccess; loginService.OnValidationFailed -= onSuggestionValidationFailed; } isWaiting = false; loginService.ValidationInProgress = false; }
public override void AddMixSession(ISession mixSession, bool canPrepopulateDisplayName = false) { if (mixSession == null) { throw new ArgumentException("Mix Session cannot be null!"); } if (this.mixSession != null) { clearSession(); } this.mixSession = mixSession; accessToken = mixSession.GuestControllerAccessToken; base.LocalUser = mixSession.LocalUser; localPlayerSwid = base.LocalUser.Id; addListeners(); eventDispatcher.DispatchEvent(new SessionEvents.SessionStartedEvent(accessToken, localPlayerSwid)); AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); accountFlowData.PreValidatedDisplayNames.Add(base.LocalUser.RegistrationProfile.Username); }
public override IEnumerator Execute(ScriptableActionPlayer player) { validator = player as InputFieldValidator; inputString = validator.TextInput.text; sessionManager = Service.Get <SessionManager>(); sw = new Stopwatch(); sw.Start(); maxTime = 30000; isBaseValidationDone = false; if (inputString == sessionManager.LocalUser.DisplayName.Text) { HasError = false; yield break; } accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); if (!string.IsNullOrEmpty(inputString) && accountFlowData.PreValidatedDisplayNames.Contains(inputString)) { HasError = false; } if (found != null && found.Contains(inputString)) { HasError = false; yield break; } if (lastInputString != null && inputString == lastInputString) { HasError = true; yield break; } sessionManager.LocalUser.ValidateDisplayNameV2(inputString, onValidateComplete); while (!isBaseValidationDone && sw.ElapsedMilliseconds < maxTime) { yield return(null); } if (!isBaseValidationDone) { HasError = false; } }
public void OnStateChanged(string state) { if (!base.gameObject.IsDestroyed() && state == HandledState && rootStateMachine != null) { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); if (cPDataEntityCollection == null || DataEntityHandle.IsNullValue(cPDataEntityCollection.LocalPlayerHandle)) { Log.LogError(this, "Unable to resolve data entity collection"); } if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out ProfileData component)) { AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); string text = (component.PenguinAgeInDays >= 1 || accountFlowData.SkipWelcome || !component.IsFirstTimePlayer) ? SkipWelcomeEvent : ShowWelcomeEvent; Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "23", "check_showwelcome", text); rootStateMachine.SendEvent(text); } else { Log.LogError(this, "No profile data found for local player"); } } }
public override string GetErrorMessage() { AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); if (i18nErrorMessage == "Acount.Displayname.Validation.AlreadyUsed" && accountFlowData.PreValidatedDisplayNames != null && accountFlowData.PreValidatedDisplayNames.Count() > 0) { i18nErrorMessage = "Acount.Displayname.Validation.AlreadyUsedWithSuggestions"; string text = ""; int num = 0; foreach (string preValidatedDisplayName in accountFlowData.PreValidatedDisplayNames) { text = text + "\n\t<a href=\"#suggestedName\">" + preValidatedDisplayName + "</a>"; if (++num > MaxSuggestedNames) { break; } } string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation(i18nErrorMessage); return(string.Format(tokenTranslation, text)); } return(Service.Get <Localizer>().GetTokenTranslation(i18nErrorMessage)); }
private void OnEnable() { accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); if (accountFlowData.FlowType == AccountFlowType.create) { NoticeContainer.SetActive(value: true); ResendContainer.SetActive(value: false); SentContainer.SetActive(value: false); } else { NoticeContainer.SetActive(value: false); ResendContainer.SetActive(value: true); ResendButton.interactable = true; SentContainer.SetActive(value: false); } sessionManager = Service.Get <SessionManager>(); mixLoginCreateService = Service.Get <MixLoginCreateService>(); Text[] parentEmailTextObjects = ParentEmailTextObjects; foreach (Text text in parentEmailTextObjects) { text.text = sessionManager.LocalUser.RegistrationProfile.ParentEmail; } }
public void MembershipOfferContinueClick() { accountFlowData = membershipService.GetAccountFlowData(); accountFlowData.SkipMembership = true; rootStateMachine.SendEvent(offerContinueEvent); }