Beispiel #1
0
 protected override void InitLabels()
 {
     base.InitLabels();
     base.GetElement <UXElement>("LabelInfo").Visible           = false;
     base.GetElement <UXElement>("LowLayoutGroup").Visible      = true;
     base.GetElement <UXLabel>("LabelUpgradeUnlockPlanet").Text = string.Empty;
     base.GetElement <UXElement>("UpgradeTime").Visible         = false;
     base.GetElement <UXLabel>("LabelInfoBottom").Text          = LangUtils.GetBuildingDescription(this.buildingInfo);
     this.labelHQUpgradeDesc.Visible     = false;
     this.labelViewGalaxyMap.Text        = this.lang.Get("s_ViewGalaxyMap", new object[0]);
     this.labelUnlockPlanetTimer         = base.GetElement <UXLabel>("LabelUnlockPlanetTimer");
     this.labelUnlockPlanetTimer.Text    = string.Empty;
     this.labelUnlockPlanetTimer.Visible = false;
 }
Beispiel #2
0
        private void SetupGrid()
        {
            if (this.itemGrid != null)
            {
                return;
            }
            this.itemGrid = base.GetElement <UXGrid>("SwapTypeGrid");
            this.itemGrid.SetTemplateItem("SwapTypeTemplate");
            CurrentPlayer          currentPlayer          = Service.CurrentPlayer;
            FactionType            faction                = currentPlayer.Faction;
            StaticDataController   staticDataController   = Service.StaticDataController;
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog;
            UnlockController       unlockController       = Service.UnlockController;

            foreach (BuildingTypeVO current in staticDataController.GetAll <BuildingTypeVO>())
            {
                if (current.Type == BuildingType.Turret && current.Faction == faction && current.StoreTab != StoreTab.NotInStore)
                {
                    BuildingTypeVO byLevel        = buildingUpgradeCatalog.GetByLevel(current.UpgradeGroup, this.buildingInfo.Lvl);
                    BuildingTypeVO buildingTypeVO = null;
                    bool           flag           = unlockController.IsUnlocked(current, 1, out buildingTypeVO);
                    if (flag || !byLevel.HideIfLocked)
                    {
                        StoreItemTag storeItemTag = new StoreItemTag();
                        storeItemTag.BuildingInfo = byLevel;
                        string    uid       = byLevel.Uid;
                        UXElement uXElement = this.itemGrid.CloneTemplateItem(uid);
                        uXElement.Tag            = storeItemTag;
                        storeItemTag.MainElement = this.itemGrid.GetSubElement <UXElement>(uid, "ItemInfoTurret");
                        UXLabel subElement = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelItemInfoTurret");
                        subElement.Text                  = LangUtils.GetBuildingDescription(byLevel);
                        storeItemTag.InfoGroup           = this.itemGrid.GetSubElement <UXButton>(uid, "InfoTextTurret");
                        storeItemTag.InfoGroup.Visible   = false;
                        storeItemTag.InfoGroup.OnClicked = new UXButtonClickedDelegate(this.OnSwapInfoLabelButtonClicked);
                        storeItemTag.InfoGroup.Tag       = storeItemTag;
                        UXButton subElement2 = this.itemGrid.GetSubElement <UXButton>(uid, "BtnItemInfoTurret");
                        subElement2.OnClicked = new UXButtonClickedDelegate(this.OnSwapInfoButtonClicked);
                        subElement2.Tag       = storeItemTag;
                        UXSprite        subElement3     = this.itemGrid.GetSubElement <UXSprite>(uid, "SpriteItemImageTurret");
                        ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(byLevel, subElement3);
                        projectorConfig.AnimPreference = AnimationPreference.NoAnimation;
                        ProjectorUtils.GenerateProjector(projectorConfig);
                        UXLabel subElement4 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelItemRequirement");
                        subElement4.Visible = !flag;
                        UXElement subElement5 = this.itemGrid.GetSubElement <UXElement>(uid, "CountAndBuildTime");
                        subElement5.Visible = flag;
                        if (flag)
                        {
                            int swapCredits    = byLevel.SwapCredits;
                            int swapMaterials  = byLevel.SwapMaterials;
                            int swapContraband = byLevel.SwapContraband;
                            UXUtils.SetupCostElements(this, "CostTurretSwap", uid, swapCredits, swapMaterials, swapContraband, 0, !flag, null, 150);
                            UXLabel subElement6 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelBuildTime");
                            subElement6.Text = GameUtils.GetTimeLabelFromSeconds(byLevel.SwapTime);
                            UXLabel subElement7 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelSwapItemCount");
                            subElement7.Text = string.Empty;
                        }
                        else if (buildingTypeVO != null)
                        {
                            subElement4.Text = this.lang.Get("BUILDING_REQUIREMENT", new object[]
                            {
                                buildingTypeVO.Lvl,
                                LangUtils.GetBuildingDisplayName(buildingTypeVO)
                            });
                            UXUtils.SetupCostElements(this, "CostTurretSwap", uid, 0, 0, 0, 0, !flag, this.lang.Get("s_Locked", new object[0]), 150);
                        }
                        UXCheckbox subElement8 = this.itemGrid.GetSubElement <UXCheckbox>(uid, "TurretItemCard");
                        subElement8.Enabled    = flag;
                        subElement8.OnSelected = new UXCheckboxSelectedDelegate(this.OnSwapItemCheckboxSelected);
                        subElement8.Selected   = (byLevel.Uid == this.buildingInfo.Uid);
                        subElement8.Tag        = storeItemTag;
                        if (subElement8.Selected)
                        {
                            this.OnSwapItemCheckboxSelected(subElement8, true);
                        }
                        this.itemGrid.AddItem(uXElement, byLevel.Order);
                    }
                }
            }
            this.itemGrid.RepositionItems();
        }
