Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        protected override void onPreShow([Optional, DefaultParameterValue(null)] object param)
        {
            ShopEntry shopEntryBySlot = Service.Binder.ShopManager.GetShopEntryBySlot(ShopManager.ValidBundleSlots[0]);

            this.m_starterBundleSpc      = new ShopPurchaseController(shopEntryBySlot, null, PathToShopType.Vendor, null, new Action <ShopEntry, PurchaseResult>(this.onPurchaseComplete));
            this.PurchaseButtonText.text = this.m_starterBundleSpc.getPriceText(1);
            this.CritterName.text        = StringExtensions.ToUpperLoca(_.L(ConfigLoca.IAP_STARTERBUNDLE_CRITTER_NAME, null, false));
            double v = this.m_starterBundleSpc.ShopEntry.BuyResourceAmounts[ResourceType.Token];

            this.TokenAmount.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.RESOURCES_TOKENS_MULTILINE, new < > __AnonType9 <string>(MenuHelpers.BigValueToString(v)), false));
            double num2 = this.m_starterBundleSpc.ShopEntry.BuyResourceAmounts[ResourceType.Diamond];

            this.GemAmount.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.RESOURCES_DIAMONDS_MULTILINE, new < > __AnonType9 <string>(MenuHelpers.BigValueToString(num2)), false));
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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 onPreShow([Optional, DefaultParameterValue(null)] object param)
        {
            this.m_inputParameters = (InputParameters)param;
            if (!string.IsNullOrEmpty(this.m_inputParameters.Headline))
            {
                this.PopupTitle.text = StringExtensions.ToUpperLoca(this.m_inputParameters.Headline);
            }
            else
            {
                this.PopupTitle.enabled = false;
            }
            if (!string.IsNullOrEmpty(this.m_inputParameters.Title))
            {
                this.DividerTitle.text = StringExtensions.ToUpperLoca(this.m_inputParameters.Title);
            }
            else
            {
                this.DividerTitle.enabled = false;
            }
            if (!string.IsNullOrEmpty(this.m_inputParameters.Message))
            {
                this.DescriptionText.enabled = true;
                this.DescriptionText.text    = this.m_inputParameters.Message;
            }
            else
            {
                this.DescriptionText.enabled = false;
            }
            if (this.m_inputParameters.DisposableBackgroundTexture != null)
            {
                this.RawBg.enabled = true;
                this.RawBg.texture = this.m_inputParameters.DisposableBackgroundTexture;
                float num     = ((float)this.m_inputParameters.DisposableBackgroundTexture.width) / ((float)this.m_inputParameters.DisposableBackgroundTexture.height);
                float newSize = Mathf.Clamp((float)(this.m_defaultWidth / num), (float)200f, (float)1880f);
                RectTransformExtensions.SetHeight(base.RectTm, newSize);
            }
            else
            {
                this.RawBg.enabled = false;
                RectTransformExtensions.SetHeight(base.RectTm, this.m_defaultHeight);
            }
            string flareProductIdForPromoSlot = Service.Binder.PromotionManager.GetFlareProductIdForPromoSlot(this.m_inputParameters.Slot);

            if (!string.IsNullOrEmpty(flareProductIdForPromoSlot))
            {
                ShopEntry shopEntryByFlareProductId = Service.Binder.ShopManager.GetShopEntryByFlareProductId(flareProductIdForPromoSlot);
                if (shopEntryByFlareProductId != null)
                {
                    this.m_purchaseController    = new ShopPurchaseController(shopEntryByFlareProductId, null, PathToShopType.Vendor, null, new Action <ShopEntry, PurchaseResult>(this.onPurchaseComplete));
                    this.PurchaseButtonText.text = this.m_purchaseController.getPriceText(1);
                    if (this.m_inputParameters.DisposableBackgroundTexture == null)
                    {
                        base.RewardsGrid.gameObject.SetActive(true);
                        List <Reward>  rewards = new List <Reward>();
                        PremiumProduct prod    = Service.Binder.ShopService.GetProduct(flareProductIdForPromoSlot);
                        foreach (ProductReward reward in ConfigShops.GetRewardsFromProduct(prod))
                        {
                            rewards.Add(ConfigShops.GetRewardFromProductReward(reward, prod));
                        }
                        base.InitRewardGrid(rewards);
                    }
                    else
                    {
                        base.RewardsGrid.gameObject.SetActive(false);
                    }
                }
            }
        }
        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();
        }