Exemple #1
0
        public static bool TrySetupConflictEndedRewardView(List <string> rewardUids, UXLabel label, UXSprite sprite)
        {
            if (rewardUids == null || rewardUids.Count == 0)
            {
                return(false);
            }
            CrateVO optional = Service.Get <IDataController>().GetOptional <CrateVO>(rewardUids[0]);

            if (optional == null)
            {
                return(false);
            }
            string uid = optional.Uid;

            label.Text = LangUtils.GetCrateDisplayName(uid);
            RewardUtils.SetCrateIcon(sprite, optional, AnimState.Closed);
            return(true);
        }
Exemple #2
0
        protected override void OnScreenLoaded()
        {
            UXLabel element = base.GetElement <UXLabel>("LabelTitleRewardNotif");

            element.Text = this.lang.Get("CRATE_REWARD_POPUP_TITLE", new object[0]);
            UXSprite element2 = base.GetElement <UXSprite>("SpriteReward");

            RewardUtils.SetCrateIcon(element2, this.targetCrateVO, AnimState.Closed);
            string  crateDisplayName = LangUtils.GetCrateDisplayName(this.targetCrateVO);
            UXLabel element3         = base.GetElement <UXLabel>("LabelRewardDescription");

            element3.Text = this.lang.Get("CRATE_REWARD_POPUP_DESC", new object[]
            {
                crateDisplayName
            });
            UXButton element4 = base.GetElement <UXButton>("BtnPrimary");

            element4.OnClicked = new UXButtonClickedDelegate(this.OnPrimaryButtonClicked);
            UXLabel element5 = base.GetElement <UXLabel>("LabelBtnPrimary");

            element5.Text = this.lang.Get("CRATE_REWARD_POPUP_CTA", new object[0]);
            this.InitButtons();
        }
        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);
        }
Exemple #4
0
        private UXElement CreateInventoryGridItem(string id, PrizeType prizeType, string title, string description, int count, IGeometryVO vo, int quality)
        {
            PrizeInventoryItemTag prizeInventoryItemTag = new PrizeInventoryItemTag();
            UXElement             uXElement             = this.itemGrid.CloneTemplateItem(id);

            prizeInventoryItemTag.TileElement = uXElement;
            prizeInventoryItemTag.PrizeID     = id;
            prizeInventoryItemTag.PrizeType   = prizeType;
            uXElement.Tag = prizeInventoryItemTag;
            this.SetupGridItemQuality(id, quality);
            prizeInventoryItemTag.MainElement = this.itemGrid.GetSubElement <UXElement>(id, "ItemInfo");
            UXLabel subElement = this.itemGrid.GetSubElement <UXLabel>(id, "LabelName");

            subElement.Text = title;
            UXButton subElement2 = this.itemGrid.GetSubElement <UXButton>(id, "BtnItemInfo");

            prizeInventoryItemTag.InfoLabel = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemInfo");
            if (!string.IsNullOrEmpty(description) && prizeType != PrizeType.None)
            {
                prizeInventoryItemTag.InfoLabel.Text = description;
                subElement2.Visible   = true;
                subElement2.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked);
                subElement2.Tag       = prizeInventoryItemTag;
            }
            else
            {
                subElement2.Visible = false;
            }
            prizeInventoryItemTag.CountLabel = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemCount");
            UXSprite subElement3 = this.itemGrid.GetSubElement <UXSprite>(id, "SpriteItemImage");

            if (prizeType == PrizeType.None)
            {
                RewardUtils.SetCrateIcon(subElement3, (CrateVO)vo, AnimState.Idle);
            }
            else if (prizeType == PrizeType.Crate)
            {
                RewardUtils.SetCrateIcon(subElement3, (CrateVO)vo, AnimState.Closed);
            }
            else
            {
                RewardUtils.SetRewardIcon(subElement3, vo, AnimationPreference.NoAnimation);
            }
            prizeInventoryItemTag.IconAssetName = vo.IconAssetName;
            UXButton subElement4 = this.itemGrid.GetSubElement <UXButton>(id, "InventoryCard");

            subElement4.OnClicked = new UXButtonClickedDelegate(this.OnTileClicked);
            subElement4.Tag       = prizeInventoryItemTag;
            this.itemGrid.GetSubElement <UXElement>(id, "CountAndBuildTime").Visible = true;
            this.itemGrid.GetSubElement <UXElement>(id, "ContainerJewelNew").Visible = false;
            UXLabel subElement5 = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemExpiration");
            UXLabel subElement6 = this.itemGrid.GetSubElement <UXLabel>(id, "LabelCurrencyAmount");

            subElement6.Visible = false;
            if (prizeType == PrizeType.None)
            {
                prizeInventoryItemTag.CountLabel.Visible = false;
                subElement5.Visible = false;
                subElement6.Text    = description;
                subElement6.Visible = true;
            }
            else if (prizeType == PrizeType.Crate)
            {
                prizeInventoryItemTag.CountLabel.Visible = false;
                CrateData crateData = this.cp.Prizes.Crates.Available[id];
                subElement5.Visible = true;
                UXUtils.SetCrateExpirationTimerLabel(crateData, subElement5, this.lang);
                if (!string.IsNullOrEmpty(crateData.PlanetId))
                {
                    PlanetVO  planetVO    = Service.StaticDataController.Get <PlanetVO>(crateData.PlanetId);
                    UXTexture subElement7 = this.itemGrid.GetSubElement <UXTexture>(id, "TexturePlanet");
                    subElement7.LoadTexture(planetVO.LeaderboardTileTexture);
                }
                if (this.crateTabLastViewedTime < crateData.ReceivedTimeStamp)
                {
                    this.itemGrid.GetSubElement <UXElement>(id, "ContainerJewelNew").Visible = true;
                    this.itemGrid.GetSubElement <UXLabel>(id, "LabelMessageCountNew").Text   = this.lang.Get("CRATE_INVENTORY_CRATE_NEW_BADGE", new object[0]);
                }
                subElement4.Tag = prizeInventoryItemTag;
            }
            else
            {
                prizeInventoryItemTag.CountLabel.Text    = string.Format("x{0}", count);
                prizeInventoryItemTag.CountLabel.Visible = true;
                subElement5.Visible = false;
            }
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemInfo").Visible        = false;
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemRequirement").Visible = false;
            this.itemGrid.GetSubElement <UXSprite>(id, "SpriteItemTimeIcon").Visible  = false;
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelBuildTime").Visible       = false;
            uXElement.Tag = prizeInventoryItemTag;
            return(uXElement);
        }
