Esempio n. 1
0
 private void OnTournamentRankUpdated(TournamentRank oldRank, TournamentRank rank, string tournamentUID)
 {
     if (!this.isLoaded)
     {
         return;
     }
     if (this.currentEventState == TimedEventState.Closing)
     {
         this.endedTierTitleLabel.Text = base.LangController.Get("CONFLICT_YOUR_LEAGUE", new object[0]);
         this.UpdateEndedUI();
     }
     else
     {
         if (this.currentTournamentVO == null || this.currentTournamentVO.Uid != tournamentUID)
         {
             return;
         }
         TournamentTierVO optional      = base.Sdc.GetOptional <TournamentTierVO>(rank.TierUid);
         TournamentTierVO vOForNextTier = TournamentController.GetVOForNextTier(optional);
         TournamentTierVO idForTopTier  = TournamentController.GetIdForTopTier();
         Dictionary <string, TournamentRewardsVO> tierRewardMap = TimedEventPrizeUtils.GetTierRewardMap(this.currentTournamentVO.RewardGroupId);
         TournamentRewardsVO rewardGroup  = null;
         TournamentRewardsVO rewardGroup2 = null;
         TournamentRewardsVO rewardGroup3 = null;
         if (optional != null && vOForNextTier != null && idForTopTier != null && tierRewardMap.TryGetValue(optional.Uid, out rewardGroup) && tierRewardMap.TryGetValue(vOForNextTier.Uid, out rewardGroup2) && tierRewardMap.TryGetValue(idForTopTier.Uid, out rewardGroup3))
         {
             this.UpdateTierInfoUI(optional, optional.Percentage, this.inProgressCurrentTierIconSprite, this.inProgressCurrentTierLabel, this.inProgressCurrentTierPercentLabel);
             this.inProgressCurrentTierPercentLabel.Text = base.LangController.Get("CONFLICT_TIER_PERCENTILE", new object[]
             {
                 Math.Round(rank.Percentile, 2)
             });
             this.UpdateTierInfoUI(vOForNextTier, vOForNextTier.Percentage, this.inProgressNextTierIconSprite, this.inProgressNextTierLabel, this.inProgressNextTierPercentLabel);
             this.UpdateTierInfoUI(idForTopTier, idForTopTier.Percentage, this.inProgressTopTierIconSprite, this.inProgressTopTierLabel, this.inProgressTopTierPercentLabel);
             TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup, this.inProgressCurrentRewardLabel, this.inProgressCurrentRewardSprite, this.inProgressCurrentRewardCrateSprite, this.inProgressCurrentRewardItemCardUnit, this.inProgressCurrentRewardItemCardBasic, this.inProgressCurrentRewardItemCardAdvanced, this.inProgressCurrentRewardItemCardElite, this.currentCrateCount, this.inProgressCurrentRewardDataFragSprite, null);
             TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup2, this.inProgressNextRewardLabel, this.inProgressNextRewardSprite, this.inProgressNextRewardCrateSprite, this.inProgressNextRewardItemCardUnit, this.inProgressNextRewardItemCardBasic, this.inProgressNextRewardItemCardAdvanced, this.inProgressNextRewardItemCardElite, this.nextCrateCount, this.inProgressNextRewardDataFragSprite, null);
             TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup3, this.inProgressTopRewardLabel, this.inProgressTopRewardSprite, this.inProgressTopRewardCrateSprite, this.inProgressTopRewardItemCardUnit, this.inProgressTopRewardItemCardBasic, this.inProgressTopRewardItemCardAdvanced, this.inProgressTopRewardItemCardElite, this.topCrateCount, this.inProgressTopRewardDataFragSprite, null);
             this.AnimateShowNext();
         }
         else
         {
             Service.Logger.ErrorFormat("Unable to load InProgress UI, invalid tiers meta data for tournamentUID: " + tournamentUID, new object[0]);
         }
     }
 }
