protected virtual void UpdateHitpoints() { if (this.useUpgradeGroup) { return; } int health = this.buildingInfo.Health; int num = health; HealthViewComponent healthViewComp = this.selectedBuilding.HealthViewComp; if (healthViewComp != null && healthViewComp.IsInitialized) { num = healthViewComp.HealthAmount; } UXLabel currentLabel = this.sliders[this.hitpointSliderIndex].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(num), this.lang.ThousandsSeparated(health) }); UXSlider currentSlider = this.sliders[this.hitpointSliderIndex].CurrentSlider; currentSlider.Value = ((health != 0) ? ((float)num / (float)health) : 0f); }
private void InitLabels() { if (this.centerTitle) { this.titleLabel = base.GetElement <UXLabel>("LabelTitleCenter"); base.GetElement <UXLabel>("LabelTitle").Visible = false; } else { this.titleLabel = base.GetElement <UXLabel>("LabelTitle"); base.GetElement <UXLabel>("LabelTitleCenter").Visible = false; } this.centerLabel = base.GetElement <UXLabel>("LabelBody"); this.rightLabel = base.GetElement <UXLabel>("LabelBodyWImage"); this.primaryLabel = base.GetElement <UXLabel>("LabelBtnPrimary"); this.primary2Option = base.GetElement <UXLabel>("LabelBtnPrimary_2option"); this.secondary2Option = base.GetElement <UXLabel>("LabelBtnSecondary"); this.centerLabel.Text = string.Empty; this.rightLabel.Text = string.Empty; UXElement element = base.GetElement <UXElement>("TitleGroupPerks"); element.Visible = false; this.costRequirement = base.GetElement <UXElement>("Requirement"); this.buttonOption2 = base.GetElement <UXElement>("2option"); this.labelBodyRequirement = base.GetElement <UXLabel>("LabelBodyRequirement"); this.labelStarProgress = base.GetElement <UXLabel>("LabelStarProgress"); this.requirementSlider = base.GetElement <UXSlider>("pBarStarProgress"); this.labelSkip = base.GetElement <UXLabel>("LabelSkip"); this.labelSkip.Text = this.lang.Get("s_SKIP", new object[0]); this.labelSkipCost = base.GetElement <UXLabel>("SkipCostLabel"); this.labelTimer = base.GetElement <UXLabel>("TickerDialogSmall"); this.requirementLabel = base.GetElement <UXLabel>("LabelRequirement"); this.requirementLabel.Visible = false; }
public override void OnScreenLoaded() { this.perkContainerGroup = this.screen.GetElement <UXElement>("PerksContainer"); this.perkContainerGroup.Visible = false; UXElement element = this.screen.GetElement <UXElement>(SquadScreenBasePerkInfoView.PERK_ACTIVATION_INFO_VIEW); element.Visible = false; this.perkCurrencyTrayGroup = this.screen.GetElement <UXElement>("PanelContainerCurrencyTrayPerks"); UXElement element2 = this.screen.GetElement <UXElement>(SquadScreenConfirmPerkUpgradeView.PERK_INVEST_CONFIRM_VIEW); element2.Visible = false; this.squadTitleLabel = this.screen.GetElement <UXLabel>("LabelTitlePerks"); this.squadTitleLabel.Text = this.lang.Get("PERK_MAIN_TITLE", new object[0]); UXButton element3 = this.screen.GetElement <UXButton>("SquadLevelMainGroupPerks"); element3.OnClicked = new UXButtonClickedDelegate(this.OnSquadLevelSelected); this.squadLevelLabel = this.screen.GetElement <UXLabel>("LabelSquadLvlPerks"); this.squadLevelProgressLabel = this.screen.GetElement <UXLabel>("LabelSquadLvlProgressPerks"); this.squadLevelProgressBar = this.screen.GetElement <UXSlider>("PBarSquadLevelMainPerks"); this.tabButton = this.screen.GetElement <UXCheckbox>("SocialPerksBtn"); this.tabButton.OnSelected = new UXCheckboxSelectedDelegate(this.OnTabButtonSelected); this.perkTabBadge = JewelControl.Create(this.screen, "Perks"); this.InitPerkTabs(); this.RefreshSquadLevel(); this.RegisterEvents(); }
protected void SetupBar(int index, string labelString, int currentValue, int nextValue, int maxValue, bool showBars) { bool flag = !string.IsNullOrEmpty(labelString); base.GetElement <UXElement>(string.Format("pBar{0}", index)).Visible = flag; if (!flag) { return; } UXLabel element = base.GetElement <UXLabel>(string.Format("LabelpBar{0}", index)); element.Text = labelString; UXSlider element2 = base.GetElement <UXSlider>(string.Format("pBarCurrent{0}", index)); UXSlider element3 = base.GetElement <UXSlider>(string.Format("pBarNext{0}", index)); element2.Visible = showBars; element3.Visible = showBars; base.GetElement <UXSprite>(string.Format("SpritepBarBkg{0}", index)).Visible = showBars; element3.Visible = (nextValue > currentValue && showBars); element2.Value = MathUtils.NormalizeRange((float)currentValue, 0f, (float)maxValue); element3.Value = MathUtils.NormalizeRange((float)nextValue, 0f, (float)maxValue); UXLabel element4 = base.GetElement <UXLabel>(string.Format("LabelpBar{0}Current", index)); element4.Text = this.lang.Get("perkEffect_descMod_PosPct", new object[] { this.lang.ThousandsSeparated(currentValue) }); UXLabel element5 = base.GetElement <UXLabel>(string.Format("LabelpBar{0}Next", index)); element5.Visible = (this.forResearchLab && nextValue > currentValue); element5.Text = this.lang.Get("perkEffect_descMod_PosPct", new object[] { this.lang.ThousandsSeparated(nextValue - currentValue) }); }
public void OnScreenLoaded() { this.chapterActionButtonLabel = this.screen.GetElement <UXLabel>("LabelBtnChapterAction"); this.pveMeshTexture = this.screen.GetElement <UXMeshRenderer>("MeshPVEImage"); this.chapterJewel = this.screen.GetElement <UXElement>("ContainerJewelChapter"); this.chapterButtonBackground = this.screen.GetElement <UXSprite>("SpriteBkgBtnChapterAction"); this.chapterStarsSprite = this.screen.GetElement <UXSprite>("SpriteChapterSelectionStar"); this.chapterLabel = this.screen.GetElement <UXLabel>("LabelChapterNumber"); this.nameLabel = this.screen.GetElement <UXLabel>("LabelChapterTitle"); this.nameLabel.Visible = false; this.nameLabelOperationsLocked = this.screen.GetElement <UXLabel>("LabelOperationsLocked"); this.nameLabelOperationsLocked.Visible = false; this.progressLabel = this.screen.GetElement <UXLabel>("LabelChapterSelectionProgress"); this.starsLabel = this.screen.GetElement <UXLabel>("LabelChapterSelectionStars"); this.progressSlider = this.screen.GetElement <UXSlider>("ChapterSelectionPbar"); this.pveContinueButton = this.screen.GetElement <UXButton>("BtnChapterAction"); this.pveContinueButton.Enabled = true; CampaignVO highestUnlockedCampaign = GameUtils.GetHighestUnlockedCampaign(); this.alternateBackground = this.screen.GetElement <UXTexture>("TextureChapterBg"); this.alternateBackground.LoadTexture("chap_btn_" + highestUnlockedCampaign.Uid); this.alternateButton = this.screen.GetElement <UXButton>("BtnChapterActionTop"); this.alternateButton.Enabled = true; this.alternateButton.OnClicked = new UXButtonClickedDelegate(this.OnPveButtonClicked); this.screen.GetElement <UXLabel>("LabelBtnChapterActionTop").Text = Service.Get <Lang>().Get("LABEL_CAMPAIGNS", new object[0]); this.alternateGroup = this.screen.GetElement <UXElement>("ChapterButtonTop"); UXElement element = this.screen.GetElement <UXElement>("ContainerJewelChapterTop"); element.Visible = false; this.RefreshScreenForPlanetChange(); }
public EpisodeWidgetView(UXFactory factory) { this.widgetBtn = factory.GetElement <UXButton>("Episode"); this.widgetBtn.OnClicked = new UXButtonClickedDelegate(this.OnWidgetClicked); this.titleLabel = factory.GetElement <UXLabel>("LabelTitleEpisode"); this.noticeLabel = factory.GetElement <UXLabel>("LabelNoticeEpisode"); this.titleLabelComplete = factory.GetElement <UXLabel>("LabelStatus"); this.noticeLabelComplete = factory.GetElement <UXLabel>("LabelCTA"); this.bgTexture = factory.GetElement <UXTexture>("TextureEpisodeBg"); this.iconTexture = factory.GetElement <UXTexture>("TextureEpisodeIcon"); this.borderTexture = factory.GetElement <UXElement>("ParticleBorder"); this.titleInitAnchorOffsetLeft = this.titleLabel.GetLabelAnchorOffset(UXAnchorSection.Left); this.noticeInitAnchorOffsetLeft = this.noticeLabel.GetLabelAnchorOffset(UXAnchorSection.Left); this.widgetCircleTimer = factory.GetElement <UXElement>("WidgetCircleTimer"); this.pBarCircleTimer = factory.GetElement <UXSlider>("pBarCircleTimer"); this.progressSlider = factory.GetElement <UXSlider>("pBarEpisodeProgress"); this.progressSliderGoal = factory.GetElement <UXSlider>("pBarEpisodeProgressDelta"); this.progressLabel = factory.GetElement <UXLabel>("LabelEpisodeProgress"); this.progressEarnedToast = factory.GetElement <UXElement>("WidgetEpisodeProgress"); this.progressEarnedToast.Visible = false; this.showTimer = false; this.needToShowCTA = false; this.showingCTA = false; this.lang = Service.Lang; this.ForceHide(); }
private void InitSlider() { UXLabel element = base.GetElement <UXLabel>("LabelLoading"); element.Text = Service.Lang.Get("LOADING", new object[0]); this.loadingSlider = base.GetElement <UXSlider>("PBarLoading"); }
public BuildingTooltip(UXFactory factory, UXElement tooltipElement, string subElementPrefix, string parentName, BuildingTooltipKind kind) { this.TooltipElement = tooltipElement; this.Kind = kind; this.lastTimeLeft = 0f; this.lastTimeTotal = 0f; string name = UXUtils.FormatAppendedName(subElementPrefix + "LabelName", parentName); this.titleLabel = factory.GetElement <UXLabel>(name); string name2 = UXUtils.FormatAppendedName(subElementPrefix + "LabelLevel", parentName); this.levelLabel = factory.GetElement <UXLabel>(name2); string name3 = UXUtils.FormatAppendedName(subElementPrefix + "Label", parentName); this.bubbleLabel = factory.GetOptionalElement <UXLabel>(name3); string name4 = UXUtils.FormatAppendedName(subElementPrefix + "SpriteBkg", parentName); this.bubbleSprite = factory.GetOptionalElement <UXSprite>(name4); string name5 = UXUtils.FormatAppendedName(subElementPrefix + "PbarLabelTime", parentName); this.timeLabel = factory.GetOptionalElement <UXLabel>(name5); string name6 = UXUtils.FormatAppendedName(subElementPrefix + "Pbar", parentName); this.progressSlider = factory.GetOptionalElement <UXSlider>(name6); string name7 = UXUtils.FormatAppendedName(subElementPrefix + "SpriteImage", parentName); this.iconSprite = factory.GetOptionalElement <UXSprite>(name7); string name8 = UXUtils.FormatAppendedName(subElementPrefix + "Selected", parentName); this.selectedGroup = factory.GetOptionalElement <UXElement>(name8); this.SetupBGBasedOnKind(); }
private void SetupDeployableShardProgress(string itemUID, ShardVO shard) { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); TroopUpgradeCatalog troopUpgradeCatalog = Service.Get <TroopUpgradeCatalog>(); StarshipUpgradeCatalog starshipUpgradeCatalog = Service.Get <StarshipUpgradeCatalog>(); UXSlider subElement = this.rewardsGrid.GetSubElement <UXSlider>(itemUID, "pBarRewardItemFrag"); UXSprite subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteRewardItempBarFrag"); subElement.Visible = true; UXLabel subElement3 = this.rewardsGrid.GetSubElement <UXLabel>(itemUID, "LabelFragProgress"); UXElement subElement4 = this.rewardsGrid.GetSubElement <UXElement>(itemUID, "IconUpgrade"); IDeployableVO deployableVO; IDeployableVO byLevel; if (shard.TargetType == "specialAttack") { int nextLevel = currentPlayer.UnlockedLevels.Starships.GetNextLevel(shard.TargetGroupId); deployableVO = starshipUpgradeCatalog.GetByLevel(shard.TargetGroupId, nextLevel); byLevel = starshipUpgradeCatalog.GetByLevel(shard.TargetGroupId, nextLevel - 1); } else { int nextLevel = currentPlayer.UnlockedLevels.Troops.GetNextLevel(shard.TargetGroupId); deployableVO = troopUpgradeCatalog.GetByLevel(shard.TargetGroupId, nextLevel); byLevel = troopUpgradeCatalog.GetByLevel(shard.TargetGroupId, nextLevel - 1); } if (deployableVO == null) { subElement3.Text = this.lang.Get("MAX_LEVEL", new object[0]); subElement.Value = 1f; return; } bool flag = Service.Get <UnlockController>().IsMinLevelUnlocked(deployableVO); if (!flag) { deployableVO = byLevel; } int shardAmount = Service.Get <DeployableShardUnlockController>().GetShardAmount(deployableVO.UpgradeShardUid); int upgradeShardCount = deployableVO.UpgradeShardCount; subElement3.Text = this.lang.Get("FRACTION", new object[] { shardAmount, upgradeShardCount }); if (upgradeShardCount == 0) { Service.Get <StaRTSLogger>().ErrorFormat("CMS Error: Shards required for {0} is zero", new object[] { deployableVO.Uid }); return; } float sliderValue = (float)shardAmount / (float)upgradeShardCount; UXUtils.SetShardProgressBarValue(subElement, subElement2, sliderValue); subElement4.Visible = (flag && shardAmount >= upgradeShardCount); }
public HealthViewComponent() { this.tooltipHelper = new TooltipHelper(); this.secondaryTooltipHelper = new TooltipHelper(); this.slider = null; this.secondarySlider = null; this.IsInitialized = false; }
public void Destroy() { Service.ViewTimeEngine.UnregisterClockTimeObserver(this); Service.EventManager.UnregisterObserver(this, EventId.ElementDestroyed); this.label = null; this.progressBar = null; this.deadline = 0; this.totalTime = 0; this.localizedFormat = null; }
public CountdownControl(UXSlider pBar, UXLabel label, string localizedFormat, int deadline, int totalTime, string deadlineText) { this.init(label, localizedFormat); if (pBar != null) { this.progressBar = pBar; this.progressBar.SendDestroyEvent = true; } this.totalTime = totalTime; this.deadlineText = deadlineText; this.SetDeadline(deadline); }
private void UpdateHousingSpace() { int num = ContractUtils.CalculateSpaceOccupiedByQueuedTroops(this.selectedBuilding); int storage = this.buildingInfo.Storage; UXLabel currentLabel = this.sliders[1].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(num), this.lang.ThousandsSeparated(storage) }); UXSlider currentSlider = this.sliders[1].CurrentSlider; currentSlider.Value = ((storage != 0) ? ((float)num / (float)storage) : 0f); }
private void UpdateHousingSpace() { int donatedTroopStorageUsedByWorldOwner = SquadUtils.GetDonatedTroopStorageUsedByWorldOwner(); int storage = this.buildingInfo.Storage; UXLabel currentLabel = this.sliders[1].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(donatedTroopStorageUsedByWorldOwner), this.lang.ThousandsSeparated(storage) }); UXSlider currentSlider = this.sliders[1].CurrentSlider; float value = (storage != 0) ? ((float)donatedTroopStorageUsedByWorldOwner / (float)storage) : 0f; currentSlider.Value = value; }
private void UpdateHousingSpace() { GamePlayer worldOwner = GameUtils.GetWorldOwner(); int totalStorageAmount = worldOwner.Inventory.SpecialAttack.GetTotalStorageAmount(); int storage = this.buildingInfo.Storage; UXLabel currentLabel = this.sliders[1].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(totalStorageAmount), this.lang.ThousandsSeparated(storage) }); UXSlider currentSlider = this.sliders[1].CurrentSlider; currentSlider.Value = ((storage == 0) ? 0f : ((float)totalStorageAmount / (float)storage)); }
private void SetupEquipmentShardProgress(string itemUID, EquipmentVO eqp) { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); UXSlider subElement = this.rewardsGrid.GetSubElement <UXSlider>(itemUID, "pBarRewardItemFrag"); UXSprite subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteRewardItempBarFrag"); subElement.Visible = true; UXLabel subElement3 = this.rewardsGrid.GetSubElement <UXLabel>(itemUID, "LabelFragProgress"); UXElement subElement4 = this.rewardsGrid.GetSubElement <UXElement>(itemUID, "IconUpgrade"); EquipmentVO nextLevel = Service.Get <EquipmentUpgradeCatalog>().GetNextLevel(eqp); string equipmentID = eqp.EquipmentID; if (nextLevel == null) { subElement3.Text = this.lang.Get("MAX_LEVEL", new object[0]); subElement.Value = 1f; return; } int num = currentPlayer.Shards.ContainsKey(equipmentID) ? currentPlayer.Shards[equipmentID] : 0; int upgradeShards; if (currentPlayer.UnlockedLevels.Equipment.Has(eqp)) { upgradeShards = nextLevel.UpgradeShards; subElement4.Visible = (num >= upgradeShards); } else { upgradeShards = eqp.UpgradeShards; } subElement3.Text = this.lang.Get("FRACTION", new object[] { num, upgradeShards }); if (upgradeShards == 0) { Service.Get <StaRTSLogger>().ErrorFormat("CMS Error: Shards required for {0} is zero", new object[] { nextLevel.Uid }); return; } float sliderValue = (float)num / (float)upgradeShards; UXUtils.SetShardProgressBarValue(subElement, subElement2, sliderValue); }
private void UpdateAmountStored(int sliderIndex) { this.sliders[sliderIndex].DescLabel.Text = this.lang.Get("STORAGE_CAPACITY", new object[0]); int num = StorageSpreadUtils.CalculateAssumedCurrencyInStorage(this.buildingInfo.Currency, this.selectedBuilding); int storage = this.buildingInfo.Storage; UXLabel currentLabel = this.sliders[sliderIndex].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(num), this.lang.ThousandsSeparated(storage) }); UXSlider currentSlider = this.sliders[sliderIndex].CurrentSlider; float num2 = (storage != 0) ? ((float)num / (float)storage) : 0f; currentSlider.Value = num2; this.projector.Config.MeterValue = num2; }
private void UpdateCurrentAmount(int sliderIndex) { BuildingComponent buildingComponent = this.selectedBuilding.Get <BuildingComponent>(); int accruedCurrency = buildingComponent.BuildingTO.AccruedCurrency; int storage = this.buildingInfo.Storage; UXLabel currentLabel = this.sliders[sliderIndex].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(accruedCurrency), this.lang.ThousandsSeparated(storage) }); UXSlider currentSlider = this.sliders[sliderIndex].CurrentSlider; float num = (storage == 0) ? 0f : ((float)accruedCurrency / (float)storage); currentSlider.Value = num; this.projector.Config.MeterValue = num; }
private UXSlider CreateSlider(GameObject gameObject, UISlider nguiSlider) { UXSliderComponent uXSliderComponent = gameObject.GetComponent <UXSliderComponent>(); if (uXSliderComponent != null) { uXSliderComponent.Slider = null; UnityEngine.Object.Destroy(uXSliderComponent); } uXSliderComponent = gameObject.AddComponent <UXSliderComponent>(); uXSliderComponent.NGUISlider = nguiSlider; UXSlider uXSlider = new UXSlider(this.uxCamera, uXSliderComponent); uXSliderComponent.Slider = uXSlider; uXSlider.Value = uXSliderComponent.Value; this.AddElement(gameObject.name, uXSlider); return(uXSlider); }
private void SetupTroopShardProgressBar(string itemUid, IDeployableVO troopType, bool isMaxLevel) { UXSlider subElement = this.troopGrid.GetSubElement <UXSlider>(itemUid, "pBarQuality"); UXSprite subElement2 = this.troopGrid.GetSubElement <UXSprite>(itemUid, "SpritepBarQuality"); UXLabel subElement3 = this.troopGrid.GetSubElement <UXLabel>(itemUid, "LabelNumberQuality"); if (isMaxLevel) { subElement3.Text = string.Empty; subElement.Value = 0f; this.troopGrid.GetSubElement <UXElement>(itemUid, "IconUpgradeQuality").Visible = false; return; } int shardAmount = Service.DeployableShardUnlockController.GetShardAmount(troopType.UpgradeShardUid); int upgradeShardCount = troopType.UpgradeShardCount; subElement3.Text = this.lang.Get("FRACTION", new object[] { shardAmount, upgradeShardCount }); if (upgradeShardCount == 0) { Service.Logger.ErrorFormat("CMS Error: Shards required for {0} is zero", new object[] { troopType.Uid }); return; } float num = (float)shardAmount / (float)upgradeShardCount; subElement.Value = ((num <= 1f) ? num : 1f); UXElement subElement4 = this.troopGrid.GetSubElement <UXElement>(itemUid, "IconUpgradeQuality"); subElement4.Visible = (shardAmount >= upgradeShardCount); if (subElement4.Visible) { subElement2.Color = UXUtils.COLOR_SHARD_COMPLETE; } else { subElement2.Color = UXUtils.COLOR_SHARD_INPROGRESS; } }
public ShardShopViewModule(StoreScreen parent) { this.parent = parent; this.lang = Service.Lang; this.modal = parent.GetElement <UXElement>("ModalPurchase"); this.modalAnimator = this.modal.Root.GetComponent <Animator>(); this.animDelayTimerId = 0u; this.quantityCounter = parent.GetElement <UXLabel>("LabelQuantityCounter"); this.quantityFloatingCounter = parent.GetElement <UXLabel>("LabelQuantityCounterFloater"); this.iconHolder = parent.GetElement <UXElement>("WidgetFragPlaceholder"); this.bodyText = parent.GetElement <UXLabel>("LabelBodyText"); this.titleText = parent.GetElement <UXLabel>("LabelTitle"); this.purchaseSingleLabel = parent.GetElement <UXLabel>("LabelPurchase1"); this.purchaseAllLabel = parent.GetElement <UXLabel>("LabelPurchaseAll"); this.purchaseSingleDescLabel = parent.GetElement <UXLabel>("CostOptionPay1LabelDescription"); this.purchaseAllDescLabel = parent.GetElement <UXLabel>("CostOptionPayAllLabelDescription"); this.purchaseSingleSprite = parent.GetElement <UXSprite>("SpriteCurrencyPurchase1"); this.purchaseAllSprite = parent.GetElement <UXSprite>("SpritePurchaseAllIcon"); this.closeModalBtn = parent.GetElement <UXButton>("BtnModalClose"); this.purchaseSingleBtn = parent.GetElement <UXButton>("BtnPurchase1"); this.purchaseAllBtn = parent.GetElement <UXButton>("BtnPurchaseAll"); this.returnBtn = parent.GetElement <UXButton>("BtnReturn"); this.closeModalBtn.OnClicked = new UXButtonClickedDelegate(this.OnCloseModalClicked); this.purchaseSingleBtn.OnClicked = new UXButtonClickedDelegate(this.OnPurchaseShardsClicked); this.purchaseAllBtn.OnClicked = new UXButtonClickedDelegate(this.OnPurchaseShardsClicked); this.returnBtn.OnClicked = new UXButtonClickedDelegate(this.OnCloseModalClicked); UXElement element = parent.GetElement <UXElement>("FragmentItemTemplate"); this.icon = parent.CloneElement <UXElement>(element, "ModalIcon", this.iconHolder.Root); this.iconProgressLabel = parent.GetElement <UXLabel>(UXUtils.FormatAppendedName("LabelFragProgress", "ModalIcon")); this.iconProgressMessage1 = parent.GetElement <UXLabel>(UXUtils.FormatAppendedName("LabelFragProgressMessage1", "ModalIcon")); this.iconProgressMessage1.Text = this.lang.Get("CRATE_REWARD_POPUP_PROGRESS_UPGRADE_SEQ1", new object[0]); this.iconProgressMessage2 = parent.GetElement <UXLabel>(UXUtils.FormatAppendedName("LabelFragProgressMessage2", "ModalIcon")); this.iconProgressMessage2.Text = this.lang.Get("CRATE_REWARD_POPUP_PROGRESS_UPGRADE_SEQ2", new object[0]); this.iconRequirement = parent.GetElement <UXLabel>(UXUtils.FormatAppendedName("LabelFragmentRequirement", "ModalIcon")); this.iconSprite = parent.GetElement <UXSprite>(UXUtils.FormatAppendedName("SpriteFragmentImage", "ModalIcon")); this.iconButtonCard = parent.GetElement <UXButton>(UXUtils.FormatAppendedName("ButtonFragmentCard", "ModalIcon")); this.iconBaseShardProgressBar = parent.GetElement <UXSlider>(UXUtils.FormatAppendedName("pBarFragmentCount", "ModalIcon")); this.iconDeltaShardProgressBar = parent.GetElement <UXSlider>(UXUtils.FormatAppendedName("pBarFragmentCountDelta", "ModalIcon")); this.iconAnimator = this.iconButtonCard.Root.GetComponent <Animator>(); this.icon.Visible = false; Service.ShardShopController.ResetClientPredictionId(); this.predictedData = Service.ShardShopController.CurrentShopData.Copy(); }
private void UpdateHousingSpace() { int num; int num2; GameUtils.GetStarportTroopCounts(out num, out num2); UXLabel currentLabel = this.sliders[1].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(num), this.lang.ThousandsSeparated(num2) }); UXSlider currentSlider = this.sliders[1].CurrentSlider; float num3 = (num2 != 0) ? ((float)num / (float)num2) : 0f; currentSlider.Value = num3; this.projector.Config.MeterValue = num3; }
public override void OnScreenLoaded() { this.donateTroopsPanel = this.screen.GetElement <UXElement>("DonatePanel"); this.donateTroopsTitle = this.screen.GetElement <UXLabel>("LabelDonateTitle"); this.troopTemplateItem = this.screen.GetElement <UXElement>("DonateTroopsCard"); this.troopTemplateItem.Visible = false; this.troopDonateCloseBtn = this.screen.GetElement <UXButton>("DonateBtnClose"); this.troopDonateCloseBtn.OnClicked = new UXButtonClickedDelegate(this.OnDonateClose); this.troopDonateGrid = this.screen.GetElement <UXGrid>("DonateTroopsGrid"); this.troopDonateGrid.BypassLocalPositionOnAdd = true; this.capacityBar = this.screen.GetElement <UXSlider>("PbarDonatePopup"); this.capacityLabel = this.screen.GetElement <UXLabel>("LabelPbarDonatePopup"); this.hintLabel = this.screen.GetElement <UXLabel>("LabelDonateHint"); this.noTroopsLabel = this.screen.GetElement <UXLabel>("LabelDonateNoTroops"); this.trainTroopsButton = this.screen.GetElement <UXButton>("BtnTrainTroops"); this.buildVehiclesButton = this.screen.GetElement <UXButton>("BtnBuildVehicles"); this.donateTroopsCancel = this.screen.GetElement <UXButton>("BtnDonateTroopsCancel"); this.donateTroopsConfirm = this.screen.GetElement <UXButton>("BtnDonateTroopsConfirmation"); this.donateTroopsConfirm.Enabled = false; this.donateTroopsCancelLabel = this.screen.GetElement <UXLabel>("LabelBtnDonateTroopsCancel"); this.donateTroopsCancelLabel.Text = Service.Get <Lang>().Get("s_Cancel", new object[0]); this.donateTroopsConfrimLabel = this.screen.GetElement <UXLabel>("LabelBtnDonateTroopsConfirmation"); this.donateTroopsConfrimLabel.Text = Service.Get <Lang>().Get("s_Confirm", new object[0]); this.earnReputationPanel = this.screen.GetElement <UXElement>("PanelEarnReputation"); this.earnReputationComplete = this.screen.GetElement <UXElement>("EarnReputationComplete"); this.earnReputationProgress = this.screen.GetElement <UXElement>("EarnReputationProgress"); this.earnReputationProgressBar = this.screen.GetElement <UXSlider>("PBarDonateForReputation"); this.earnReputationProgressLabel = this.screen.GetElement <UXLabel>("LabelEarnReputationProgress"); this.earnReputationTimer = this.screen.GetElement <UXLabel>("LabelEarnReputationTimer"); UXLabel element = this.screen.GetElement <UXLabel>("LabelEarnReputation"); element.Text = this.lang.Get("PERK_CHAT_DONATE_DESC", new object[] { GameConstants.SQUADPERK_DONATION_REPUTATION_AWARD, GameConstants.SQUADPERK_DONATION_REPUTATION_AWARD_THRESHOLD }); UXLabel element2 = this.screen.GetElement <UXLabel>("LabelRepAmountChat"); element2.Text = GameConstants.SQUADPERK_DONATION_REPUTATION_AWARD.ToString(); UXLabel element3 = this.screen.GetElement <UXLabel>("LabelEarnReputationComplete"); element3.Text = this.lang.Get("PERK_CHAT_DONATE_TITLE_COMPLETE", new object[0]); }
public void TeardownElements() { if (!this.IsInitialized) { return; } this.IsInitialized = false; MiscElementsManager miscElementsManager = Service.Get <UXController>().MiscElementsManager; if (this.slider != null) { miscElementsManager.DestroyHealthSlider(this.slider, false); this.slider = null; } this.tooltipHelper.TeardownElements(true); if (this.secondarySlider != null) { miscElementsManager.DestroyHealthSlider(this.secondarySlider, true); this.secondarySlider = null; } this.secondaryTooltipHelper.TeardownElements(false); }
public void SetupElements(GameObjectViewComponent view, bool primary, bool secondary) { if (this.IsInitialized) { return; } if (this.HealthAmount >= this.MaxHealthAmount && this.SecondaryHealthAmount >= this.SecondaryMaxHealthAmount) { this.TeardownElements(); return; } this.IsInitialized = true; if (primary && TooltipHelper.WouldOverlapAnotherTooltip(view)) { return; } this.secondaryOnly = (secondary && !primary); UXController uXController = Service.Get <UXController>(); string text = "HealthSlider" + view.MainGameObject.GetInstanceID().ToString(); if (primary) { this.slider = uXController.MiscElementsManager.CreateHealthSlider(text, uXController.WorldUIParent, false); if (this.slider != null) { this.slider.Value = 1f; this.tooltipHelper.SetupElements(view, this.slider, 0f, true, true); } } if (secondary) { this.secondarySlider = uXController.MiscElementsManager.CreateHealthSlider("s_" + text, uXController.WorldUIParent, true); if (this.secondarySlider != null) { this.secondarySlider.Value = 1f; this.secondaryTooltipHelper.SetupElements(view, this.secondarySlider, 1f, true, false); } } }
protected virtual void UpdateReputation(int sliderIndex) { Inventory inventory = Service.CurrentPlayer.Inventory; if (!inventory.HasItem("reputation")) { this.sliders[sliderIndex].HideAll(); Service.Logger.WarnFormat("No reputation found in your inventory", new object[0]); return; } int itemAmount = inventory.GetItemAmount("reputation"); int itemCapacity = inventory.GetItemCapacity("reputation"); UXLabel currentLabel = this.sliders[sliderIndex].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(itemAmount), this.lang.ThousandsSeparated(itemCapacity) }); UXSlider currentSlider = this.sliders[sliderIndex].CurrentSlider; currentSlider.Value = ((itemCapacity != 0) ? ((float)itemAmount / (float)itemCapacity) : 0f); }
public HUDResourceView(string resourceId, UXSlider slider, UXLabel label, UXElement animatorElement) { this.resourceId = resourceId; this.slider = slider; this.label = label; if (animatorElement != null) { this.animator = animatorElement.Root.GetComponent <Animator>(); if (this.animator != null) { this.animOffNameHash = this.animator.GetCurrentAnimatorStateInfo(0).fullPathHash; } } this.currentViewAmount = -1; this.desiredAmount = -1; this.maxAmount = -1; this.tickerStartAmount = -1; this.tickerDeltaAmount = 0; this.tickerDuration = 0f; this.tickerDt = 0f; this.animOffTimerId = 0u; this.animSpinningOn = false; this.NeedsUpdate = false; }
public override void OnScreenLoaded() { this.completeGroup = this.screen.GetElement <UXElement>("GroupDailyRepComplete"); this.progressGroup = this.screen.GetElement <UXElement>("GroupDailyRepProgress"); UXLabel element = this.screen.GetElement <UXLabel>("LabelDailyRepCompleteTitle"); element.Text = this.lang.Get("PERK_CHAT_DONATE_TITLE_COMPLETE", new object[0]); this.countdownTimerLabel = this.screen.GetElement <UXLabel>("LabelDailyRepTimer"); UXLabel element2 = this.screen.GetElement <UXLabel>("LabelDailyRepProgressTitle"); element2.Text = this.lang.Get("PERK_CHAT_DONATE_TITLE", new object[0]); UXLabel element3 = this.screen.GetElement <UXLabel>("LabelEarnDailyRep"); element3.Text = this.lang.Get("PERK_CHAT_DONATE_DESC", new object[] { GameConstants.SQUADPERK_DONATION_REPUTATION_AWARD, GameConstants.SQUADPERK_DONATION_REPUTATION_AWARD_THRESHOLD }); this.progressAmountLabel = this.screen.GetElement <UXLabel>("LabelDailyRepProgress"); this.progressRewardAmountLabel = this.screen.GetElement <UXLabel>("LabelRepAmount"); this.progressRewardAmountLabel.Text = GameConstants.SQUADPERK_DONATION_REPUTATION_AWARD.ToString(); this.progressBar = this.screen.GetElement <UXSlider>("PBarDonateRep"); this.RefreshTroopDonationProgress(); }
protected override void OnScreenLoaded() { base.OnScreenLoaded(); this.InitButtons(); this.isCrateOpen = false; this.rewardCycleReady = true; this.CloseButton.Visible = false; this.shardReward = false; this.showUpgrade = false; this.btnNextReward = base.GetElement <UXButton>("BtnPrimary"); this.btnNextReward.OnClicked = new UXButtonClickedDelegate(this.OnNextRewardClicked); this.btnFullScreen = base.GetElement <UXButton>("BtnCloseFullScreen"); this.btnFullScreen.OnClicked = null; base.CurrentBackDelegate = new UXButtonClickedDelegate(this.OnNextRewardClicked); base.CurrentBackButton = this.btnNextReward; this.lblCrateTitle = base.GetElement <UXLabel>("LabelCrateType"); this.lblCrateTitle.Text = LangUtils.GetCrateDisplayName(this.crateData.CrateId); this.lblRewardCount = base.GetElement <UXLabel>("LabelRewardCounter"); this.lblRewardCount.Visible = false; this.lblNextReward = base.GetElement <UXLabel>("LabelBtnPrimary"); this.lblNextReward.Text = this.lang.Get("CRATE_OPEN_SEQUENCE_CTA_OPEN", new object[0]); this.gridRewardItems = base.GetElement <UXGrid>("GridListItem"); this.InitRewardGrid(); this.pBarRewardTop = base.GetElement <UXSlider>("pBarCurrentItemTop"); this.spriteRewardTopPBar = base.GetElement <UXSprite>("SpriteCurrentItempTopBar"); this.spriteRewardBottomPBar = base.GetElement <UXSprite>("SpriteCurrentItempBottomBar"); this.pBarRewardBottom = base.GetElement <UXSlider>("pBarCurrentItemBottom"); this.lblCurrentReward = base.GetElement <UXLabel>("LabelCurrentItem"); this.lblRewardAvailable = base.GetElement <UXLabel>("LabelUpgradeAvailable"); this.lblRewardAvailable.Text = this.lang.Get("CRATE_REWARD_POPUP_PROGRESS_UPGRADE_SEQ1", new object[0]); this.lblRewardAvailableAt = base.GetElement <UXLabel>("LabelUpgradeAvailableAlt"); this.lblRewardAvailableAt.Text = this.lang.Get("CRATE_REWARD_POPUP_PROGRESS_UPGRADE_SEQ2", new object[0]); this.lblRewardPBarCounter = base.GetElement <UXLabel>("LabelCounter"); this.HideUpgradeLabels(); base.InitAnimator(); }
private void SetProgressBarElements(CurrentPlayer player, int quality) { UXSlider element = base.GetElement <UXSlider>("pBarFrag"); UXSprite element2 = base.GetElement <UXSprite>("SpritepBarFrag"); UXLabel element3 = base.GetElement <UXLabel>("LabelProgress"); UXLabel element4 = base.GetElement <UXLabel>("ItemStatus"); EquipmentVO nextLevel = Service.EquipmentUpgradeCatalog.GetNextLevel(this.selectedEquipment); UXElement element5 = base.GetElement <UXElement>("IconUpgrade"); string equipmentID = this.selectedEquipment.EquipmentID; element.Visible = true; element4.Visible = false; if (nextLevel == null) { element3.Text = this.lang.Get("MAX_LEVEL", new object[0]); element.Value = 0f; element5.Visible = false; return; } bool flag; if (this.forResearchLab) { flag = (this.activeContract != null && this.activeContract.ProductUid.Equals(nextLevel.Uid)); } else { Contract contract = Service.ISupportController.FindFirstContractWithProductUid(nextLevel.Uid); flag = (contract != null); } if (flag) { element.Visible = false; element5.Visible = false; return; } int num = (!player.Shards.ContainsKey(equipmentID)) ? 0 : player.Shards[equipmentID]; int upgradeShards; if (player.UnlockedLevels.Equipment.Has(this.selectedEquipment)) { upgradeShards = nextLevel.UpgradeShards; element5.Visible = (num >= upgradeShards); if (!this.forResearchLab) { element4.Visible = true; element4.Text = ((num < upgradeShards) ? this.lang.Get("EQUIPMENT_UPGRADE_LOCKED", new object[] { this.CalculateFragmentsNeededForUnlock(nextLevel.UpgradeShards, this.selectedEquipment.EquipmentID) }) : this.lang.Get("ARMORY_UPGRADE_CTA", new object[0])); } } else { upgradeShards = this.selectedEquipment.UpgradeShards; element5.Visible = false; } element3.Text = this.lang.Get("FRACTION", new object[] { num, upgradeShards }); if (upgradeShards == 0) { Service.Logger.ErrorFormat("CMS Error: Shards required for {0} is zero", new object[] { nextLevel.Uid }); return; } float sliderValue = (float)num / (float)upgradeShards; UXUtils.SetShardProgressBarValue(element, element2, sliderValue); }