private void onRemoveAccount(string username, LoginRememberMeListButton button) { rememberedButtons.Remove(button); button.gameObject.SetActive(value: false); Object.Destroy(button.gameObject); RememberMeService rememberMeService = Service.Get <RememberMeService>(); rememberMeService.RemoveUsername(username); MulticoloredList componentInChildren = GetComponentInChildren <MulticoloredList>(); if (componentInChildren != null) { componentInChildren.Refresh(); } }
private void displayRememberedAccounts() { RememberMeService rememberMeService = Service.Get <RememberMeService>(); List <string> usernames = rememberMeService.Usernames; int count = usernames.Count; List <RememberMeAccountData> list = new List <RememberMeAccountData>(); for (int i = 0; i < count; i++) { RememberMeAccountData item = rememberMeService.LoadAccountData(usernames[i]); list.Add(item); } list.Sort((RememberMeAccountData x, RememberMeAccountData y) => string.Compare(x.DisplayName, y.DisplayName)); for (int i = 0; i < count; i++) { createRememberedButton(list[i]); } }
private void transitionToSingle(string error = "") { RememberMeService rememberMeService = Service.Get <RememberMeService>(); RememberMeData rememberMeData = rememberMeService.GetRememberMeData(); rememberMeData.AccountData = accountData; rememberMeData.GeneralErrorMessage = error; if (!string.IsNullOrEmpty(FSMTarget)) { StateMachineContext componentInParent = GetComponentInParent <StateMachineContext>(); componentInParent.SendEvent(new ExternalEvent(FSMTarget, RememberMeSingleEvent)); } else { StateMachine componentInParent2 = GetComponentInParent <StateMachine>(); componentInParent2.SendEvent(RememberMeSingleEvent); } }
private void onRemoveAccountPromptButtonClicked(DPrompt.ButtonFlags pressed) { if (pressed == DPrompt.ButtonFlags.YES || pressed == DPrompt.ButtonFlags.OK) { RememberMeService rememberMeService = Service.Get <RememberMeService>(); rememberMeService.RemoveUsername(rememberedData.AccountData.Username); GetComponentInParent <BackButtonStateHandler>().MarkCurrentStateInvalid(); if (!string.IsNullOrEmpty(FSMTarget)) { StateMachineContext componentInParent = GetComponentInParent <StateMachineContext>(); componentInParent.SendEvent(new ExternalEvent(FSMTarget, RemovedEvent)); } else { StateMachine componentInParent2 = GetComponentInParent <StateMachine>(); componentInParent2.SendEvent(RemovedEvent); } } }
public override string HandleStateChange() { string result = LoginAccountEvent; RememberMeService rememberMeService = Service.Get <RememberMeService>(); int count = rememberMeService.Usernames.Count; if (!string.IsNullOrEmpty(rememberMeService.CurrentUsername) && !Service.Get <MembershipService>().LoginViaMembership) { result = SoftLoginEvent; } else if (count > 1) { result = MultipleAccountEvent; } else if (count == 1) { result = SingleAccountEvent; } return(result); }
public override void Start() { RememberMeService rememberMeService = Service.Get <RememberMeService>(); rememberedData = rememberMeService.GetRememberMeData(); if (rememberedData.AccountData == null) { string text = rememberMeService.CurrentUsername; if (string.IsNullOrEmpty(text)) { text = rememberMeService.Usernames[0]; } rememberedData.AccountData = rememberMeService.LoadAccountData(text); } string username = rememberedData.AccountData.Username; SoftLoginSelector.IsOn = username == rememberMeService.CurrentUsername && PlatformUtils.GetPlatformType() != PlatformType.Mobile; showGeneralError(rememberedData.GeneralErrorMessage); rememberedData.GeneralErrorMessage = string.Empty; setPasswordValid = false; PasswordField.TextInput.text = rememberedData.AccountData.Password; RememberPassword.isOn = !string.IsNullOrEmpty(PasswordField.TextInput.text); if (!string.IsNullOrEmpty(PasswordField.TextInput.text)) { PasswordField.HasError = false; PasswordField.IsValidationComplete = true; setPasswordValid = true; } AvatarRenderTextureComponent componentInChildren = GetComponentInChildren <AvatarRenderTextureComponent>(); if (componentInChildren != null) { componentInChildren.RenderAvatar(rememberedData.AccountData.Outfit, rememberedData.AccountData.BodyColor); } if (DisplayName != null) { DisplayName.text = rememberedData.AccountData.DisplayName; } if (MembershipSelector != null) { int index = 0; switch (rememberedData.AccountData.MembershipType) { case MembershipType.Member: index = 1; break; case MembershipType.None: case MembershipType.AllAccessEventMember: { AllAccessService allAccessService = Service.Get <AllAccessService>(); if (allAccessService.IsAllAccessActive() && AllAccessHelper.HasSeenAllAccessFlow(allAccessService.GetAllAccessEventKey(), rememberedData.AccountData.DisplayName)) { index = 2; } break; } } MembershipSelector.SelectSprite(index); } bool isBanned = false; if (rememberedData.AccountData.Banned.HasValue) { if (!rememberedData.AccountData.Banned.Value.ExpirationDate.HasValue) { isBanned = true; } else if ((rememberedData.AccountData.Banned.Value.ExpirationDate - DateTime.Now).Value.TotalHours >= 0.0) { isBanned = true; } } updateBannedState(isBanned); base.Start(); }