public void SetIAPRewardIcon(UXSprite iconSprite, string uid) { StaticDataController staticDataController = Service.StaticDataController; InAppPurchaseTypeVO inAppPurchaseTypeVO = staticDataController.Get <InAppPurchaseTypeVO>(uid); string rewardUid = string.Empty; if (Service.CurrentPlayer.Faction == FactionType.Empire) { rewardUid = inAppPurchaseTypeVO.RewardEmpire; } else { rewardUid = inAppPurchaseTypeVO.RewardRebel; } if (inAppPurchaseTypeVO.CurrencyType.Equals("hard") || inAppPurchaseTypeVO.CurrencyType.Equals("pack")) { UXUtils.SetupGeometryForIcon(iconSprite, inAppPurchaseTypeVO.CurrencyIconId); } else { RewardType rewardType = RewardType.Invalid; IGeometryVO config; Service.RewardManager.GetFirstRewardAssetName(rewardUid, ref rewardType, out config); RewardUtils.SetRewardIcon(iconSprite, config, AnimationPreference.NoAnimation); } }
private void InitRewardsGrid() { this.rewardsGrid = base.GetElement <UXGrid>("GridRewards"); this.rewardsGrid.SetTemplateItem("RewardItem"); RewardVO rewardVO = Service.StaticDataController.Get <RewardVO>(this.meta.Reward); List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO); for (int i = 0; i < rewardComponents.Count; i++) { RewardComponentTag rewardComponentTag = rewardComponents[i]; string itemUid = rewardVO.Uid + i; UXElement uXElement = this.rewardsGrid.CloneTemplateItem(itemUid); uXElement.Tag = rewardComponentTag; UXLabel subElement = this.rewardsGrid.GetSubElement <UXLabel>(itemUid, "LabelRewardCount"); subElement.Text = rewardComponentTag.Quantity; RewardType type = rewardComponentTag.Type; UXSprite subElement2; if (type != RewardType.Building && type != RewardType.Currency) { subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUid, "SpriteTroop"); } else { subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUid, "SpriteReward"); } RewardUtils.SetRewardIcon(subElement2, rewardComponentTag.RewardGeometryConfig, AnimationPreference.NoAnimation); this.rewardsGrid.AddItem(uXElement, rewardComponentTag.Order); this.rewardsGrid.RepositionItems(); this.rewardsGrid.Scroll(0.5f); } this.rewardsGrid.RepositionItems(); this.rewardsGrid.Scroll(0.5f); }
private void InitMissionRewardsGrid(string rewardUid, int campaignPoints) { this.rewardsGrid = this.screen.GetElement <UXGrid>("MissionRewardsGrid"); this.rewardsGrid.Clear(); this.rewardsGrid.SetTemplateItem("MissionRewardsItem"); if (string.IsNullOrEmpty(rewardUid) && campaignPoints <= 0) { return; } if (campaignPoints > 0) { string itemUid = "RewardItem0"; UXElement item = this.rewardsGrid.CloneTemplateItem(itemUid); UXLabel subElement = this.rewardsGrid.GetSubElement <UXLabel>(itemUid, "LabelMissionReward"); subElement.Text = base.LangController.Get("CAMPAIGN_POINTS", new object[] { campaignPoints }); UXSprite subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUid, "SpriteMissionReward"); subElement2.Visible = true; subElement2.SpriteName = "icoCampaignPoints"; this.rewardsGrid.AddItem(item, 0); } else { RewardVO rewardVO = base.Sdc.Get <RewardVO>(rewardUid); List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO); int i = 0; int count = rewardComponents.Count; while (i < count) { string itemUid2 = "RewardItem" + i; RewardComponentTag rewardComponentTag = rewardComponents[i]; UXElement item2 = this.rewardsGrid.CloneTemplateItem(itemUid2); UXLabel subElement3 = this.rewardsGrid.GetSubElement <UXLabel>(itemUid2, "LabelMissionReward"); subElement3.Text = base.LangController.Get("CURRENCY_VALUE_NAME", new object[] { rewardComponentTag.Quantity, rewardComponentTag.RewardName }); UXSprite subElement4 = this.rewardsGrid.GetSubElement <UXSprite>(itemUid2, "SpriteMissionReward"); RewardUtils.SetRewardIcon(subElement4, rewardComponentTag.RewardGeometryConfig, AnimationPreference.NoAnimation); this.rewardsGrid.AddItem(item2, i); i++; } } this.rewardsGrid.RepositionItems(); this.rewardsGrid.Scroll(0.5f); }
private void UpdateElements() { IDataController dataController = Service.Get <IDataController>(); if (this.currentOffer != null) { UXLabel element = base.GetElement <UXLabel>("LabelTitle"); element.Text = this.lang.Get(this.currentOffer.Title, new object[0]); UXLabel element2 = base.GetElement <UXLabel>("LabelDescription"); element2.Text = this.lang.Get(this.currentOffer.ConfirmationString, new object[0]); int i = 0; int count = this.currentOffer.RewardUIDs.Count; while (i < count) { RewardVO rewardVO = dataController.Get <RewardVO>(this.currentOffer.RewardUIDs[i]); if (!RewardUtils.SetupTargetedOfferCrateRewardDisplay(rewardVO, this.itemLabels[i], this.itemSprites[i])) { List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO); int j = 0; int count2 = rewardComponents.Count; while (j < count2) { RewardComponentTag rewardComponentTag = rewardComponents[j]; this.itemLabels[i].Text = this.lang.Get("AMOUNT_AND_NAME", new object[] { rewardComponentTag.RewardName, rewardComponentTag.Quantity }); RewardUtils.SetRewardIcon(this.itemSprites[i], rewardComponentTag.RewardGeometryConfig, AnimationPreference.NoAnimation); j++; } } i++; } this.confirmButton.Tag = this.currentOffer; } }
private void UpdateElements() { StaticDataController staticDataController = Service.StaticDataController; TargetedBundleController targetedBundleController = Service.TargetedBundleController; this.currentOffer = targetedBundleController.CurrentTargetedOffer; if (this.currentOffer != null) { UXLabel element = base.GetElement <UXLabel>("LabelTitle"); element.Text = this.lang.Get(this.currentOffer.Title, new object[0]); UXLabel element2 = base.GetElement <UXLabel>("LabelDescription"); element2.Text = this.lang.Get(this.currentOffer.Description, new object[0]); TextureVO optional = staticDataController.GetOptional <TextureVO>("gui_textures_promotional"); if (optional != null) { UXTexture element3 = base.GetElement <UXTexture>("TexturePromoArt"); element3.LoadTexture(optional.AssetName); } optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_entry"); if (optional != null) { UXTexture element4 = base.GetElement <UXTexture>("TextureEnvironmentEntry"); element4.LoadTexture(optional.AssetName); } optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_treads"); if (optional != null) { UXTexture element5 = base.GetElement <UXTexture>("TextureEnvironmentRight"); element5.LoadTexture(optional.AssetName); } optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_treads"); if (optional != null) { UXTexture element6 = base.GetElement <UXTexture>("TextureEnvironmentLeft"); element6.LoadTexture(optional.AssetName); } optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_dust"); if (optional != null) { UXTexture element7 = base.GetElement <UXTexture>("TextureEnvironmentDustRight"); element7.LoadTexture(optional.AssetName); element7 = base.GetElement <UXTexture>("TextureEnvironmentDustLeft"); element7.LoadTexture(optional.AssetName); } int i = 0; int count = this.currentOffer.RewardUIDs.Count; while (i < count) { RewardVO rewardVO = staticDataController.Get <RewardVO>(this.currentOffer.RewardUIDs[i]); if (!RewardUtils.SetupTargetedOfferCrateRewardDisplay(rewardVO, this.itemLabels[i], this.itemSprites[i])) { List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO); int j = 0; int count2 = rewardComponents.Count; while (j < count2) { RewardComponentTag rewardComponentTag = rewardComponents[j]; this.itemLabels[i].Text = this.lang.Get("AMOUNT_AND_NAME", new object[] { rewardComponentTag.RewardName, rewardComponentTag.Quantity }); RewardUtils.SetRewardIcon(this.itemSprites[i], rewardComponentTag.RewardGeometryConfig, AnimationPreference.AnimationAlways); j++; } } i++; } if (targetedBundleController.IsCurrencyCostOffer(this.currentOffer)) { this.SetupCurrencyCostOffer(this.currentOffer); } else { this.SetupIAPLinkedOffer(this.currentOffer); } UXUtils.SetupAnimatedCharacter(this.characterSprite1, this.currentOffer.Character1Image, ref this.charGeometry1); UXUtils.SetupAnimatedCharacter(this.characterSprite2, this.currentOffer.Character2Image, ref this.charGeometry2); uint serverTime = Service.ServerAPI.ServerTime; this.timeRemaining = (int)(targetedBundleController.OfferExpiresAt - serverTime); this.timerLabel.Text = this.lang.Get("expires_in", new object[] { GameUtils.GetTimeLabelFromSeconds(this.timeRemaining) }); this.valueLabel.Text = this.lang.Get("PERCENTAGE", new object[] { this.currentOffer.Discount.ToString() }); this.value2Label.Text = this.lang.Get("TARGETED_BUNDLE_DISCOUNT", new object[] { this.currentOffer.Discount.ToString() }); } else { Service.Logger.Error("No current offer available for targeted bundle screen"); } }
public void InitCampaignGrid() { this.screen.CurrentBackButton = this.backButtonChapter; this.screen.CurrentBackDelegate = new UXButtonClickedDelegate(this.OnBackButtonClicked); this.campaignSelectGroup.Visible = true; if (this.campaignGroupInitialized) { return; } this.campaignGroupInitialized = true; this.campaignGrid = this.screen.GetElement <UXGrid>("CampaignGrid"); this.campaignGrid.SetTemplateItem("CampaignTemplate"); foreach (CampaignVO current in base.Sdc.GetAll <CampaignVO>()) { if (!current.Timed && current.Faction == base.Player.Faction) { string uid = current.Uid; UXElement uXElement = this.campaignGrid.CloneTemplateItem(uid); uXElement.Tag = current; int totalCampaignStarsEarned = base.Player.CampaignProgress.GetTotalCampaignStarsEarned(current); int totalMasteryStars = current.TotalMasteryStars; UXLabel subElement = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelCampaignName"); subElement.Text = LangUtils.GetCampaignTitle(current); UXLabel subElement2 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterDescription"); subElement2.Text = LangUtils.GetCampaignDescription(current); UXLabel subElement3 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelStarsCount"); subElement3.Text = base.LangController.Get("LABEL_CAMPAIGN_STARS", new object[] { totalCampaignStarsEarned, totalMasteryStars }); UXButton subElement4 = this.campaignGrid.GetSubElement <UXButton>(uid, "ButtonCampaignCard"); subElement4.Tag = current; subElement4.OnClicked = new UXButtonClickedDelegate(this.OnCampaignItemButtonClicked); UXTexture subElement5 = this.campaignGrid.GetSubElement <UXTexture>(uid, "SpriteCampaignImage"); subElement5.LoadTexture(current.Uid); if (!base.Player.CampaignProgress.HasCampaign(current)) { subElement4.Enabled = false; } UXSprite subElement6 = this.campaignGrid.GetSubElement <UXSprite>(uid, "SpriteIcoChapterLocked"); subElement6.Visible = !subElement4.Enabled; UXLabel subElement7 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterNumberSelect"); this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterReward").Text = base.LangController.Get("s_Rewards", new object[0]); subElement7.Text = base.LangController.Get("CHAPTER_NUMBER", new object[] { current.UnlockOrder }); UXLabel subElement8 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelObjectivesCount"); UXLabel subElement9 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelCampaignComplete"); UXSprite subElement10 = this.campaignGrid.GetSubElement <UXSprite>(uid, "SpriteIconCheck"); UXLabel subElement11 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelUnlocks"); UXSprite subElement12 = this.campaignGrid.GetSubElement <UXSprite>(uid, "SpriteChapterRewardItem"); UXLabel subElement13 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterRewarded"); int totalCampaignMissionsCompleted = base.Player.CampaignProgress.GetTotalCampaignMissionsCompleted(current); int totalMissions = current.TotalMissions; IGeometryVO config = null; RewardType rewardType = RewardType.Invalid; base.RManager.GetFirstRewardAssetName(current.Reward, ref rewardType, out config); RewardUtils.SetRewardIcon(subElement12, config, AnimationPreference.NoAnimation); if (totalCampaignMissionsCompleted > 0 && totalCampaignMissionsCompleted == totalMissions) { subElement8.Visible = false; subElement9.Text = base.LangController.Get("LABEL_CAMPAIGN_COMPLETE", new object[0]); subElement11.Text = base.RManager.GetRewardString(current.Reward); bool flag = totalCampaignStarsEarned >= totalMasteryStars; subElement13.Visible = flag; subElement12.Visible = !flag; subElement11.Visible = !flag; } else { subElement9.Visible = false; subElement10.Visible = false; subElement8.Text = base.LangController.Get("LABEL_CAMPAIGN_MISSIONS", new object[] { totalCampaignMissionsCompleted, totalMissions }); subElement11.Text = base.RManager.GetRewardString(current.Reward); } UXSlider subElement14 = this.campaignGrid.GetSubElement <UXSlider>(uid, "ChapterPbar"); subElement14.Value = ((totalMissions != 0) ? ((float)totalCampaignMissionsCompleted / (float)totalMissions) : 0f); this.campaignGrid.AddItem(uXElement, current.UnlockOrder); } } this.campaignGrid.RepositionItems(); }
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); }
public void InitCampaignDetailScreen() { UXLabel element = this.screen.GetElement <UXLabel>("LabelCampaignDescription"); element.Text = LangUtils.GetCampaignDescription(this.selectedCampaign); this.campaignDescriptionGroup = this.screen.GetElement <UXElement>("ContainerChapterDescription"); this.campaignDescriptionGroup.Visible = false; UXButton element2 = this.screen.GetElement <UXButton>("BtnChapterInfo"); element2.OnClicked = new UXButtonClickedDelegate(this.OnCampaignInfoButtonClicked); UXLabel element3 = this.screen.GetElement <UXLabel>("LabelCampaigns"); element3.Text = base.LangController.Get("s_ViewAllChapters", new object[0]); UXLabel element4 = this.screen.GetElement <UXLabel>("LabelDetailsTitle"); element4.Text = LangUtils.GetCampaignTitle(this.selectedCampaign); this.missionCountdown = this.screen.GetElement <UXLabel>("Countdown"); this.missionCountdown.Visible = false; UXButton element5 = this.screen.GetElement <UXButton>("BtnViewCampaignRewards"); element5.Visible = false; this.campaignDetailsTimeLeft = this.screen.GetElement <UXElement>("CampaignDetailsTimeLeft"); this.campaignDetailsTimeLeft.Visible = false; int totalCampaignStarsEarned = base.Player.CampaignProgress.GetTotalCampaignStarsEarned(this.selectedCampaign); UXLabel element6 = this.screen.GetElement <UXLabel>("LabelStarsCountDetails"); element6.Text = base.LangController.Get("LABEL_CAMPAIGN_STARS", new object[] { totalCampaignStarsEarned, this.selectedCampaign.TotalMasteryStars }); UXSprite element7 = this.screen.GetElement <UXSprite>("SpriteMasteryReward"); RewardType rewardType = RewardType.Invalid; IGeometryVO config; base.RManager.GetFirstRewardAssetName(this.selectedCampaign.Reward, ref rewardType, out config); RewardUtils.SetRewardIcon(element7, config, AnimationPreference.NoAnimation); int totalCampaignMissionsCompleted = base.Player.CampaignProgress.GetTotalCampaignMissionsCompleted(this.selectedCampaign); UXLabel element8 = this.screen.GetElement <UXLabel>("LabelObjectivesCount"); element8.Text = base.LangController.Get("LABEL_CAMPAIGN_DETAIL_MISSIONS", new object[] { totalCampaignMissionsCompleted, this.selectedCampaign.TotalMissions }); UXLabel element9 = this.screen.GetElement <UXLabel>("LabelUnlocksDetails"); if (totalCampaignMissionsCompleted > 0 && totalCampaignMissionsCompleted == this.selectedCampaign.TotalMissions) { element9.Text = base.RManager.GetRewardString(this.selectedCampaign.Reward); if (totalCampaignStarsEarned == this.selectedCampaign.TotalMasteryStars) { element9.TextColor = PlanetDetailsMissionViewModule.COMPLETION_COLOR; } } else { element9.Text = base.RManager.GetRewardString(this.selectedCampaign.Reward); } UXTexture element10 = this.screen.GetElement <UXTexture>("SpriteCampaignImageLarge"); element10.LoadTexture(this.selectedCampaign.Uid); this.screen.GetElement <UXElement>("MasteryProgress").Visible = true; this.screen.GetElement <UXElement>("MasteryReward").Visible = true; this.allChaptersButton.Visible = true; this.InitMissionGrid(); }