protected override void OnPayMeForCurrencyResult(object result, object cookie) { if (GameUtils.HandleSoftCurrencyFlow(result, cookie) && !PayMeScreen.ShowIfNoFreeDroids(new OnScreenModalResult(this.OnPayMeForDroidResult), null)) { this.OnUpgradeButtonClicked(null); } }
private void OnPayMeForCurrencyResult(object result, object cookie) { if (GameUtils.HandleSoftCurrencyFlow(result, cookie) && !PayMeScreen.ShowIfNoFreeDroids(new OnScreenModalResult(this.OnPayMeForDroidResult), null)) { this.ConfirmUpgrade(); } }
private void OnSwapPayMeForCurrencyResult(object result, object cookie) { if (GameUtils.HandleSoftCurrencyFlow(result, cookie) && !PayMeScreen.ShowIfNoFreeDroids(new OnScreenModalResult(this.OnSwapPayMeForDroidResult), null)) { this.OnSwapStartContractSuccess(); } }
private static void ShowModal(int crystals, bool forDroids, string title, string message, string spriteName, OnScreenModalResult onModalResult, object modalResultCookie) { PayMeScreen payMeScreen = new PayMeScreen(crystals, forDroids, title, message, spriteName); payMeScreen.OnModalResult = onModalResult; payMeScreen.ModalResultCookie = modalResultCookie; Service.Get <ScreenController>().AddScreen(payMeScreen); }
public static bool ShowIfNoFreeDroids(OnScreenModalResult onModalResult, object modalResultCookie) { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); int num = ContractUtils.CalculateDroidsInUse(); if (num >= currentPlayer.CurrentDroidsAmount) { Lang lang = Service.Get <Lang>(); string title = lang.Get("droid_title_AllDroidsBusy", new object[0]); string message = (currentPlayer.CurrentDroidsAmount < currentPlayer.MaxDroidsAmount) ? lang.Get("droid_desc_CompletePreviousBuildingOrBuy", new object[0]) : lang.Get("droid_desc_CompletePreviousBuilding", new object[0]); int num2 = ContractUtils.MinimumCostToFinish(); PayMeScreen.ShowModal(num2, true, title, message, null, onModalResult, modalResultCookie); return(true); } return(false); }
private void OnCreateClicked(UXButton button) { if (!GameUtils.CanAffordCredits(GameConstants.SQUAD_CREATE_COST)) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("create"); stringBuilder.Append("|"); string text = this.openEnrollment ? "public" : "private"; stringBuilder.Append(text); stringBuilder.Append("|"); stringBuilder.Append(this.scoreReq); PayMeScreen.ShowIfNotEnoughCurrency(GameConstants.SQUAD_CREATE_COST, 0, 0, stringBuilder.ToString(), new OnScreenModalResult(this.OnPurchaseSoftCurrency)); return; } this.CreateSquad(); }
protected override void OnPurchaseClicked(UXButton button) { int upgradeCredits = this.nextBuildingInfo.UpgradeCredits; int upgradeMaterials = this.nextBuildingInfo.UpgradeMaterials; int upgradeContraband = this.nextBuildingInfo.UpgradeContraband; string buildingPurchaseContext = GameUtils.GetBuildingPurchaseContext(this.nextBuildingInfo, this.buildingInfo, true, false); if (PayMeScreen.ShowIfNotEnoughCurrency(upgradeCredits, upgradeMaterials, upgradeContraband, buildingPurchaseContext, new OnScreenModalResult(this.OnPayMeForCurrencyResult))) { return; } if (PayMeScreen.ShowIfNoFreeDroids(new OnScreenModalResult(this.OnPayMeForDroidResult), null)) { return; } this.ConfirmUpgrade(); }
private void OnSwapConfirmButtonClicked(UXButton button) { if (this.selectedTurret == null) { return; } BuildingTypeVO buildingInfo = this.selectedTurret.BuildingInfo; int swapCredits = buildingInfo.SwapCredits; int swapMaterials = buildingInfo.SwapMaterials; int swapContraband = buildingInfo.SwapContraband; string buildingPurchaseContext = GameUtils.GetBuildingPurchaseContext(buildingInfo, this.buildingInfo, false, true); if (PayMeScreen.ShowIfNotEnoughCurrency(swapCredits, swapMaterials, swapContraband, buildingPurchaseContext, new OnScreenModalResult(this.OnSwapPayMeForCurrencyResult))) { return; } if (PayMeScreen.ShowIfNoFreeDroids(new OnScreenModalResult(this.OnSwapPayMeForDroidResult), null)) { return; } this.OnSwapStartContractSuccess(); }
protected override void OnUpgradeButtonClicked(UXButton button) { int upgradeCredits = this.nextBuildingInfo.UpgradeCredits; int upgradeMaterials = this.nextBuildingInfo.UpgradeMaterials; int upgradeContraband = this.nextBuildingInfo.UpgradeContraband; string buildingPurchaseContext = GameUtils.GetBuildingPurchaseContext(this.nextBuildingInfo, this.buildingInfo, true, false, this.selectedPlanet); if (PayMeScreen.ShowIfNotEnoughCurrency(upgradeCredits, upgradeMaterials, upgradeContraband, buildingPurchaseContext, new OnScreenModalResult(this.OnPayMeForCurrencyResult))) { return; } if (PayMeScreen.ShowIfNoFreeDroids(new OnScreenModalResult(this.OnPayMeForDroidResult), null)) { return; } string planetDisplayName = LangUtils.GetPlanetDisplayName(this.selectedPlanet); AlertScreen alertScreen = AlertScreen.ShowModal(false, this.lang.Get("PLANETS_GNC_UNLOCK_MODAL_TITLE", new object[0]), this.lang.Get("PLANETS_GNC_UNLOCK_MODAL_DESC", new object[] { planetDisplayName }), new OnScreenModalResult(this.OnConfirmation), this.selectedPlanet); alertScreen.SetPrimaryLabelText(this.lang.Get("s_Confirm", new object[0])); alertScreen.SetTextureInset("PlanetEnvIcon-" + this.selectedPlanet.Abbreviation); }
public static bool ShowIfNotEnoughCurrency(int credits, int materials, int contraband, string purchaseContext, OnScreenModalResult onModalResult) { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); CurrencyType currencyType = GameUtils.GetCurrencyType(credits, materials, contraband); int num = 0; switch (currencyType) { case CurrencyType.Credits: num = credits - currentPlayer.CurrentCreditsAmount; break; case CurrencyType.Materials: num = materials - currentPlayer.CurrentMaterialsAmount; break; case CurrencyType.Contraband: num = contraband - currentPlayer.CurrentContrabandAmount; break; } if (num > 0) { if (GameUtils.HasEnoughCurrencyStorage(currencyType, num)) { Lang lang = Service.Get <Lang>(); string currencyStringId = LangUtils.GetCurrencyStringId(currencyType); string text = lang.Get(currencyStringId, new object[0]); string title = lang.Get("NEED_MORE", new object[] { text }); string message = lang.Get("NEED_MORE_BUY_MISSING", new object[] { lang.ThousandsSeparated(num), text }); int num2 = 0; switch (currencyType) { case CurrencyType.Credits: num2 = GameUtils.CreditsCrystalCost(num); break; case CurrencyType.Materials: num2 = GameUtils.MaterialsCrystalCost(num); break; case CurrencyType.Contraband: num2 = GameUtils.ContrabandCrystalCost(num); break; } string currencyItemAssetName = UXUtils.GetCurrencyItemAssetName(currencyType.ToString()); CurrencyTag modalResultCookie = new CurrencyTag(currencyType, num, num2, purchaseContext); PayMeScreen.ShowModal(num2, false, title, message, currencyItemAssetName, onModalResult, modalResultCookie); } else { onModalResult(null, null); } return(true); } return(false); }
public unsafe static long $Invoke8(long instance, long *args) { PayMeScreen.ShowModal(*(int *)args, *(sbyte *)(args + 1) != 0, Marshal.PtrToStringUni(*(IntPtr *)(args + 2)), Marshal.PtrToStringUni(*(IntPtr *)(args + 3)), Marshal.PtrToStringUni(*(IntPtr *)(args + 4)), (OnScreenModalResult)GCHandledObjects.GCHandleToObject(args[5]), GCHandledObjects.GCHandleToObject(args[6])); return(-1L); }
public unsafe static long $Invoke7(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(PayMeScreen.ShowIfNotEnoughCurrency(*(int *)args, *(int *)(args + 1), *(int *)(args + 2), Marshal.PtrToStringUni(*(IntPtr *)(args + 3)), (OnScreenModalResult)GCHandledObjects.GCHandleToObject(args[4])))); }
public unsafe static long $Invoke6(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(PayMeScreen.ShowIfNoFreeDroids((OnScreenModalResult)GCHandledObjects.GCHandleToObject(*args), GCHandledObjects.GCHandleToObject(args[1])))); }
public static bool ShowIfNotEnoughCurrency(int credits, int materials, int contraband, string purchaseContext, OnScreenModalResult onModalResult) { return(PayMeScreen.ShowIfNotEnoughCurrency(credits, materials, contraband, purchaseContext, null, onModalResult)); }