コード例 #1
0
        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);
        }
コード例 #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]);
                }
            }
        }