Ejemplo n.º 1
0
        private bool showAllAccess()
        {
            AllAccessService allAccessService = Service.Get <AllAccessService>();

            if (allAccessService.IsAllAccessActive())
            {
                CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
                if (cPDataEntityCollection.TryGetComponent <DisplayNameData>(cPDataEntityCollection.LocalPlayerHandle, out var 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);
        }
        public void LoadData(RememberMeAccountData accountData)
        {
            this.accountData = accountData;
            DisplayName.text = accountData.DisplayName;
            if (AvatarIcon != null)
            {
                AvatarIcon.RenderAvatar(accountData.Outfit, accountData.BodyColor);
            }
            if (MembershipSelector != null)
            {
                int index = 0;
                switch (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(), accountData.DisplayName))
                    {
                        index = 2;
                    }
                    break;
                }
                }
                MembershipSelector.SelectSprite(index);
            }
            if (accountData.Banned.HasValue)
            {
                if (!accountData.Banned.Value.ExpirationDate.HasValue)
                {
                    displayBannedState();
                }
                else if ((accountData.Banned.Value.ExpirationDate - DateTime.Now).Value.TotalHours >= 0.0)
                {
                    displayBannedState();
                }
            }
        }
Ejemplo 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)
            {
                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();
        }