Exemplo n.º 1
0
 protected override void SetupControls()
 {
     base.GetElement <UXLabel>("TickerDialogSmall").Visible = false;
     this.titleLabel.Text     = this.title;
     this.payButton.Visible   = true;
     this.payButton.OnClicked = new UXButtonClickedDelegate(this.OnPayButtonClicked);
     UXUtils.SetupCostElements(this, "Cost", null, 0, 0, 0, this.crystals, false, null);
     if (this.multiItemSpriteNames != null && this.multiItemLabelTexts != null)
     {
         this.groupMultipleItems.Visible = true;
         this.centerLabel.Visible        = false;
         this.rightLabel.Visible         = false;
         this.multiItemMessageLabel.Text = this.message;
         this.sprite.Visible             = false;
         this.textureImageInset.Enabled  = false;
         if (this.multiItemTable != null && this.multiItemSpriteNames.Count == this.multiItemLabelTexts.Count)
         {
             this.multiItemTable.Clear();
             int i     = 0;
             int count = this.multiItemSpriteNames.Count;
             while (i < count)
             {
                 string    itemUid     = i.ToString();
                 UXElement item        = this.multiItemTable.CloneTemplateItem(itemUid);
                 UXSprite  subElement  = this.multiItemTable.GetSubElement <UXSprite>(itemUid, "SpriteImageAndTextMultiple");
                 UXLabel   subElement2 = this.multiItemTable.GetSubElement <UXLabel>(itemUid, "LabelItemImageAndTextMultiple");
                 UXUtils.SetupGeometryForIcon(subElement, this.multiItemSpriteNames[i]);
                 subElement2.Text = this.multiItemLabelTexts[i];
                 this.multiItemTable.AddItem(item, i);
                 i++;
             }
         }
     }
 }
Exemplo n.º 2
0
 private void UpdateRequestState()
 {
     if (this.requestResendCost != null)
     {
         uint serverTime           = Service.ServerAPI.ServerTime;
         uint troopRequestDate     = Service.SquadController.StateManager.TroopRequestDate;
         int  troopRequestTimeLeft = SquadUtils.GetTroopRequestTimeLeft(serverTime, troopRequestDate);
         bool flag = troopRequestTimeLeft <= 0;
         if (flag)
         {
             this.requestResendCost.Visible = false;
             if (this.observingClockViewTime && !Service.PostBattleRepairController.IsEntityInRepair(this.selectedBuilding))
             {
                 this.observingClockViewTime = false;
                 Service.ViewTimeEngine.UnregisterClockTimeObserver(this);
             }
         }
         else
         {
             int troopRequestCrystalCost = SquadUtils.GetTroopRequestCrystalCost(serverTime, troopRequestDate);
             this.requestResendCost.Visible = true;
             this.requestResendCost.Enabled = GameUtils.CanAffordCrystals(troopRequestCrystalCost);
             UXUtils.SetupCostElements(this, "CostResendRequest", "troop_request", 0, 0, 0, troopRequestCrystalCost, false, null);
             if (!this.observingClockViewTime)
             {
                 this.observingClockViewTime = true;
                 Service.ViewTimeEngine.RegisterClockTimeObserver(this, 1f);
             }
         }
     }
 }
Exemplo n.º 3
0
 protected override void InitLabels()
 {
     base.InitLabels();
     this.swapLabel     = base.GetElement <UXLabel>("LabelSwap");
     this.upgradeButton = base.GetElement <UXButton>("BtnTurretUpgrade");
     if (this.nextBuildingInfo != null)
     {
         this.upgradeButton.Visible = true;
         UXUtils.SetupCostElements(this, "CostTurretUpgrade", null, this.nextBuildingInfo.UpgradeCredits, this.nextBuildingInfo.UpgradeMaterials, this.nextBuildingInfo.UpgradeContraband, 0, !this.reqMet, null, 150);
     }
 }
 protected override void SetupControls()
 {
     base.SetupControls();
     this.primaryButton.Visible            = false;
     this.payRightLabel.Visible            = false;
     this.payRightButton.OnClicked         = new UXButtonClickedDelegate(base.OnPrimaryButtonClicked);
     this.secondary2Option.Text            = this.lang.Get("CANCEL", new object[0]);
     this.secondary2OptionButton.OnClicked = new UXButtonClickedDelegate(this.OnSecondButtonClicked);
     this.CloseButton.OnClicked            = new UXButtonClickedDelegate(this.OnSecondButtonClicked);
     this.payRightButton.Visible           = true;
     this.secondary2Option.Visible         = true;
     this.secondary2OptionButton.Visible   = true;
     UXUtils.SetupCostElements(this, "CostOptionPay2", null, this.LeiVO.Credits, this.LeiVO.Materials, this.LeiVO.Contraband, this.LeiVO.Crystals, false, null);
 }
