示例#1
0
        public bool IsEquipmentUnlockableOrUpgradeable(EquipmentVO equipment)
        {
            CurrentPlayer currentPlayer = Service.CurrentPlayer;
            bool          flag          = ArmoryUtils.CanAffordEquipment(currentPlayer, equipment);
            bool          flag2         = ArmoryUtils.IsBuildingRequirementMet(equipment);

            return(flag && flag2);
        }
示例#2
0
        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]);
                }
            }
        }