Exemplo n.º 1
0
    protected override DecalDefinition[] filterDefinitions(DecalDefinition[] definitions)
    {
        List <TagDefinition> filterTags = null;

        if (Service.Get <CatalogServiceProxy>().IsCatalogThemeActive())
        {
            CatalogThemeDefinition catalogTheme = Service.Get <CatalogServiceProxy>().GetCatalogTheme();
            if (catalogTheme != null)
            {
                filterTags = catalogTheme.DecalTags.ToList();
            }
        }
        List <DecalDefinition> list = new List <DecalDefinition>();

        if (filterTags != null && filterTags.Count > 0 && definitions != null)
        {
            for (int i = 0; i < definitions.Length; i++)
            {
                List <TagDefinition> list2 = definitions[i].Tags.ToList();
                int tagIndex;
                for (tagIndex = 0; tagIndex < filterTags.Count; tagIndex++)
                {
                    if (list2.Exists((TagDefinition x) => x.Tag == filterTags[tagIndex].Tag) && !list.Contains(definitions[i]))
                    {
                        list.Add(definitions[i]);
                        break;
                    }
                }
            }
            return(list.ToArray());
        }
        return(definitions);
    }
        private void filterDisplayedTemplatesByTags(List <DisplayedTemplate> filterTemplates)
        {
            displayedTemplates.Clear();
            List <TagDefinition> filterTags = null;

            if (Service.Get <CatalogServiceProxy>().IsCatalogThemeActive())
            {
                CatalogThemeDefinition catalogTheme = Service.Get <CatalogServiceProxy>().GetCatalogTheme();
                if (catalogTheme != null)
                {
                    filterTags = catalogTheme.TemplateTags.ToList();
                }
            }
            if (filterTags != null && filterTags.Count > 0)
            {
                for (int i = 0; i < filterTemplates.Count; i++)
                {
                    List <TagDefinition> list = filterTemplates[i].Definition.Tags.ToList();
                    int tagIndex;
                    for (tagIndex = 0; tagIndex < filterTags.Count; tagIndex++)
                    {
                        if (list.Exists((TagDefinition x) => x.Tag == filterTags[tagIndex].Tag) && !displayedTemplates.Contains(filterTemplates[i]))
                        {
                            displayedTemplates.Add(filterTemplates[i]);
                            break;
                        }
                    }
                }
            }
            else
            {
                displayedTemplates.AddRange(filterTemplates);
            }
        }
        private bool onShopItemClickedEvent(CatalogUIEvents.ShopItemClickedEvent evt)
        {
            CatalogThemeDefinition themeByScheduelId  = Service.Get <CatalogServiceProxy>().GetThemeByScheduelId(currentTheme.scheduledThemeChallengeId);
            TemplateDefinition     templateDefinition = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >().Values.ToList().First((TemplateDefinition x) => x.Id == evt.ItemData.equipment.definitionId);

            Service.Get <ICPSwrveService>().Action("clothing_catalog_item", "more_details", themeByScheduelId.Title, templateDefinition.Name, evt.IsAlreadyOwned.ToString());
            return(false);
        }
    private bool onCatalogChallengeSelected(CatalogUIEvents.ShowItemsForThemeEvent evt)
    {
        long scheduledThemeChallengeId           = evt.Theme.scheduledThemeChallengeId;
        CatalogThemeDefinition themeByScheduelId = Service.Get <CatalogServiceProxy>().GetThemeByScheduelId(scheduledThemeChallengeId);

        HeaderText.text = Service.Get <Localizer>().GetTokenTranslation(themeByScheduelId.Title);
        return(false);
    }
