public void ShowCompensationOnTimer(uint timerId, object data) { if (!Service.PerkManager.WillShowPerkTutorial()) { UXUtils.ShowCompensationMessage(); } base.Process(this.continueProcessing); }
public Vector3 SetTemplateItem(string templateItemName) { this.templateItem = this.uxFactory.GetElement <UXElement>(templateItemName); this.templateItem.Visible = true; this.itemSize = UXUtils.CalculateElementSize(this.templateItem); this.templateItem.Visible = false; return(this.itemSize); }
public string GetFactionAssetName() { if (this.isPveBuffBase) { return(UXUtils.GetIconNameFromFactionType(this.battleData.Defender.PlayerFaction)); } return(this.battle.DefenderId); }
protected void LoadFriends() { this.ResetGrid(); ProcessingScreen.Show(); Service.Get <ISocialDataController>().FriendsDetailsCB = new OnFBFriendsDelegate(this.OnFriendsListLoaded); Service.Get <ISocialDataController>().UpdateFriends(); UXUtils.SetSpriteTopAnchorPoint(this.scrollUp, -4); }
public CrateInfoModalScreen(string crateUid, string planetID, int hqLevel, FactionType faction, bool playerHasArmory) : base("gui_modal_crateinfo") { StaticDataController staticDataController = Service.StaticDataController; this.targetCrateVO = staticDataController.Get <CrateVO>(crateUid); string text = null; if (faction != FactionType.Empire) { if (faction == FactionType.Rebel) { text = this.targetCrateVO.RebelLEIUid; } } else { text = this.targetCrateVO.EmpireLEIUid; } if (!string.IsNullOrEmpty(text)) { this.targetLEIVO = staticDataController.Get <LimitedEditionItemVO>(text); } this.planetVO = staticDataController.GetOptional <PlanetVO>(planetID); this.playerHasArmory = playerHasArmory; this.hqLevel = hqLevel; this.filteredFlyoutItems = new List <CrateFlyoutItemVO>(); string[] array = (faction != FactionType.Empire) ? this.targetCrateVO.FlyoutRebelItems : this.targetCrateVO.FlyoutEmpireItems; if (array != null) { int i = 0; int num = array.Length; while (i < num) { string text2 = array[i]; CrateFlyoutItemVO optional = staticDataController.GetOptional <CrateFlyoutItemVO>(text2); if (optional == null) { Service.Logger.ErrorFormat("CrateInfoModalScreen: FlyoutItemVO Uid {0} not found", new object[] { text2 }); } else { bool flag = UXUtils.IsValidRewardItem(optional, this.planetVO, hqLevel); bool flag2 = UXUtils.ShouldDisplayCrateFlyoutItem(optional, CrateFlyoutDisplayType.Flyout); if (flag && flag2 && this.filteredFlyoutItems.Count < 4) { this.filteredFlyoutItems.Add(optional); } } i++; } } }
protected override void InitButtons() { base.InitButtons(); this.buttonInstantBuy.Visible = false; this.buttonUpgradeAllWalls.Visible = true; this.buttonUpgradeAllWalls.Enabled = (this.reqMet && GameConstants.ENABLE_UPGRADE_ALL_WALLS); this.buttonUpgradeAllWalls.OnClicked = new UXButtonClickedDelegate(this.OnUpgradeAllWallsButton); int crystals = GameUtils.CrystalCostToUpgradeAllWalls(this.nextBuildingInfo.UpgradeMaterials, this.allWallSameLevelCount); UXUtils.SetupSingleCostElement(this, "SecondaryCost", 0, 0, 0, crystals, 0, !this.reqMet, null); }
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); } }
private void SetupGridItemQuality(string itemUID, int quality) { UXElement subElement = this.itemGrid.GetSubElement <UXElement>(itemUID, "Default"); if (quality == 0) { UXUtils.HideGridQualityCards(this.itemGrid, itemUID, "QualityCardQ{0}"); subElement.Visible = true; return; } subElement.Visible = false; UXUtils.SetCardQuality(this, this.itemGrid, itemUID, quality, "QualityCardQ{0}"); }
private UXElement CreateTileWithPrizeInfo(string id, int count, PrizeType prizeType) { string title = null; string description = null; DeployableShardUnlockController deployableShardUnlockController = Service.DeployableShardUnlockController; IGeometryVO geometryVO = TimedEventPrizeUtils.GetFinalUnitFromPrize(prizeType, id); int quality = 0; switch (prizeType) { case PrizeType.Currency: title = this.lang.Get(id.ToUpper(), new object[0]); geometryVO = UXUtils.GetDefaultCurrencyIconVO(id); break; case PrizeType.Infantry: case PrizeType.Hero: case PrizeType.Vehicle: case PrizeType.Mercenary: { TroopTypeVO troopTypeVO = (TroopTypeVO)geometryVO; quality = deployableShardUnlockController.GetUpgradeQualityForDeployable(troopTypeVO); title = LangUtils.GetTroopDisplayName(troopTypeVO); description = LangUtils.GetTroopDescription(troopTypeVO); break; } case PrizeType.SpecialAttack: { SpecialAttackTypeVO specialAttackTypeVO = (SpecialAttackTypeVO)geometryVO; quality = deployableShardUnlockController.GetUpgradeQualityForDeployable(specialAttackTypeVO); title = LangUtils.GetStarshipDisplayName(specialAttackTypeVO); description = LangUtils.GetStarshipDescription(specialAttackTypeVO); break; } case PrizeType.Crate: { CrateData crateData = this.cp.Prizes.Crates.Available[id]; string crateDisplayName = LangUtils.GetCrateDisplayName(crateData.CrateId); title = this.lang.Get("CRATE_INVENTORY_CRATE_TITLE", new object[] { LangUtils.GetPlanetDisplayName(crateData.PlanetId), crateDisplayName }); geometryVO = Service.StaticDataController.Get <CrateVO>(crateData.CrateId); break; } } return(this.CreateInventoryGridItem(id, prizeType, title, description, count, geometryVO, quality)); }
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); }
private void HandlePBarValueChange(float value, bool showCompleteLabels) { UXUtils.SetShardProgressBarValue(this.pBarRewardTop, this.spriteRewardTopPBar, value); Color color = this.spriteRewardTopPBar.Color; color.a *= 0.5f; this.spriteRewardBottomPBar.Color = color; if (value >= 1f & showCompleteLabels) { this.ShowUpgradeLabels(); return; } this.HideUpgradeLabels(); }
private void UpdateUplinkHelper(int index, bool active, string reqKey) { UXUtils.UpdateUplinkHelper(this.uplinks[index], active, false); if (active) { this.requirements[index].Text = this.lang.Get(reqKey, new object[0]); } else { this.requirements[index].Text = this.lang.Get("WAR_PLAYER_DETAILS_REQ_COMPLETE", new object[0]); } this.checks[index].Visible = !active; this.stars[index].Visible = active; }
private void LoadSquadInvites() { base.ResetGrid(); List <SquadInvite> squadInvites = Service.SquadController.StateManager.SquadInvites; if (squadInvites != null && this.squadIdsRequiringDetails.Count == 0) { base.AddItemsToGrid <SquadInvite>(squadInvites, true, false); } else { ProcessingScreen.Show(); } UXUtils.SetSpriteTopAnchorPoint(this.scrollUp, -4); }
public GameObject CloneRoot(string name, GameObject parent) { if (this.root == null) { return(null); } GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.root); gameObject.layer = parent.layer; UXUtils.AppendNameRecursively(gameObject, name, true); gameObject.SetActive(true); gameObject.transform.parent = parent.transform; gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localScale = Vector3.one; return(gameObject); }
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); }
public void AutoCenter() { if (base.Count == 0) { return; } if (!this.autoCenterPositionSet) { this.autoCenterPositionSet = true; this.autoCenterPosition = base.LocalPosition; } base.Width = 0f; Vector3 localPosition = this.autoCenterPosition; localPosition.x -= 0.5f * (UXUtils.CalculateElementSize(this).x + this.Padding.x); base.LocalPosition = localPosition; }
private void PopulateEquipmentGrid() { EquipmentUpgradeCatalog equipmentUpgradeCatalog = Service.EquipmentUpgradeCatalog; CurrentPlayer currentPlayer = Service.CurrentPlayer; this.FindAllUpgradableEquipment(currentPlayer, equipmentUpgradeCatalog); int maxItemsPerLine = (this.equipmentToDisplay.Count + 1) / 2; this.equipmentGrid.MaxItemsPerLine = maxItemsPerLine; EquipmentTabHelper equipmentTabHelper = this.filterHelper as EquipmentTabHelper; EquipmentTab currentTab = (EquipmentTab)equipmentTabHelper.CurrentTab; List <UXElement> list = new List <UXElement>(); int i = 0; int count = this.equipmentToDisplay.Count; while (i < count) { EquipmentVO equipmentVO = this.equipmentToDisplay[i]; if (equipmentTabHelper.IsEquipmentValidForTab(equipmentVO, currentTab)) { if (this.contractHidden) { EquipmentVO nextLevel = equipmentUpgradeCatalog.GetNextLevel(equipmentVO); if (nextLevel.Uid == this.activeContract.ProductUid) { this.contractHidden = false; } } UXElement item = this.FetchEquipmentCardGridItem(currentPlayer, equipmentVO, equipmentUpgradeCatalog); list.Add(item); } i++; } UXUtils.SortListForTwoRowGrids(list, this.equipmentGrid); int j = 0; int count2 = list.Count; while (j < count2) { this.equipmentGrid.AddItem(list[j], j); j++; } list.Clear(); this.equipmentGrid.RepositionItemsFrameDelayed(new UXDragDelegate(this.FinishEquipmentGridSetup), 1); this.CheckActiveContract(); }
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; } }
private void UpdateTimeRemaining() { TimedEventState state = TimedEventUtils.GetState(this.Campaign); string text = ""; switch (state) { case TimedEventState.Upcoming: { int num = TimedEventUtils.GetSecondsRemaining(this.Campaign); string text2 = LangUtils.FormatTime((long)num); text = this.lang.Get("CAMPAIGN_BEGINS_IN", new object[] { text2 }); break; } case TimedEventState.Live: { int num = TimedEventUtils.GetSecondsRemaining(this.Campaign); string text2 = LangUtils.FormatTime((long)num); text = this.lang.Get("CAMPAIGN_ENDS_IN", new object[] { text2 }); break; } case TimedEventState.Closing: { int num = TimedEventUtils.GetStoreSecondsRemaining(this.Campaign); string text2 = LangUtils.FormatTime((long)num); text = this.lang.Get("REWARD_DURATION", new object[] { text2 }); break; } } if (!string.IsNullOrEmpty(text)) { this.label.Text = UXUtils.WrapTextInColor(text, this.timerColor); } }
protected override void SetupControls() { base.GetElement <UXLabel>("TickerDialogSmall").Visible = false; this.rightLabel.Text = DisableProtectionAlertScreen.GetProtectionTimeRemaining(); this.titleLabel.Text = this.lang.Get("ALERT", new object[0]); this.primary2Option.Text = this.lang.Get("YES", new object[0]); this.primary2OptionButton.Visible = true; this.primary2OptionButton.Tag = true; this.primary2OptionButton.OnClicked = new UXButtonClickedDelegate(this.OnYesOrNoButtonClicked); this.secondary2Option.Text = this.lang.Get("NO", new object[0]); this.secondary2OptionButton.Visible = true; this.secondary2OptionButton.Tag = null; this.secondary2OptionButton.OnClicked = new UXButtonClickedDelegate(this.OnYesOrNoButtonClicked); if (!string.IsNullOrEmpty(this.spriteName)) { UXUtils.SetupGeometryForIcon(this.sprite, this.spriteName); } }
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(); }
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); }
protected override void OnScreenLoaded() { base.OnScreenLoaded(); this.movementSpeedGroup.LocalPosition = this.unitCapacityGroup.LocalPosition; this.attackRangeGroup.LocalPosition = this.trainingTimeGroup.LocalPosition; this.trainingTimeGroup.LocalPosition = this.trainingCostGroup.LocalPosition; this.unitCapacityGroup.Visible = false; this.trainingCostGroup.Visible = false; this.trainingTimeNameLabel.Text = this.lang.Get("s_RepairTime", new object[0]); base.GetElement <UXButton>("BtnBack").Visible = false; if (this.nextBuildingInfo != null) { this.labelUpgradeTime.Text = GameUtils.GetTimeLabelFromSeconds(this.nextBuildingInfo.UpgradeTime); if (this.showUpgradeControls) { UXUtils.SetupSingleCostElement(this, "Cost", this.nextBuildingInfo.UpgradeCredits, this.nextBuildingInfo.UpgradeMaterials, this.nextBuildingInfo.UpgradeContraband, 0, 0, false, null); } } }
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; }
private void SetupTargetedOfferElements() { IDataController dataController = Service.Get <IDataController>(); this.characterSprite1 = base.GetElement <UXSprite>("SpriteCharacter1"); this.characterSprite2 = base.GetElement <UXSprite>("SpriteCharacter2"); TextureVO optional = dataController.GetOptional <TextureVO>("gui_textures_promotional"); if (optional != null) { UXTexture element = base.GetElement <UXTexture>("TexturePromoArt"); element.LoadTexture(optional.AssetName); } optional = dataController.GetOptional <TextureVO>("targeted_bundle_entry"); if (optional != null) { UXTexture element2 = base.GetElement <UXTexture>("TextureEnvironmentEntry"); element2.LoadTexture(optional.AssetName); } optional = dataController.GetOptional <TextureVO>("targeted_bundle_treads"); if (optional != null) { UXTexture element3 = base.GetElement <UXTexture>("TextureEnvironmentRight"); element3.LoadTexture(optional.AssetName); } optional = dataController.GetOptional <TextureVO>("targeted_bundle_treads"); if (optional != null) { UXTexture element4 = base.GetElement <UXTexture>("TextureEnvironmentLeft"); element4.LoadTexture(optional.AssetName); } optional = dataController.GetOptional <TextureVO>("targeted_bundle_dust"); if (optional != null) { UXTexture element5 = base.GetElement <UXTexture>("TextureEnvironmentDustRight"); element5.LoadTexture(optional.AssetName); element5 = base.GetElement <UXTexture>("TextureEnvironmentDustLeft"); element5.LoadTexture(optional.AssetName); } UXUtils.SetupAnimatedCharacter(this.characterSprite1, this.CurrentOffer.Character1Image, ref this.charGeometry1); UXUtils.SetupAnimatedCharacter(this.characterSprite2, this.CurrentOffer.Character2Image, ref this.charGeometry2); }
private void SetupEquipmentShardRewardItemElements(string itemUID, CrateSupplyVO crateSupply) { EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(crateSupply.RewardUid); int quality = (int)currentEquipmentDataByID.Quality; string name = string.Format("SpriteTroopImageBkgGridQ{0}", quality); this.rewardsGrid.GetSubElement <UXElement>(itemUID, name).Visible = true; UXSprite subElement = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteIconFragmentLootTable"); UXUtils.SetupFragmentIconSprite(subElement, quality); this.SetupEquipmentShardProgress(itemUID, currentEquipmentDataByID); UXSprite subElement2 = this.rewardsGrid.GetSubElement <UXSprite>(itemUID, "SpriteRewardItemImage"); ProjectorConfig projectorConfig = ProjectorUtils.GenerateEquipmentConfig(currentEquipmentDataByID, subElement2, true); projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; GeometryProjector item = ProjectorUtils.GenerateProjector(projectorConfig); this.projectors.Add(item); UXUtils.SetCardQuality(this, this.rewardsGrid, itemUID, quality, "RewardItemCardQ{0}"); }
public override void OnViewFrameTime(float dt) { base.OnViewFrameTime(dt); if (!this.manualCullGUIObjects) { return; } if (this.Grid == null) { return; } foreach (UXElement current in this.Grid.GetElementList()) { if (current != null) { Bounds bounds = UXUtils.CalculateAbsoluteWidgetBound(current.GetUIWidget.transform); Vector3[] worldCorners = base.NGUIPanel.worldCorners; Vector3 vector = bounds.center - bounds.size * this.cullingFactor; Vector3 vector2 = bounds.center + bounds.size * this.cullingFactor; if (this.NGUIGrid.arrangement == UIGrid.Arrangement.Horizontal) { if (vector.x > worldCorners[2].x || vector2.x < worldCorners[0].x) { current.GetUIWidget.gameObject.SetActive(false); } else { current.GetUIWidget.gameObject.SetActive(true); } } else if (vector.y > worldCorners[2].y || vector2.y < worldCorners[0].y) { current.GetUIWidget.gameObject.SetActive(false); } else { current.GetUIWidget.gameObject.SetActive(true); } } } }
private UXElement CreateDeployableUXElement(UXGrid grid, string uid, string assetName, int amount, IDeployableVO troop, BattleEntry battle) { UXElement result = grid.CloneTemplateItem(uid); UXSprite subElement = grid.GetSubElement <UXSprite>(uid, this.TroopCardIconName); ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement); Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, projectorConfig, battle)); projectorConfig.AnimPreference = AnimationPreference.NoAnimation; ProjectorUtils.GenerateProjector(projectorConfig); UXLabel subElement2 = grid.GetSubElement <UXLabel>(uid, this.TroopCardAmountName); subElement2.Text = LangUtils.GetMultiplierText(amount); UXLabel subElement3 = grid.GetSubElement <UXLabel>(uid, this.TroopCardLevelName); subElement3.Text = LangUtils.GetLevelText(troop.Lvl); FactionDecal.UpdateDeployableDecal(uid, grid, troop, this.TroopHeroDecalName); string text = null; if (troop is TroopTypeVO) { TroopTypeVO troop2 = troop as TroopTypeVO; Service.SkinController.GetApplicableSkin(troop2, battle.AttackerEquipment, out text); } int qualityInt; if (!string.IsNullOrEmpty(text)) { StaticDataController staticDataController = Service.StaticDataController; EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(text); qualityInt = (int)equipmentVO.Quality; } else { qualityInt = Service.DeployableShardUnlockController.GetUpgradeQualityForDeployable(troop); } UXUtils.SetCardQuality(this, this.troopGrid, uid, qualityInt, this.TroopCardQualityName, this.TroopCardDefaultName); UXButton subElement4 = grid.GetSubElement <UXButton>(uid, this.TroopCardName); this.troopTooltipHelper.RegisterButtonTooltip(subElement4, troop, battle); return(result); }
protected override void SetupControls() { if (!this.noContract) { Service.ViewTimeEngine.RegisterClockTimeObserver(this, 1f); } if (Service.BuildingController.SelectedBuilding == this.buildingEntity) { Service.UXController.HUD.ShowContextButtons(null); } if (this.geometry != null) { UXUtils.SetupGeometryForIcon(this.sprite, this.geometry); } this.payButton.Visible = true; if (this.buildingEntity != null) { this.payButton.Tag = this.buildingEntity; } else if (!string.IsNullOrEmpty(this.perkId)) { this.payButton.Tag = this.perkId; } else { this.payButton.Tag = true; } if (string.IsNullOrEmpty(this.titleOverride)) { this.titleLabel.Text = Service.Lang.Get((!this.noContract) ? "upgrade_title_FinishNow" : "instant_upgrade_confirm_title", new object[0]); } else { this.titleLabel.Text = this.titleOverride; } this.payButton.OnClicked = new UXButtonClickedDelegate(this.OnPayButtonClicked); Service.UserInputInhibitor.AddToAllow(this.CloseButton); Service.UserInputInhibitor.AddToAllow(this.payButton); base.GetElement <UXLabel>("TickerDialogSmall").Visible = false; }
protected void SetupPerkBadge(PerkVO perkVO, string perkItemID, string jewelId) { PerkViewController perkViewController = Service.PerkViewController; PerkManager perkManager = Service.PerkManager; bool flag = true; Squad currentSquad = Service.SquadController.StateManager.GetCurrentSquad(); int level = currentSquad.Level; Dictionary <string, string> available = currentSquad.Perks.Available; if (perkManager.IsPerkLevelLocked(perkVO, level) || perkManager.IsPerkReputationLocked(perkVO, level, available)) { flag = false; } string perkGroup = perkVO.PerkGroup; JewelControl jewelControl; if (this.perkBadgeMap.ContainsKey(perkGroup)) { jewelControl = this.perkBadgeMap[perkGroup]; } else { string name = UXUtils.FormatAppendedName(jewelId, perkItemID); jewelControl = JewelControl.Create(this.screen, name); this.perkBadgeMap.Add(perkGroup, jewelControl); } if (jewelControl != null) { bool flag2 = perkViewController.IsPerkGroupBadged(perkVO.PerkGroup); if (flag2 && flag) { jewelControl.Text = "!"; } else { jewelControl.Value = 0; } } }