更新AB商城最终版
This commit is contained in:
@@ -5,6 +5,7 @@ import Freeze from "../../prop/Freeze";
|
||||
import SceneManager from "../../SceneManager";
|
||||
import { MiniGameSdk } from "../../Sdk/MiniGameSdk";
|
||||
import Utils from "../Pay/Utils";
|
||||
import { getNewShopProduct } from "../Config/ShopCatalog";
|
||||
import BlockAssetManager from "./BlockAssetManager";
|
||||
import {
|
||||
starterPackReward, applyStarterPackStatus, starterPackRemaining, starterPackNow,
|
||||
@@ -999,6 +1000,10 @@ var GameTool = {
|
||||
|
||||
//商城购买
|
||||
shopBuy(productId, compensate, orderContext: any = null) {
|
||||
const newProduct = getNewShopProduct(productId);
|
||||
const newOrderKey = newProduct && orderContext?.outTradeNo
|
||||
? "ShopBGranted_" + cc.fx.GameConfig.GM_INFO.uid + "_" + orderContext.outTradeNo : "";
|
||||
if (newOrderKey && cc.fx.StorageMessage.getStorage(newOrderKey)) return;
|
||||
const rebornOrderKey = /^reborn_Gift(?:_[2-5])?$/.test(productId) && orderContext?.outTradeNo
|
||||
? "RebornGiftGranted_" + cc.fx.GameConfig.GM_INFO.uid + "_" + orderContext.outTradeNo : "";
|
||||
if (rebornOrderKey && cc.fx.StorageMessage.getStorage(rebornOrderKey)) return false;
|
||||
@@ -1017,7 +1022,35 @@ var GameTool = {
|
||||
}
|
||||
//console.log(productId);
|
||||
//console.log("发放奖励", productId);
|
||||
switch (productId) {
|
||||
if (newProduct) {
|
||||
price = newProduct.price;
|
||||
coin = newProduct.coin;
|
||||
const doubleKey = newProduct.firstPurchaseKey;
|
||||
const doubleInfo = cc.fx.GameConfig.GM_INFO.shopDouble;
|
||||
if (doubleKey && doubleInfo && doubleInfo[doubleKey] === false) {
|
||||
coin *= 2;
|
||||
doubleInfo[doubleKey] = true;
|
||||
Utils.setShopDouble(() => {}, doubleInfo);
|
||||
MiniGameSdk.API.showToast("充值成功,获得双倍金币");
|
||||
}
|
||||
this.changeCoin(coin);
|
||||
rewardData = [{ type: "coin", count: coin }];
|
||||
if (newProduct.hammer) {
|
||||
this.getShopProp({ hammer: newProduct.hammer, freeze: newProduct.freeze,
|
||||
magic_wand: newProduct.magic, price }, compensate);
|
||||
rewardData.push({ type: "hammer", count: newProduct.hammer },
|
||||
{ type: "freeze", count: newProduct.freeze }, { type: "magic", count: newProduct.magic });
|
||||
}
|
||||
if (newProduct.infiniteHealth) {
|
||||
this.setUserPowerTime(newProduct.infiniteHealth, productId, compensate);
|
||||
rewardData.push({ type: "infinite_health", count: newProduct.infiniteHealth });
|
||||
}
|
||||
if (newOrderKey) cc.fx.StorageMessage.setStorage(newOrderKey, true);
|
||||
if (shopComp) {
|
||||
shopComp.initCoin();
|
||||
shopComp.refreshJungleRewardDisplay();
|
||||
}
|
||||
} else switch (productId) {
|
||||
case "gold_1":
|
||||
if (cc.fx.GameConfig.GM_INFO.shopDouble.gold_1 == false) {
|
||||
cc.fx.GameConfig.GM_INFO.shopDouble.gold_1 = true;
|
||||
|
||||
Reference in New Issue
Block a user