public void ActivateEquipment(string equipmentId) { CurrentPlayer currentPlayer = Service.CurrentPlayer; EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(equipmentId); if (currentEquipmentDataByID == null) { Service.Logger.Warn("Invalid EquipmentID: " + equipmentId); return; } if (currentPlayer.ActiveArmory.Equipment.Contains(currentEquipmentDataByID.Uid)) { return; } if (ArmoryUtils.GetCurrentActiveEquipmentCapacity(currentPlayer.ActiveArmory) + currentEquipmentDataByID.Size > currentPlayer.ActiveArmory.MaxCapacity) { string instructions = Service.Lang.Get("ARMORY_FULL", new object[0]); Service.UXController.MiscElementsManager.ShowPlayerInstructions(instructions); return; } if (!ArmoryUtils.IsEquipmentOnValidPlanet(currentPlayer, currentEquipmentDataByID)) { string instructions2 = Service.Lang.Get("BASE_ON_INCORRECT_PLANET", new object[0]); Service.UXController.MiscElementsManager.ShowPlayerInstructions(instructions2); return; } currentPlayer.ActiveArmory.Equipment.Add(currentEquipmentDataByID.Uid); Service.EventManager.SendEvent(EventId.EquipmentActivated, currentEquipmentDataByID); EquipmentIdRequest request = new EquipmentIdRequest(equipmentId); ActivateEquipmentCommand activateEquipmentCommand = new ActivateEquipmentCommand(request); activateEquipmentCommand.Context = equipmentId; activateEquipmentCommand.AddFailureCallback(new AbstractCommand <EquipmentIdRequest, DefaultResponse> .OnFailureCallback(this.OnActivateEquipmentFailure)); Service.ServerAPI.Enqueue(activateEquipmentCommand); }
public void HandleEarnedShardReward(string equipmentId, int count) { CurrentPlayer currentPlayer = Service.CurrentPlayer; Dictionary <string, int> shards = currentPlayer.Shards; EquipmentVO equipmentDataByID = ArmoryUtils.GetEquipmentDataByID(equipmentId, 1); if (equipmentDataByID == null) { return; } int num = count; if (shards.ContainsKey(equipmentId)) { num += shards[equipmentId]; } currentPlayer.ModifyShardAmount(equipmentId, num); EquipmentVO nextEquipmentVOUpgrade = this.GetNextEquipmentVOUpgrade(equipmentId); if (nextEquipmentVOUpgrade != null && shards[equipmentId] - count < nextEquipmentVOUpgrade.UpgradeShards && nextEquipmentVOUpgrade.UpgradeShards < shards[equipmentId]) { this.AllowShowEquipmentTabBadge = true; Service.EventManager.SendEvent(EventId.EquipmentNowUpgradable, equipmentId); } Service.EventManager.SendEvent(EventId.ShardsEarned, null); if (!ArmoryUtils.IsEquipmentOwned(currentPlayer, equipmentDataByID)) { this.TryToUnlockPlayerEquipment(equipmentDataByID); } }
private void UpdateArmoryAnimation(SmartEntity entity) { IState currentState = Service.Get <GameStateMachine>().CurrentState; CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); BuildingComponent buildingComp = entity.BuildingComp; if (!(currentState is HomeState) || buildingComp == null || buildingComp.BuildingType.Type != BuildingType.Armory) { return; } BuildingAnimationComponent buildingAnimationComp = entity.BuildingAnimationComp; if (buildingAnimationComp == null) { return; } Animation anim = buildingAnimationComp.Anim; if (!ArmoryUtils.IsAnyEquipmentActive(currentPlayer.ActiveArmory) && anim.GetClip("Idle") != null) { anim.Stop(); anim.Play("Idle"); Service.Get <ShuttleController>().DestroyArmoryShuttle(entity); return; } if (entity.StateComp.CurState == EntityState.Idle && anim.IsPlaying("Idle") && anim.GetClip("Active") != null && anim.GetClip("Intro") != null) { anim.Stop(); anim.Play("Intro"); this.EnqueueAnimation(buildingAnimationComp, "Active"); Service.Get <ShuttleController>().UpdateArmoryShuttle(entity); } }
private void OnMainButtonClicked(UXButton button) { CurrentPlayer currentPlayer = Service.CurrentPlayer; if (this.forResearchLab) { if (this.activeContract != null) { Service.UXController.MiscElementsManager.ShowPlayerInstructionsError(this.lang.Get("UPGRADE_CONTRACT_ACTIVE", new object[0])); return; } if (this.selectedBuilding == null) { Service.UXController.MiscElementsManager.ShowPlayerInstructionsError(this.lang.Get("UPGRADE_RESEARCH_CENTER_ACTIVE", new object[0])); return; } Service.ISupportController.StartEquipmentUpgrade(this.nextEquipmentVoUpgrade, this.selectedBuilding); this.CloseFromResearchScreen(); } else { if (ArmoryUtils.IsEquipmentActive(currentPlayer, this.selectedEquipment)) { Service.ArmoryController.DeactivateEquipment(this.selectedEquipment.EquipmentID); } else { Service.ArmoryController.ActivateEquipment(this.selectedEquipment.EquipmentID); } this.OnBackButtonClicked(null); } }
public bool IsEquipmentUnlockableOrUpgradeable(EquipmentVO equipment) { CurrentPlayer currentPlayer = Service.CurrentPlayer; bool flag = ArmoryUtils.CanAffordEquipment(currentPlayer, equipment); bool flag2 = ArmoryUtils.IsBuildingRequirementMet(equipment); return(flag && flag2); }
public bool IsEquipmentUpgradeable(EquipmentVO equipmentVO, EquipmentVO nextEquipmentVO) { CurrentPlayer currentPlayer = Service.CurrentPlayer; bool flag = ArmoryUtils.IsEquipmentOwned(currentPlayer, equipmentVO); bool flag2 = this.IsEquipmentUnlockableOrUpgradeable(nextEquipmentVO); return(flag && flag2); }
protected override void OnScreenLoaded() { if (this.selectedBuilding == null) { base.DestroyScreen(); return; } this.researchMode = TroopUpgradeScreenMode.Troops; base.GetElement <UXLabel>("LabelSelectTroop").Text = this.lang.Get("UPGRADE_UPGRADE_TROOPS", new object[0]); this.troopGrid = base.GetElement <UXGrid>("TroopCapacityGrid"); this.troopGrid.SetTemplateItem("TroopItemTemplate"); this.equipmentGrid = base.GetElement <UXGrid>("EquipmentGrid"); this.equipmentGrid.SetTemplateItem("EquipmentItemTemplate"); this.equipmentGrid.DupeOrdersAllowed = true; this.InitButtons(); this.troopTabButton = base.GetElement <UXCheckbox>("Btn1"); this.troopTabButton.OnSelected = new UXCheckboxSelectedDelegate(this.OnTroopsTabClicked); this.troopTabLabel = base.GetElement <UXLabel>("LabelBtn1"); this.troopTabLabel.Text = this.lang.Get("RESEARCH_LAB_TROOPS_TAB", new object[0]); this.equipmentTabButton = base.GetElement <UXCheckbox>("Btn2"); this.equipmentTabButton.OnSelected = new UXCheckboxSelectedDelegate(this.OnEquipmentTabClicked); this.equipmentTabLabel = base.GetElement <UXLabel>("LabelBtn2"); this.equipmentTabLabel.Text = this.lang.Get("RESEARCH_LAB_EQUIPMENT_TAB", new object[0]); this.equipmentTabButtonDim = base.GetElement <UXButton>("Btn2Dim"); this.equipmentTabButtonDim.OnClicked = new UXButtonClickedDelegate(this.OnEquipmentTabDimClicked); this.equipmentTabLabelDim = base.GetElement <UXLabel>("LabelBtn2Dim"); this.equipmentTabLabelDim.Text = this.lang.Get("RESEARCH_LAB_EQUIPMENT_TAB", new object[0]); if (ArmoryUtils.PlayerHasArmory()) { this.equipmentTabButton.Enabled = true; this.equipmentTabButton.Visible = true; this.equipmentTabButtonDim.Enabled = false; this.equipmentTabButtonDim.Visible = false; } else { this.equipmentTabButton.Enabled = false; this.equipmentTabButton.Visible = false; this.equipmentTabButtonDim.Enabled = true; this.equipmentTabButtonDim.Visible = true; } base.GetElement <UXElement>("ContainerJewel1").Visible = false; base.GetElement <UXLabel>("LabelMessage1").Text = this.lang.Get("RESEARCH_EQUIPMENT_TAB_NEW", new object[0]); ArmoryController armoryController = Service.ArmoryController; bool visible = armoryController.AllowShowEquipmentTabBadge && armoryController.DoesUserHaveAnyUpgradableEquipment(); base.GetElement <UXElement>("ContainerJewel").Visible = visible; base.GetElement <UXLabel>("LabelMessage").Text = this.lang.Get("RESEARCH_EQUIPMENT_TAB_NEW", new object[0]); EventManager eventManager = Service.EventManager; eventManager.RegisterObserver(this, EventId.ContractCompleted); eventManager.RegisterObserver(this, EventId.InventoryUnlockUpdated); this.RefreshFilterTabs(); this.RefreshGrids(); armoryController.AllowShowEquipmentTabBadge = false; Service.DeployableShardUnlockController.AllowResearchBuildingBadging = false; eventManager.SendEvent(EventId.TroopUpgradeScreenOpened, null); }
private void AnimateArmoryShuttle(ShuttleAnim anim) { if (anim.Anim == null || !ArmoryUtils.IsAnyEquipmentActive(Service.Get <CurrentPlayer>().ActiveArmory)) { return; } anim.EnqueueState(ShuttleState.DropOff); anim.EnqueueState(ShuttleState.Idle); }
public static CrateInfoModalScreen CreateForMobileConnectorAd(string crateUid, string planetID) { BuildingLookupController buildingLookupController = Service.BuildingLookupController; Entity currentHQ = buildingLookupController.GetCurrentHQ(); BuildingTypeVO buildingType = currentHQ.Get <BuildingComponent>().BuildingType; FactionType faction = Service.CurrentPlayer.Faction; bool flag = ArmoryUtils.PlayerHasArmory(); return(new CrateInfoModalScreen(crateUid, planetID, buildingType.Lvl, faction, flag) { ModalReason = CrateInfoReason.Reason_Mobile_Connector_Ad }); }
public void DestroyArmoryShuttle(Entity entity) { if (!this.shuttles.ContainsKey(entity)) { return; } ShuttleAnim shuttleAnim = this.shuttles[entity]; if (shuttleAnim.State == ShuttleState.Idle || !ArmoryUtils.IsAnyEquipmentActive(Service.Get <CurrentPlayer>().ActiveArmory)) { this.RemoveStarportShuttle(entity); } }
private void SetUpArmoryScreenInfo(CurrentPlayer player) { this.SetTitleText(base.GetElement <UXLabel>("DialogBldgUpgradeTitle"), "BUILDING_INFO", this.selectedEquipment.EquipmentName, this.selectedEquipment.Lvl); UXLabel element = base.GetElement <UXLabel>("LabelRequirement"); element.Visible = true; UXLabel element2 = base.GetElement <UXLabel>("LabelNormalIntro"); UXButton element3 = base.GetElement <UXButton>("BtnNormal"); element3.Visible = true; element3.OnClicked = new UXButtonClickedDelegate(this.OnMainButtonClicked); if (!ArmoryUtils.IsEquipmentOwned(player, this.selectedEquipment)) { element3.Enabled = false; element2.Text = this.lang.Get("ARMORY_ACTIVATE", new object[0]); element.Text = this.lang.Get("EQUIPMENT_LOCKED", new object[] { this.CalculateFragmentsNeededForUnlock(this.selectedEquipment.UpgradeShards, this.selectedEquipment.EquipmentID) }); return; } if (ArmoryUtils.IsEquipmentActive(player, this.selectedEquipment)) { element2.Text = this.lang.Get("ARMORY_DEACTIVATE", new object[0]); element3.Enabled = true; } else { bool flag = ArmoryUtils.HasEnoughCapacityToActivateEquipment(player.ActiveArmory, this.selectedEquipment); bool flag2 = ArmoryUtils.IsEquipmentValidForPlanet(this.selectedEquipment, player.PlanetId); element3.Enabled = (flag && flag2); element2.Text = this.lang.Get("ARMORY_ACTIVATE", new object[0]); if (!flag2) { string planetDisplayName = LangUtils.GetPlanetDisplayName(player.PlanetId); element.Text = this.lang.Get("ARMORY_INVALID_EQUIPMENT_PLANET", new object[] { planetDisplayName }); return; } if (!flag) { element.Text = this.lang.Get("ARMORY_NOT_ENOUGH_CAPACITY", new object[0]); return; } } element.Text = string.Empty; }
public static CrateInfoModalScreen CreateForTargetedOffer(TargetedBundleVO offer, CrateVO crate) { BuildingLookupController buildingLookupController = Service.BuildingLookupController; Entity currentHQ = buildingLookupController.GetCurrentHQ(); BuildingTypeVO buildingType = currentHQ.Get <BuildingComponent>().BuildingType; string planetId = Service.CurrentPlayer.PlanetId; FactionType faction = Service.CurrentPlayer.Faction; bool flag = ArmoryUtils.PlayerHasArmory(); return(new CrateInfoModalScreen(crate.Uid, planetId, buildingType.Lvl, faction, flag) { ModalReason = CrateInfoReason.Reason_Targeted_Offer, CurrentOffer = offer }); }
public void DeactivateEquipment(string equipmentId) { CurrentPlayer currentPlayer = Service.CurrentPlayer; EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(equipmentId); if (!currentPlayer.ActiveArmory.Equipment.Contains(currentEquipmentDataByID.Uid)) { return; } this.DeactivateEquipmentOnClient(currentPlayer, currentEquipmentDataByID); EquipmentIdRequest request = new EquipmentIdRequest(equipmentId); DeactivateEquipmentCommand deactivateEquipmentCommand = new DeactivateEquipmentCommand(request); deactivateEquipmentCommand.Context = equipmentId; deactivateEquipmentCommand.AddFailureCallback(new AbstractCommand <EquipmentIdRequest, DefaultResponse> .OnFailureCallback(this.OnDeactivateEquipmentFailure)); Service.ServerAPI.Enqueue(deactivateEquipmentCommand); }
private void OnCardButtonClicked(UXButton button) { CurrentPlayer currentPlayer = Service.CurrentPlayer; EquipmentVO equipmentVOFromCard = this.GetEquipmentVOFromCard(button.Tag as UXElement); if (!ArmoryUtils.IsEquipmentValidForPlanet(equipmentVOFromCard, currentPlayer.PlanetId)) { Service.UXController.MiscElementsManager.ShowPlayerInstructions(this.lang.Get("BASE_ON_INCORRECT_PLANET", new object[0])); return; } if (!ArmoryUtils.HasEnoughCapacityToActivateEquipment(currentPlayer.ActiveArmory, equipmentVOFromCard)) { Service.UXController.MiscElementsManager.ShowPlayerInstructions(this.lang.Get("ARMORY_FULL", new object[0])); return; } Service.ArmoryController.ActivateEquipment(equipmentVOFromCard.EquipmentID); }
private void SetupLockedRewardItemElements(string itemUID, PlanetLootEntryVO lootEntry) { UXSprite subElement = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteLockIcon"); UXSprite subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteDimLock"); UXLabel subElement3 = this.rewardsGrid.GetSubElement <UXLabel>(itemUID, "LabelEquipmentRequirement"); subElement.Visible = false; subElement2.Visible = false; subElement3.Visible = false; bool flag = lootEntry.ReqArmory && !ArmoryUtils.PlayerHasArmory(); if (flag) { subElement2.Visible = true; subElement.Visible = true; subElement3.Visible = true; subElement3.Text = this.lang.Get("EQUIPMENT_ARMORY_REQUIRED", new object[0]); } }
private void InitLabels() { ActiveArmory activeArmory = Service.CurrentPlayer.ActiveArmory; this.titleLabel = base.GetElement <UXLabel>("LabelTitle"); this.titleLabel.Text = this.lang.Get("BUILDING_INFO", new object[] { LangUtils.GetBuildingDisplayName(this.buildingInfo), this.buildingInfo.Lvl }); this.currentCapacityLabel = base.GetElement <UXLabel>("LabelEquipmentActive"); this.currentCapacityLabel.Text = this.lang.Get("ARMORY_CAPACITY", new object[] { ArmoryUtils.GetCurrentActiveEquipmentCapacity(activeArmory), activeArmory.MaxCapacity }); this.instructionsLabel = base.GetElement <UXLabel>("LabelEquipment"); this.instructionsLabel.Text = this.lang.Get("ARMORY_CTA", new object[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 bool BuildingEligibleForIdleAnimation(Entity entity, IState gameState, BuildingAnimationComponent animComp) { if (entity == null) { return(false); } if (gameState is EditBaseState) { return(false); } if (animComp.BuildingUpgrading) { return(false); } if (Service.Get <PostBattleRepairController>().IsEntityInRepair(entity)) { return(false); } BuildingComponent buildingComponent = entity.Get <BuildingComponent>(); if (buildingComponent == null) { return(false); } if (!(gameState is HomeState)) { return(false); } if (buildingComponent.BuildingType.Type == BuildingType.ScoutTower) { return(true); } if (buildingComponent.BuildingType.Type == BuildingType.Armory) { ActiveArmory activeArmory = Service.Get <CurrentPlayer>().ActiveArmory; return(!ArmoryUtils.IsAnyEquipmentActive(activeArmory)); } return(false); }
public static void TrySetupItemQualityView(CrateSupplyVO supplyData, UXElement unitElement, UXElement basicElement, UXElement advancedElement, UXElement eliteElement, UXElement defaultElement) { if (supplyData == null) { return; } unitElement.Visible = false; basicElement.Visible = false; advancedElement.Visible = false; eliteElement.Visible = false; bool flag = false; ShardQuality shardQuality = ShardQuality.Basic; if (supplyData.Type == SupplyType.ShardTroop || supplyData.Type == SupplyType.ShardSpecialAttack) { ShardVO optional = Service.StaticDataController.GetOptional <ShardVO>(supplyData.RewardUid); shardQuality = optional.Quality; flag = true; } else if (supplyData.Type == SupplyType.Shard) { EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(supplyData.RewardUid); shardQuality = currentEquipmentDataByID.Quality; flag = true; } if (flag) { unitElement.Visible = (shardQuality == ShardQuality.Unit); basicElement.Visible = (shardQuality == ShardQuality.Basic); advancedElement.Visible = (shardQuality == ShardQuality.Advanced); eliteElement.Visible = (shardQuality == ShardQuality.Elite); } if (defaultElement != null) { defaultElement.Visible = !flag; } }
private UXElement CreateCommonEquipmentCard(UXGrid grid, EquipmentVO equipment, string labelName, string labelLevel, string icon, string cardName, bool shouldAnimate, bool closeup) { CurrentPlayer currentPlayer = Service.CurrentPlayer; string uid = equipment.Uid; UXElement uXElement = grid.CloneTemplateItem(uid); uXElement.Tag = new SortableEquipment(equipment); UXLabel subElement = grid.GetSubElement <UXLabel>(uid, labelName); subElement.Text = LangUtils.GetEquipmentDisplayName(equipment); UXLabel subElement2 = grid.GetSubElement <UXLabel>(uid, labelLevel); if (ArmoryUtils.IsEquipmentOwned(currentPlayer, equipment)) { subElement2.Text = LangUtils.GetLevelText(equipment.Lvl); } else { subElement2.Visible = false; } UXSprite subElement3 = grid.GetSubElement <UXSprite>(uid, icon); ProjectorConfig projectorConfig = ProjectorUtils.GenerateEquipmentConfig(equipment, subElement3, closeup); if (shouldAnimate) { projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; } ProjectorUtils.GenerateProjector(projectorConfig); UXElement uXElement2 = UXUtils.SetCardQuality(this, grid, uid, (int)equipment.Quality, cardName); if (uXElement2 != null) { uXElement2.SkipBoundsCalculations(true); } return(uXElement); }
private void SetupCrateReward(string itemUid, TournamentRewardsVO rewardGroup, UXGrid rewardGrid, UXElement rewardItem, string rewardSuffix, CrateFlyoutItemVO crateFlyoutItemVO) { IDataController dataController = Service.Get <IDataController>(); CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); UXButton uXButton = rewardItem as UXButton; UXSprite subElement = rewardGrid.GetSubElement <UXSprite>(itemUid, "SpriteFragmentIcon" + rewardSuffix); UXUtils.HideAllQualityCards(rewardGrid, itemUid, "EquipmentItemCardQ{0}" + rewardSuffix); UXElement subElement2 = rewardGrid.GetSubElement <UXElement>(itemUid, "ParticlesTopPrize" + rewardSuffix); subElement2.Visible = false; uXButton.Enabled = false; subElement.Visible = false; CrateSupplyVO optional = dataController.GetOptional <CrateSupplyVO>(crateFlyoutItemVO.CrateSupplyUid); if (optional == null) { Service.Get <StaRTSLogger>().ErrorFormat("Could not find crate supply {0} for faction {1}", new object[] { crateFlyoutItemVO.CrateSupplyUid, currentPlayer.Faction }); return; } bool flag = crateFlyoutItemVO.TournamentTierDisplay3D && optional.Type != SupplyType.Currency && optional.Type != SupplyType.Invalid; int num = currentPlayer.Map.FindHighestHqLevel(); UXSprite subElement3 = rewardGrid.GetSubElement <UXSprite>(itemUid, "SpriteReward2D" + rewardSuffix); subElement3.Visible = false; if (flag) { IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(optional, num); if (iconVOFromCrateSupply != null) { UXSprite subElement4 = rewardGrid.GetSubElement <UXSprite>(itemUid, "SpriteEquipmentItemImage" + rewardSuffix); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, subElement4, true); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; ProjectorUtils.GenerateProjector(projectorConfig); if (rewardGroup.TournamentTier == this.tiers[0].Uid) { this.particleElements.Add(subElement2.Root.name); } } else { Service.Get <StaRTSLogger>().ErrorFormat("Could not generate geometry for crate supply {0}", new object[] { optional.Uid }); } uXButton.Tag = optional; uXButton.OnClicked = new UXButtonClickedDelegate(this.OnGuaranteedRewardClicked); uXButton.Enabled = true; } else { subElement3.Visible = true; int num2 = crateFlyoutItemVO.ListIcons.Length - 1; subElement3.SpriteName = crateFlyoutItemVO.ListIcons[num2]; rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteEquipmentGradient" + rewardSuffix).Visible = false; rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteEquipmentGradientBottom" + rewardSuffix).Visible = false; rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteEquipmentImageBkg" + rewardSuffix).Visible = false; rewardGrid.GetSubElement <UXElement>(itemUid, "SpriteFrameHover" + rewardSuffix).Visible = false; } UXLabel subElement5 = rewardGrid.GetSubElement <UXLabel>(itemUid, "LabelPrizeCount" + rewardSuffix); int rewardAmount = Service.Get <InventoryCrateRewardController>().GetRewardAmount(optional, num); int num3 = rewardGroup.CrateRewardIds.Length; string text = this.lang.ThousandsSeparated(rewardAmount * num3); string quantityString = crateFlyoutItemVO.QuantityString; if (!string.IsNullOrEmpty(quantityString)) { subElement5.Text = this.lang.Get(quantityString, new object[] { text }); } else if (rewardAmount > 0) { subElement5.Text = this.lang.Get("CONFLICT_PRIZE_CRATE_MULTIPLIER", new object[] { text }); } else { subElement5.Visible = false; } int num4 = -1; bool visible = false; if (optional.Type == SupplyType.ShardSpecialAttack || optional.Type == SupplyType.ShardTroop) { ShardVO optional2 = dataController.GetOptional <ShardVO>(optional.RewardUid); if (optional2 != null) { num4 = (int)optional2.Quality; } } else if (optional.Type == SupplyType.Shard) { EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(optional.RewardUid); if (currentEquipmentDataByID != null) { num4 = (int)currentEquipmentDataByID.Quality; visible = true; } } else if (optional.Type == SupplyType.Troop || optional.Type == SupplyType.Hero || optional.Type == SupplyType.SpecialAttack) { num4 = Service.Get <DeployableShardUnlockController>().GetUpgradeQualityForDeployableUID(optional.RewardUid); } if (num4 > 0 & flag) { subElement.Visible = true; subElement.SpriteName = string.Format("icoDataFragQ{0}", new object[] { num4 }); string text2 = string.Format("SpriteEquipmentImageBkgGridQ{0}", new object[] { num4 }); rewardGrid.GetSubElement <UXElement>(itemUid, text2 + rewardSuffix).Visible = visible; UXUtils.SetCardQuality(this, rewardGrid, itemUid, num4, "EquipmentItemCardQ{0}" + rewardSuffix); } }
private void SetUpResearchLabScreenInfo(StaticDataController sdc, CurrentPlayer player) { UXLabel element = base.GetElement <UXLabel>("DialogBldgUpgradeTitle"); UXButton element2 = base.GetElement <UXButton>("BtnNormal"); element2.OnClicked = new UXButtonClickedDelegate(this.OnMainButtonClicked); UXButton element3 = base.GetElement <UXButton>("BtnFinish"); element3.OnClicked = new UXButtonClickedDelegate(this.OnFinishClicked); UXLabel element4 = base.GetElement <UXLabel>("LabelRequirement"); element4.Visible = true; element4.Text = string.Empty; if (this.nextEquipmentVoUpgrade != null) { ArmoryController armoryController = Service.ArmoryController; this.SetTitleText(element, "BUILDING_UPGRADE", this.selectedEquipment.EquipmentName, this.nextEquipmentVoUpgrade.Lvl); element2.Visible = true; base.GetElement <UXLabel>("LabelNormalIntro").Text = this.lang.Get("LABEL_REWARD_UPGRADE", new object[0]); if (this.activeContract != null) { if (this.activeContract.ProductUid == this.nextEquipmentVoUpgrade.Uid) { element3.Visible = true; element2.Visible = false; element4.Visible = false; base.GetElement <UXLabel>("LabelUpgradeTimeStatic").Text = this.lang.Get("s_TimeRemaining", new object[0]); base.GetElement <UXElement>("ContainerUpgradeTime").Visible = true; this.UpdateContractTimers(); } else { element2.VisuallyDisableButton(); } } else if (armoryController.IsEquipmentUpgradeable(this.selectedEquipment, this.nextEquipmentVoUpgrade)) { element2.VisuallyEnableButton(); element2.Enabled = true; this.SetUpUpgradeElements(true); } else { this.SetTitleText(element, "BUILDING_INFO", this.selectedEquipment.EquipmentName, this.selectedEquipment.Lvl); element2.Enabled = false; BuildingTypeVO buildingTypeVO = (this.nextEquipmentVoUpgrade.BuildingRequirement != null) ? sdc.Get <BuildingTypeVO>(this.nextEquipmentVoUpgrade.BuildingRequirement) : null; if (buildingTypeVO != null && !ArmoryUtils.IsBuildingRequirementMet(this.nextEquipmentVoUpgrade)) { element4.Text = this.lang.Get("EQUIPMENT_REQUIRES_BUILDING", new object[] { LangUtils.GetBuildingDisplayName(buildingTypeVO), buildingTypeVO.Lvl }); } else if (!ArmoryUtils.IsEquipmentOwned(player, this.selectedEquipment)) { element4.Text = this.lang.Get("EQUIPMENT_LOCKED", new object[] { this.CalculateFragmentsNeededForUnlock(this.selectedEquipment.UpgradeShards, this.selectedEquipment.EquipmentID) }); } else if (!ArmoryUtils.CanAffordEquipment(player, this.nextEquipmentVoUpgrade)) { element4.Text = this.lang.Get("EQUIPMENT_UPGRADE_LOCKED", new object[] { this.CalculateFragmentsNeededForUnlock(this.nextEquipmentVoUpgrade.UpgradeShards, this.selectedEquipment.EquipmentID) }); } } } else { element2.Visible = false; EquipmentVO maxLevel = Service.EquipmentUpgradeCatalog.GetMaxLevel(this.selectedEquipment); if (maxLevel == this.selectedEquipment) { this.SetTitleText(element, "BUILDING_INFO", this.selectedEquipment.EquipmentName, this.selectedEquipment.Lvl); element4.Text = this.lang.Get("MAX_LEVEL", new object[0]); } } }
private void DisplayBarsForEquipmentBuffs(StaticDataController sdc) { int num = 1; int num2 = this.selectedEquipment.EffectUids.Length; int i = 0; int num3 = num2; while (i < num3) { EquipmentEffectVO equipmentEffectVO = sdc.Get <EquipmentEffectVO>(this.selectedEquipment.EffectUids[i]); EquipmentEffectVO equipmentEffectVO2 = null; if (this.nextEquipmentVoUpgrade != null && this.nextEquipmentVoUpgrade.EffectUids.Length > 0 && this.nextEquipmentVoUpgrade.EffectUids.Length > i) { equipmentEffectVO2 = sdc.Get <EquipmentEffectVO>(this.nextEquipmentVoUpgrade.EffectUids[i]); } ArmorType armorType = ArmorType.Invalid; if (equipmentEffectVO.AffectedBuildingIds != null && equipmentEffectVO.AffectedBuildingIds.Length > 0) { BuildingTypeVO minLevel = Service.BuildingUpgradeCatalog.GetMinLevel(equipmentEffectVO.AffectedBuildingIds[0]); if (minLevel != null) { armorType = minLevel.ArmorType; } } else if (equipmentEffectVO.AffectedTroopIds != null && equipmentEffectVO.AffectedTroopIds.Length > 0) { TroopTypeVO minLevel2 = Service.TroopUpgradeCatalog.GetMinLevel(equipmentEffectVO.AffectedTroopIds[0]); if (minLevel2 != null) { armorType = minLevel2.ArmorType; } } int j = 0; int num4 = equipmentEffectVO.BuffUids.Length; while (j < num4) { BuffTypeVO buffTypeVO = sdc.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[j]); BuffTypeVO buffTypeVO2 = null; if (equipmentEffectVO2 != null && equipmentEffectVO2.BuffUids.Length > 0 && equipmentEffectVO2.BuffUids.Length > j) { buffTypeVO2 = sdc.Get <BuffTypeVO>(equipmentEffectVO2.BuffUids[j]); } int num5 = buffTypeVO.Values[(int)armorType]; int nextValue = num5; if (ArmoryUtils.IsEquipmentOwned(Service.CurrentPlayer, this.selectedEquipment)) { nextValue = ((buffTypeVO2 != null) ? buffTypeVO2.Values[(int)armorType] : num5); } string buffString = this.GetBuffString(buffTypeVO.Modify); this.SetupBar(num, buffString, num5, nextValue, 1, false); num++; if (num >= 3) { break; } j++; } if (num >= 3) { break; } i++; } for (int k = num; k <= 3; k++) { base.GetElement <UXElement>(string.Format("pBar{0}", num)).Visible = false; num++; } }
private void UpdateContractTimers() { if (this.activeContract == null || this.labelUpgradeTime == null) { return; } if (this.nextEquipmentVoUpgrade != null && this.nextEquipmentVoUpgrade.Uid == this.activeContract.ProductUid) { int remainingTimeForView = this.activeContract.GetRemainingTimeForView(); if (remainingTimeForView > 0) { this.labelUpgradeTime.Text = GameUtils.GetTimeLabelFromSeconds(remainingTimeForView); int crystalCostToFinishContract = ContractUtils.GetCrystalCostToFinishContract(this.activeContract); UXUtils.SetupCostElements(this, "FinishCost", null, 0, 0, 0, crystalCostToFinishContract, 0, !ArmoryUtils.IsBuildingRequirementMet(this.nextEquipmentVoUpgrade), null); } else { this.activeContract = null; this.DisableTimers(); this.Redraw(); } } }
public static CrateInfoModalScreen CreateForObjectiveProgressInfo(string crateUid, ObjectiveProgress progress) { return(new CrateInfoModalScreen(crateUid, progress.PlanetId, progress.HQ, Service.CurrentPlayer.Faction, ArmoryUtils.PlayerHasArmory()) { ModalReason = CrateInfoReason.Reason_Info }); }
public static CrateInfoModalScreen CreateForInventory(CrateData crateData) { return(new CrateInfoModalScreen(crateData.CrateId, crateData.PlanetId, crateData.HQLevel, Service.CurrentPlayer.Faction, ArmoryUtils.PlayerHasArmory()) { crateData = crateData, ModalReason = CrateInfoReason.Reason_Inventory_Open }); }
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 EatResponse OnEvent(EventId id, object cookie) { switch (id) { case EventId.BattleReplaySetup: { BattleRecord battleRecord = (BattleRecord)cookie; ArmoryController.AddEquipmentBuffs(battleRecord.AttackerEquipment, battleRecord.DefenderEquipment); return(EatResponse.NotEaten); } case EventId.BattleRecordRetrieved: { GetReplayResponse getReplayResponse = (GetReplayResponse)cookie; BattleRecord replayData = getReplayResponse.ReplayData; ArmoryController.AddEquipmentBuffs(replayData.AttackerEquipment, replayData.DefenderEquipment); return(EatResponse.NotEaten); } case EventId.BattleLeftBeforeStarting: case EventId.BattleReplayEnded: goto IL_150; case EventId.BattleLoadedForDefend: break; default: switch (id) { case EventId.EquipmentUnlocked: this.pendingCelebrationEquipment = (cookie as EquipmentVO); this.UpdateLastEquipmentUnlocked(this.pendingCelebrationEquipment.Uid); if (this.AllowUnlockCelebration) { if (GameUtils.IsUnlockBlockingScreenOpen()) { Service.EventManager.RegisterObserver(this, EventId.ScreenClosing); } else { bool immediate = GameUtils.CanShardUnlockCelebrationPlayImmediately(); this.ShowEquipmentUnlockedCelebration(immediate); } } return(EatResponse.NotEaten); case EventId.EquipmentUpgraded: { ContractEventData contractEventData = cookie as ContractEventData; StaticDataController staticDataController = Service.StaticDataController; EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(contractEventData.Contract.ProductUid); this.UpdateActiveArmoryLevel(equipmentVO); return(EatResponse.NotEaten); } case EventId.EquipmentActivated: case EventId.EquipmentDeactivated: this.UpdateArmoryBuildingTooltip(); return(EatResponse.NotEaten); default: switch (id) { case EventId.ScreenClosing: if (cookie is InventoryCrateCollectionScreen) { GameUtils.CloseStoreOrInventoryScreen(); Service.EventManager.UnregisterObserver(this, EventId.ScreenClosing); if (this.AllowUnlockCelebration) { this.ShowEquipmentUnlockedCelebration(false); } } return(EatResponse.NotEaten); case EventId.ScreenClosed: case EventId.ScreenOverlayClosing: { IL_58: if (id == EventId.BattleLoadStart) { goto IL_E3; } if (id == EventId.BattleEndFullyProcessed) { goto IL_150; } if (id != EventId.PlanetConfirmRelocate) { return(EatResponse.NotEaten); } CurrentPlayer currentPlayer = Service.CurrentPlayer; StaticDataController staticDataController2 = Service.StaticDataController; for (int i = currentPlayer.ActiveArmory.Equipment.Count - 1; i >= 0; i--) { EquipmentVO equipment = staticDataController2.Get <EquipmentVO>(currentPlayer.ActiveArmory.Equipment[i]); if (!ArmoryUtils.IsEquipmentValidForPlanet(equipment, (string)cookie)) { this.DeactivateEquipmentOnClient(currentPlayer, equipment); } } return(EatResponse.NotEaten); } case EventId.ScreenLoaded: if (cookie is ArmoryScreen) { this.UpdateLastEquipmentUnlocked("false"); } return(EatResponse.NotEaten); } goto IL_58; } break; } IL_E3: CurrentBattle currentBattle = Service.BattleController.GetCurrentBattle(); ArmoryController.AddEquipmentBuffs(currentBattle.AttackerEquipment, currentBattle.DefenderEquipment); return(EatResponse.NotEaten); IL_150: Service.BuffController.ClearEquipmentBuffs(); return(EatResponse.NotEaten); }
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); }
public string GetCrateSupplyRewardName(CrateSupplyVO supplyData) { string text = string.Empty; if (supplyData == null) { return(text); } Lang lang = Service.Get <Lang>(); IDataController dataController = Service.Get <IDataController>(); string rewardUid = supplyData.RewardUid; SupplyType type = supplyData.Type; switch (type) { case SupplyType.Currency: text = lang.Get(supplyData.RewardUid.ToUpper(), new object[0]); break; case SupplyType.Shard: { EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(rewardUid); if (currentEquipmentDataByID != null) { text = lang.Get(currentEquipmentDataByID.EquipmentName, new object[0]); } break; } case SupplyType.Troop: case SupplyType.Hero: { TroopTypeVO optional = dataController.GetOptional <TroopTypeVO>(rewardUid); if (optional != null) { text = LangUtils.GetTroopDisplayName(optional); } break; } case SupplyType.SpecialAttack: { SpecialAttackTypeVO optional2 = dataController.GetOptional <SpecialAttackTypeVO>(rewardUid); if (optional2 != null) { text = LangUtils.GetStarshipDisplayName(optional2); } break; } case SupplyType.ShardTroop: { ShardVO optional3 = dataController.GetOptional <ShardVO>(rewardUid); if (optional3 != null) { text = LangUtils.GetTroopDisplayNameFromTroopID(optional3.TargetGroupId); } break; } case SupplyType.ShardSpecialAttack: { ShardVO optional4 = dataController.GetOptional <ShardVO>(rewardUid); if (optional4 != null) { text = LangUtils.GetStarshipDisplayNameFromAttackID(optional4.TargetGroupId); } break; } } if (string.IsNullOrEmpty(text)) { Service.Get <StaRTSLogger>().ErrorFormat("CrateSupplyVO Uid:{0}, Cannot find reward for RewardUid:{1}, Type:{2}", new object[] { supplyData.Uid, rewardUid, type }); } return(text); }