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 void SetupEquipmentShardRewardItemElements(string itemUID, CrateSupplyVO crateSupply) { EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(crateSupply.RewardUid); int quality = (int)currentEquipmentDataByID.Quality; string name = string.Format("SpriteTroopImageBkgGridQ{0}", quality); this.rewardsGrid.GetSubElement <UXElement>(itemUID, name).Visible = true; UXSprite subElement = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteIconFragmentLootTable"); UXUtils.SetupFragmentIconSprite(subElement, quality); this.SetupEquipmentShardProgress(itemUID, currentEquipmentDataByID); UXSprite subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteRewardItemImage"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateEquipmentConfig(currentEquipmentDataByID, subElement2, true); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; GeometryProjector item = ProjectorUtils.GenerateProjector(projectorConfig); this.projectors.Add(item); UXUtils.SetCardQuality(this, this.rewardsGrid, itemUID, quality, "RewardItemCardQ{0}"); }
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); }
private UXElement FetchEquipmentCardGridItem(CurrentPlayer player, EquipmentVO equipmentVO, EquipmentUpgradeCatalog catalog) { UXElement result = this.equipmentGrid.CloneTemplateItem(equipmentVO.Uid); string uid = equipmentVO.Uid; EquipmentVO nextLevel = catalog.GetNextLevel(equipmentVO); ShardQuality quality = equipmentVO.Quality; UXUtils.SetCardQuality(this, this.equipmentGrid, uid, (int)quality, "EquipmentItemCardQ{0}"); UXLabel subElement = this.equipmentGrid.GetSubElement <UXLabel>(uid, "LabelEquipmentName"); subElement.Text = this.lang.Get(equipmentVO.EquipmentName, new object[0]); UXLabel subElement2 = this.equipmentGrid.GetSubElement <UXLabel>(uid, "LabelEquipmentLevel"); subElement2.Text = LangUtils.GetLevelText(equipmentVO.Lvl); UXButton subElement3 = this.equipmentGrid.GetSubElement <UXButton>(uid, "BtnEquipmentItemCard"); subElement3.Tag = equipmentVO; subElement3.OnClicked = new UXButtonClickedDelegate(this.OnEquipmentButtonClicked); this.troopGrid.GetSubElement <UXSlider>(uid, "pBarUpgradeTimeEquipment").Visible = false; this.troopGrid.GetSubElement <UXLabel>(uid, "LabelpBarUpgradeTimeEquipment").Visible = false; UXSprite subElement4 = this.equipmentGrid.GetSubElement <UXSprite>(uid, "SpriteFragmentEquip"); UXUtils.SetupFragmentIconSprite(subElement4, (int)quality); UXSprite subElement5 = this.equipmentGrid.GetSubElement <UXSprite>(uid, "SpriteEquipmentItemImage"); ProjectorConfig config = ProjectorUtils.GenerateEquipmentConfig(equipmentVO, subElement5, true); ProjectorUtils.GenerateProjector(config); UXLabel subElement6 = this.equipmentGrid.GetSubElement <UXLabel>(uid, "LabelEquipmentNumber"); UXSlider subElement7 = this.equipmentGrid.GetSubElement <UXSlider>(uid, "pBarFrag"); UXSprite subElement8 = this.equipmentGrid.GetSubElement <UXSprite>(uid, "SpritepBarFrag"); subElement8.Color = UXUtils.COLOR_SHARD_INPROGRESS; UXLabel subElement9 = this.equipmentGrid.GetSubElement <UXLabel>(uid, "LabelEquipmentRequirement"); UXSprite subElement10 = this.equipmentGrid.GetSubElement <UXSprite>(uid, "SpriteDim"); UXSprite subElement11 = this.equipmentGrid.GetSubElement <UXSprite>(uid, "SpriteIconLockedEquip"); UXElement subElement12 = this.equipmentGrid.GetSubElement <UXElement>(uid, "IconUpgrade"); if (!player.UnlockedLevels.Equipment.Has(equipmentVO)) { subElement9.Text = LangUtils.GetShardLockedEquipmentString(equipmentVO); subElement10.Visible = true; subElement11.Visible = true; subElement2.Visible = false; int shards = player.GetShards(equipmentVO.EquipmentID); subElement6.Text = this.lang.Get("OBJECTIVE_PROGRESS", new object[] { shards, equipmentVO.UpgradeShards }); subElement7.Value = this.CalculateProgress(shards, equipmentVO); subElement12.Visible = false; } else if (nextLevel == null) { subElement6.Visible = false; subElement10.Visible = true; subElement11.Visible = false; subElement6.Visible = false; subElement9.Text = this.lang.Get("MAX_LEVEL", new object[0]); subElement7.Visible = false; subElement12.Visible = false; } else { int shards2 = player.GetShards(equipmentVO.EquipmentID); subElement6.Text = this.lang.Get("OBJECTIVE_PROGRESS", new object[] { shards2, nextLevel.UpgradeShards }); subElement7.Value = this.CalculateProgress(shards2, nextLevel); subElement12.Visible = (shards2 >= nextLevel.UpgradeShards); if (subElement12.Visible) { subElement8.Color = UXUtils.COLOR_SHARD_COMPLETE; } if (ArmoryUtils.IsBuildingRequirementMet(nextLevel)) { subElement9.Visible = false; subElement10.Visible = false; subElement11.Visible = false; } else { BuildingTypeVO buildingInfo = this.dataController.Get <BuildingTypeVO>(nextLevel.BuildingRequirement); subElement9.Text = this.lang.Get("BUILDING_REQUIREMENT", new object[] { nextLevel.Lvl, LangUtils.GetBuildingDisplayName(buildingInfo) }); subElement10.Visible = true; subElement11.Visible = true; } } return(result); }
protected void SetupFragmentSprite(int quality) { UXUtils.SetupFragmentIconSprite(this.fragmentSprite, quality); }
private UXElement CreateInactiveCard(UXGrid grid, EquipmentVO equipment, CurrentPlayer currentPlayer) { UXElement uXElement = this.CreateCommonEquipmentCard(grid, equipment, "LabelEquipmentName", "LabelEquipmentLevel", "SpriteEquipmentItemImage", "EquipmentItemCardQ{0}", false, true); (uXElement.Tag as SortableEquipment).Player = currentPlayer; UXButton subElement = this.inactiveGrid.GetSubElement <UXButton>(equipment.Uid, "BtnEquipmentInfo"); subElement.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked); subElement.Tag = equipment; UXButton subElement2 = this.inactiveGrid.GetSubElement <UXButton>(equipment.Uid, "BtnEquipmentItemCard"); subElement2.OnClicked = new UXButtonClickedDelegate(this.OnCardButtonClicked); subElement2.Tag = uXElement; EquipmentUpgradeCatalog equipmentUpgradeCatalog = Service.EquipmentUpgradeCatalog; UXSlider subElement3 = this.inactiveGrid.GetSubElement <UXSlider>(equipment.Uid, "pBarEquipmentItemFrag"); UXSprite subElement4 = this.inactiveGrid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentItempBarFrag"); UXLabel subElement5 = grid.GetSubElement <UXLabel>(equipment.Uid, "LabelFragProgress"); UXElement subElement6 = this.inactiveGrid.GetSubElement <UXElement>(equipment.Uid, "IconUpgrade"); UXSprite subElement7 = grid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentImageBkgStroke"); UXSprite subElement8 = grid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentItemBarOutline"); UXSprite subElement9 = grid.GetSubElement <UXSprite>(equipment.Uid, "SpriteEquipmentImageBkgGlow"); subElement7.Color = ArmoryScreen.qualityColor[equipment.Quality]; subElement8.Color = ArmoryScreen.qualityColor[equipment.Quality]; subElement9.Color = ArmoryScreen.qualityColor[equipment.Quality]; subElement9.Alpha = 0.4f; float sliderProgressValue = this.GetSliderProgressValue(equipment, currentPlayer.GetShards(equipment.EquipmentID)); UXSprite subElement10 = this.inactiveGrid.GetSubElement <UXSprite>(equipment.Uid, "SpriteIconFragment"); UXUtils.SetupFragmentIconSprite(subElement10, (int)equipment.Quality); UXUtils.SetShardProgressBarValue(subElement3, subElement4, sliderProgressValue); subElement6.Visible = false; if (ArmoryUtils.IsAtMaxLevel(equipmentUpgradeCatalog, equipment)) { subElement5.Text = this.lang.Get("MAX_LEVEL", new object[0]); } else { int shards = currentPlayer.GetShards(equipment.EquipmentID); int shardsRequiredForNextUpgrade = ArmoryUtils.GetShardsRequiredForNextUpgrade(currentPlayer, equipmentUpgradeCatalog, equipment); if (shards >= shardsRequiredForNextUpgrade) { subElement5.Text = this.lang.Get("ARMORY_UPGRADE_NOW", new object[0]); } else { subElement5.Text = this.lang.Get("OBJECTIVE_PROGRESS", new object[] { shards, shardsRequiredForNextUpgrade }); } } if (ArmoryUtils.IsEquipmentOwned(currentPlayer, equipment)) { EquipmentVO nextLevel = equipmentUpgradeCatalog.GetNextLevel(equipment); if (nextLevel != null) { if (Service.ISupportController.FindFirstContractWithProductUid(nextLevel.Uid) != null) { subElement5.Visible = false; subElement3.Visible = false; } else if (currentPlayer.GetShards(equipment.EquipmentID) >= nextLevel.UpgradeShards) { subElement6.Visible = true; } } } this.SetDimmerBasedOnRequirements(currentPlayer, equipment); return(uXElement); }