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; }
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 SetDimmerBasedOnRequirements(CurrentPlayer player, EquipmentVO equipment) { UXSprite subElement = this.inactiveGrid.GetSubElement <UXSprite>(equipment.Uid, "SpriteDim"); UXSprite subElement2 = this.inactiveGrid.GetSubElement <UXSprite>(equipment.Uid, "SpriteDimFull"); UXLabel subElement3 = this.inactiveGrid.GetSubElement <UXLabel>(equipment.Uid, "LabelEquipmentRequirement"); UXSprite subElement4 = this.inactiveGrid.GetSubElement <UXSprite>(equipment.Uid, "SpriteLockIcon"); UXElement subElement5 = this.inactiveGrid.GetSubElement <UXElement>(equipment.Uid, "PlanetLocked"); subElement2.Visible = false; subElement4.Visible = false; subElement5.Visible = false; bool flag = ArmoryUtils.IsEquipmentOwned(player, equipment); if (ArmoryUtils.IsBuildingRequirementMet(equipment) && flag && ArmoryUtils.IsEquipmentValidForPlanet(equipment, player.PlanetId)) { subElement3.Text = string.Empty; if (ArmoryUtils.HasEnoughCapacityToActivateEquipment(player.ActiveArmory, equipment)) { this.UpdateMinimumInactiveSize(equipment.Size); subElement.Visible = false; return; } subElement3.Text = this.lang.Get("ARMORY_INACTIVE_CAPACITY_REACHED", new object[0]); subElement.Visible = true; return; } else { if (!ArmoryUtils.IsBuildingRequirementMet(equipment)) { StaticDataController staticDataController = Service.StaticDataController; BuildingTypeVO buildingTypeVO = staticDataController.Get <BuildingTypeVO>(equipment.BuildingRequirement); subElement3.Text = this.lang.Get("BUILDING_REQUIREMENT", new object[] { buildingTypeVO.Lvl, LangUtils.GetBuildingDisplayName(buildingTypeVO) }); subElement2.Visible = true; subElement.Visible = false; return; } UXButton subElement6 = this.inactiveGrid.GetSubElement <UXButton>(equipment.Uid, "BtnEquipmentItemCard"); subElement6.Enabled = false; if (!ArmoryUtils.IsEquipmentOnValidPlanet(player, equipment) && flag) { subElement.Visible = false; subElement2.Visible = true; string planetDisplayName = LangUtils.GetPlanetDisplayName(player.PlanetId); subElement3.Text = this.lang.Get("BASE_ON_INCORRECT_PLANET", new object[] { planetDisplayName }); subElement5.Visible = true; return; } subElement.Visible = false; subElement2.Visible = true; subElement4.Visible = true; if (player.Shards.ContainsKey(equipment.EquipmentID)) { subElement3.Text = this.lang.Get("EQUIPMENT_LOCKED", new object[] { equipment.UpgradeShards - player.Shards[equipment.EquipmentID] }); } else { subElement3.Text = this.lang.Get("EQUIPMENT_LOCKED", new object[] { equipment.UpgradeShards }); } return; } }