Exemplo n.º 5
0
        public override void RefreshView()
        {
            if (!base.IsLoaded())
            {
                return;
            }
            if (this.remainingTimeInSec == 0 && !this.noContract)
            {
                this.Close(null);
            }
            string id = "upgrade_desc_FinishNow";

            if (this.currentContract != null && this.currentContract.DeliveryType != DeliveryType.UpgradeBuilding)
            {
                id = "upgrade_desc_FinishNow_units";
            }
            string text;

            if (this.messageOverride == null)
            {
                text = ((!this.noContract) ? Service.Lang.Get(id, new object[]
                {
                    GameUtils.GetTimeLabelFromSeconds(this.remainingTimeInSec),
                    this.displayName,
                    this.crystals
                }) : Service.Lang.Get("instant_upgrade_confirm_desc", new object[]
                {
                    this.crystals
                }));
            }
            else
            {
                text = this.messageOverride;
            }
            if (this.geometry == null)
            {
                this.centerLabel.Text = text.Replace("\\n", Environment.NewLine);
            }
            else
            {
                this.rightLabel.Text = text.Replace("\\n", Environment.NewLine);
            }
            UXUtils.SetupCostElements(this, "Cost", null, 0, 0, 0, this.crystals, false, null);
        }
Exemplo n.º 6
0
        protected override void SetupControls()
        {
            base.GetElement <UXLabel>("TickerDialogSmall").Visible = false;
            CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>();

            if (this.forDroids && currentPlayer.CurrentDroidsAmount < currentPlayer.MaxDroidsAmount)
            {
                this.payLeftLabel.Text       = this.lang.Get("FINISH", new object[0]);
                this.payLeftButton.Visible   = true;
                this.payLeftButton.OnClicked = new UXButtonClickedDelegate(this.OnPayButtonClicked);
                UXUtils.SetupCostElements(this, "CostOptionPay1", null, 0, 0, 0, this.crystals, false, null);
                this.payRightLabel.Text       = this.lang.Get("ADD_DROID", new object[0]);
                this.payRightButton.Visible   = true;
                this.payRightButton.OnClicked = new UXButtonClickedDelegate(this.OnAlternatePayButtonClicked);
                int num = GameUtils.DroidCrystalCost(currentPlayer.CurrentDroidsAmount);
                UXUtils.SetupCostElements(this, "CostOptionPay2", null, 0, 0, 0, num, false, null);
                this.centerLabel.Text    = this.message;
                this.centerLabel.Visible = true;
                this.rightLabel.Visible  = false;
            }
            else
            {
                this.payButton.Visible   = true;
                this.payButton.OnClicked = new UXButtonClickedDelegate(this.OnPayButtonClicked);
                UXUtils.SetupCostElements(this, "Cost", null, 0, 0, 0, this.crystals, false, null);
                if (this.forDroids)
                {
                    this.centerLabel.Text    = this.message;
                    this.centerLabel.Visible = true;
                    this.rightLabel.Visible  = false;
                }
                else
                {
                    this.rightLabel.Text     = this.message;
                    this.centerLabel.Visible = false;
                    this.rightLabel.Visible  = true;
                    this.sprite.SpriteName   = this.spriteName;
                    UXUtils.SetupGeometryForIcon(this.sprite, this.spriteName);
                }
            }
            this.titleLabel.Text = this.title;
        }
Exemplo n.º 7
0
 private void UpdateContractTimers()
 {
     if (this.activeContract == null || this.labelUpgradeTime == null)
     {
         return;
     }
     if (this.nextEquipmentVoUpgrade != null && this.nextEquipmentVoUpgrade.Uid == this.activeContract.ProductUid)
     {
         int remainingTimeForView = this.activeContract.GetRemainingTimeForView();
         if (remainingTimeForView > 0)
         {
             this.labelUpgradeTime.Text = GameUtils.GetTimeLabelFromSeconds(remainingTimeForView);
             int crystalCostToFinishContract = ContractUtils.GetCrystalCostToFinishContract(this.activeContract);
             UXUtils.SetupCostElements(this, "FinishCost", null, 0, 0, 0, crystalCostToFinishContract, 0, !ArmoryUtils.IsBuildingRequirementMet(this.nextEquipmentVoUpgrade), null);
         }
         else
         {
             this.activeContract = null;
             this.DisableTimers();
             this.Redraw();
         }
     }
 }
Exemplo n.º 8
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();
        }
Exemplo n.º 9
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;
        }