Exemplo n.º 1
0
 private bool showAllAccessOver()
 {
     if (!Service.Get <AllAccessService>().IsAllAccessActive() && AllAccessHelper.ShowAccessEndedFlow())
     {
         AllAccessHelper.SetHasSeenAllAccessEndedFlow();
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
    private bool showAllAccess()
    {
        AllAccessService allAccessService = Service.Get <AllAccessService>();

        if (allAccessService.IsAllAccessActive())
        {
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
            if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out DisplayNameData component))
            {
                string allAccessEventKey = allAccessService.GetAllAccessEventKey();
                if (!AllAccessHelper.HasSeenAllAccessFlow(allAccessEventKey, component.DisplayName))
                {
                    AllAccessHelper.SetHasSeenAllAccessFlow(allAccessEventKey, component.DisplayName);
                    DataEntityHandle         handle = cPDataEntityCollection.AddEntity("AllAccessCelebrationData");
                    AllAccessCelebrationData allAccessCelebrationData = cPDataEntityCollection.AddComponent <AllAccessCelebrationData>(handle);
                    allAccessCelebrationData.ShowAllAccessCelebration = true;
                    return(true);
                }
            }
        }
        return(false);
    }
Exemplo n.º 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)
        {
            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();
    }