Esempio n. 2
0
        private void UpdateComingSoonUI()
        {
            TournamentTierVO idForTopTier = TournamentController.GetIdForTopTier();

            if (idForTopTier == null)
            {
                return;
            }
            this.comingSoonTopTierTitle.Text        = base.LangController.Get("CONFLICT_TOP_LEAGUE", new object[0]);
            this.comingSoonTopRewardTitleLabel.Text = base.LangController.Get("CONFLICT_TOP_REWARD", new object[0]);
            this.UpdateTierInfoUI(idForTopTier, idForTopTier.Percentage, this.comingSoonTopTierIcon, this.comingSoonTopTierName, this.comingSoonTopTierPercent);
            Dictionary <string, TournamentRewardsVO> tierRewardMap = TimedEventPrizeUtils.GetTierRewardMap(this.currentTournamentVO.RewardGroupId);

            if (tierRewardMap.ContainsKey(idForTopTier.Uid))
            {
                TournamentRewardsVO rewardGroup = tierRewardMap[idForTopTier.Uid];
                TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup, this.comingSoonTopRewardIconLabel, this.comingSoonTopRewardSprite, this.comingSoonTopRewardCrateSprite, this.comingSoonTopRewardItemCardUnit, this.comingSoonTopRewardItemCardBasic, this.comingSoonTopRewardItemCardAdvanced, this.comingSoonTopRewardItemCardElite, this.comingSoonCrateCount, this.comingSoonTopRewardDataFragIcon, this.comingSoonTopRewardLabel);
                this.AnimateShowNext();
            }
            else
            {
                Service.Logger.ErrorFormat("No Tournament to display reward on planet " + this.screen.viewingPlanetVO.Uid, new object[0]);
            }
        }
        private void SetupCrateReward(string itemUid, TournamentRewardsVO rewardGroup, UXGrid rewardGrid, UXElement rewardItem, string rewardSuffix, CrateFlyoutItemVO crateFlyoutItemVO)
        {
            IDataController dataController = Service.Get <IDataController>();
            CurrentPlayer   currentPlayer  = Service.Get <CurrentPlayer>();
            UXButton        uXButton       = rewardItem as UXButton;
            UXSprite        subElement     = rewardGrid.GetSubElement <UXSprite>(itemUid, "SpriteFragmentIcon" + rewardSuffix);

            UXUtils.HideAllQualityCards(rewardGrid, itemUid, "EquipmentItemCardQ{0}" + rewardSuffix);
            UXElement subElement2 = rewardGrid.GetSubElement <UXElement>(itemUid, "ParticlesTopPrize" + rewardSuffix);

            subElement2.Visible = false;
            uXButton.Enabled    = false;
            subElement.Visible  = false;
            CrateSupplyVO optional = dataController.GetOptional <CrateSupplyVO>(crateFlyoutItemVO.CrateSupplyUid);

            if (optional == null)
            {
                Service.Get <StaRTSLogger>().ErrorFormat("Could not find crate supply {0} for faction {1}", new object[]
                {
                    crateFlyoutItemVO.CrateSupplyUid,
                    currentPlayer.Faction
                });
                return;
            }
            bool     flag        = crateFlyoutItemVO.TournamentTierDisplay3D && optional.Type != SupplyType.Currency && optional.Type != SupplyType.Invalid;
            int      num         = currentPlayer.Map.FindHighestHqLevel();
            UXSprite subElement3 = rewardGrid.GetSubElement <UXSprite>(itemUid, "SpriteReward2D" + rewardSuffix);

            subElement3.Visible = false;
            if (flag)
            {
                IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(optional, num);
                if (iconVOFromCrateSupply != null)
                {
                    UXSprite        subElement4     = rewardGrid.GetSubElement <UXSprite>(itemUid, "SpriteEquipmentItemImage" + rewardSuffix);
                    ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, subElement4, true);
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    ProjectorUtils.GenerateProjector(projectorConfig);
                    if (rewardGroup.TournamentTier == this.tiers[0].Uid)
                    {
                        this.particleElements.Add(subElement2.Root.name);
                    }
                }
                else
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("Could not generate geometry for crate supply {0}", new object[]
                    {
                        optional.Uid
                    });
                }
                uXButton.Tag       = optional;
                uXButton.OnClicked = new UXButtonClickedDelegate(this.OnGuaranteedRewardClicked);
                uXButton.Enabled   = true;
            }
            else
            {
                subElement3.Visible = true;
                int num2 = crateFlyoutItemVO.ListIcons.Length - 1;
                subElement3.SpriteName = crateFlyoutItemVO.ListIcons[num2];
                rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteEquipmentGradient" + rewardSuffix).Visible       = false;
                rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteEquipmentGradientBottom" + rewardSuffix).Visible = false;
                rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteEquipmentImageBkg" + rewardSuffix).Visible       = false;
                rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteFrameHover" + rewardSuffix).Visible = false;
            }
            UXLabel subElement5    = rewardGrid.GetSubElement <UXLabel>(itemUid, "LabelPrizeCount" + rewardSuffix);
            int     rewardAmount   = Service.Get <InventoryCrateRewardController>().GetRewardAmount(optional, num);
            int     num3           = rewardGroup.CrateRewardIds.Length;
            string  text           = this.lang.ThousandsSeparated(rewardAmount * num3);
            string  quantityString = crateFlyoutItemVO.QuantityString;

            if (!string.IsNullOrEmpty(quantityString))
            {
                subElement5.Text = this.lang.Get(quantityString, new object[]
                {
                    text
                });
            }
            else if (rewardAmount > 0)
            {
                subElement5.Text = this.lang.Get("CONFLICT_PRIZE_CRATE_MULTIPLIER", new object[]
                {
                    text
                });
            }
            else
            {
                subElement5.Visible = false;
            }
            int  num4    = -1;
            bool visible = false;

            if (optional.Type == SupplyType.ShardSpecialAttack || optional.Type == SupplyType.ShardTroop)
            {
                ShardVO optional2 = dataController.GetOptional <ShardVO>(optional.RewardUid);
                if (optional2 != null)
                {
                    num4 = (int)optional2.Quality;
                }
            }
            else if (optional.Type == SupplyType.Shard)
            {
                EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(optional.RewardUid);
                if (currentEquipmentDataByID != null)
                {
                    num4    = (int)currentEquipmentDataByID.Quality;
                    visible = true;
                }
            }
            else if (optional.Type == SupplyType.Troop || optional.Type == SupplyType.Hero || optional.Type == SupplyType.SpecialAttack)
            {
                num4 = Service.Get <DeployableShardUnlockController>().GetUpgradeQualityForDeployableUID(optional.RewardUid);
            }
            if (num4 > 0 & flag)
            {
                subElement.Visible    = true;
                subElement.SpriteName = string.Format("icoDataFragQ{0}", new object[]
                {
                    num4
                });
                string text2 = string.Format("SpriteEquipmentImageBkgGridQ{0}", new object[]
                {
                    num4
                });
                rewardGrid.GetSubElement <UXElement>(itemUid, text2 + rewardSuffix).Visible = visible;
                UXUtils.SetCardQuality(this, rewardGrid, itemUid, num4, "EquipmentItemCardQ{0}" + rewardSuffix);
            }
        }
        private void AddTier(TournamentTierVO tierVO, bool isCurrent, int order, Dictionary <string, TournamentRewardsVO> tierRewardMap)
        {
            if (!tierRewardMap.ContainsKey(tierVO.Uid))
            {
                Service.Get <StaRTSLogger>().ErrorFormat("There is no reward found for tier {0}", new object[]
                {
                    tierVO.Uid
                });
                return;
            }
            string    uid        = tierVO.Uid;
            UXElement item       = this.tierGrid.CloneTemplateItem(uid);
            UXElement subElement = this.tierGrid.GetSubElement <UXElement>(uid, "CurrentLeague");

            subElement.Visible = isCurrent;
            if (isCurrent && this.currentPlayerRank != null)
            {
                string  id          = (TimedEventUtils.GetState(this.currentTournamentVO) == TimedEventState.Live) ? "CONFLICT_CURRENT_PERCENTILE" : "CONFLICT_FINAL_PERCENTILE";
                UXLabel subElement2 = this.tierGrid.GetSubElement <UXLabel>(uid, "LabelCurrentLeague");
                subElement2.Text = this.lang.Get(id, new object[]
                {
                    Math.Round(this.currentPlayerRank.Percentile, 2)
                });
            }
            float   percentage  = tierVO.Percentage;
            UXLabel subElement3 = this.tierGrid.GetSubElement <UXLabel>(uid, "LabelRequirements");

            if (percentage < 100f)
            {
                subElement3.Text = this.lang.Get("CONFLICT_TIER_REQ_PERCENTAGE", new object[]
                {
                    percentage
                });
            }
            else
            {
                subElement3.Text = this.lang.Get("CONFLICT_TIER_REQ_ANY", new object[0]);
            }
            UXLabel subElement4 = this.tierGrid.GetSubElement <UXLabel>(uid, "LabelLeagueLevel");

            subElement4.Text = this.lang.Get(tierVO.RankName, new object[0]);
            if (tierVO.Division != null)
            {
                string text = this.lang.Get(tierVO.Division, new object[0]);
                if (!string.IsNullOrEmpty(text) && text.Trim().get_Length() != 0)
                {
                    UXLabel expr_1A0 = subElement4;
                    expr_1A0.Text = expr_1A0.Text + " - " + text;
                }
            }
            UXSprite subElement5 = this.tierGrid.GetSubElement <UXSprite>(uid, "SpriteLeagueIcon");

            subElement5.SpriteName = Service.Get <TournamentController>().GetTierIconName(tierVO);
            TournamentRewardsVO tournamentRewardsVO = tierRewardMap[tierVO.Uid];
            UXGrid        subElement6   = this.tierGrid.GetSubElement <UXGrid>(uid, "GridRewardCards");
            StringBuilder stringBuilder = new StringBuilder(" (");

            stringBuilder.Append(uid);
            stringBuilder.Append(")");
            string text2 = stringBuilder.ToString();

            subElement6.SetTemplateItem("EquipmentItemCard" + text2);
            CrateVO optional = Service.Get <IDataController>().GetOptional <CrateVO>(tournamentRewardsVO.CrateRewardIds[0]);

            if (optional != null)
            {
                IDataController          dataController = Service.Get <IDataController>();
                List <CrateFlyoutItemVO> list           = new List <CrateFlyoutItemVO>();
                CurrentPlayer            currentPlayer  = Service.Get <CurrentPlayer>();
                string[] array = (currentPlayer.Faction == FactionType.Empire) ? optional.FlyoutEmpireItems : optional.FlyoutRebelItems;
                if (array != null)
                {
                    int i   = 0;
                    int num = array.Length;
                    while (i < num)
                    {
                        string            text3     = array[i];
                        CrateFlyoutItemVO optional2 = dataController.GetOptional <CrateFlyoutItemVO>(text3);
                        if (optional2 == null)
                        {
                            Service.Get <StaRTSLogger>().ErrorFormat("CrateInfoModalScreen: FlyoutItemVO Uid {0} not found", new object[]
                            {
                                text3
                            });
                        }
                        else
                        {
                            bool flag = UXUtils.ShouldDisplayCrateFlyoutItem(optional2, CrateFlyoutDisplayType.TournamentTier);
                            if (flag)
                            {
                                PlanetVO optional3      = dataController.GetOptional <PlanetVO>(this.currentTournamentVO.PlanetId);
                                int      currentHqLevel = currentPlayer.Map.FindHighestHqLevel();
                                bool     flag2          = UXUtils.IsValidRewardItem(optional2, optional3, currentHqLevel);
                                if (flag2 && (!optional2.ReqArmory || ArmoryUtils.PlayerHasArmory()) && list.Count <= 5)
                                {
                                    list.Add(optional2);
                                    string    uid2      = optional2.Uid;
                                    UXElement uXElement = subElement6.CloneTemplateItem(uid2);
                                    this.SetupCrateReward(uid2, tournamentRewardsVO, subElement6, uXElement, text2, optional2);
                                    subElement6.AddItem(uXElement, i);
                                }
                            }
                        }
                        i++;
                    }
                }
                else
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("There is no crate data for {0}", new object[]
                    {
                        tournamentRewardsVO.CrateRewardIds[0]
                    });
                }
                UXSprite subElement7 = subElement6.GetSubElement <UXSprite>(uid, "SpriteSupplyPrize");
                RewardUtils.SetCrateIcon(subElement7, optional, AnimState.Closed);
                UXButton subElement8 = subElement6.GetSubElement <UXButton>(uid, "BtnConflictPrize");
                subElement8.OnClicked = new UXButtonClickedDelegate(this.OnCrateClicked);
                subElement8.Tag       = optional.Uid;
                UXLabel subElement9 = subElement6.GetSubElement <UXLabel>(uid, "LabelPrize");
                subElement9.Text = this.lang.Get("CONFLICT_PRIZE_CRATE", new object[]
                {
                    LangUtils.GetCrateDisplayName(optional)
                });
                UXLabel subElement10 = subElement6.GetSubElement <UXLabel>(uid, "LabelPrizeNumber");
                if (tournamentRewardsVO.CrateRewardIds.Length > 1)
                {
                    subElement10.Text = this.lang.Get("CONFLICT_PRIZE_CRATE_MULTIPLIER", new object[]
                    {
                        tournamentRewardsVO.CrateRewardIds.Length
                    });
                }
                else
                {
                    subElement10.Visible = false;
                    subElement6.GetSubElement <UXElement>(uid, "SpritePrizeNumberShadow").Visible = false;
                }
            }
            this.tierGrid.AddItem(item, order);
        }