Beispiel #3
0
        protected virtual void InitLabels()
        {
            UXLabel element  = base.GetElement <UXLabel>("DialogBldgUpgradeTitle");
            UXLabel element2 = base.GetElement <UXLabel>("DialogBldgUpgradeTitlePerks");

            if (this.useUpgradeGroup && this.nextBuildingInfo != null)
            {
                element.Text = this.lang.Get("BUILDING_UPGRADE", new object[]
                {
                    LangUtils.GetBuildingDisplayName(this.nextBuildingInfo),
                    this.nextBuildingInfo.Lvl
                });
            }
            else
            {
                element.Text = this.lang.Get("BUILDING_INFO", new object[]
                {
                    LangUtils.GetBuildingDisplayName(this.buildingInfo),
                    this.buildingInfo.Lvl
                });
            }
            element2.Text = element.Text;
            string buildingDescription = LangUtils.GetBuildingDescription(this.buildingInfo);

            if (this.useStorageGroup)
            {
                this.labelStorage                   = base.GetElement <UXLabel>("LabelStorage");
                this.labelItemInfoStorage           = base.GetElement <UXLabel>("LabelItemInfoStorage");
                this.labelItemInfoStorage.Text      = buildingDescription;
                this.labelItemInfoStorage.Visible   = false;
                this.labelUnlockDescStorage         = base.GetElement <UXLabel>("LabelUnlockDescriptionStorage");
                this.labelUnlockDescStorage.Visible = false;
            }
            else
            {
                this.labelItemInfo           = base.GetElement <UXLabel>("LabelItemInfo");
                this.labelItemInfo.Text      = buildingDescription;
                this.labelItemInfo.Visible   = false;
                this.labelUnlockDesc         = base.GetElement <UXLabel>("LabelUnlockDescription");
                this.labelUnlockDesc.Visible = false;
            }
            this.labelInfo = base.GetElement <UXLabel>("LabelInfo");
            if (this.useUpgradeGroup)
            {
                this.labelInfo.Visible = false;
            }
            else
            {
                this.labelInfo.Text = buildingDescription;
            }
            this.labelHQUpgradeDesc = base.GetElement <UXLabel>("LabelUpgradeHQStorage");
            if (!this.useUpgradeGroup || this.reqMet || this.reqBuildingInfo == null)
            {
                this.labelHQUpgradeDesc.Visible = false;
            }
            else
            {
                this.labelHQUpgradeDesc.Visible = true;
                this.labelHQUpgradeDesc.Text    = this.lang.Get("BUILDING_REQUIREMENT", new object[]
                {
                    this.reqBuildingInfo.Lvl,
                    LangUtils.GetBuildingDisplayName(this.reqBuildingInfo)
                });
            }
            this.buttonPrimaryAction = base.GetElement <UXButton>("ButtonPrimary");
            if (this.useUpgradeGroup && this.nextBuildingInfo != null)
            {
                UXLabel uXLabel = (!this.useStorageGroup) ? base.GetElement <UXLabel>("LabelUpgrade") : base.GetElement <UXLabel>("LabelUpgradeStorage");
                uXLabel.Text = this.lang.Get("s_upgradeTime", new object[0]);
                UXLabel uXLabel2 = (!this.useStorageGroup) ? base.GetElement <UXLabel>("LabelUpgradeTime") : base.GetElement <UXLabel>("LabelUpgradeTimeStorage");
                uXLabel2.Text = GameUtils.GetTimeLabelFromSeconds(this.nextBuildingInfo.UpgradeTime);
                this.buttonPrimaryAction.Visible = true;
                UXUtils.SetupCostElements(this, "Cost", null, this.nextBuildingInfo.UpgradeCredits, this.nextBuildingInfo.UpgradeMaterials, this.nextBuildingInfo.UpgradeContraband, 0, !this.reqMet, null);
            }
            if (this.useUpgradeGroup)
            {
                this.buttonPrimaryAction.Visible   = true;
                this.buttonPrimaryAction.Enabled   = this.reqMet;
                this.buttonPrimaryAction.OnClicked = new UXButtonClickedDelegate(this.OnUpgradeButtonClicked);
            }
            else
            {
                this.buttonPrimaryAction.Visible = false;
            }
            this.labelPrimaryAction           = base.GetElement <UXLabel>("LabelButtonPrimaryInfo");
            this.labelSecondaryAction         = base.GetElement <UXLabel>("LabelButtonSecondaryInfo");
            this.labelViewGalaxyMap           = base.GetElement <UXLabel>("LabelViewGalaxyMap");
            this.labelPrimaryAction.Visible   = false;
            this.labelSecondaryAction.Visible = false;
        }