private static List <DRewardPopupScreen> buildCustomEquipmentScreens(DRewardPopup popupData, bool checkForNonMemberScreens)
        {
            List <DRewardPopupScreen> list = new List <DRewardPopupScreen>();

            if (popupData.RewardData.TryGetValue <EquipmentInstanceReward>(out var rewardable) && !rewardable.IsEmpty())
            {
                DRewardPopupScreenItems dRewardPopupScreenItems = new DRewardPopupScreenItems();
                DReward[] array = new DReward[rewardable.EquipmentInstances.Count];
                bool      isRewardsAllNonMember = false;
                for (int i = 0; i < rewardable.EquipmentInstances.Count; i++)
                {
                    DReward dReward = new DReward();
                    dReward.EquipmentRequest = rewardable.EquipmentInstances[i];
                    array[i] = dReward;
                }
                if (checkForNonMemberScreens)
                {
                    for (int j = 0; j < array.Length; j++)
                    {
                        if (RewardUtils.IsRewardMemberOnly(RewardCategory.equipmentInstances, array[j].EquipmentRequest.definitionId))
                        {
                            isRewardsAllNonMember = false;
                            break;
                        }
                        isRewardsAllNonMember = true;
                    }
                }
                dRewardPopupScreenItems.ItemCategory          = RewardCategory.equipmentInstances;
                dRewardPopupScreenItems.Rewards               = array;
                dRewardPopupScreenItems.IsRewardsAllNonMember = isRewardsAllNonMember;
                list.Add(dRewardPopupScreenItems);
            }
            return(list);
        }
        private static DRewardPopupScreenItems buildItemScreenFromIList(RewardCategory category, IList unlockedItems, DRewardPopup popupData)
        {
            DRewardPopupScreenItems dRewardPopupScreenItems = new DRewardPopupScreenItems();

            DReward[] array = new DReward[unlockedItems.Count];
            for (int i = 0; i < unlockedItems.Count; i++)
            {
                DReward dReward = new DReward();
                dReward.UnlockID = unlockedItems[i];
                array[i]         = dReward;
                dReward.Category = category;
            }
            dRewardPopupScreenItems.ItemCategory    = category;
            dRewardPopupScreenItems.Rewards         = array;
            dRewardPopupScreenItems.RewardPopupType = popupData.PopupType;
            return(dRewardPopupScreenItems);
        }
