Пример #1
0
        private void setupSession()
        {
            ILocalUser localUser = Service.Get <SessionManager>().LocalUser;
            string     username  = localUser.RegistrationProfile.Username;

            if (!string.IsNullOrEmpty(username))
            {
                CurrentUsername = username;
                addUsername(username);
                RememberMeData rememberMeData = GetRememberMeData();
                rememberMeData.AccountData = LoadAccountData(username);
                rememberMeData.ResetAccountBan();
            }
        }
        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);
            }
        }
Пример #3
0
        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();
        }