private void onShopEntryPurchased(Player player, ShopEntryInstance shopEntryInstance, ShopEntry shopEntry, ResourceType spentResource, double totalPrice, int purchaseCount) { string shopEntryId; string itemCategory = "vendor"; int repeatPurchase = 0; if (shopEntryInstance != null) { shopEntryId = shopEntryInstance.ShopEntryId; repeatPurchase = shopEntryInstance.NumTimesPurchased; if (shopEntryInstance.ShopEntry.Type == ShopEntryType.ReviveBundle) { this.sendCrmEvent(player, "crm_purchase_item_revive"); } } else { shopEntryId = shopEntry.Id; if (shopEntry.Type == ShopEntryType.ReviveBundle) { this.sendCrmEvent(player, "crm_purchase_item_revive"); } else if (shopEntry.Type == ShopEntryType.MegaBoxBundle) { itemCategory = "megabox"; purchaseCount = (int)ConfigShops.CalculateMegaBoxBundleSize(shopEntryId); } } this.sendPurchaseItemEvent(player, shopEntryId, itemCategory, spentResource, totalPrice, purchaseCount, repeatPurchase); this.sendCrmEvent(player, "crm_purchase_item_vendor"); }
public CmdCheatSendFBGift(string[] serialized) { this.m_inboxCmd = null; foreach (KeyValuePair <string, FbPlatformUser> pair in Service.Binder.FacebookAdapter.Friends) { UnityEngine.Debug.Log(string.Format("Friend id: {0} username: {1} imageUrl: {2}", pair.Key, pair.Value.userName, pair.Value.ImageUrl)); } string targetPlayerFBid = !(serialized[0] != "D") ? GameLogic.Binder.GameState.Player.SocialData.FacebookId : serialized[0]; string id = !(serialized[1] != "D") ? "PetBoxSmall" : serialized[1]; if (ConfigShops.GetShopEntry(id) == null) { UnityEngine.Debug.LogError("Invalid shop entry id"); } else { string facebookId = GameLogic.Binder.GameState.Player.SocialData.FacebookId; if (facebookId == null) { UnityEngine.Debug.LogError("Cannot send facebook gift when not logged into Facebook"); } else { this.m_inboxCmd = SocialGift.CreateFacebookGiftCommand(facebookId, targetPlayerFBid, "PetBoxSmall"); } } }
private void onShopPurchaseCompleted(ShopEntry shopEntry, PurchaseResult purchaseResult) { if (ConfigShops.IsIapShopEntry(shopEntry)) { PlayerView.Binder.MenuSystem.waitAndTransitionToNewMenu(MenuType.StackedPopupMenu, MenuContentType.VendorPopupContent, null); } }
private void onShopPurchaseCompleted(ShopEntry shopEntry, PurchaseResult purchaseResult) { if (ConfigShops.IsIapShopEntry(shopEntry)) { MiniPopupMenu.InputParameters parameters2 = new MiniPopupMenu.InputParameters(); parameters2.MenuContentParams = this.m_param; MiniPopupMenu.InputParameters parameter = parameters2; PlayerView.Binder.MenuSystem.waitAndTransitionToNewMenu(MenuType.MiniPopupMenu, MenuContentType.VendorMiniPopupContent, parameter); } }
public HandleReceiveGift(Dictionary <string, object> parameters) { Reward reward = new Reward(); reward.RewardSource = RewardSourceType.FacebookFriend; reward.RewardSourceId = parameters["senderFBid"].ToString(); this.m_reward = reward; string id = parameters["shopEntryId"].ToString(); if (ConfigShops.GetShopEntry(id) == null) { id = "PetBoxSmall"; } this.m_reward.addShopEntryDrop(GameLogic.Binder.GameState.Player, id, false); }
internal void initBuyResourceAmounts(PremiumProduct prod) { this.BuyResourceAmounts.Clear(); foreach (ProductReward reward in ConfigShops.GetRewardsFromProduct(prod)) { try { ResourceType key = (ResourceType)((int)Enum.Parse(typeof(ResourceType), reward.key)); this.BuyResourceAmounts.Add(key, (double)reward.amount); } catch (Exception) { Debug.Log("ShopEntry - Can't parse shop product reward. " + reward.key + " is not a ResourceType (Which is fine for now)."); } } }
public List <Reward> GetRewards(RemotePromotion promotion) { RewardParams parsedCustomParams = promotion.ParsedCustomParams as RewardParams; if (parsedCustomParams == null) { return(null); } List <Reward> list = new List <Reward>(); foreach (ProductReward reward in parsedCustomParams.Rewards) { Reward rewardFromProductReward = ConfigShops.GetRewardFromProductReward(reward, null); list.Add(rewardFromProductReward); } return(list); }
public void addShopEntryDrop(Player player, string shopEntryId, [Optional, DefaultParameterValue(false)] bool applyMysteryChestDiminisher) { double num; CharacterInstance activeCharacter = player.ActiveCharacter; ShopEntry shopEntry = ConfigShops.GetShopEntry(shopEntryId); this.ShopEntryDrops.Add(shopEntryId); if (string.IsNullOrEmpty(this.ShopEntryId)) { this.ShopEntryId = shopEntryId; } switch (shopEntry.Type) { case ShopEntryType.CoinBundle: { if (!applyMysteryChestDiminisher) { num = ConfigShops.CalculateCoinBundleSize(player, shopEntry.Id, 1); break; } ConfigMeta configMeta = App.Binder.ConfigMeta; double numUpgrades = player.getMysteryCoinOfferMultiplier(shopEntryId); num = configMeta.CoinBundleSize(activeCharacter.HighestLevelItemOwnedAtFloorStart, player, shopEntryId, numUpgrades, 0.0); break; } case ShopEntryType.IapDiamonds: case ShopEntryType.IapStarterBundle: case ShopEntryType.SpecialChest: case ShopEntryType.RewardBox: return; case ShopEntryType.Boost: this.Boost = shopEntry.Boost; return; case ShopEntryType.MysteryItem: { ItemInstance item = ConfigShops.CreateNewMysteryItemInstance(player, shopEntry.Id); this.ItemDrops.Add(item); return; } case ShopEntryType.TokenBundle: MathUtil.DistributeValuesIntoChunksInt((int)ConfigShops.CalculateTokenBundleSize(player, shopEntry.Id), shopEntry.NumBursts, ref this.TokenDrops); return; case ShopEntryType.ReviveBundle: this.Revives = (int)ConfigShops.CalculateReviveBundleSize(shopEntry.Id); return; case ShopEntryType.FrenzyBundle: this.FrenzyPotions = (int)ConfigShops.CalculateFrenzyBundleSize(shopEntry.Id); return; case ShopEntryType.DustBundle: MathUtil.DistributeValuesIntoChunksInt((int)ConfigShops.CalculateDustBundleSize(activeCharacter, shopEntry.Id), shopEntry.NumBursts, ref this.DustDrops); return; case ShopEntryType.DiamondBundle: MathUtil.DistributeValuesIntoChunksInt((int)ConfigShops.CalculateDiamondBundleSize(player, shopEntry.Id), shopEntry.NumBursts, ref this.DiamondDrops); return; case ShopEntryType.XpBundle: this.XpPotions = (int)ConfigShops.CalculateXpBundleSize(shopEntry.Id); return; case ShopEntryType.BossBundle: this.BossPotions = (int)ConfigShops.CalculateBossBundleSize(shopEntry.Id); return; case ShopEntryType.PetBundle: { string str = CmdRollPetBundleLootTable.ExecuteStatic(App.Binder.ConfigLootTables.PetBundleLootTables[shopEntry.Id], player); int num6 = ConfigShops.CalculatePetBundleSize(player, shopEntry.Id); PetReward reward3 = new PetReward(); reward3.PetId = str; reward3.Amount = num6; this.Pets.Add(reward3); return; } case ShopEntryType.PetBox: { this.ChestType = shopEntry.ChestType; Reward reward = new Reward(); CmdRollChestLootTable.ExecuteStatic(shopEntry.ChestType, player, false, ref reward, null); this.Pets.AddRange(reward.Pets); return; } case ShopEntryType.MegaBoxBundle: this.MegaBoxes = (int)ConfigShops.CalculateMegaBoxBundleSize(shopEntry.Id); return; case ShopEntryType.LootBox: { Reward reward2 = new Reward(); CmdRollChestLootTable.ExecuteStatic(shopEntry.ChestType, player, false, ref reward2, null); this.copyFrom(reward2); this.ChestType = shopEntry.ChestType; return; } default: return; } MathUtil.DistributeValuesIntoChunksDouble(num, shopEntry.NumBursts, ref this.CoinDrops); }
public void postDeserializeInitialization() { this.ShopEntry = ConfigShops.GetShopEntry(this.ShopEntryId); }
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(); }