Exemple #5
0
        protected override void OnScreenLoaded()
        {
            base.InitAnimator();
            string  crateDisplayName = LangUtils.GetCrateDisplayName(this.targetCrateVO);
            UXLabel element          = base.GetElement <UXLabel>("LabelCrateTitle");

            element.Text = crateDisplayName;
            UXSprite element2 = base.GetElement <UXSprite>("SpriteCrateImage");

            RewardUtils.SetCrateIcon(element2, this.targetCrateVO, AnimState.Idle);
            UXLabel element3 = base.GetElement <UXLabel>("LabelRewardsListTitle");

            element3.Text = this.lang.Get("CRATE_FLYOUT_LIST_TITLE", new object[0]);
            UXButton element4 = base.GetElement <UXButton>("BtnCloseCrateInfo");

            element4.OnClicked = new UXButtonClickedDelegate(this.OnCloseCrateInfoButtonClicked);
            UXLabel element5 = base.GetElement <UXLabel>("LabelCratePullAmt");
            int     num      = this.targetCrateVO.SupplyPoolUIDs.Length;

            element5.Text = this.lang.Get("CRATE_FLYOUT_REWARD_COUNT", new object[]
            {
                num
            });
            UXElement element6 = base.GetElement <UXElement>("ContainerCrateCircle");
            UXElement element7 = base.GetElement <UXElement>("ContainerCrateCircleSpecial");

            element7.Visible     = (this.targetLEIVO != null);
            element6.Visible     = !element7.Visible;
            this.labelRewardType = base.GetElement <UXLabel>("LabelRewardTypePreview");
            this.InitPlanetUI();
            this.InitExpirationLabel();
            this.labelRewardChance     = base.GetElement <UXLabel>("LabelChanceTitle");
            this.labelRewardName       = base.GetElement <UXLabel>("LabelRewardNamePreview");
            this.labelRewardAmt        = base.GetElement <UXLabel>("LabelRewardAmt");
            this.spriteRewardIcon      = base.GetElement <UXSprite>("SpriteRewardIcon");
            this.spriteRewardImage     = base.GetElement <UXSprite>("SpriteRewardItemImage");
            this.btnCurrencyLabel      = base.GetElement <UXLabel>("LabelBtnPayCenteredCurrency");
            this.btnCurrencySprite     = base.GetElement <UXSprite>("SpriteBtnPayCenteredCurrency");
            this.discountGroup         = base.GetElement <UXElement>("GroupDiscountBadge");
            this.discountGroup.Visible = false;
            this.InitRewardsGrid();
            base.SetTrigger("Show");
            if (this.filteredFlyoutItems.Count > 0)
            {
                this.SelectRowItemAtIndex(0);
                this.AutoScrollFlyoutRowItem();
            }
            if (this.ModalReason == CrateInfoReason.Reason_Targeted_Offer)
            {
                this.SetupTargetedOfferElements();
                this.discountGroup.Visible = true;
                UXLabel element8 = base.GetElement <UXLabel>("LabelValueStatement");
                UXLabel element9 = base.GetElement <UXLabel>("LabelValueStatement2");
                element8.Text = this.lang.Get("PERCENTAGE", new object[]
                {
                    this.CurrentOffer.Discount.ToString()
                });
                element9.Text = this.lang.Get("TARGETED_BUNDLE_DISCOUNT", new object[0]);
            }
            this.InitCTAUI();
            Service.Get <EventManager>().SendEvent(EventId.ObjectiveCrateInfoScreenOpened, null);
        }
Exemple #6
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
            });
        }