Esempio n. 1
0
        private void setRewards()
        {
            ProgressionService progressionService = Service.Get <ProgressionService>();

            YourRewardsText.text = Service.Get <Localizer>().GetTokenTranslation("PartyGames.ScavengerHunt.YourRewards");
            CPRewardDefinition cPRewardDefinition = (isWinner ? ((CPRewardDefinition)scavengerHuntData.WinRewardDefinition) : ((CPRewardDefinition)scavengerHuntData.LoseRewardDefinition));

            CoinText.text = cPRewardDefinition.Coins.Amount.ToString();
            bool flag = false;
            int  num  = 0;

            MascotXPRewardDefinition[] mascotXP = cPRewardDefinition.MascotXP;
            for (int i = 0; i < mascotXP.Length; i++)
            {
                num += mascotXP[i].XP;
                MascotDefinition mascot = mascotXP[i].Mascot;
                flag = progressionService.IsMascotMaxLevel(mascot.name);
            }
            if (num > 0)
            {
                if (flag)
                {
                    XPText.gameObject.SetActive(value: false);
                    MaxLevelText.SetActive(value: true);
                }
                else
                {
                    XPText.text = num.ToString();
                }
            }
            else
            {
                XPPanel.SetActive(value: false);
            }
        }
Esempio n. 2
0
        protected void parseClaimableRewards()
        {
            ClaimedRewardIdsData component = Service.Get <CPDataEntityCollection>().GetComponent <ClaimedRewardIdsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle);
            List <int>           rewardIds = component.RewardIds;
            Dictionary <int, ClaimableRewardDefinition> dictionary = Service.Get <IGameData>().Get <Dictionary <int, ClaimableRewardDefinition> >();
            bool isMember = isLocalPlayerMember();

            for (int i = 0; i < rewardIds.Count; i++)
            {
                if (dictionary.TryGetValue(rewardIds[i], out var value))
                {
                    CPRewardDefinition cPRewardDefinition = value.Reward as CPRewardDefinition;
                    parseRewardDefinition(getRewards(value.Reward), isMember, new SpriteContentKey("Images/ProgressionIcons/Quests_ProgressionLock_Membership"), cPRewardDefinition.ThemeDefinition);
                }
            }
        }
Esempio n. 3
0
        protected virtual void parseItemGroups()
        {
            T[] collection = filterDefinitions(progressionService.GetUnlockedDefinitionsForCategory <T>(UnlockCategory));
            progressionUnlockedRewards = new HashSet <T>(collection);
            bool flag = isLocalPlayerMember();

            for (int i = 0; i <= progressionService.MaxUnlockLevel; i++)
            {
                ProgressionService.UnlockDefinition unlockedDefinitionsForLevel = progressionService.GetUnlockedDefinitionsForLevel(i, UnlockCategory);
                T[]      array = filterDefinitions(unlockedDefinitionsForLevel.Definitions as T[]);
                List <T> list  = new List <T>();
                List <T> list2 = new List <T>();
                List <T> list3 = new List <T>();
                if (array == null || array.Length <= 0)
                {
                    continue;
                }
                for (int j = 0; j < array.Length; j++)
                {
                    if (array[j].IsMemberOnly && !flag)
                    {
                        list.Add(array[j]);
                    }
                    else if (i > progressionService.Level)
                    {
                        list2.Add(array[j]);
                    }
                    else
                    {
                        list3.Add(array[j]);
                    }
                }
                if (list3.Count > 0)
                {
                    addItems(list3.ToArray(), ItemGroup.LockedState.Unlocked, i, null, unlockedDefinitionsForLevel.ThemeDefinition);
                }
                if (list2.Count > 0)
                {
                    addItems(list2.ToArray(), ItemGroup.LockedState.LevelLocked, i, null, unlockedDefinitionsForLevel.ThemeDefinition);
                }
                if (list.Count > 0)
                {
                    addItems(list.ToArray(), ItemGroup.LockedState.MemberLocked, i, null, unlockedDefinitionsForLevel.ThemeDefinition);
                }
                removeUnlocksFromRewardSet(array);
            }
            Dictionary <string, Mascot> questToMascotMap = questService.QuestToMascotMap;

            foreach (QuestDefinition knownQuest in questService.KnownQuests)
            {
                questToMascotMap.TryGetValue(knownQuest.name, out var value);
                if (value == null)
                {
                    continue;
                }
                if (knownQuest.StartReward != null)
                {
                    CPRewardDefinition cPRewardDefinition = knownQuest.StartReward as CPRewardDefinition;
                    parseRewardDefinition(getRewards(knownQuest.StartReward), flag, value.Definition.ProgressionLockedIconContentKey, cPRewardDefinition.ThemeDefinition);
                }
                if (knownQuest.CompleteReward != null)
                {
                    CPRewardDefinition cPRewardDefinition = knownQuest.CompleteReward as CPRewardDefinition;
                    parseRewardDefinition(getRewards(knownQuest.CompleteReward), flag, value.Definition.ProgressionLockedIconContentKey, cPRewardDefinition.ThemeDefinition);
                }
                if (knownQuest.ObjectiveRewards != null)
                {
                    for (int i = 0; i < knownQuest.ObjectiveRewards.Length; i++)
                    {
                        CPRewardDefinition cPRewardDefinition = knownQuest.ObjectiveRewards[i] as CPRewardDefinition;
                        parseRewardDefinition(getRewards(knownQuest.ObjectiveRewards[i]), flag, value.Definition.ProgressionLockedIconContentKey, cPRewardDefinition.ThemeDefinition);
                    }
                }
            }
            parseDisneyShopRewards();
            parseClaimableRewards();
            if (progressionUnlockedRewards.Count > 0)
            {
                if (flag)
                {
                    T[] array2 = new T[progressionUnlockedRewards.Count];
                    progressionUnlockedRewards.CopyTo(array2);
                    addItems(array2, ItemGroup.LockedState.Unlocked, -1);
                }
                else
                {
                    List <T> list4 = new List <T>();
                    List <T> list5 = new List <T>();
                    foreach (T progressionUnlockedReward in progressionUnlockedRewards)
                    {
                        T current2 = progressionUnlockedReward;
                        if (current2.IsMemberOnly)
                        {
                            list4.Add(current2);
                        }
                        else
                        {
                            list5.Add(current2);
                        }
                    }
                    if (list5.Count > 0)
                    {
                        T[] array2 = new T[progressionUnlockedRewards.Count];
                        list5.CopyTo(array2);
                        addItems(array2, ItemGroup.LockedState.Unlocked, -1);
                    }
                    if (list4.Count > 0)
                    {
                        T[] array2 = new T[progressionUnlockedRewards.Count];
                        list4.CopyTo(array2);
                        addItems(array2, ItemGroup.LockedState.MemberLocked, -1);
                    }
                }
            }
            parseUnlockedItems();
        }