private void SetupShardRewardItemElements(string itemUID, CrateSupplyVO crateSupply) { ShardVO shardVO = Service.Get <IDataController>().Get <ShardVO>(crateSupply.RewardUid); int quality = (int)shardVO.Quality; string name = string.Format("SpriteTroopImageBkgGridQ{0}", new object[] { quality }); this.rewardsGrid.GetSubElement <UXElement>(itemUID, name).Visible = false; UXSprite subElement = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteIconFragmentLootTable"); UXUtils.SetupFragmentIconSprite(subElement, quality); UXSprite subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteRewardItemImage"); IDeployableVO deployableVOFromShard = Service.Get <DeployableShardUnlockController>().GetDeployableVOFromShard(shardVO); if (deployableVOFromShard == null) { Service.Get <StaRTSLogger>().Error("SetupShardRewardItemElements Unable to find deployable"); return; } ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(deployableVOFromShard, subElement2, true); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; GeometryProjector item = ProjectorUtils.GenerateProjector(projectorConfig); this.projectors.Add(item); this.SetupDeployableShardProgress(itemUID, shardVO); UXUtils.SetCardQuality(this, this.rewardsGrid, itemUID, quality, "RewardItemCardQ{0}"); }
private bool AddTroopItem(KeyValuePair <string, InventoryEntry> unit, TroopTypeVO troop) { string itemUid = "troop_" + troop.Uid; UXButton uXButton = this.troopDonateGrid.CloneItem(itemUid, this.troopTemplateItem) as UXButton; uXButton.Tag = unit; uXButton.OnClicked = new UXButtonClickedDelegate(this.OnTroopToDonateClicked); UXLabel subElement = this.troopDonateGrid.GetSubElement <UXLabel>(itemUid, "LabelDonateTroops"); subElement.Text = string.Format("x{0}", unit.Value.Amount); UXLabel subElement2 = this.troopDonateGrid.GetSubElement <UXLabel>(itemUid, "LabelTroopLevel"); subElement2.Text = LangUtils.GetLevelText(troop.Lvl); UXElement subElement3 = this.troopDonateGrid.GetSubElement <UXElement>(itemUid, "WidgetTroopsCardBgDefault"); UXElement subElement4 = this.troopDonateGrid.GetSubElement <UXElement>(itemUid, "WidgetTroopsCardBgQ10"); if (string.IsNullOrEmpty(troop.UpgradeShardUid)) { subElement3.Visible = true; subElement4.Visible = false; } else { subElement3.Visible = false; subElement4.Visible = true; } UXSprite subElement5 = this.troopDonateGrid.GetSubElement <UXSprite>(itemUid, "SpriteDonateTroopsItem"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement5); projectorConfig.AnimPreference = AnimationPreference.NoAnimation; ProjectorUtils.GenerateProjector(projectorConfig); this.troopDonateGrid.AddItem(uXButton, troop.Order); return(troop.Size <= this.totalCapacity - this.alreadyDonatedSize); }
private void InitCrateProjector(UXSprite sprite, CrateVO crateVO) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(crateVO, sprite); projectorConfig.AnimState = AnimState.Closed; ProjectorUtils.GenerateProjector(projectorConfig); }
public static void SetRewardIcon(UXSprite sprite, IGeometryVO config, AnimationPreference animPreference = AnimationPreference.NoAnimation) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(config, sprite); projectorConfig.AnimPreference = animPreference; ProjectorUtils.GenerateProjector(projectorConfig); }
protected override void OnScreenLoaded() { BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>(); Service.Get <UXController>().HUD.Visible = false; this.InitButtons(); this.SetUIText(); this.LoadFx(); UXSprite element = base.GetElement <UXSprite>("SpriteInstructions"); BuildingTypeVO buildingTypeVO = null; if (this.isSpecialAttack) { if (buildingLookupController.HasStarshipCommand()) { FleetCommandNode head = buildingLookupController.FleetCommandNodeList.Head; buildingTypeVO = head.BuildingComp.BuildingType; } } else { buildingTypeVO = buildingLookupController.GetHighestAvailableBuildingVOForTroop((TroopTypeVO)this.subjectVO); } if (buildingTypeVO != null) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(buildingTypeVO, element, false); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); } else { element.Visible = false; } this.fadingOutSubject = false; }
private void ProcessSkin(GeometryTag cookie) { if (!(cookie.geometry is TroopTypeVO)) { return; } TroopTypeVO troop = cookie.geometry as TroopTypeVO; ProjectorConfig projector = cookie.projector; TeamType team = TeamType.Attacker; CurrentBattle currentBattle = Service.BattleController.GetCurrentBattle(); if (currentBattle != null && !string.IsNullOrEmpty(currentBattle.MissionId)) { CampaignMissionVO campaignMissionVO = Service.StaticDataController.Get <CampaignMissionVO>(currentBattle.MissionId); if (campaignMissionVO != null && campaignMissionVO.IsRaidDefense()) { team = TeamType.Defender; } } SkinTypeVO applicableSkin = this.GetApplicableSkin(troop, cookie.armory, cookie.battle, team); if (applicableSkin != null) { ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(applicableSkin, projector.FrameSprite, projector.closeup); projector.MakeEquivalentTo(config); } }
protected void AddTroopItem(IUpgradeableVO troop, int troopCount, string tooltipText) { TroopUpgradeTag troopUpgradeTag = new TroopUpgradeTag(troop as IDeployableVO, true); this.troopList.Add(troopUpgradeTag); string uid = troop.Uid; UXElement item = this.storageItemGrid.CloneTemplateItem(uid); UXLabel subElement = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelStorageCount"); subElement.Text = LangUtils.GetMultiplierText(troopCount); UXSprite subElement2 = this.storageItemGrid.GetSubElement <UXSprite>(uid, "SpriteStorageItemImageTroops"); ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(troop as IDeployableVO, subElement2); Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, config, Service.CurrentPlayer.ActiveArmory)); ProjectorUtils.GenerateProjector(config); UXLabel subElement3 = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelTroopLevel"); subElement3.Text = LangUtils.GetLevelText(troop.Lvl); UXElement subElement4 = this.storageItemGrid.GetSubElement <UXElement>(uid, "BtnRequestTroops"); subElement4.Visible = false; UXButton subElement5 = this.storageItemGrid.GetSubElement <UXButton>(uid, "StorageItemsCard"); if (tooltipText != null) { this.troopTooltipHelper.RegisterButtonTooltip(subElement5, tooltipText); } else { subElement5.Tag = troopUpgradeTag; subElement5.OnClicked = new UXButtonClickedDelegate(this.OnTroopItemClicked); } this.storageItemGrid.AddItem(item, troop.Order); }
public static void SetupAnimatedCharacter(UXSprite charSprite, string imageName, ref GeometryProjector geom) { if (charSprite != null && !string.IsNullOrEmpty(imageName)) { StaticDataController staticDataController = Service.StaticDataController; TroopTypeVO vo = staticDataController.Get <TroopTypeVO>(imageName); if (geom == null) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(vo, charSprite); projectorConfig.AnimPreference = AnimationPreference.AnimationAlways; geom = ProjectorUtils.GenerateProjector(projectorConfig); } } }
public void SetIconAsset(IUpgradeableVO iconAsset) { if (this.iconSprite != null) { bool flag = iconAsset != null; this.iconSprite.Visible = flag; this.DestroyIconGeometry(); if (flag) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconAsset, this.iconSprite); Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(iconAsset, projectorConfig, Service.CurrentPlayer.ActiveArmory)); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; projectorConfig.Sharpness = 4f; this.iconGeometry = ProjectorUtils.GenerateProjector(projectorConfig); } } }
protected override void OnScreenLoaded() { Service.Get <UXController>().HUD.Visible = false; this.InitButtons(); this.SetUIText(); this.LoadFx(); UXSprite element = base.GetElement <UXSprite>("SpriteInstructions"); ArmoryNode head = Service.Get <BuildingLookupController>().ArmoryNodeList.Head; if (head != null) { BuildingTypeVO buildingType = head.BuildingComp.BuildingType; ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(buildingType, element, false); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); } this.fadingOutSubject = false; }
public static void SetCrateIcon(UXSprite sprite, CrateVO crateVO, AnimState animState) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(crateVO, sprite); if (GameConstants.CRATE_SHOW_VFX && !string.IsNullOrEmpty(crateVO.VfxAssetName) && animState == AnimState.Idle) { projectorConfig.AttachmentAssets = new string[] { crateVO.VfxAssetName }; projectorConfig.AnimPreference = AnimationPreference.AnimationAlways; } else { projectorConfig.AnimPreference = AnimationPreference.NoAnimation; } projectorConfig.AnimState = animState; ProjectorUtils.GenerateProjector(projectorConfig); }
private UXElement CreateDeployableUXElement(UXGrid grid, string uid, string assetName, int amount, IDeployableVO troop, BattleEntry battle) { UXElement result = grid.CloneTemplateItem(uid); UXSprite subElement = grid.GetSubElement <UXSprite>(uid, this.TroopCardIconName); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement); Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, projectorConfig, battle)); projectorConfig.AnimPreference = AnimationPreference.NoAnimation; ProjectorUtils.GenerateProjector(projectorConfig); UXLabel subElement2 = grid.GetSubElement <UXLabel>(uid, this.TroopCardAmountName); subElement2.Text = LangUtils.GetMultiplierText(amount); UXLabel subElement3 = grid.GetSubElement <UXLabel>(uid, this.TroopCardLevelName); subElement3.Text = LangUtils.GetLevelText(troop.Lvl); FactionDecal.UpdateDeployableDecal(uid, grid, troop, this.TroopHeroDecalName); string text = null; if (troop is TroopTypeVO) { TroopTypeVO troop2 = troop as TroopTypeVO; Service.SkinController.GetApplicableSkin(troop2, battle.AttackerEquipment, out text); } int qualityInt; if (!string.IsNullOrEmpty(text)) { StaticDataController staticDataController = Service.StaticDataController; EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(text); qualityInt = (int)equipmentVO.Quality; } else { qualityInt = Service.DeployableShardUnlockController.GetUpgradeQualityForDeployable(troop); } UXUtils.SetCardQuality(this, this.troopGrid, uid, qualityInt, this.TroopCardQualityName, this.TroopCardDefaultName); UXButton subElement4 = grid.GetSubElement <UXButton>(uid, this.TroopCardName); this.troopTooltipHelper.RegisterButtonTooltip(subElement4, troop, battle); return(result); }
protected void AddTroopItem(IUpgradeableVO troop, int troopCount) { TroopUpgradeTag item = new TroopUpgradeTag(troop as IDeployableVO, true); this.troopList.Add(item); string uid = troop.Uid; UXElement item2 = this.storageItemGrid.CloneTemplateItem(uid); UXLabel subElement = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelDonateTroops"); subElement.Text = LangUtils.GetMultiplierText(troopCount); UXSprite subElement2 = this.storageItemGrid.GetSubElement <UXSprite>(uid, "SpriteDonateTroopsItem"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop as IDeployableVO, subElement2); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); UXLabel subElement3 = this.storageItemGrid.GetSubElement <UXLabel>(uid, "LabelTroopLevel"); subElement3.Text = LangUtils.GetLevelText(troop.Lvl); this.storageItemGrid.GetSubElement <UXSprite>(uid, "SpriteCardEmpty").Visible = false; this.storageItemGrid.AddItem(item2, troop.Order); }
private void CreateUnlockCards <T>(List <T> deployableList) where T : IDeployableVO { this.troopListForInfoScreen = new List <TroopUpgradeTag>(); int i = 0; int count = deployableList.Count; while (i < count) { IDeployableVO deployableVO = deployableList[i]; if (deployableVO is TroopTypeVO) { int level = Service.CurrentPlayer.UnlockedLevels.Troops.GetLevel(deployableVO.UpgradeGroup); deployableVO = Service.TroopUpgradeCatalog.GetByLevel(deployableVO.UpgradeGroup, level); } else { int level2 = Service.CurrentPlayer.UnlockedLevels.Starships.GetLevel(deployableVO.UpgradeGroup); deployableVO = Service.StarshipUpgradeCatalog.GetByLevel(deployableVO.UpgradeGroup, level2); } if (deployableVO.PlayerFacing) { TroopUpgradeTag troopUpgradeTag = new TroopUpgradeTag(deployableVO, true); this.troopListForInfoScreen.Add(troopUpgradeTag); UXElement item = this.unlockGrid.CloneTemplateItem(deployableVO.Uid); UXButton subElement = this.unlockGrid.GetSubElement <UXButton>(deployableVO.Uid, "BuildingUnlockCard"); subElement.OnClicked = new UXButtonClickedDelegate(this.OnUnlockCardClicked); subElement.Tag = troopUpgradeTag; UXSprite subElement2 = this.unlockGrid.GetSubElement <UXSprite>(deployableVO.Uid, "SpriteItemImageTroops"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(deployableVO, subElement2); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); UXLabel subElement3 = this.unlockGrid.GetSubElement <UXLabel>(deployableVO.Uid, "LabelUnlockCount"); subElement3.Text = LangUtils.GetMultiplierText(1); this.unlockGrid.AddItem(item, deployableVO.Order); } i++; } }
private void AddExpendedItem(UXGrid expendedGrid, string entryItemUid, string troopUid, IUpgradeableVO troop, int count, int unitQuality, BattleEntry battleEntry) { if (expendedGrid.Count == 8) { return; } if (count <= 0) { return; } UXElement uXElement = expendedGrid.CloneTemplateItem(troopUid); uXElement.Root.name = UXUtils.FormatAppendedName(uXElement.Root.name, entryItemUid); UXLabel subElement = expendedGrid.GetSubElement <UXLabel>(troopUid, UXUtils.FormatAppendedName("LabelTroopsExpended", entryItemUid)); subElement.Text = ((count <= 0) ? string.Empty : this.lang.Get("TROOP_MULTIPLIER", new object[] { count })); UXLabel subElement2 = expendedGrid.GetSubElement <UXLabel>(troopUid, UXUtils.FormatAppendedName("LabelTroopLevel", entryItemUid)); subElement2.Text = LangUtils.GetLevelText(troop.Lvl); UXSprite subElement3 = expendedGrid.GetSubElement <UXSprite>(troopUid, UXUtils.FormatAppendedName("SpriteTroopsImage", entryItemUid)); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement3); Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, projectorConfig, battleEntry)); UXUtils.SetupGeometryForIcon(subElement3, projectorConfig); string defaultCardName = UXUtils.FormatAppendedName("TroopsExpendBgDefault", entryItemUid); string cardName = UXUtils.FormatAppendedName("TroopsExpendBgQ{0}", entryItemUid); UXUtils.SetCardQuality(this, expendedGrid, troopUid, unitQuality, cardName, defaultCardName); FactionDecal.UpdateDeployableDecal(troopUid, entryItemUid, expendedGrid, (IDeployableVO)troop); UXButton subElement4 = expendedGrid.GetSubElement <UXButton>(troopUid, UXUtils.FormatAppendedName("TroopsExpendedCard", entryItemUid)); this.troopTooltipHelper.RegisterButtonTooltip(subElement4, troop, battleEntry); expendedGrid.AddItem(uXElement, troop.Order); }
private UXElement CreateDeployableUXElement(UXGrid grid, string uid, string assetName, int amount, IDeployableVO troop, BattleEntry battle) { UXElement result = grid.CloneTemplateItem(uid); UXSprite subElement = grid.GetSubElement <UXSprite>(uid, this.TroopCardIconName); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement); Service.Get <EventManager>().SendEvent(EventId.ButtonCreated, new GeometryTag(troop, projectorConfig, battle)); projectorConfig.AnimPreference = AnimationPreference.NoAnimation; ProjectorUtils.GenerateProjector(projectorConfig); UXLabel subElement2 = grid.GetSubElement <UXLabel>(uid, this.TroopCardAmountName); subElement2.Text = LangUtils.GetMultiplierText(amount); UXLabel subElement3 = grid.GetSubElement <UXLabel>(uid, this.TroopCardLevelName); subElement3.Text = LangUtils.GetLevelText(troop.Lvl); FactionDecal.UpdateDeployableDecal(uid, grid, troop, this.TroopHeroDecalName); int upgradeQualityForDeployable = Service.Get <DeployableShardUnlockController>().GetUpgradeQualityForDeployable(troop); UXUtils.SetCardQuality(this, this.troopGrid, uid, upgradeQualityForDeployable, this.TroopCardQualityName, this.TroopCardDefaultName); UXButton subElement4 = grid.GetSubElement <UXButton>(uid, this.TroopCardName); this.troopTooltipHelper.RegisterButtonTooltip(subElement4, troop, battle); return(result); }
private bool AddTroopItem(KeyValuePair <string, InventoryEntry> unit, TroopTypeVO troop) { string itemUid = "troop_" + troop.Uid; UXButton uXButton = this.troopDonateGrid.CloneItem(itemUid, this.troopTemplateItem) as UXButton; uXButton.Tag = unit; uXButton.OnClicked = new UXButtonClickedDelegate(this.OnTroopToDonateClicked); UXLabel subElement = this.troopDonateGrid.GetSubElement <UXLabel>(itemUid, "LabelDonateTroops"); subElement.Text = string.Format("x{0}", new object[] { unit.get_Value().Amount }); UXLabel subElement2 = this.troopDonateGrid.GetSubElement <UXLabel>(itemUid, "LabelTroopLevel"); subElement2.Text = LangUtils.GetLevelText(troop.Lvl); UXSprite subElement3 = this.troopDonateGrid.GetSubElement <UXSprite>(itemUid, "SpriteDonateTroopsItem"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement3); projectorConfig.AnimPreference = AnimationPreference.NoAnimation; ProjectorUtils.GenerateProjector(projectorConfig); this.troopDonateGrid.AddItem(uXButton, troop.Order); return(troop.Size <= this.totalCapacity - this.alreadyDonatedSize); }
public InventoryCrateAnimation(List <CrateSupplyVO> supplyTableDataList, CrateData crateData, Dictionary <string, int> shardsOriginal, Dictionary <string, int> equipmentOriginal, Dictionary <string, int> troopUpgradeOriginalCopy, Dictionary <string, int> specialAttackUpgradeOriginalCopy) { List <string> assetNames = new List <string>(); List <object> cookies = new List <object>(); this.assetHandles = new List <AssetHandle>(); this.supplyCrateDataList = new List <SupplyCrateTag>(); this.hq = crateData.HQLevel; this.screen = new InventoryCrateCollectionScreen(this, crateData); StaticDataController staticDataController = Service.StaticDataController; this.crateVO = staticDataController.Get <CrateVO>(crateData.CrateId); this.shardsOriginal = shardsOriginal; this.equipmentOriginal = equipmentOriginal; this.troopUpgradeOrignal = troopUpgradeOriginalCopy; this.specialAttackUpgradeOrignal = specialAttackUpgradeOriginalCopy; this.crateAnimState = InventoryCrateAnimationState.Falling; this.crateLandTimer = 0u; this.playOpenOnLanding = false; this.isSkippingReward = false; this.rewardAnimStarted = false; this.rewardAnimEventReceived = false; this.IsLoaded = false; int i = 0; int count = supplyTableDataList.Count; while (i < count) { SupplyCrateTag supplyCrateTag = new SupplyCrateTag(); CrateSupplyVO crateSupplyVO = supplyTableDataList[i]; SupplyType type = crateSupplyVO.Type; supplyCrateTag.CrateSupply = crateSupplyVO; this.supplyCrateDataList.Add(supplyCrateTag); if (type != SupplyType.Currency) { IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(crateSupplyVO, this.hq); this.AddAssetToLoadList(assetNames, cookies, iconVOFromCrateSupply.IconAssetName); ProjectorConfig projectorConfig; if (iconVOFromCrateSupply is EquipmentVO) { EquipmentVO equipmentVO = (EquipmentVO)iconVOFromCrateSupply; supplyCrateTag.Equipment = equipmentVO; supplyCrateTag.ShardQuailty = equipmentVO.Quality; projectorConfig = ProjectorUtils.GenerateEquipmentConfig(iconVOFromCrateSupply as EquipmentVO, new Action <RenderTexture, ProjectorConfig>(this.RenderTextureCompleteCallback), 256f, 256f); } else { if (type == SupplyType.ShardSpecialAttack || type == SupplyType.ShardTroop) { ShardVO shardVO = staticDataController.Get <ShardVO>(crateSupplyVO.RewardUid); supplyCrateTag.ShardQuailty = shardVO.Quality; supplyCrateTag.UnlockShard = shardVO; } projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, new Action <RenderTexture, ProjectorConfig>(this.RenderTextureCompleteCallback), 256f, 256f); } projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; supplyCrateTag.Config = projectorConfig; supplyCrateTag.Projector = ProjectorUtils.GenerateProjector(projectorConfig); } i++; } this.AddAssetToLoadList(assetNames, cookies, this.crateVO.RewardAnimationAssetName); this.AddAssetToLoadList(assetNames, cookies, "crate_controller"); Service.AssetManager.MultiLoad(this.assetHandles, assetNames, new AssetSuccessDelegate(this.LoadSuccess), new AssetFailureDelegate(this.LoadFailed), cookies, new AssetsCompleteDelegate(this.AssetsCompleteDelegate), null); }
private void AddUpgradeableItemToTroopGrid(IDeployableVO nextTroop, IDeployableVO currentTroop, int sortOrder) { string uid = nextTroop.Uid; UXElement uXElement = this.troopGrid.CloneTemplateItem(uid); UXLabel subElement = this.troopGrid.GetSubElement <UXLabel>(uid, "LabelTroopLevel"); subElement.Text = LangUtils.GetLevelText(currentTroop.Lvl); UXElement subElement2 = this.troopGrid.GetSubElement <UXElement>(uid, "CardDefault"); UXElement subElement3 = this.troopGrid.GetSubElement <UXElement>(uid, "CardQuality"); string text = null; string text2 = null; bool flag = !nextTroop.PlayerFacing || nextTroop.Lvl == currentTroop.Lvl; bool flag2; if (flag) { flag2 = false; text = this.lang.Get("MAX_LEVEL", new object[0]); text2 = text; } else { flag2 = Service.UnlockController.CanDeployableBeUpgraded(currentTroop, nextTroop, out text, out text2); } this.troopGrid.GetSubElement <UXSprite>(uid, "SpriteDim").Visible = !flag2; this.troopGrid.GetSubElement <UXSprite>(uid, "SpriteIconLockedTroop").Visible = (!flag2 && !flag); UXSprite subElement4 = this.troopGrid.GetSubElement <UXSprite>(uid, "SpriteFragmentTroop"); bool flag3 = !string.IsNullOrEmpty(currentTroop.UpgradeShardUid); if (flag3) { subElement2.Visible = false; subElement3.Visible = true; subElement4.Visible = true; ShardVO shardVO = this.dataController.Get <ShardVO>(currentTroop.UpgradeShardUid); int quality = (int)shardVO.Quality; string name = string.Format("CardQ10", quality); UXElement optionalSubElement = this.troopGrid.GetOptionalSubElement <UXElement>(uid, name); if (optionalSubElement != null) { base.RevertToOriginalNameRecursively(optionalSubElement.Root, uid); optionalSubElement.Visible = true; } UXUtils.SetupFragmentIconSprite(subElement4, quality); IDeployableVO troopType = currentTroop; if (Service.UnlockController.IsMinLevelUnlocked(currentTroop)) { troopType = nextTroop; } this.SetupTroopShardProgressBar(uid, troopType, flag); } else { subElement4.Visible = false; subElement2.Visible = true; subElement3.Visible = false; } UXLabel subElement5 = this.troopGrid.GetSubElement <UXLabel>(uid, "LabelRequirement"); subElement5.Visible = !flag2; if (!flag2) { subElement5.Text = text2; } UXSlider subElement6 = this.troopGrid.GetSubElement <UXSlider>(uid, "pBarUpgradeTime"); subElement6.Visible = false; UXLabel subElement7 = this.troopGrid.GetSubElement <UXLabel>(uid, "LabelpBarUpgradeTime"); subElement7.Visible = false; UXSlider subElement8 = this.troopGrid.GetSubElement <UXSlider>(uid, "pBarUpgradeTimeQuality"); subElement8.Visible = false; UXLabel subElement9 = this.troopGrid.GetSubElement <UXLabel>(uid, "LabelpBarUpgradeTimeQuality"); subElement9.Visible = false; string text3 = "SpriteTroopItemImage"; if (flag3) { text3 += "Quality"; } UXSprite subElement10 = this.troopGrid.GetSubElement <UXSprite>(uid, text3); ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(nextTroop, subElement10, true); ProjectorUtils.GenerateProjector(config); FactionDecal.SetDeployableDecalVisibiliy(uid, this.troopGrid, false); TroopUpgradeTag troopUpgradeTag = new TroopUpgradeTag(nextTroop, flag2); troopUpgradeTag.IsMaxLevel = flag; troopUpgradeTag.RequirementText = text; troopUpgradeTag.ShortRequirementText = text2; UXButton subElement11 = this.troopGrid.GetSubElement <UXButton>(uid, "ButtonTroopItemCard"); subElement11.Tag = troopUpgradeTag; subElement11.OnClicked = new UXButtonClickedDelegate(this.OnTroopCardClicked); uXElement.Tag = troopUpgradeTag; this.troopGrid.AddItem(uXElement, sortOrder); }
public void Render(ShardShopViewTO vto, bool shouldShowProgressLerp) { bool flag = this.vto == null || this.vto.SupplyVO != vto.SupplyVO; bool flag2 = this.vto != null && !this.vto.ValueEquals(vto); if (flag2) { this.previousShardsEarned = this.vto.UpgradeShardsEarned; } this.vto = vto; if (flag) { IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(vto.SupplyVO, vto.PlayerHQLevel); ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, this.iconSprite); this.projector = ProjectorUtils.GenerateProjector(config); } int upgradeShardsEarned = vto.UpgradeShardsEarned; int upgradeShardsRequired = vto.UpgradeShardsRequired; this.quantityCounter.Text = vto.RemainingShardsForSale.ToString(); this.bodyText.Text = this.lang.Get("shard_shop_shards_remaining", new object[] { vto.ItemName }); this.purchaseSingleDescLabel.Text = this.lang.Get("shard_shop_buy_single", new object[0]); this.purchaseAllDescLabel.Text = this.lang.Get("shard_shop_buy_all", new object[0]); this.nextProgressBarValue = this.GetProgessBarValue(upgradeShardsEarned, upgradeShardsRequired); this.previousProgressBarValue = this.GetProgessBarValue(this.previousShardsEarned, upgradeShardsRequired); this.iconDeltaShardProgressBar.Value = this.nextProgressBarValue; if (!shouldShowProgressLerp) { this.isProgressBarLerping = false; this.iconProgressLabel.Text = upgradeShardsEarned + "/" + upgradeShardsRequired; this.iconBaseShardProgressBar.Value = this.nextProgressBarValue; } else if (flag2) { this.progressLerpTimer = 0f; this.isProgressBarLerping = true; this.iconProgressLabel.Text = this.previousShardsEarned + "/" + upgradeShardsRequired; this.iconBaseShardProgressBar.Value = this.previousProgressBarValue; Service.ViewTimeEngine.RegisterFrameTimeObserver(this); } SupplyType type = vto.SupplyVO.Type; if (type != SupplyType.Shard) { if (type == SupplyType.ShardTroop || type == SupplyType.ShardSpecialAttack) { this.titleText.Text = this.lang.Get("shard_shop_buy_unit_shards", new object[0]); } } else { this.titleText.Text = this.lang.Get("shard_shop_buy_equipment_shards", new object[0]); } if (vto.RemainingShardsForSale > 0) { UXUtils.SetupSingleResourceUI(vto.CostOfNextShard, this.purchaseSingleLabel, this.purchaseSingleSprite); UXUtils.SetupSingleResourceUI(vto.CostOfAllShards, this.purchaseAllLabel, this.purchaseAllSprite); } this.returnBtn.Visible = (vto.RemainingShardsForSale == 0); this.purchaseSingleBtn.Visible = (vto.RemainingShardsForSale > 0); this.purchaseAllBtn.Visible = (vto.RemainingShardsForSale > 0); this.parent.RevertToOriginalNameRecursively(this.icon.Root, "ModalIcon"); Service.Engine.StartCoroutine(this.SetAnimatorState()); }
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); } }
public void UpdateObjectiveEntry(ObjectiveViewData objectiveData, bool isGrace) { ObjectiveProgress objective = objectiveData.Objective; UXSprite spriteCheckmark = objectiveData.SpriteCheckmark; UXSprite spriteSupplyCrate = objectiveData.SpriteSupplyCrate; UXSprite spriteObjectiveIcon = objectiveData.SpriteObjectiveIcon; UXSprite spritePreview = objectiveData.SpritePreview; UXLabel statusLabel = objectiveData.StatusLabel; UXLabel titleLabel = objectiveData.TitleLabel; UXSlider progressSlider = objectiveData.ProgressSlider; UXSprite radialProgress = objectiveData.RadialProgress; UXLabel expiredLabel = objectiveData.ExpiredLabel; UXSprite spriteObjectiveExpired = objectiveData.SpriteObjectiveExpired; UXElement objectiveBgComplete = objectiveData.ObjectiveBgComplete; UXElement objectiveBgCollected = objectiveData.ObjectiveBgCollected; UXElement objectiveBgExpired = objectiveData.ObjectiveBgExpired; UXElement objectiveBgActive = objectiveData.ObjectiveBgActive; UXElement objectiveContainer = objectiveData.ObjectiveContainer; UXElement objectiveContainerLEI = objectiveData.ObjectiveContainerLEI; bool flag = objective.State == ObjectiveState.Complete || (objective.State == ObjectiveState.Active && !isGrace); Lang lang = Service.Lang; ObjectiveVO vO = objectiveData.Objective.VO; string crateRewardUid = vO.CrateRewardUid; CrateVO optional = Service.StaticDataController.GetOptional <CrateVO>(crateRewardUid); if (optional == null) { Service.Logger.ErrorFormat("The objective {0} specifies an invalid crateRewardUid {1}", new object[] { vO.Uid, crateRewardUid }); return; } string value = null; if (objectiveContainerLEI != null) { FactionType faction = Service.CurrentPlayer.Faction; if (faction != FactionType.Rebel) { if (faction == FactionType.Empire) { value = optional.EmpireLEIUid; } } else { value = optional.RebelLEIUid; } } if (objectiveBgCollected == null || objectiveContainer == null || objectiveContainerLEI == null || objectiveBgComplete == null || objectiveBgExpired == null) { Service.Logger.Error("ObjectiveViewData is initialized incompletely"); } else { ObjectiveState state = objective.State; if (state != ObjectiveState.Active) { if (state != ObjectiveState.Complete) { if (state == ObjectiveState.Rewarded) { objectiveBgCollected.Visible = true; objectiveBgExpired.Visible = false; objectiveContainer.Visible = false; objectiveContainerLEI.Visible = false; objectiveBgComplete.Visible = false; objectiveBgActive.Visible = false; } } else { objectiveBgComplete.Visible = true; objectiveBgExpired.Visible = false; objectiveContainer.Visible = false; objectiveContainerLEI.Visible = false; objectiveBgCollected.Visible = false; objectiveBgActive.Visible = false; } } else if (isGrace) { objectiveBgExpired.Visible = true; objectiveBgCollected.Visible = false; objectiveContainer.Visible = false; objectiveContainerLEI.Visible = false; objectiveBgComplete.Visible = false; objectiveBgActive.Visible = false; } else { objectiveContainerLEI.Visible = !string.IsNullOrEmpty(value); objectiveContainer.Visible = string.IsNullOrEmpty(value); objectiveBgActive.Visible = true; objectiveBgExpired.Visible = false; objectiveBgCollected.Visible = false; objectiveBgComplete.Visible = false; } } if (progressSlider != null) { if (objective.State == ObjectiveState.Complete || (objective.State == ObjectiveState.Active && !isGrace)) { progressSlider.Visible = true; progressSlider.Value = (float)objective.Count / (float)objective.Target; } else { progressSlider.Visible = false; } } if (radialProgress != null) { if (objective.State == ObjectiveState.Complete || (objective.State == ObjectiveState.Active && !isGrace)) { radialProgress.Visible = true; radialProgress.FillAmount = (float)objective.Count / (float)objective.Target; } else { radialProgress.Visible = false; } } if (expiredLabel != null) { expiredLabel.Visible = (isGrace && objective.State == ObjectiveState.Active); } if (spriteObjectiveExpired != null) { spriteObjectiveExpired.Visible = (isGrace && objective.State == ObjectiveState.Active); } if (statusLabel != null) { ObjectiveState state2 = objective.State; if (state2 != ObjectiveState.Active) { if (state2 != ObjectiveState.Complete) { if (state2 == ObjectiveState.Rewarded) { statusLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREEN_DIM_COLOR : ObjectiveController.TEXT_GREEN_COLOR); statusLabel.Text = lang.Get("OBJECTIVE_COLLECTED", new object[] { lang.ThousandsSeparated(objective.Count), lang.ThousandsSeparated(objective.Target) }); } } else { statusLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREEN_DIM_COLOR : ObjectiveController.TEXT_GREEN_COLOR); statusLabel.Text = lang.Get("OBJECTIVE_ACTIVE_UNLOCKED", new object[] { lang.ThousandsSeparated(objective.Count), lang.ThousandsSeparated(objective.Target) }); } } else if (isGrace) { statusLabel.TextColor = ObjectiveController.TEXT_RED_DIM_COLOR; statusLabel.Text = lang.Get("OBJECTIVE_EXPIRED", new object[0]); } else { statusLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREEN_DIM_COLOR : ObjectiveController.TEXT_GREEN_COLOR); statusLabel.Text = lang.Get("OBJECTIVE_PROGRESS", new object[] { lang.ThousandsSeparated(objective.Count), lang.ThousandsSeparated(objective.Target) }); } } if (titleLabel != null) { titleLabel.Text = lang.Get(objective.VO.ObjString, new object[] { lang.ThousandsSeparated(objective.Target) }); titleLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREY_COLOR : ObjectiveController.TEXT_WHITE_COLOR); } UXSprite uXSprite = null; UXSprite uXSprite2 = null; if (spriteSupplyCrate != null) { spriteSupplyCrate.Tag = objectiveData; uXSprite2 = spriteSupplyCrate; ObjectiveState state3 = objective.State; if (state3 != ObjectiveState.Active) { if (state3 != ObjectiveState.Complete) { if (state3 == ObjectiveState.Rewarded) { spriteCheckmark.Visible = true; spriteCheckmark.SpriteName = "IcoCheck"; spriteSupplyCrate.Alpha = 0.6f; spriteSupplyCrate.Visible = true; } } else { spriteCheckmark.Visible = false; spriteSupplyCrate.Alpha = 1f; spriteSupplyCrate.Visible = true; } } else { spriteCheckmark.Visible = false; spriteSupplyCrate.Visible = !isGrace; } } if (spritePreview != null) { spritePreview.Tag = objectiveData; ObjectiveState state4 = objective.State; if (state4 != ObjectiveState.Active) { if (state4 != ObjectiveState.Complete) { if (state4 == ObjectiveState.Rewarded) { uXSprite2 = spritePreview; uXSprite = null; spriteCheckmark.Visible = true; spriteCheckmark.SpriteName = "IcoCheck"; } } else { uXSprite2 = spritePreview; uXSprite = null; spriteCheckmark.Visible = false; } } else { uXSprite = spritePreview; uXSprite2 = null; spriteCheckmark.Visible = isGrace; spriteCheckmark.SpriteName = "icoCancelRed"; } } if (spriteObjectiveIcon != null) { uXSprite = spriteObjectiveIcon; } if (objectiveData.GeoControlCrate != null) { objectiveData.GeoControlCrate.Destroy(); } if (objectiveData.GeoControlIcon != null) { objectiveData.GeoControlIcon.Destroy(); } if (uXSprite2 != null) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(optional, uXSprite2); projectorConfig.AnimState = this.GetAnimStateFromObjectiveState(objectiveData.Objective.State); projectorConfig.AnimPreference = AnimationPreference.AnimationAlways; projectorConfig.Outline = (objective.State == ObjectiveState.Complete); projectorConfig.OutlineInner = GameConstants.CRATE_OUTLINE_INNER; projectorConfig.OutlineOuter = GameConstants.CRATE_OUTLINE_OUTER; objectiveData.GeoControlCrate = ProjectorUtils.GenerateProjector(projectorConfig); uXSprite2.Alpha = ((!flag) ? 0.5f : 1f); } if (uXSprite != null) { IGeometryVO iconVOFromObjective = GameUtils.GetIconVOFromObjective(objectiveData.Objective.VO, objectiveData.Objective.HQ); ProjectorConfig projectorConfig2 = ProjectorUtils.GenerateGeometryConfig(iconVOFromObjective, uXSprite); projectorConfig2.AnimPreference = AnimationPreference.AnimationPreferred; objectiveData.GeoControlIcon = ProjectorUtils.GenerateProjector(projectorConfig2); uXSprite.Alpha = ((!flag) ? 0.5f : 1f); } }
private void UpdateRewardUI(CrateFlyoutItemVO crateFlyoutItemVO) { IDataController dataController = Service.Get <IDataController>(); InventoryCrateRewardController inventoryCrateRewardController = Service.Get <InventoryCrateRewardController>(); string crateSupplyUid = crateFlyoutItemVO.CrateSupplyUid; CrateSupplyVO optional = dataController.GetOptional <CrateSupplyVO>(crateSupplyUid); if (optional != null) { base.GetElement <UXElement>("RewardItemDefault").Visible = false; for (int i = 1; i <= 3; i++) { base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[] { i })).Visible = false; } if (optional.Type == SupplyType.ShardTroop || optional.Type == SupplyType.ShardSpecialAttack) { ShardVO optional2 = Service.Get <IDataController>().GetOptional <ShardVO>(optional.RewardUid); int quality = (int)optional2.Quality; base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[] { quality })).Visible = true; base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", new object[] { quality })).Visible = false; } else if (optional.Type == SupplyType.Shard) { EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(optional.RewardUid); int quality2 = (int)currentEquipmentDataByID.Quality; base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[] { quality2 })).Visible = true; base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", new object[] { quality2 })).Visible = true; } else if (optional.Type == SupplyType.Troop || optional.Type == SupplyType.Hero || optional.Type == SupplyType.SpecialAttack) { int upgradeQualityForDeployableUID = Service.Get <DeployableShardUnlockController>().GetUpgradeQualityForDeployableUID(optional.RewardUid); if (upgradeQualityForDeployableUID > 0) { base.GetElement <UXElement>(string.Format("RewardItemCardQ{0}", new object[] { upgradeQualityForDeployableUID })).Visible = true; base.GetElement <UXElement>(string.Format("SpriteTroopImageBkgGridQ{0}", new object[] { upgradeQualityForDeployableUID })).Visible = false; } } else { base.GetElement <UXElement>("RewardItemDefault").Visible = true; } IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(optional, this.hqLevel); if (iconVOFromCrateSupply != null) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, this.spriteRewardImage, true); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); } else { Service.Get <StaRTSLogger>().ErrorFormat("CrateInfoModalScreen: Could not generate geometry for crate supply {0}", new object[] { optional.Uid }); } this.labelRewardChance.Text = this.lang.Get(crateFlyoutItemVO.DetailChanceString, new object[0]); this.labelRewardName.Text = this.lang.Get(crateFlyoutItemVO.DetailDescString, new object[0]); string[] listIcons = crateFlyoutItemVO.ListIcons; if (listIcons != null && listIcons.Length != 0) { this.spriteRewardIcon.SpriteName = listIcons[listIcons.Length - 1]; } else { this.spriteRewardIcon.Visible = false; } string detailTypeStringId = crateFlyoutItemVO.DetailTypeStringId; if (!string.IsNullOrEmpty(detailTypeStringId)) { this.labelRewardType.Visible = true; string text = this.lang.Get(detailTypeStringId, new object[0]); this.labelRewardType.Text = text; } else { this.labelRewardType.Visible = false; } int rewardAmount = inventoryCrateRewardController.GetRewardAmount(optional, this.hqLevel); string text2 = this.lang.ThousandsSeparated(rewardAmount); string quantityString = crateFlyoutItemVO.QuantityString; if (!string.IsNullOrEmpty(quantityString)) { this.labelRewardAmt.Text = this.lang.Get(quantityString, new object[] { text2 }); } else if (rewardAmount > 1) { this.labelRewardAmt.Text = this.lang.Get("lcfly_quant", new object[] { text2 }); } else { this.labelRewardAmt.Visible = false; } UXSprite element = base.GetElement <UXSprite>("SpriteLockIcon"); UXSprite element2 = base.GetElement <UXSprite>("SpriteRewardDim"); UXLabel element3 = base.GetElement <UXLabel>("LabelEquipmentRequirement"); element.Visible = false; element2.Visible = false; element3.Visible = false; bool flag = crateFlyoutItemVO.ReqArmory && !ArmoryUtils.PlayerHasArmory(); if (flag) { element2.Visible = true; element.Visible = true; element3.Visible = true; element3.Text = this.lang.Get("EQUIPMENT_ARMORY_REQUIRED", new object[0]); } this.UpdateRowHighlight(crateFlyoutItemVO.Uid, true); return; } Service.Get <StaRTSLogger>().ErrorFormat("CrateInfoModalScreen: Could not find crate supply {0} for crate flyout {1}", new object[] { crateSupplyUid, crateFlyoutItemVO.Uid }); }
public static void SetupGeometryForIcon(UXSprite itemIconSprite, IGeometryVO data) { ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(data, itemIconSprite); UXUtils.SetupGeometryForIcon(itemIconSprite, config); }
private void AddFeaturedRewardItemToGrid(PlanetLootEntryVO lootEntry, int order) { IDataController dataController = Service.Get <IDataController>(); InventoryCrateRewardController inventoryCrateRewardController = Service.Get <InventoryCrateRewardController>(); Lang lang = Service.Get <Lang>(); CrateSupplyVO optional = dataController.GetOptional <CrateSupplyVO>(lootEntry.SupplyDataUid); if (optional == null) { Service.Get <StaRTSLogger>().ErrorFormat("Couldn't find CrateSupplyVO: {0} specified in PlanetLootEntryVO: {1}", new object[] { lootEntry.SupplyDataUid, lootEntry.Uid }); return; } string uid = lootEntry.Uid; UXElement uXElement = this.rewardsGrid.CloneTemplateItem(uid); uXElement.Tag = lootEntry; UXLabel subElement = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelRewardName"); subElement.Text = inventoryCrateRewardController.GetCrateSupplyRewardName(optional); UXUtils.ClampUILabelWidth(subElement, 200, 0); UXLabel subElement2 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelGate"); subElement2.Text = string.Empty; if (!string.IsNullOrEmpty(lootEntry.NotesString)) { subElement2.Text = lang.Get(lootEntry.NotesString, new object[0]); UXUtils.ClampUILabelWidth(subElement2, 200, 0); } for (int i = 1; i <= 3; i++) { string name = string.Format("RewardItemCardQ{0}", new object[] { i }); this.rewardsGrid.GetSubElement <UXElement>(uid, name).Visible = false; } this.rewardsGrid.GetSubElement <UXElement>(uid, "RewardItemDefault").Visible = false; this.rewardsGrid.GetSubElement <UXElement>(uid, "pBarRewardItemFrag").Visible = false; this.rewardsGrid.GetSubElement <UXElement>(uid, "IconUpgrade").Visible = false; UXLabel subElement3 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelRewardTypeLootTimer"); UXUtils.ClampUILabelWidth(subElement3, 200, 0); bool flag = this.DoesLootEntryHaveCountdown(lootEntry); subElement3.Visible = flag; if (flag) { this.UpdateTimeRemainingLabel(lootEntry); } UXButton subElement4 = this.rewardsGrid.GetSubElement <UXButton>(uid, "BtnRewardInfo"); UXButton subElement5 = this.rewardsGrid.GetSubElement <UXButton>(uid, "BtnRewardItemCard"); subElement5.InitTweenComponent(); subElement4.Visible = false; if (optional.Type == SupplyType.Hero || optional.Type == SupplyType.Troop || optional.Type == SupplyType.SpecialAttack || optional.Type == SupplyType.Shard || optional.Type == SupplyType.ShardTroop || optional.Type == SupplyType.ShardSpecialAttack) { subElement4.Visible = true; subElement4.Tag = optional; subElement4.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked); subElement5.Tag = optional; subElement5.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked); } else { subElement5.DisablePlayTween(); } UXLabel subElement6 = this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelRewardTypeLootTable"); subElement6.Visible = true; this.rewardsGrid.GetSubElement <UXSprite>(uid, "SpriteIconFragmentLootTable").Visible = false; if (optional.Type == SupplyType.ShardTroop || optional.Type == SupplyType.ShardSpecialAttack) { this.SetupShardRewardItemElements(uid, optional); } else if (optional.Type == SupplyType.Shard) { this.SetupEquipmentShardRewardItemElements(uid, optional); } else { this.rewardsGrid.GetSubElement <UXElement>(uid, "RewardItemDefault").Visible = true; this.rewardsGrid.GetSubElement <UXLabel>(uid, "LabelFragProgress").Text = string.Empty; UXSprite subElement7 = this.rewardsGrid.GetSubElement <UXSprite>(uid, "SpriteRewardItemImage"); IGeometryVO geometryVO = null; if (optional.Type == SupplyType.Currency) { subElement6.Visible = false; geometryVO = UXUtils.GetDefaultCurrencyIconVO(optional.RewardUid); } else if (optional.Type == SupplyType.Hero || optional.Type == SupplyType.Troop) { geometryVO = dataController.Get <TroopTypeVO>(optional.RewardUid); } else if (optional.Type == SupplyType.SpecialAttack) { geometryVO = dataController.Get <SpecialAttackTypeVO>(optional.RewardUid); } if (geometryVO != null) { ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(geometryVO, subElement7, false); GeometryProjector item = ProjectorUtils.GenerateProjector(config); this.projectors.Add(item); } } this.SetupLockedRewardItemElements(uid, lootEntry); if (subElement6.Visible) { string typeStringID = lootEntry.TypeStringID; if (!string.IsNullOrEmpty(typeStringID)) { subElement6.Visible = true; subElement6.Text = lang.Get(typeStringID, new object[0]); } else { subElement6.Visible = false; } } subElement6.InitTweenComponent(); subElement3.InitTweenComponent(); if (flag && subElement6.Visible) { subElement6.EnablePlayTween(); subElement3.EnablePlayTween(); } else { subElement6.ResetPlayTweenTarget(); subElement3.ResetPlayTweenTarget(); subElement6.TextColor = Color.white; subElement3.TextColor = Color.white; } this.rewardsGrid.AddItem(uXElement, order); }
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 }); }