private void OnPurchaseMissingSoftCurrency(object result, object cookie) { if (GameUtils.HandleSoftCurrencyFlow(result, cookie)) { ShardShopPurchaseCookie shardShopPurchaseCookie = null; if (cookie is CurrencyTag) { CurrencyTag currencyTag = (CurrencyTag)cookie; shardShopPurchaseCookie = (ShardShopPurchaseCookie)currencyTag.Cookie; } else if (cookie is MultiCurrencyTag) { MultiCurrencyTag multiCurrencyTag = (MultiCurrencyTag)cookie; shardShopPurchaseCookie = (ShardShopPurchaseCookie)multiCurrencyTag.Cookie; } if (shardShopPurchaseCookie != null) { shardShopPurchaseCookie.DeferredSuccessCallback(shardShopPurchaseCookie.Quantity, true); CostVO cost = shardShopPurchaseCookie.Cost; this.PurchasePoolIdShard(shardShopPurchaseCookie.SlotIndex, shardShopPurchaseCookie.Quantity, shardShopPurchaseCookie.ServerCallback, shardShopPurchaseCookie.Cookie, cost); } else { Service.Logger.Error("Shard Shop Missing soft currency purchase has null purchase cookie"); } } }
public bool BuyShards(int slotIndex, int quantity, Action <int, bool> deferredSuccess, Action <object> serverCallback) { CostVO costVO = ShardShopController.CalculateCost(slotIndex, quantity, this.CurrentShopData); MissingCurrencyTypes missingCurrencyTypes = CostUtils.CheckForMissingCurrency(Service.CurrentPlayer, costVO); if (missingCurrencyTypes != MissingCurrencyTypes.Hard) { if (missingCurrencyTypes != MissingCurrencyTypes.MultipleSoft) { if (missingCurrencyTypes == MissingCurrencyTypes.Soft) { ShardShopPurchaseCookie purchaseCookie = new ShardShopPurchaseCookie(slotIndex, quantity, deferredSuccess, serverCallback, this.ClientPredictionId, costVO); PayMeScreen.ShowIfNotEnoughCurrency(costVO.Credits, costVO.Materials, costVO.Contraband, "shard", purchaseCookie, new OnScreenModalResult(this.OnPurchaseMissingSoftCurrency)); } } else { ShardShopPurchaseCookie purchaseCookie2 = new ShardShopPurchaseCookie(slotIndex, quantity, deferredSuccess, serverCallback, this.ClientPredictionId, costVO); MultiResourcePayMeScreen.ShowIfNotEnoughMultipleCurrencies(costVO, "shard", purchaseCookie2, new OnScreenModalResult(this.OnPurchaseMissingSoftCurrency)); } } else { GameUtils.PromptToBuyCrystals(); } if (missingCurrencyTypes != MissingCurrencyTypes.None) { return(false); } this.ClientPredictionId++; this.PurchasePoolIdShard(slotIndex, quantity, serverCallback, this.ClientPredictionId, costVO); return(true); }