示例#1
0
    private void Start()
    {
        Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "06", "welcome");
        PenguinName.text = Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayName;
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

        if (!(SceneManager.GetActiveScene().name == "Boot"))
        {
            avatarRenderer = GetComponentInChildren <AvatarRenderTextureComponent>();
            DataEntityHandle     localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle;
            AvatarAnimationFrame avatarFrame       = new AvatarAnimationFrame("Base Layer.Interactions.PassPortPoses_CelebrateAnimation", 0f);
            if (cPDataEntityCollection.TryGetComponent(localPlayerHandle, out AvatarDetailsData component))
            {
                avatarRenderer.RenderAvatar(component, avatarFrame);
            }
            else
            {
                avatarRenderer.RenderAvatar(new DCustomEquipment[0], avatarFrame);
            }
        }
        AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData();

        accountFlowData.SkipWelcome = true;
        StartCoroutine(AutoTransition());
    }
示例#2
0
        private void Start()
        {
            Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().MembershipFunnelName, "05", "membership_thanks");
            membershipController = GetComponentInParent <MembershipController>();
            if (MonoSingleton <NativeAccessibilityManager> .Instance.AccessibilityLevel == NativeAccessibilityLevel.VOICE)
            {
                string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Accessibility.Popup.Title.MembershipThanks");
                MonoSingleton <NativeAccessibilityManager> .Instance.Native.Speak(tokenTranslation);
            }
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
            DataEntityHandle       localPlayerHandle      = cPDataEntityCollection.LocalPlayerHandle;

            if (!(SceneManager.GetActiveScene().name == "Boot"))
            {
                avatarRenderer = GetComponentInChildren <AvatarRenderTextureComponent>();
                if (cPDataEntityCollection.TryGetComponent <AvatarDetailsData>(localPlayerHandle, out var component))
                {
                    avatarRenderer.RenderAvatar(component);
                }
                else
                {
                    avatarRenderer.RenderAvatar(new DCustomEquipment[0]);
                }
            }
        }
 public void ShowStatsButton()
 {
     StatsButton.gameObject.SetActive(value: true);
     BackButton.gameObject.SetActive(value: false);
     if (avatarDetailsData != null)
     {
         avatarRenderTextureComponent.RenderAvatar(avatarDetailsData);
     }
     else
     {
         avatarRenderTextureComponent.RenderAvatar(new DCustomEquipment[0]);
     }
 }
示例#4
0
    private void Start()
    {
        membershipController = GetComponentInParent <MembershipController>();
        membershipController.OnPurchaseRetried += onPurchaseRetried;
        backgroundButtons  = GetComponentInParent <BackgroundButtonsController>();
        showCarrierBilling = membershipController.IsCarrierBillingAvailable();
        string message = showCarrierBilling ? "with_carrier_billing_info" : "regular";

        Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().MembershipFunnelName, "03", "membership_terms", message);
        PenguinName.text = Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayName;
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
        DataEntityHandle       localPlayerHandle      = cPDataEntityCollection.LocalPlayerHandle;

        if (!(SceneManager.GetActiveScene().name == "Boot"))
        {
            avatarRenderer = GetComponentInChildren <AvatarRenderTextureComponent>();
            AvatarAnimationFrame avatarFrame = new AvatarAnimationFrame("Base Layer.Interactions.PassPortPoses_CelebrateAnimation", 0f);
            if (cPDataEntityCollection.TryGetComponent(localPlayerHandle, out AvatarDetailsData component))
            {
                avatarRenderer.RenderAvatar(component, avatarFrame);
            }
            else
            {
                avatarRenderer.RenderAvatar(new DCustomEquipment[0], avatarFrame);
            }
        }
        bool           hasTrialAvailable = true;
        MembershipData component3        = default(MembershipData);

        if (cPDataEntityCollection.TryGetComponent(localPlayerHandle, out ProfileData component2) && cPDataEntityCollection.TryGetComponent(localPlayerHandle, out component3))
        {
            if (component2.IsFirstTimePlayer || SceneManager.GetActiveScene().name != Service.Get <GameStateController>().SceneConfig.HomeSceneName)
            {
                ChangePenguinContainer.SetActive(value: false);
            }
            else
            {
                ChangePenguinContainer.SetActive(value: true);
            }
            hasTrialAvailable = component3.MembershipTrialAvailable;
        }
        membershipController.OnProductsReady += onProductsReady;
        membershipController.GetProduct(hasTrialAvailable);
        if (MonoSingleton <NativeAccessibilityManager> .Instance.AccessibilityLevel == NativeAccessibilityLevel.VOICE)
        {
            string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Accessibility.Popup.Title.MembershipTerms");
            MonoSingleton <NativeAccessibilityManager> .Instance.Native.Speak(tokenTranslation);
        }
    }
