private void OnActivateButtonClicked(UXButton button) { PerkManager perkManager = Service.Get <PerkManager>(); string purchaseContextForActivationCost = perkManager.GetPurchaseContextForActivationCost(this.targetPerkVO); if (!perkManager.HasPlayerActivatedFirstPerk()) { this.CompletePerkActivation(); return; } Squad currentSquad = Service.Get <SquadController>().StateManager.GetCurrentSquad(); if (currentSquad == null) { return; } string squadLevelUIDFromSquad = GameUtils.GetSquadLevelUIDFromSquad(currentSquad); if (!perkManager.HasEmptyPerkActivationSlot(squadLevelUIDFromSquad)) { string instructions = Service.Get <Lang>().Get("PERK_ACTIVATE_NO_SLOT_AVAILABLE", new object[0]); Service.Get <UXController>().MiscElementsManager.ShowPlayerInstructionsError(instructions); return; } if (MultiResourcePayMeScreen.ShowIfNotEnoughMultipleCurrencies(this.targetPerkVO.ActivationCost, purchaseContextForActivationCost, new OnScreenModalResult(this.OnPayMeForCurrencyResult))) { return; } this.CompletePerkActivation(); }
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); }