public void initialize(GameLogic.ChestType chestType) { this.ChestType = chestType; ChestBlueprint blueprint = ConfigUi.CHEST_BLUEPRINTS[chestType]; LootTable table = GameLogic.Binder.ItemResources.getDynamicChestLootTable(chestType); List <Item> list = new List <Item>(table.Items.Count); for (int i = 0; i < table.Items.Count; i++) { LootTableItem item = table.Items[i]; if (!GameLogic.Binder.ItemResources.itemExists(item.Id)) { Debug.LogError("Only fixed item visualization supported for chests: " + item.Id); } else { Item item2 = GameLogic.Binder.ItemResources.getItemForLootTableRollId(item.Id, ItemType.UNSPECIFIED); list.Add(item2); } } list.Sort(this.m_chestContentComparer); for (int j = 0; j < list.Count; j++) { Item item3 = list[j]; SpriteAtlasEntry sprite = new SpriteAtlasEntry("Menu", item3.SpriteId); this.addItemToGrid(item3, item3.Rarity, sprite); } this.Title.text = _.L(blueprint.Name, null, false); this.setupChest(chestType); }
public void InitForReward(Reward reward) { SpriteAtlasEntry atlasEntry = new SpriteAtlasEntry("Menu", reward.Sprite); this.Icon.sprite = PlayerView.Binder.SpriteResources.getSprite(atlasEntry); this.Description.text = StringExtensions.ToUpperLoca(this.GetRewardEntryDropTitle(reward)); }
public Sprite getSprite(SpriteAtlasEntry atlasEntry) { if (atlasEntry == null) { return(null); } return(this.getSprite(atlasEntry.AtlasId, atlasEntry.SpriteId)); }
private void SetIconForResource(ref Image costIcon, string costResourceType) { SpriteAtlasEntry atlasEntry = ConfigUi.RESOURCE_TYPE_SPRITES[this.GetResourceType(costResourceType)]; if (atlasEntry != null) { costIcon.sprite = PlayerView.Binder.SpriteResources.getSprite(atlasEntry); } }
public MiniPopupEntry(MiniPopupEntry another) { this.TitleText = another.TitleText; this.TitleIcon = another.TitleIcon; this.DescriptionText = another.DescriptionText; this.ButtonBackground = another.ButtonBackground; this.ButtonText = another.ButtonText; this.ShowAdditionalShopButton = another.ShowAdditionalShopButton; this.HideCloseButton = another.HideCloseButton; }
private Sprite GetIconForSprite(SpriteAtlasEntry spriteEntry) { try { return(PlayerView.Binder.SpriteResources.getSprite(spriteEntry)); } catch (Exception) { Debug.LogError("Sprite not found " + spriteEntry.AtlasId + "." + spriteEntry.SpriteId); } return(null); }
private void addItemToGrid(Item item, int rarity, SpriteAtlasEntry sprite) { RewardGalleryCell.Content content2 = new RewardGalleryCell.Content(); content2.Obj = item; content2.Sprite = sprite; content2.StarRank = rarity; content2.DoUseSmallStars = true; RewardGalleryCell.Content content = content2; RewardGalleryCell cell = PlayerView.Binder.RewardGalleryCellPool.getObject(RewardGalleryCellType.RewardGalleryCellFazer); cell.transform.SetParent(this.ItemGrid, false); cell.initialize(content, new Action <RewardGalleryCell>(this.onItemCellClick)); this.m_rewardGalleryCells.Add(cell); cell.gameObject.SetActive(true); }
public ShopEntry(ShopEntry another) { this.Title = string.Empty; this.NumBursts = 1; this.MinFloor = 1; this.FormattedPrice = string.Empty; this.Id = another.Id; this.Type = another.Type; this.BuyResourceAmounts = another.BuyResourceAmounts; this.CostAmount = another.CostAmount; this.CostResource = another.CostResource; this.Title = another.Title; this.Boost = another.Boost; this.ItemType = another.ItemType; this.Sprite = another.Sprite; this.NumBursts = another.NumBursts; this.MinFloor = another.MinFloor; this.FormattedPrice = another.FormattedPrice; }
public void refresh(System.Action clickCallback, System.Action autoRefreshCallback, int counter, [Optional, DefaultParameterValue(null)] SpriteAtlasEntry iconSprite) { this.ClickCallback = clickCallback; this.AutoRefreshCallback = autoRefreshCallback; this.CounterRoot.SetActive(counter > 1); this.CounterText.text = counter.ToString(); if (iconSprite != null) { this.Icon.sprite = PlayerView.Binder.SpriteResources.getSprite(iconSprite); } }
protected override void onPreShow([Optional, DefaultParameterValue(null)] object param) { RewardGalleryCell.Content content4; MiniPopupEntry entry3; MiniPopupMenu contentMenu = (MiniPopupMenu)base.m_contentMenu; this.m_param = param; this.m_shopPurchaseController = null; if (param is PlayerAugmentation) { contentMenu.MainButton.gameObject.SetActive(true); this.DualButtonLeft.gameObject.SetActive(false); this.DualButtonRight.gameObject.SetActive(false); PlayerAugmentation augmentation = (PlayerAugmentation)param; SpriteAtlasEntry sprite = null; string overrideDescriptionTextLocalized = null; string str2 = null; if (augmentation.PerkInstance != null) { ConfigPerks.SharedData data = ConfigPerks.SHARED_DATA[augmentation.PerkInstance.Type]; sprite = data.Sprite; overrideDescriptionTextLocalized = _.L(ConfigLoca.MINIPOPUP_AUGMENTATIONS_DESCRIPTION, new < > __AnonType24 <string>(_.L(data.ShortDescription, null, false)), false); str2 = MenuHelpers.BigModifierToString(augmentation.PerkInstance.Modifier, true); } content4 = new RewardGalleryCell.Content(); content4.Sprite = sprite; content4.Text = str2; RewardGalleryCell.Content rewardContent = content4; string overrideButtonText = MenuHelpers.BigValueToString(App.Binder.ConfigMeta.GetAugmentationPrice(augmentation.Id)); SpriteAtlasEntry atlasEntry = ConfigUi.RESOURCE_TYPE_SPRITES[ResourceType.Token]; entry3 = new MiniPopupEntry(); entry3.TitleText = ConfigLoca.MINIPOPUP_AUGMENTATIONS_TITLE; contentMenu.populateLayout(entry3, true, rewardContent, overrideButtonText, PlayerView.Binder.SpriteResources.getSprite(atlasEntry), overrideDescriptionTextLocalized); } else if (param is ShopPurchaseController) { ShopPurchaseController controller = (ShopPurchaseController)param; this.m_shopPurchaseController = new ShopPurchaseController(controller.ShopEntry, controller.ShopEntryInstance, PathToShopType.Vendor, new System.Action(this.onShopClosed), new Action <ShopEntry, PurchaseResult>(this.onShopPurchaseCompleted)); content4 = new RewardGalleryCell.Content(); content4.Sprite = controller.getSprite(); content4.StickerText = controller.getStickerText(); RewardGalleryCell.Content content2 = content4; if (controller.payWithAd()) { contentMenu.MainButton.gameObject.SetActive(true); this.DualButtonLeft.gameObject.SetActive(false); this.DualButtonRight.gameObject.SetActive(false); double v = controller.getAmount(); content2.Text = (v <= 1.0) ? null : ("+" + MenuHelpers.BigValueToString(v)); entry3 = new MiniPopupEntry(); entry3.TitleText = ConfigLoca.MINIPOPUP_ADS_VENDOR_TITLE; contentMenu.populateLayout(entry3, true, content2, StringExtensions.ToUpperLoca(_.L(ConfigLoca.UI_PROMPT_WATCH, null, false)), null, _.L(ConfigLoca.MINIPOPUP_SPECIAL_OFFER_DESCRIPTION, null, false)); } else if (controller.getRefShopEntry().Type == ShopEntryType.MegaBoxBundle) { contentMenu.MainButton.gameObject.SetActive(true); this.DualButtonLeft.gameObject.SetActive(false); this.DualButtonRight.gameObject.SetActive(false); double num2 = ConfigShops.CalculateMegaBoxBundleSize(controller.getRefShopEntry().Id); string str4 = null; if (num2 > 1.0) { str4 = _.L(ConfigLoca.MINIPOPUP_MEGABOX_DESCRIPTION_MANY, new < > __AnonType9 <string>(num2.ToString("0")), false); } else { str4 = _.L(ConfigLoca.MINIPOPUP_MEGABOX_DESCRIPTION_SINGLE, null, false); } entry3 = new MiniPopupEntry(); entry3.TitleText = ConfigLoca.MINIPOPUP_MEGABOX_TITLE; contentMenu.populateLayout(entry3, true, content2, controller.getPriceText(1), PlayerView.Binder.SpriteResources.getSprite(controller.getPriceIcon()), str4); } else if (controller.getPurchasesRemaining() > 1) { contentMenu.MainButton.gameObject.SetActive(false); this.DualButtonLeft.gameObject.SetActive(true); this.DualButtonRight.gameObject.SetActive(true); this.DualButtonLeft.CornerText.text = "1x"; this.DualButtonLeft.Text.text = controller.getPriceText(1); this.DualButtonLeft.Icon.sprite = PlayerView.Binder.SpriteResources.getSprite(controller.getPriceIcon()); int numPurchases = controller.getPurchasesRemaining(); this.DualButtonRight.CornerText.text = numPurchases + "x"; this.DualButtonRight.Text.text = controller.getPriceText(numPurchases); this.DualButtonRight.Icon.sprite = PlayerView.Binder.SpriteResources.getSprite(controller.getPriceIcon()); double num4 = controller.getAmount(); content2.Text = (num4 <= 1.0) ? null : ("+" + MenuHelpers.BigValueToString(num4)); entry3 = new MiniPopupEntry(); entry3.TitleText = ConfigLoca.MINIPOPUP_BASIC_VENDOR_TITLE; contentMenu.populateLayout(entry3, false, content2, null, null, _.L(ConfigLoca.MINIPOPUP_BASIC_VENDOR_DESCRIPTION, null, false)); } else { contentMenu.MainButton.gameObject.SetActive(true); this.DualButtonLeft.gameObject.SetActive(false); this.DualButtonRight.gameObject.SetActive(false); double num5 = controller.getAmount(); content2.Text = (num5 <= 1.0) ? null : ("+" + MenuHelpers.BigValueToString(num5)); entry3 = new MiniPopupEntry(); entry3.TitleText = ConfigLoca.MINIPOPUP_BASIC_VENDOR_TITLE; contentMenu.populateLayout(entry3, true, content2, controller.getPriceText(1), PlayerView.Binder.SpriteResources.getSprite(controller.getPriceIcon()), _.L(ConfigLoca.MINIPOPUP_BASIC_VENDOR_DESCRIPTION, null, false)); } } else if (param is TournamentView) { this.m_tournamentView = (TournamentView)param; contentMenu.MainButton.gameObject.SetActive(false); this.DualButtonLeft.gameObject.SetActive(true); this.DualButtonRight.gameObject.SetActive(true); double num6 = this.m_tournamentView.Instance.getDonationPrice(); this.DualButtonLeft.CornerText.text = "1x"; this.DualButtonLeft.Text.text = num6.ToString("0"); this.DualButtonLeft.Icon.sprite = PlayerView.Binder.SpriteResources.getSprite(ConfigUi.RESOURCE_TYPE_SPRITES[ResourceType.Diamond]); int num7 = this.m_tournamentView.Instance.getDonationsRemaining(); this.DualButtonRight.CornerText.text = num7 + "x"; this.DualButtonRight.Text.text = (num7 * num6).ToString("0"); this.DualButtonRight.Icon.sprite = this.DualButtonLeft.Icon.sprite; content4 = new RewardGalleryCell.Content(); content4.Sprite = new SpriteAtlasEntry("Menu", "icon_cardpack_floater"); RewardGalleryCell.Content content3 = content4; entry3 = new MiniPopupEntry(); entry3.TitleText = ConfigLoca.UI_BUTTON_INFO; contentMenu.populateLayout(entry3, false, content3, null, null, _.L(ConfigLoca.ADVPANEL_DONATE_DESCRIPTION, null, false)); } this.onRefresh(); }