Exemplo n.º 5
0
    private void loadCatalogDaily(CurrentThemeData currentTheme)
    {
        CatalogThemeDefinition themeByScheduelId        = Service.Get <CatalogServiceProxy>().GetThemeByScheduelId(currentTheme.scheduledThemeChallengeId);
        TaskDefinition         clothingCatalogChallenge = Service.Get <TaskService>().ClothingCatalogChallenge;

        clothingCatalogChallenge.Title             = themeByScheduelId.Title;
        clothingCatalogChallenge.CompletionMessage = themeByScheduelId.CompleteMessage;
        clothingCatalogChallenge.Description       = themeByScheduelId.Description;
    }
 private bool onAcceptChallengeClickEvent(CatalogUIEvents.AcceptChallengeClickedEvent evt)
 {
     challengeTheme        = evt.Theme;
     showCatalogCustomizer = true;
     ClothingDesignerContext.EventBus.DispatchEvent(new ClothingDesignerEvents.UpdateClothingDesignerTheme(evt.ThemeColors));
     ClothingDesignerContext.EventBus.DispatchEvent(default(ClothingDesignerUIEvents.ChangeStateCustomizer));
     hideCatalog();
     return(false);
 }
        private bool onWearItClickedEvent(CatalogUIEvents.BuyPanelWearItButtonClickedEvent evt)
        {
            CatalogThemeDefinition themeByScheduelId  = Service.Get <CatalogServiceProxy>().GetThemeByScheduelId(currentTheme.scheduledThemeChallengeId);
            TemplateDefinition     templateDefinition = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >().Values.ToList().First((TemplateDefinition x) => x.Id == evt.ItemData.equipment.definitionId);
            bool flag = navCategory == CatalogShopNavEnum.POPULAR;

            Service.Get <ICPSwrveService>().Action("clothing_catalog_item", "wear_it", themeByScheduelId.Title, templateDefinition.Name, flag.ToString());
            return(false);
        }
        public void OnAcceptChallengeClicked()
        {
            Service.Get <ICPSwrveService>().Action("clothing_catalog_challenge", "enter");
            Color[] colorsByIndex = Service.Get <CatalogServiceProxy>().themeColors.GetColorsByIndex(0);
            Model.State = CatalogState.Homepage;
            Service.Get <CatalogServiceProxy>().ActivateCatalogTheme();
            CatalogThemeDefinition catalogTheme = Service.Get <CatalogServiceProxy>().GetCatalogTheme();

            CatalogContext.EventBus.DispatchEvent(new CatalogUIEvents.AcceptChallengeClickedEvent(catalogTheme, colorsByIndex));
        }
        private void setBillboardTheme(CatalogThemeDefinition theme)
        {
            Color[] colorsByIndex = Service.Get <CatalogServiceProxy>().themeColors.GetColorsByIndex(0);
            GoButton.GetComponent <Image>().color = colorsByIndex[0];
            BackgroundImage.color           = colorsByIndex[1];
            TodaysChallengeBackground.color = colorsByIndex[0];
            Localizer localizer = Service.Get <Localizer>();

            ThemeTitle.text       = localizer.GetTokenTranslation(theme.Title);
            ThemeDescription.text = localizer.GetTokenTranslation(theme.Description);
        }
Exemplo n.º 10
0
        private bool onPurchaseClickedEvent(CatalogUIEvents.BuyPanelPurchaseButtonClickedEvent evt)
        {
            CatalogThemeDefinition themeByScheduelId  = Service.Get <CatalogServiceProxy>().GetThemeByScheduelId(currentTheme.scheduledThemeChallengeId);
            TemplateDefinition     templateDefinition = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >().Values.ToList().First((TemplateDefinition x) => x.Id == evt.ItemData.equipment.definitionId);
            string tokenTranslation  = Service.Get <Localizer>().GetTokenTranslation(templateDefinition.Name);
            string tokenTranslation2 = Service.Get <Localizer>().GetTokenTranslation(themeByScheduelId.Title);
            int    level             = Service.Get <ProgressionService>().Level;
            long   cost = evt.ItemData.cost;

            Service.Get <ICPSwrveService>().PurchaseClothing(tokenTranslation, (int)cost, 1, level);
            bool flag = navCategory == CatalogShopNavEnum.POPULAR;

            Service.Get <ICPSwrveService>().Action("clothing_catalog_item", "purchase", tokenTranslation2, tokenTranslation, flag.ToString());
            return(false);
        }
Exemplo n.º 11
0
    private IEnumerator delayedSubmitSuccess(CatalogServiceEvents.ItemSubmissionCompleteEvent evt)
    {
        yield return(new WaitForSeconds(4f));

        CustomizationContext.EventBus.DispatchEvent(default(CustomizerUIEvents.EndPurchaseMoment));
        ClothingDesignerContext.EventBus.DispatchEvent(new ClothingDesignerUIEvents.ShowSubmittedInCatalog(evt.Response.clothingCatalogItemId));
        int coins2 = Service.Get <CPDataEntityCollection>().GetComponent <CoinsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle).Coins;

        if (evt.Response.newCoinTotal > coins2)
        {
            coins2 = (int)evt.Response.newCoinTotal - coins2;
            CatalogThemeDefinition catalogTheme = Service.Get <CatalogServiceProxy>().GetCatalogTheme();
            string tokenTranslation             = Service.Get <Localizer>().GetTokenTranslation(catalogTheme.Title);
            Service.Get <ICPSwrveService>().CoinsGiven(coins2, "rewarded", tokenTranslation, "clothing_catalog_challenge");
            Service.Get <ICPSwrveService>().Action("clothing_catalog_challenge", "submit_outfit", catalogTheme.ToString(), tokenTranslation);
        }
    }
