public void CompletePurchase() { if (currency.SpendCurrency(currencyPrice)) { if (OnPurchaseSucceeded != null) { OnPurchaseSucceeded.Invoke(); } } else { if (OnPurchaseFailed != null) { OnPurchaseFailed.Invoke(); } } }
public override void Buy() { if (currency.SpendCurrency(currencyPrice)) { if (OnPurchaseSucceeded != null) { OnPurchaseSucceeded.Invoke(); } } else { if (OnPurchaseFailed != null) { OnPurchaseFailed.Invoke(); } } }
private void OnEnable() { this.cakeRaceMode = (WPFMonoBehaviour.levelManager.CurrentGameMode as CakeRaceMode); if (WPFMonoBehaviour.levelManager.CurrentGameMode.ContraptionProto.HasPart(BasePart.PartType.Egg, BasePart.PartTier.Legendary)) { WPFMonoBehaviour.levelManager.CurrentGameMode.ContraptionProto.ApplySuperGlue(Glue.Type.Alien); } if (DeviceInfo.ActiveDeviceFamily == DeviceInfo.DeviceFamily.Ios) { IapManager.onPurchaseSucceeded += this.HandleIapManageronPurchaseSucceeded; } this.SetButtonAmountText(this.superBluePrintButton, GameProgress.BluePrintCount()); this.SetButtonAmountText(this.superGlueButton, GameProgress.SuperGlueCount()); this.SetButtonAmountText(this.superMagnetButton, GameProgress.SuperMagnetCount()); this.SetButtonAmountText(this.turboChargeButton, GameProgress.TurboChargeCount()); this.SetButtonAmountText(this.nightVisionButton, GameProgress.NightVisionCount()); if (WPFMonoBehaviour.levelManager && WPFMonoBehaviour.levelManager.ContraptionProto) { this.superGlueButton.SetUsedState(WPFMonoBehaviour.levelManager.ContraptionProto.HasRegularGlue); this.superMagnetButton.SetUsedState(WPFMonoBehaviour.levelManager.ContraptionProto.HasSuperMagnet); this.turboChargeButton.SetUsedState(WPFMonoBehaviour.levelManager.ContraptionProto.HasTurboCharge); this.nightVisionButton.SetUsedState(WPFMonoBehaviour.levelManager.ContraptionProto.HasNightVision); } else { this.superGlueButton.SetUsedState(false); this.superMagnetButton.SetUsedState(false); this.turboChargeButton.SetUsedState(false); this.nightVisionButton.SetUsedState(false); } bool @bool = GameProgress.GetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", false, GameProgress.Location.Local, null); this.superBluePrintButton.SetUsedState(@bool); this.SetSuperAutoBuildAvailable(@bool); EventManager.Connect <InGameBuildMenu.AutoBuildEvent>(new EventManager.OnEvent <InGameBuildMenu.AutoBuildEvent>(this.SetSuperAutoBuildButtonAmount)); EventManager.Connect <InGameBuildMenu.ApplySuperGlueEvent>(new EventManager.OnEvent <InGameBuildMenu.ApplySuperGlueEvent>(this.SetSuperGlueButtonAmount)); EventManager.Connect <InGameBuildMenu.ApplySuperMagnetEvent>(new EventManager.OnEvent <InGameBuildMenu.ApplySuperMagnetEvent>(this.SetSuperMagnetButtonAmount)); EventManager.Connect <InGameBuildMenu.ApplyTurboChargeEvent>(new EventManager.OnEvent <InGameBuildMenu.ApplyTurboChargeEvent>(this.SetTurboChargeButtonAmount)); EventManager.Connect <InGameBuildMenu.ApplyNightVisionEvent>(new EventManager.OnEvent <InGameBuildMenu.ApplyNightVisionEvent>(this.SetNightVisionButtonAmount)); OnPurchaseSucceeded component = this.superGlueButton.GetComponent <OnPurchaseSucceeded>(); if (component != null) { component.buildMenu = this; } component = this.superMagnetButton.GetComponent <OnPurchaseSucceeded>(); if (component != null) { component.buildMenu = this; } component = this.turboChargeButton.GetComponent <OnPurchaseSucceeded>(); if (component != null) { component.buildMenu = this; } component = this.nightVisionButton.GetComponent <OnPurchaseSucceeded>(); if (component != null) { component.buildMenu = this; } component = this.superBluePrintButton.GetComponent <OnPurchaseSucceeded>(); if (component != null) { component.buildMenu = this; } if (this.editorButtons) { this.editorButtons.SetActive(false); } }