예제 #3
0
        public override void Init(DRewardPopupScreen screenData, RewardPopupController popupController)
        {
            controller              = popupController;
            this.screenData         = (DRewardPopupScreenItems)screenData;
            RewardCategoryText.text = RewardUtils.GetUnlockText(this.screenData.ItemCategory);
            popupController.RewardChest.ChestAnimator.SetTrigger("LaunchItems");
            isIntroComplete = false;
            loadItems(this.screenData.ItemCategory, this.screenData.Rewards);
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

            if (cPDataEntityCollection.TryGetComponent <MembershipData>(cPDataEntityCollection.LocalPlayerHandle, out var component))
            {
                component.MembershipDataUpdated += onMembershipDataUpdated;
            }
            checkMembershipDisclaimer();
            showMemberStatusIndicator();
            setBackground();
            UnlockedText.SetActive(Service.Get <CPDataEntityCollection>().IsLocalPlayerMember() && !this.screenData.IsRewardsAllNonMember);
        }
        private static DRewardPopupScreenItems buildItemScreenFromDictionary(RewardCategory category, IDictionary unlockedItems, DRewardPopup popupData)
        {
            DRewardPopupScreenItems dRewardPopupScreenItems = new DRewardPopupScreenItems();

            DReward[]             array      = new DReward[unlockedItems.Count];
            int                   num        = 0;
            IDictionaryEnumerator enumerator = unlockedItems.GetEnumerator();

            while (enumerator.MoveNext())
            {
                DReward dReward = new DReward();
                dReward.UnlockID = enumerator.Key;
                dReward.Data     = enumerator.Value;
                dReward.Category = category;
                array[num]       = dReward;
                num++;
            }
            dRewardPopupScreenItems.ItemCategory    = category;
            dRewardPopupScreenItems.Rewards         = array;
            dRewardPopupScreenItems.RewardPopupType = popupData.PopupType;
            return(dRewardPopupScreenItems);
        }
        private static List <DRewardPopupScreen> buildItemScreens(DRewardPopup popupData, bool checkForNonMemberScreens)
        {
            List <DRewardPopupScreen> list = new List <DRewardPopupScreen>();
            Type typeFromHandle            = typeof(IList);
            Type typeFromHandle2           = typeof(int);
            Type typeFromHandle3           = typeof(IDictionary);

            foreach (IRewardable rewardDatum in popupData.RewardData)
            {
                if (rewardDatum is EquipmentInstanceReward || rewardDatum.IsEmpty() || !Enum.IsDefined(typeof(RewardCategory), rewardDatum.RewardType))
                {
                    continue;
                }
                RewardCategory rewardCategory = (RewardCategory)Enum.Parse(typeof(RewardCategory), rewardDatum.RewardType);
                Type           type           = rewardDatum.Reward.GetType();
                if (rewardCategory == RewardCategory.iglooSlots)
                {
                    int num = (int)rewardDatum.Reward;
                    if (num > 0)
                    {
                        DRewardPopupScreenItems dRewardPopupScreenItems = new DRewardPopupScreenItems();
                        DReward[] rewards = new DReward[num];
                        for (int i = 0; i < num; i++)
                        {
                            DReward dReward = new DReward();
                            dReward.Category = rewardCategory;
                        }
                        dRewardPopupScreenItems.ItemCategory    = rewardCategory;
                        dRewardPopupScreenItems.Rewards         = rewards;
                        dRewardPopupScreenItems.RewardPopupType = popupData.PopupType;
                        list.Add(dRewardPopupScreenItems);
                    }
                }
                else if (typeFromHandle.IsAssignableFrom(type))
                {
                    IList list2 = rewardDatum.Reward as IList;
                    if (list2 == null || list2.Count <= 0)
                    {
                        continue;
                    }
                    bool isRewardsAllNonMember = false;
                    DRewardPopupScreenItems dRewardPopupScreenItems = buildItemScreenFromIList(rewardCategory, list2, popupData);
                    if (checkForNonMemberScreens)
                    {
                        for (int i = 0; i < dRewardPopupScreenItems.Rewards.Length; i++)
                        {
                            if (RewardUtils.IsRewardMemberOnly(rewardCategory, dRewardPopupScreenItems.Rewards[i].UnlockID))
                            {
                                isRewardsAllNonMember = false;
                                break;
                            }
                            isRewardsAllNonMember = true;
                        }
                    }
                    dRewardPopupScreenItems.IsRewardsAllNonMember = isRewardsAllNonMember;
                    list.Add(dRewardPopupScreenItems);
                }
                else if (typeFromHandle3.IsAssignableFrom(type))
                {
                    IDictionary dictionary = rewardDatum.Reward as IDictionary;
                    if (dictionary == null || dictionary.Count <= 0)
                    {
                        continue;
                    }
                    bool isRewardsAllNonMember = false;
                    DRewardPopupScreenItems dRewardPopupScreenItems = buildItemScreenFromDictionary(rewardCategory, dictionary, popupData);
                    if (checkForNonMemberScreens)
                    {
                        for (int i = 0; i < dRewardPopupScreenItems.Rewards.Length; i++)
                        {
                            if (RewardUtils.IsRewardMemberOnly(rewardCategory, dRewardPopupScreenItems.Rewards[i].UnlockID))
                            {
                                isRewardsAllNonMember = false;
                                break;
                            }
                            isRewardsAllNonMember = true;
                        }
                    }
                    dRewardPopupScreenItems.IsRewardsAllNonMember = isRewardsAllNonMember;
                    list.Add(dRewardPopupScreenItems);
                }
                else if (type.Equals(typeFromHandle2))
                {
                    int num = (int)rewardDatum.Reward;
                    if (num > 0)
                    {
                        list.Add(buildCountScreen(rewardCategory, num));
                    }
                }
            }
            list.Sort(delegate(DRewardPopupScreen p1, DRewardPopupScreen p2)
            {
                RewardCategory rewardCategory2 = ((!(p1 is DRewardPopupScreenItems)) ? ((DRewardPopupScreenCount)p1).CountCategory : ((DRewardPopupScreenItems)p1).ItemCategory);
                RewardCategory rewardCategory3 = ((!(p2 is DRewardPopupScreenItems)) ? ((DRewardPopupScreenCount)p2).CountCategory : ((DRewardPopupScreenItems)p2).ItemCategory);
                return(rewardCategory2.CompareTo(rewardCategory3));
            });
            return(list);
        }