Exemplo n.º 12
0
        private List <DecalDefinition> buildVisibleDecalList(bool isFiltered = true)
        {
            List <DecalDefinition>            list       = new List <DecalDefinition>();
            Dictionary <int, DecalDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, DecalDefinition> >();

            if (dictionary == null)
            {
                Log.LogError(this, "Unable to retrieve the decal definitions.");
                return(new List <DecalDefinition>());
            }
            if (isFiltered)
            {
                TagDefinition[]        filterTags   = null;
                CatalogThemeDefinition catalogTheme = Service.Get <CatalogServiceProxy>().GetCatalogTheme();
                if (catalogTheme != null)
                {
                    filterTags = catalogTheme.DecalTags;
                }
                if (filterTags != null && filterTags.Length > 0)
                {
                    foreach (KeyValuePair <int, DecalDefinition> item in dictionary)
                    {
                        List <TagDefinition> list2 = item.Value.Tags.ToList();
                        int tagIndex;
                        for (tagIndex = 0; tagIndex < filterTags.Length; tagIndex++)
                        {
                            if (list2.Exists((TagDefinition x) => x.Tag == filterTags[tagIndex].Tag) && !list.Contains(item.Value))
                            {
                                list.Add(item.Value);
                                break;
                            }
                        }
                    }
                    return(list);
                }
            }
            foreach (KeyValuePair <int, DecalDefinition> item2 in dictionary)
            {
                list.Add(item2.Value);
            }
            return(list);
        }
 public void SetChallengeTheme(CurrentThemeData theme, int index)
 {
     themeIndex            = index;
     currentThemeData      = theme;
     catalogChallengeTheme = Service.Get <CatalogServiceProxy>().GetThemeByScheduelId(theme.scheduledThemeChallengeId);
     Color[] colorsByIndex = Service.Get <CatalogServiceProxy>().themeColors.GetColorsByIndex(index);
     if (ButtonImage != null)
     {
         ButtonImage.color = colorsByIndex[0];
     }
     if (BackgroundImage != null)
     {
         BackgroundImage.color = colorsByIndex[1];
     }
     if (CreatorButton != null && CreatorText != null)
     {
         CreatorButton.gameObject.SetActive(value: false);
         if (theme.mostPopularItem.HasValue)
         {
             CreatorButton.gameObject.SetActive(value: true);
             CreatorText.text = theme.mostPopularItem.Value.creatorName;
         }
     }
     if (ThemeTitleText != null)
     {
         ThemeTitleText.text = Service.Get <Localizer>().GetTokenTranslation(catalogChallengeTheme.Title);
     }
     if (TopSellerTitleText != null)
     {
         TopSellerTitleText.enabled = false;
         if (theme.mostPopularItem.HasValue)
         {
             TopSellerTitleText.enabled = true;
         }
     }
 }
Exemplo n.º 14
0
 public AcceptChallengeClickedEvent(CatalogThemeDefinition theme, Color[] themeColors)
 {
     Theme       = theme;
     ThemeColors = themeColors;
 }
        private void PopulateChallengeData(CurrentThemeData currentTheme)
        {
            bool flag = ((currentTheme.userSubmissionClothingCatalogId != 0) ? true : false);

            GoButton.SetActive(!flag);
            SubmittedButton.SetActive(flag);
            Button component = GoButton.transform.parent.GetComponent <Button>();

            if (component != null)
            {
                component.enabled = !flag;
            }
            CatalogThemeDefinition themeByScheduelId = Service.Get <CatalogServiceProxy>().GetThemeByScheduelId(currentTheme.scheduledThemeChallengeId);
            bool flag2 = Service.Get <CPDataEntityCollection>().IsLocalPlayerMember();

            if (themeByScheduelId == null)
            {
                ChallengeMemberLock.transform.parent.gameObject.SetActive(value: false);
                return;
            }
            if (flag2)
            {
                ProgressionService progressionService = Service.Get <ProgressionService>();
                int level = progressionService.Level;
                int num   = 0;
                Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >();
                TagDefinition[]           templateTags          = themeByScheduelId.TemplateTags;
                List <TemplateDefinition> list = new List <TemplateDefinition>();
                foreach (TagDefinition value in templateTags)
                {
                    for (int j = 0; j < dictionary.Values.Count; j++)
                    {
                        TemplateDefinition templateDefinition = dictionary.Values.ToList()[j];
                        if (templateDefinition.Tags.Contains(value) && list.IndexOf(templateDefinition) < 0)
                        {
                            list.Add(templateDefinition);
                        }
                    }
                }
                for (int i = 0; i < list.Count; i++)
                {
                    int unlockLevelFromDefinition = progressionService.GetUnlockLevelFromDefinition(list[i], ProgressionUnlockCategory.equipmentTemplates);
                    if (unlockLevelFromDefinition < num)
                    {
                        num = unlockLevelFromDefinition;
                    }
                }
                ChallengeProgressionLock.SetActive(value: false);
                if (num > level)
                {
                    ChallengeProgressionLock.SetActive(value: true);
                    if (ChallengeProgressionLockText != null)
                    {
                        ChallengeProgressionLockText.text = Service.Get <Localizer>().GetTokenTranslation(num.ToString());
                    }
                }
            }
            else
            {
                ChallengeMemberLock.SetActive(value: false);
                if (ChallengeMemberLock != null)
                {
                    ChallengeMemberLock.SetActive(value: true);
                }
            }
            setBillboardTheme(themeByScheduelId);
            DateTime dateTime = Service.Get <ContentSchedulerService>().PresentTime();
            int      hours    = 24 - dateTime.Hour - 1;
            int      minutes  = 60 - dateTime.Minute - 1;
            int      seconds  = 60 - dateTime.Second - 1;
            TimeSpan timeSpan = new TimeSpan(hours, minutes, seconds);

            endTime        = DateTime.Now + timeSpan;
            isTimerRunning = true;
        }