示例#5
0
    private void Start()
    {
        Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "05", "display_name");
        createController = GetComponentInParent <AbstractCreateController>();
        createController.OnUpdateDisplayNameError += OnUpdateDisplayNameError;
        referAFriendEnabled = true;
        if (Service.Get <SessionManager>().LocalUser != null && (Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayNameProposedStatus == DisplayNameProposedStatus.Rejected || (Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayNameProposedStatus == DisplayNameProposedStatus.Pending && Service.Get <SessionManager>().LocalUser.RegistrationProfile.ProposedDisplayName.StartsWith("DNAME-REJ-"))))
        {
            Instructions.text   = Service.Get <Localizer>().GetTokenTranslation("Account.DisplayName.DisplayNameRejected");
            referAFriendEnabled = false;
        }
        if (ReferAFriendSection != null)
        {
            ReferAFriendSection.SetActive(referAFriendEnabled);
        }
        else
        {
            referAFriendEnabled = false;
        }
        setDisplayNameValid = false;
        AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData();
        SessionManager  sessionManager  = Service.Get <SessionManager>();

        if (!string.IsNullOrEmpty(sessionManager.LocalUser.RegistrationProfile.Username) && accountFlowData.PreValidatedDisplayNames.Contains(sessionManager.LocalUser.RegistrationProfile.Username))
        {
            DisplayNameInputField.TextInput.text       = sessionManager.LocalUser.RegistrationProfile.Username;
            DisplayNameInputField.HasError             = false;
            DisplayNameInputField.IsValidationComplete = true;
            setDisplayNameValid = true;
        }
        AvatarRenderTextureComponent componentInChildren    = GetComponentInChildren <AvatarRenderTextureComponent>();
        CPDataEntityCollection       cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
        DataEntityHandle             localPlayerHandle      = cPDataEntityCollection.LocalPlayerHandle;
        AvatarDetailsData            component = default(AvatarDetailsData);

        if (!localPlayerHandle.IsNull && cPDataEntityCollection.TryGetComponent(localPlayerHandle, out component))
        {
            componentInChildren.RenderAvatar(component);
        }
        else
        {
            componentInChildren.RenderAvatar(new DCustomEquipment[0]);
        }
    }
    private void Start()
    {
        avatarRenderTextureComponent = GetComponent <AvatarRenderTextureComponent>();
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
        DataEntityHandle       localPlayerHandle      = cPDataEntityCollection.LocalPlayerHandle;

        if (!localPlayerHandle.IsNull)
        {
            if (cPDataEntityCollection.TryGetComponent(localPlayerHandle, out AvatarDetailsData component))
            {
                avatarRenderTextureComponent.RenderAvatar(component);
                return;
            }
            avatarRenderTextureComponent.RenderAvatar(new DCustomEquipment[0]);
            Log.LogError(this, "Local player handle did not have avatar details data");
        }
        else
        {
            Log.LogError(this, "Local player handle was null");
        }
    }
        public void EquipSubmittedItem()
        {
            AvatarDetailsData avatarDetailsData = new AvatarDetailsData();

            DCustomEquipment[] outfit = ((submittedItem.Parts.Length != 0) ? new DCustomEquipment[1] {
                submittedItem
            } : new DCustomEquipment[0]);
            avatarDetailsData.Init(outfit);
            if (!Service.Get <CPDataEntityCollection>().LocalPlayerHandle.IsNull&& Service.Get <CPDataEntityCollection>().TryGetComponent <AvatarDetailsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle, out var component))
            {
                avatarDetailsData.BodyColor = component.BodyColor;
            }
            AvatarRenderTextureComponent.RenderAvatar(avatarDetailsData);
        }
        private void Start()
        {
            Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "16", "restore_membership_success");
            ModalBackground component = GetComponent <ModalBackground>();

            component.enabled = true;
            PenguinName.text  = string.Format(PenguinName.text, Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayName);
            if (!(SceneManager.GetActiveScene().name == "Boot"))
            {
                avatarRenderer = GetComponentInChildren <AvatarRenderTextureComponent>();
                CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
                DataEntityHandle       localPlayerHandle      = cPDataEntityCollection.LocalPlayerHandle;
                AvatarAnimationFrame   avatarFrame            = new AvatarAnimationFrame("Base Layer.Interactions.PassPortPoses_CelebrateAnimation", 0f);
                if (cPDataEntityCollection.TryGetComponent <AvatarDetailsData>(localPlayerHandle, out var component2))
                {
                    avatarRenderer.RenderAvatar(component2, avatarFrame);
                }
                else
                {
                    avatarRenderer.RenderAvatar(new DCustomEquipment[0], avatarFrame);
                }
            }
        }
        protected void SetEquipment()
        {
            DCustomEquipment  dCustomEquipment  = CustomEquipmentResponseAdaptor.ConvertResponseToCustomEquipment(ItemData.equipment);
            AvatarDetailsData avatarDetailsData = new AvatarDetailsData();

            DCustomEquipment[] outfit = ((dCustomEquipment.Parts.Length != 0) ? new DCustomEquipment[1] {
                dCustomEquipment
            } : new DCustomEquipment[0]);
            avatarDetailsData.Init(outfit);
            if (!Service.Get <CPDataEntityCollection>().LocalPlayerHandle.IsNull&& Service.Get <CPDataEntityCollection>().TryGetComponent <AvatarDetailsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle, out var component))
            {
                avatarDetailsData.BodyColor = component.BodyColor;
            }
            AvatarRenderTextureComponent.RenderAvatar(avatarDetailsData);
        }
        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();
                }
            }
        }
