示例#1
0
        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);
            }
        }
示例#2
0
        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;
        }