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]);
        }
    }
Beispiel #2
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)
        {
            DateTime?expirationDate = rememberedData.AccountData.Banned.Value.ExpirationDate;
            if (!expirationDate.HasValue)
            {
                isBanned = true;
            }
            else if ((rememberedData.AccountData.Banned.Value.ExpirationDate - DateTime.Now).Value.TotalHours >= 0.0)
            {
                isBanned = true;
            }
        }
        updateBannedState(isBanned);
        base.Start();
    }