private void UpdateGridItemCooldownSkipCost(UXLabel cooldownSkipCostLabel, string perkId) { int perkCooldownTimeLeft = this.GetPerkCooldownTimeLeft(perkId); int crystals = GameUtils.SecondsToCrystalsForPerk(perkCooldownTimeLeft); cooldownSkipCostLabel.Text = crystals.ToString(); cooldownSkipCostLabel.TextColor = UXUtils.GetCostColor(cooldownSkipCostLabel, GameUtils.CanAffordCrystals(crystals), false); }
public void Show(Vector3 worldPosition, bool error, string message) { worldPosition.y = 5f; Vector3 vector = Service.Get <CameraManager>().MainCamera.WorldPositionToScreenPoint(worldPosition); this.label.LocalPosition = new Vector3(vector.x, vector.y, 0f); this.label.WidgetDepth = Service.Get <UXController>().ComputeDepth(worldPosition); this.label.Visible = true; this.label.Text = message; this.label.TextColor = UXUtils.GetCostColor(this.label, !error, false); this.curTime = 0f; if (!this.registered) { Service.Get <ViewTimeEngine>().RegisterFrameTimeObserver(this); this.registered = true; } }
public void Disable(bool clearTroopCountLabel) { this.Enabled = false; this.cardDimmer.Visible = true; this.cardDimmer.FillAmount = 1f; if (this.glowElement != null) { this.glowElement.Visible = false; } if (this.abilityActivateFxSprite != null) { this.abilityActivateFxSprite.Visible = false; } this.TroopCheckbox.Selected = false; this.TroopCountLabel.TextColor = UXUtils.GetCostColor(this.TroopCountLabel, false, false); if (clearTroopCountLabel) { this.TroopCountLabel.Text = string.Empty; } if (this.IsHero && this.AbilityState == HeroAbilityState.InUse) { this.StopCoolDown(); } }
protected override void InitButtons() { base.InitButtons(); if (this.useStorageGroup) { this.buttonImageStorage = base.GetElement <UXButton>("BuildingImageStorage"); this.buttonInfoStorage = base.GetElement <UXButton>("BtnItemInfoStorage"); if (this.useUpgradeGroup) { this.buttonInfoStorage.OnClicked = new UXButtonClickedDelegate(this.OnInfoStorageClicked); this.buttonImageStorage.OnClicked = new UXButtonClickedDelegate(this.OnInfoStorageClicked); } else { this.buttonInfoStorage.Visible = false; } } else { this.buttonImage = base.GetElement <UXButton>("BuildingImage"); this.buttonInfo = base.GetElement <UXButton>("BtnItemInfo"); if (this.useUpgradeGroup) { this.buttonInfo.OnClicked = new UXButtonClickedDelegate(this.OnInfoClicked); this.buttonImage.OnClicked = new UXButtonClickedDelegate(this.OnInfoClicked); } else { this.buttonInfo.Visible = false; } } this.buttonUpgradeAllWalls = base.GetElement <UXButton>("ButtonSecondary"); this.buttonSwap = base.GetElement <UXButton>("BtnSwap"); this.buttonInstantBuy = base.GetElement <UXButton>("BtnInstantBuy"); this.buttonViewGalaxyMap = base.GetElement <UXButton>("BtnViewGalaxyMap"); this.buttonSwap.Visible = false; this.buttonUpgradeAllWalls.Visible = false; this.buttonInstantBuy.Visible = (this.useUpgradeGroup && this.nextBuildingInfo != null); this.upgradeButton = base.GetElement <UXButton>("BtnTurretUpgrade"); if (!GameConstants.ENABLE_INSTANT_BUY) { this.buttonInstantBuy.Visible = GameConstants.ENABLE_INSTANT_BUY; } if (this.useUpgradeGroup && this.nextBuildingInfo != null) { int num = GameUtils.CrystalCostToInstantUpgrade(this.nextBuildingInfo); UXLabel element = base.GetElement <UXLabel>("CostInstantBuyLabel"); UXLabel element2 = base.GetElement <UXLabel>("CostInstantBuyValue"); element.Text = this.lang.ThousandsSeparated(num); element2.Text = this.lang.Get("BUILDING_UPGRADE_INSTANT", new object[0]); element.TextColor = UXUtils.GetCostColor(element, GameUtils.CanAffordCrystals(num), !this.reqMet); element2.TextColor = UXUtils.GetCostColor(element2, true, !this.reqMet); this.buttonInstantBuy.OnClicked = new UXButtonClickedDelegate(this.OnInstantUpgradeButtonClicked); this.buttonInstantBuy.Enabled = (this.reqMet && GameConstants.ENABLE_INSTANT_BUY); UXSprite element3 = base.GetElement <UXSprite>("CostInstantBuyIconCrystal"); if (!this.reqMet) { element3.Color = UXUtils.COLOR_COST_LOCKED; } else { element3.Color = Color.white; } } }
public void Enable() { this.Enabled = true; this.cardDimmer.Visible = false; this.TroopCountLabel.TextColor = UXUtils.GetCostColor(this.TroopCountLabel, true, false); }