示例#11
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();
    }
示例#12
0
 private bool onStatsResponse(CatalogServiceProxyEvents.StatsReponse evt)
 {
     if (isStatsLoading)
     {
         isStatsLoading = false;
         if (Model.State == CatalogState.StatsView)
         {
             shopScroller.ClearScroller();
             stats = evt.Stats;
             if (TotalSold != null)
             {
                 TotalSold.text = stats.TotalItemsSold.ToString();
             }
             if (BestSellerSold != null)
             {
                 try
                 {
                     BestSellerSold.text = stats.StatsItem.numberSold.ToString();
                     if (stats.TotalItemsSold < stats.StatsItem.numberSold)
                     {
                         BestSellerSold.text = stats.TotalItemsSold.ToString();
                     }
                 }
                 catch (Exception ex)
                 {
                     Log.LogErrorFormatted(this, "An error occured when setting best seller sold text. Message: {0}", ex.Message);
                 }
             }
             if (TotalSubmitted != null)
             {
                 TotalSubmitted.text = stats.TotalItemsPurchased.ToString();
             }
             if (stats.StatsData != null)
             {
                 DCustomEquipment[] outfit;
                 if (stats.StatsItem.equipment.parts == null || stats.StatsItem.equipment.parts.Length == 0)
                 {
                     outfit = new DCustomEquipment[0];
                 }
                 else
                 {
                     DCustomEquipment dCustomEquipment = CustomEquipmentResponseAdaptor.ConvertResponseToCustomEquipment(stats.StatsItem.equipment);
                     outfit = new DCustomEquipment[1] {
                         dCustomEquipment
                     };
                 }
                 AvatarDetailsData avatarDetailsData = new AvatarDetailsData();
                 avatarDetailsData.Init(outfit);
                 if (this.avatarDetailsData != null)
                 {
                     avatarDetailsData.BodyColor = this.avatarDetailsData.BodyColor;
                 }
                 AvatarRenderTextureComponent.RenderAvatar(avatarDetailsData);
                 shopScroller.items         = stats.StatsData;
                 shopScroller.filteredItems = stats.StatsData;
                 shopScroller.GenerateScrollData(stats.StatsData);
                 for (int i = 0; i < shopScroller.numShopRows; i++)
                 {
                     shopScroller.Scroller.AddElement(1);
                 }
                 shopScroller.isShopScrollInitialized = true;
                 shopScroller.lastNumShopRows         = shopScroller.numShopRows;
             }
         }
     }
     return(false);
 }
    public void SetUpPlayerCard(DataEntityHandle handle)
    {
        Handle = handle;
        if (this.OnHandleSet != null)
        {
            this.OnHandleSet.InvokeSafe(handle);
        }
        string displayName = dataEntityCollection.GetComponent <DisplayNameData>(handle).DisplayName;

        NameText.text = displayName;
        DetailsController.SetDisplayName(displayName);
        ActionListController.SetName(displayName);
        PassportCodeController.SetDisplayNameText(displayName);
        MembershipSpriteSelector.gameObject.SetActive(value: false);
        OnlineSpriteSelector.gameObject.SetActive(value: false);
        StatusText.gameObject.SetActive(value: false);
        FriendStatus = updateFriendStatus();
        PassportCodeController.gameObject.SetActive(value: false);
        LocalXpPanel.SetActive(value: true);
        if (FriendStatus == FriendStatus.Self)
        {
            if (dataEntityCollection.TryGetComponent(handle, out presenceData))
            {
                setUpPresenceData(presenceData);
            }
            else
            {
                Log.LogError(this, "Couldn't find presence data on the local player");
            }
            if (dataEntityCollection.TryGetComponent(handle, out profileData))
            {
                setUpProfileData(profileData);
            }
            else
            {
                Log.LogError(this, "Couldn't find profile data on the local player");
            }
            if (dataEntityCollection.TryGetComponent(handle, out membershipData))
            {
                setUpMembershipData(membershipData);
            }
            else
            {
                Log.LogError(this, "Couldn't find membership data on the local player");
            }
            coinsData = dataEntityCollection.GetComponent <CoinsData>(handle);
            setCoins(coinsData.Coins);
            coinsData.OnCoinsChanged += setCoins;
        }
        else
        {
            if (dataEntityCollection.TryGetComponent(handle, out presenceData))
            {
                presenceData.PresenceDataUpdated += onPresenceDataUpdated;
                setUpPresenceData(presenceData);
            }
            else
            {
                dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <PresenceData> >(onPresenceDataAdded);
            }
            if (dataEntityCollection.TryGetComponent(handle, out profileData))
            {
                profileData.ProfileDataUpdated += onProfileDataUpdated;
                setUpProfileData(profileData);
            }
            else
            {
                dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <ProfileData> >(onProfileDataAdded);
            }
            if (dataEntityCollection.TryGetComponent(handle, out membershipData))
            {
                membershipData.MembershipDataUpdated += onMembershipDataUpdated;
                setUpMembershipData(membershipData);
            }
            else
            {
                dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <MembershipData> >(onMembershipDataAdded);
            }
            if (dataEntityCollection.TryGetComponent(handle, out SwidData component))
            {
                Service.Get <INetworkServicesManager>().PlayerStateService.GetOtherPlayerDataBySwid(component.Swid);
            }
            else
            {
                Service.Get <INetworkServicesManager>().PlayerStateService.GetOtherPlayerDataByDisplayName(displayName);
            }
        }
        if (dataEntityCollection.TryGetComponent(handle, out AvatarDetailsData component2))
        {
            AvatarRenderTextureComponent.RenderAvatar(component2);
        }
        else
        {
            dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <AvatarDetailsData> >(onAvatarDetailsDataAdded);
        }
    }