Esempio n. 5
0
        public static void TrySetupConflictItemRewardView(TournamentRewardsVO rewardGroup, UXLabel prizeLabel, UXSprite iconSprite, UXSprite crateSprite, UXElement basicElement, UXElement advancedElement, UXElement eliteElement, UXLabel crateCountLabel, UXSprite dataFragIcon, UXLabel optionalUnitName)
        {
            IDataController dataController = Service.Get <IDataController>();
            CurrentPlayer   currentPlayer  = Service.Get <CurrentPlayer>();
            string          text           = string.Empty;
            FactionType     faction        = currentPlayer.Faction;

            if (faction != FactionType.Empire)
            {
                if (faction == FactionType.Rebel)
                {
                    text = rewardGroup.RebelGuaranteedReward;
                }
            }
            else
            {
                text = rewardGroup.EmpireGuaranteedReward;
            }
            CrateSupplyVO optional = dataController.GetOptional <CrateSupplyVO>(text);
            Lang          lang     = Service.Get <Lang>();

            if (optional != null)
            {
                UXUtils.TrySetupItemQualityView(optional, basicElement, advancedElement, eliteElement, null);
                int         num = currentPlayer.Map.FindHighestHqLevel();
                IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(optional, num);
                if (iconVOFromCrateSupply != null)
                {
                    ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, iconSprite, true);
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    ProjectorUtils.GenerateProjector(projectorConfig);
                }
                else
                {
                    Service.Get <StaRTSLogger>().ErrorFormat("Could not generate geometry for crate supply {0}", new object[]
                    {
                        optional.Uid
                    });
                }
                if (iconVOFromCrateSupply != null)
                {
                    int shardQualityNumeric = GameUtils.GetShardQualityNumeric(optional);
                    if (shardQualityNumeric > -1)
                    {
                        dataFragIcon.SpriteName = string.Format("icoDataFragQ{0}", new object[]
                        {
                            shardQualityNumeric
                        });
                        dataFragIcon.Visible = true;
                    }
                    else
                    {
                        dataFragIcon.Visible = false;
                    }
                }
                InventoryCrateRewardController inventoryCrateRewardController = Service.Get <InventoryCrateRewardController>();
                int rewardAmount = inventoryCrateRewardController.GetRewardAmount(optional, num);
                if (rewardAmount > 1)
                {
                    string text2 = lang.ThousandsSeparated(rewardAmount);
                    prizeLabel.Text = lang.Get("CONFLICT_PRIZE_CRATE_MULTIPLIER", new object[]
                    {
                        text2
                    });
                }
                else
                {
                    prizeLabel.Visible = false;
                }
                if (optionalUnitName != null)
                {
                    optionalUnitName.Text = inventoryCrateRewardController.GetCrateSupplyRewardName(optional);
                }
            }
            else
            {
                Service.Get <StaRTSLogger>().ErrorFormat("Could not find crate supply {0} for faction {1}", new object[]
                {
                    text,
                    currentPlayer.Faction
                });
            }
            if (crateCountLabel != null)
            {
                crateCountLabel.Visible = false;
            }
            string[] crateRewardIds = rewardGroup.CrateRewardIds;
            CrateVO  crateVO        = null;

            if (crateRewardIds != null)
            {
                if (crateRewardIds.Length != 0)
                {
                    crateVO = dataController.GetOptional <CrateVO>(rewardGroup.CrateRewardIds[0]);
                }
                if (crateCountLabel != null && crateRewardIds.Length > 1)
                {
                    crateCountLabel.Visible = true;
                    crateCountLabel.Text    = lang.Get("CONFLICT_PRIZE_CRATE_MULTIPLIER", new object[]
                    {
                        crateRewardIds.Length
                    });
                }
            }
            if (crateVO != null)
            {
                RewardUtils.SetCrateIcon(crateSprite, crateVO, AnimState.Idle);
                return;
            }
            Service.Get <StaRTSLogger>().ErrorFormat("Missing crate reward meta data for tournament reward:{0}", new object[]
            {
                rewardGroup.Uid
            });
        }