private void addShopCellToList(ShopEntry shopEntry, ShopEntryInstance shopEntryInstance, RectTransform parentTm) { ShopPurchaseController controller = this.createShopPurchaseController(shopEntry, shopEntryInstance); string str = StringExtensions.ToUpperLoca(_.L(ConfigLoca.VENDOR_SOLD_OUT, null, false)); Card.Content content2 = new Card.Content(); content2.Obj = controller; content2.Text = StringExtensions.ToUpperLoca(controller.getTitle()); content2.Sprite = controller.getSprite(); content2.Interactable = controller.isPurchaseable(); content2.Grayscale = !controller.isPurchaseable(); content2.PriceText = controller.getPriceText(1); content2.PriceIcon = controller.getPriceIcon(); content2.SoldText = !controller.isSold() ? null : str; content2.StickerText = controller.getStickerText(); Card.Content content = content2; if (controller.payWithAd() && !Service.Binder.AdsSystem.initialized()) { content.SoldText = str; } Card item = PlayerView.Binder.CardButtonPool.getObject(); item.transform.SetParent(parentTm, false); item.initialize(content, new Action <Card>(this.onCardClicked)); this.m_vendorCards.Add(item); item.gameObject.SetActive(true); }
private void onCardClicked(Card card) { if (!PlayerView.Binder.MenuSystem.InTransition) { MiniPopupMenu.InputParameters parameters3; if (card.ActiveContent.Obj is PlayerAugmentation) { Player player = GameLogic.Binder.GameState.Player; PlayerAugmentation augmentation = (PlayerAugmentation)card.ActiveContent.Obj; if (player.Augmentations.canBuy(augmentation.Id)) { parameters3 = new MiniPopupMenu.InputParameters(); parameters3.MenuContentParams = card.ActiveContent.Obj; MiniPopupMenu.InputParameters parameter = parameters3; PlayerView.Binder.MenuSystem.transitionToMenu(MenuType.MiniPopupMenu, MenuContentType.VendorMiniPopupContent, parameter, 0f, false, true); } } else if (card.ActiveContent.Obj is ShopPurchaseController) { ShopPurchaseController controller = (ShopPurchaseController)card.ActiveContent.Obj; if (controller.isPurchaseable()) { bool flag = controller.getRefShopEntry().Type == ShopEntryType.IapDiamonds; if (App.Binder.ConfigMeta.DISABLE_VENDOR_ADS_CONFIRMATION_POPUP && controller.payWithAd()) { flag = true; } if (flag) { controller.purchase(1); } else { parameters3 = new MiniPopupMenu.InputParameters(); parameters3.MenuContentParams = card.ActiveContent.Obj; MiniPopupMenu.InputParameters parameters2 = parameters3; PlayerView.Binder.MenuSystem.transitionToMenu(MenuType.MiniPopupMenu, MenuContentType.VendorMiniPopupContent, parameters2, 0f, false, true); } } } } }
protected override void onRefresh() { base.m_contentMenu.refreshTitle(StringExtensions.ToUpperLoca(_.L(ConfigLoca.VENDOR_TITLE_SHOP, null, false)), string.Empty, string.Empty); Player player = GameLogic.Binder.GameState.Player; player.Notifiers.ShopInspected = true; this.RefreshValue.text = MenuHelpers.SecondsToStringHoursMinutes(player.Vendor.getSecondsToNextVendorInventoryRefresh()); for (int i = 0; i < this.m_augCards.Count; i++) { Card card = this.m_augCards[i]; PlayerAugmentation augmentation = (PlayerAugmentation)card.ActiveContent.Obj; bool interactable = !player.Tournaments.hasTournamentSelected() && player.Augmentations.canBuy(augmentation.Id); this.m_augCards[i].refresh(card.ActiveContent.Text, card.ActiveContent.PriceText, card.ActiveContent.PriceIcon, interactable, !interactable); } for (int j = 0; j < this.m_vendorCards.Count; j++) { ShopPurchaseController controller = (ShopPurchaseController)this.m_vendorCards[j].ActiveContent.Obj; controller.updateDetails(); this.m_vendorCards[j].refresh(StringExtensions.ToUpperLoca(controller.getTitle()), controller.getPriceText(1), controller.getPriceIcon(), controller.isPurchaseable(), !controller.isPurchaseable()); } bool flag2 = false; foreach (string str in ShopManager.ValidPromoSlots) { RemotePromotion promotionForPromoSlot = Service.Binder.PromotionManager.GetPromotionForPromoSlot(str); if (((promotionForPromoSlot != null) && promotionForPromoSlot.ParsedLoca.ValidateShopBannerLoca()) && Service.Binder.PromotionManager.ShouldShowTimer(promotionForPromoSlot)) { flag2 = true; this.PromoRunsOutValue.text = Service.Binder.PromotionManager.GetTimeLeftFormatted(promotionForPromoSlot); break; } } this.PromoRunsOutTitle.gameObject.SetActive(flag2); this.PromoRunsOutValue.gameObject.SetActive(flag2); flag2 = false; foreach (string str2 in ShopManager.ValidSecondaryPromoSlots) { RemotePromotion promotion = Service.Binder.PromotionManager.GetPromotionForPromoSlot(str2); if (((promotion != null) && promotion.ParsedLoca.ValidateShopBannerLoca()) && Service.Binder.PromotionManager.ShouldShowTimer(promotion)) { flag2 = true; this.SecondaryPromoRunsOutValue.text = Service.Binder.PromotionManager.GetTimeLeftFormatted(promotion); break; } } this.SecondaryPromoRunsOutTitle.gameObject.SetActive(flag2); this.SecondaryPromoRunsOutValue.gameObject.SetActive(flag2); }