更新AB商城最终版
This commit is contained in:
+31
-29
@@ -1,4 +1,5 @@
|
||||
import { canClaimPass, passTier } from './module/Config/BattlePassModel';
|
||||
import { getNewShopProduct } from './module/Config/ShopCatalog';
|
||||
// Learn TypeScript:
|
||||
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
|
||||
// Learn Attribute:
|
||||
@@ -59,6 +60,8 @@ export default class JiaZai extends cc.Component {
|
||||
|
||||
// 缓存 shop 预制体
|
||||
private static cachedShopPrefab: cc.Prefab | null = null;
|
||||
private static cachedShop2Prefab: cc.Prefab | null = null;
|
||||
private shopNodePrefabPath: string = "";
|
||||
// 缓存 shop 节点
|
||||
private shopNode: cc.Node | null = null;
|
||||
|
||||
@@ -100,6 +103,7 @@ export default class JiaZai extends cc.Component {
|
||||
|
||||
static clearShopPrefabCaches(): void {
|
||||
JiaZai.cachedShopPrefab = null;
|
||||
JiaZai.cachedShop2Prefab = null;
|
||||
JiaZai.cachedRewardPrefab = null;
|
||||
JiaZai.cachedMonthlyCardPrefab = null;
|
||||
}
|
||||
@@ -600,7 +604,7 @@ export default class JiaZai extends cc.Component {
|
||||
["action_bundle", "prefab/newbieGift", "cachedActionPrefab", 1],
|
||||
["shop", "prefab/monthlyCard", "cachedMonthlyCardPrefab", 1],
|
||||
["shop", "prefab/passCheck", "cachedPassCheckPrefab", 1],
|
||||
["shop", "prefab/shop", "cachedShopPrefab", 1],
|
||||
["shop", cc.fx.GameConfig.getShopPrefabPath(), cc.fx.GameConfig.isShopB() ? "cachedShop2Prefab" : "cachedShopPrefab", 1],
|
||||
["action_bundle", "prefab/Avatar", "cachedAvatarPrefab", 0],
|
||||
["action_bundle", "prefab/dailyQuests", "cachedDailyQuestsPrefab", 0],
|
||||
["action_bundle", cc.fx.GameConfig.usesRainbowWinStreakUI() ? "prefab/winStreak2" : "prefab/winStreak",
|
||||
@@ -2119,36 +2123,23 @@ export default class JiaZai extends cc.Component {
|
||||
if (!cc.fx.GameConfig.GM_INFO.canIos) {
|
||||
return;
|
||||
}
|
||||
if (!this.ensureHomePopupPrefab("shop", "prefab/shop", "cachedShopPrefab",
|
||||
const shopPath = cc.fx.GameConfig.getShopPrefabPath();
|
||||
const shopCacheKey = cc.fx.GameConfig.isShopB() ? "cachedShop2Prefab" : "cachedShopPrefab";
|
||||
if (!this.ensureHomePopupPrefab("shop", shopPath, shopCacheKey,
|
||||
() => this.openShop(undefined, customEventData))) return;
|
||||
let double = {
|
||||
gold_1: false,
|
||||
gold_2: false,
|
||||
gold_3: false,
|
||||
gold_4: false,
|
||||
gold_5: false,
|
||||
gold_6: false
|
||||
if (this.shopNode && this.shopNodePrefabPath !== shopPath) {
|
||||
this.shopNode.destroy();
|
||||
this.shopNode = null;
|
||||
}
|
||||
if (!this.shopNode) {
|
||||
// 第一次使用,创建节点
|
||||
this.shopNode = cc.instantiate(JiaZai.cachedShopPrefab);
|
||||
if (this.node && this.shopNode)
|
||||
this.node.addChild(this.shopNode);
|
||||
this.shopNode.getComponent("shop").init(double);
|
||||
} else {
|
||||
// 非第一次使用,直接激活节点
|
||||
this.shopNode.active = true;
|
||||
this.shopNode.getComponent("shop").init(double);
|
||||
}
|
||||
|
||||
this.shopNodePrefabPath = shopPath;
|
||||
if (!cc.fx.GameConfig.GM_INFO.canIos) {
|
||||
return;
|
||||
}
|
||||
|
||||
Utils.getShopDouble(res => {
|
||||
const onShopDouble = (res) => {
|
||||
if (!this.isHomeRuntimeAlive() || cc.fx.GameConfig.isGameplayEntryPreparing()) return;
|
||||
if (shopPath !== cc.fx.GameConfig.getShopPrefabPath()) return;
|
||||
if (res.code === 1) {
|
||||
cc.fx.GameConfig.GM_INFO.shopDouble = res.shopDouble;
|
||||
let eventName = "";
|
||||
let btnName = ""
|
||||
if (customEventData !== undefined) {
|
||||
@@ -2170,7 +2161,7 @@ export default class JiaZai extends cc.Component {
|
||||
// console.log("商店双倍", res.data.shopDouble);
|
||||
if (!this.shopNode) {
|
||||
// 第一次使用,创建节点
|
||||
this.shopNode = cc.instantiate(JiaZai.cachedShopPrefab);
|
||||
this.shopNode = cc.instantiate(JiaZai[shopCacheKey]);
|
||||
if (this.node && this.shopNode)
|
||||
this.node.addChild(this.shopNode);
|
||||
this.shopNode.getComponent("shop").init((res.data.shopDouble));
|
||||
@@ -2188,7 +2179,8 @@ export default class JiaZai extends cc.Component {
|
||||
wx.offHide(this.onHideListener);
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
Utils.getShopDouble(onShopDouble);
|
||||
}
|
||||
|
||||
//打开奖励弹窗
|
||||
@@ -2661,7 +2653,7 @@ export default class JiaZai extends cc.Component {
|
||||
|| order.itemid == "gold_4" || order.itemid == "gold_5" || order.itemid == "gold_6"
|
||||
|| order.itemid == "unlimited_health_bundle_10" || order.itemid == "unlimited_health_bundle_20"
|
||||
|| order.itemid == "unlimited_health_bundle_30" || order.itemid == "month_Card" || /^reborn_Gift(?:_[2-5])?$/.test(order.itemid)
|
||||
|| order.itemid == "starter_pack" || order.itemid == "battlepass"
|
||||
|| order.itemid == "starter_pack" || order.itemid == "battlepass" || !!getNewShopProduct(order.itemid)
|
||||
) {
|
||||
if (canUpdateHome()) this.openLoad();
|
||||
// console.log("补发名称:", order.itemid);
|
||||
@@ -2707,7 +2699,7 @@ export default class JiaZai extends cc.Component {
|
||||
let title = "充值补发奖励金币:" + coinTemp;
|
||||
// MiniGameSdk.API.showToast(title);
|
||||
if (order.itemid != "month_Card")
|
||||
cc.fx.GameTool.shopBuy(productId, true, productId === "starter_pack" || /^reborn_Gift(?:_[2-5])?$/.test(productId) ? { outTradeNo: order.outTradeNo } : null);
|
||||
cc.fx.GameTool.shopBuy(productId, true, productId === "starter_pack" || /^reborn_Gift(?:_[2-5])?$/.test(productId) || !!getNewShopProduct(productId) ? { outTradeNo: order.outTradeNo } : null);
|
||||
// console.log("充值成功获得金币");
|
||||
let price = parseInt(order.goodsPrice) || 0;
|
||||
// const dataSuccess = {
|
||||
@@ -2891,8 +2883,12 @@ export default class JiaZai extends cc.Component {
|
||||
// - customEventData:自定义事件数据
|
||||
// ============================================
|
||||
// 打开通行证弹窗
|
||||
openStarter_pack(event?: cc.Event, customEventData?: string, fromQueue: boolean = false) {
|
||||
openStarter_pack(event?: cc.Event, customEventData?: string, fromQueue: boolean = false,
|
||||
canOpen?: () => boolean) {
|
||||
if (!this.isHomeRuntimeAlive() || cc.fx.GameConfig.isGameplayEntryPreparing()) return;
|
||||
// 商城入口不重复打开,且异步加载完成后仍须确认商城没有退出。
|
||||
if (canOpen && (!canOpen() || this.starterPackOpening
|
||||
|| (this.actionpNode && this.actionpNode.active))) return;
|
||||
if (!event && customEventData === undefined && !fromQueue) {
|
||||
HomePopupQueue.get(this.node).enqueue("starterPack", 40, done => {
|
||||
const show = () => {
|
||||
@@ -2916,7 +2912,7 @@ export default class JiaZai extends cc.Component {
|
||||
const show = () => {
|
||||
this.starterPackOpening = false;
|
||||
if (!this.isHomeRuntimeAlive() || cc.fx.GameConfig.isGameplayEntryPreparing()
|
||||
|| starterPackRemaining() <= 0) return;
|
||||
|| (canOpen && !canOpen()) || starterPackRemaining() <= 0) return;
|
||||
const first = !this.actionpNode;
|
||||
if (first) {
|
||||
this.actionpNode = cc.instantiate(JiaZai.cachedActionPrefab);
|
||||
@@ -3016,6 +3012,9 @@ export default class JiaZai extends cc.Component {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** 读取服务器配置和当前玩家的 51 档状态;成功前不加载活动分包。 */
|
||||
private requestJungleTreasureData(
|
||||
openAfterLoad: boolean = false,
|
||||
@@ -4027,6 +4026,9 @@ export default class JiaZai extends cc.Component {
|
||||
cc.fx.GameTool.shushu_Track("resource_get", dataTemp);
|
||||
if (!canUpdateHome()) return;
|
||||
this.updateCoin();
|
||||
const shopNode = this.node.getChildByName("shop");
|
||||
const shop = shopNode && shopNode.activeInHierarchy && shopNode.getComponent("shop");
|
||||
if (shop) shop.refreshJungleRewardDisplay();
|
||||
HomePopupQueue.get(this.node).enqueue("monthlyReward", 20, done => {
|
||||
if (!canUpdateHome() || !this.getcard || !cc.isValid(this.getcard, true)
|
||||
|| !this.cardTime || !cc.isValid(this.cardTime, true)) { done(); return; }
|
||||
|
||||
@@ -124,6 +124,8 @@ export default class SceneManager extends cc.Component {
|
||||
|
||||
// 缓存 shop 预制体
|
||||
private static cachedShopPrefab: cc.Prefab | null = null;
|
||||
private static cachedShop2Prefab: cc.Prefab | null = null;
|
||||
private shopNodePrefabPath: string = "";
|
||||
// 缓存 shop 节点
|
||||
private shopNode: cc.Node | null = null;
|
||||
private starterPackOpening = false;
|
||||
@@ -149,12 +151,16 @@ export default class SceneManager extends cc.Component {
|
||||
|
||||
static clearShopPrefabCaches(): void {
|
||||
SceneManager.cachedShopPrefab = null;
|
||||
SceneManager.cachedShop2Prefab = null;
|
||||
SceneManager.cachedRewardPrefab = null;
|
||||
SceneManager.cachedMonthlyCardPrefab = null;
|
||||
}
|
||||
|
||||
/** releaseAll 不会同步清空 JS 静态字段;使用前先丢弃已经失效的 Prefab。 */
|
||||
private static clearInvalidShopPrefabCaches(): void {
|
||||
if (SceneManager.cachedShop2Prefab && !cc.isValid(SceneManager.cachedShop2Prefab)) {
|
||||
SceneManager.cachedShop2Prefab = null;
|
||||
}
|
||||
if (SceneManager.cachedShopPrefab && !cc.isValid(SceneManager.cachedShopPrefab)) {
|
||||
SceneManager.cachedShopPrefab = null;
|
||||
}
|
||||
@@ -889,20 +895,22 @@ export default class SceneManager extends cc.Component {
|
||||
this.changeBg();
|
||||
// 预加载 shop 预制体
|
||||
SceneManager.clearInvalidShopPrefabCaches();
|
||||
if (!SceneManager.cachedShopPrefab
|
||||
const shopCacheKey = cc.fx.GameConfig.isShopB() ? "cachedShop2Prefab" : "cachedShopPrefab";
|
||||
const shopPath = cc.fx.GameConfig.getShopPrefabPath();
|
||||
if (!SceneManager[shopCacheKey]
|
||||
|| !SceneManager.cachedMonthlyCardPrefab) {
|
||||
cc.assetManager.loadBundle('shop', (err: Error, bundle: cc.AssetManager.Bundle) => {
|
||||
if (err) {
|
||||
cc.error(err.message || err);
|
||||
return;
|
||||
}
|
||||
if (!SceneManager.cachedShopPrefab) {
|
||||
bundle.load('prefab/shop', cc.Prefab, (err: Error, prefab: cc.Prefab) => {
|
||||
if (!SceneManager[shopCacheKey]) {
|
||||
bundle.load(shopPath, cc.Prefab, (err: Error, prefab: cc.Prefab) => {
|
||||
if (err) {
|
||||
cc.error(err.message || err);
|
||||
return;
|
||||
}
|
||||
SceneManager.cachedShopPrefab = prefab;
|
||||
SceneManager[shopCacheKey] = prefab;
|
||||
});
|
||||
}
|
||||
if (!SceneManager.cachedMonthlyCardPrefab) {
|
||||
@@ -1864,8 +1872,9 @@ export default class SceneManager extends cc.Component {
|
||||
|
||||
|
||||
/** Reuse the authored gift prefab when reactivation happens inside a level. */
|
||||
openStarterPack() {
|
||||
openStarterPack(entryPoint: string = "reactivate_level", canOpen?: () => boolean) {
|
||||
if (!this.isPopupRuntimeAlive() || this.starterPackOpening || starterPackRemaining() <= 0) return;
|
||||
if (canOpen && !canOpen()) return;
|
||||
const existing = this.getDynamicPopup("starterPack");
|
||||
if (existing && existing.active) return;
|
||||
const map = MapConroler._instance;
|
||||
@@ -1891,14 +1900,16 @@ export default class SceneManager extends cc.Component {
|
||||
this.loadDynamicPopup("starterPack", "action_bundle", "prefab/newbieGift", this.node, (error, root) => {
|
||||
this.starterPackOpening = false;
|
||||
this.finishDynamicPopupLoad("starterPack");
|
||||
// 商城已关闭时,由商城自己的关闭流程处理暂停,避免旧回调再覆盖状态。
|
||||
if (canOpen && !canOpen()) return;
|
||||
if (error || !root || starterPackRemaining() <= 0 || map.gameWin) { restore(); return; }
|
||||
root.zIndex = cc.macro.MAX_ZINDEX - 1;
|
||||
root.active = true;
|
||||
root.once("starter-pack-closed", restore);
|
||||
root.getComponent("NewbieGift").init(!existing);
|
||||
cc.fx.GameTool.shushu_Track("interface_exposure", {
|
||||
interface_id: "NewbieGift", reason: "auto", is_first_exposure: !existing,
|
||||
entry_point: "reactivate_level",
|
||||
interface_id: "NewbieGift", reason: entryPoint === "shop_page" ? "click" : "auto", is_first_exposure: !existing,
|
||||
entry_point: entryPoint,
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1912,13 +1923,16 @@ export default class SceneManager extends cc.Component {
|
||||
}
|
||||
cc.fx.GameTool.tryReactivateStarterPack("level_purchase");
|
||||
SceneManager.clearInvalidShopPrefabCaches();
|
||||
if (!SceneManager.cachedShopPrefab) {
|
||||
const shopPath = cc.fx.GameConfig.getShopPrefabPath();
|
||||
const shopCacheKey = cc.fx.GameConfig.isShopB() ? "cachedShop2Prefab" : "cachedShopPrefab";
|
||||
if (!SceneManager[shopCacheKey]) {
|
||||
cc.error('Shop prefab is not loaded yet.');
|
||||
return;
|
||||
}
|
||||
|
||||
Utils.getShopDouble(res => {
|
||||
const onShopDouble = (res) => {
|
||||
if (!this.isPopupRuntimeAlive()) return;
|
||||
if (shopPath !== cc.fx.GameConfig.getShopPrefabPath()) return;
|
||||
if (res.code === 1) {
|
||||
let eventName = "";
|
||||
let btnName = ""
|
||||
@@ -1942,9 +1956,14 @@ export default class SceneManager extends cc.Component {
|
||||
MapConroler._instance.pause = true;
|
||||
MapConroler._instance.stopBoom();
|
||||
}
|
||||
if (this.shopNode && this.shopNodePrefabPath !== shopPath) {
|
||||
this.shopNode.destroy();
|
||||
this.shopNode = null;
|
||||
}
|
||||
this.shopNodePrefabPath = shopPath;
|
||||
if (!this.shopNode) {
|
||||
// 第一次使用,创建节点
|
||||
this.shopNode = cc.instantiate(SceneManager.cachedShopPrefab);
|
||||
this.shopNode = cc.instantiate(SceneManager[shopCacheKey]);
|
||||
if (this.node && this.shopNode)
|
||||
this.node.addChild(this.shopNode);
|
||||
this.shopNode.getComponent("shop").init(res.data.shopDouble);
|
||||
@@ -1956,7 +1975,8 @@ export default class SceneManager extends cc.Component {
|
||||
|
||||
// console.log("shopNode parent:", this.shopNode.parent);
|
||||
}
|
||||
});
|
||||
};
|
||||
Utils.getShopDouble(onShopDouble);
|
||||
|
||||
}
|
||||
//打开月卡
|
||||
|
||||
@@ -412,6 +412,19 @@ export class GameConfig {
|
||||
&& ["B", "2"].includes(String(assignment.group).toUpperCase());
|
||||
}
|
||||
|
||||
static isShopB(): boolean {
|
||||
const assignments = this.GM_INFO.abTestAssignments || {};
|
||||
const assignment = assignments.layer_3 || Object.keys(assignments)
|
||||
.map(key => assignments[key]).find(item => item && Number(item.layer) === 3);
|
||||
if (assignment) return assignment.enabled !== false
|
||||
&& ["B", "2"].includes(String(assignment.group).toUpperCase());
|
||||
return !!this.GM_INFO.abTests && this.GM_INFO.abTests.layer_three === 2;
|
||||
}
|
||||
|
||||
static getShopPrefabPath(): string {
|
||||
return this.isShopB() ? "prefab/shop2" : "prefab/shop";
|
||||
}
|
||||
|
||||
static getLevelConfigPath(level: number, mainline: boolean = true): string {
|
||||
const folder = mainline && this.isNewPlayerB() && level >= 1 && level <= 50 ? "Json2" : "Json";
|
||||
return `${folder}/level${level}`;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
export interface ShopProduct {
|
||||
id: string;
|
||||
price: number; // 分
|
||||
coin: number;
|
||||
firstPurchaseKey?: string;
|
||||
hammer?: number;
|
||||
freeze?: number;
|
||||
magic?: number;
|
||||
infiniteHealth?: number; // 秒;8 元礼包没有无限体力
|
||||
}
|
||||
|
||||
export const SHOP_A_GOLD: ShopProduct[] = [
|
||||
{ id: "gold_1", price: 600, coin: 1200, firstPurchaseKey: "gold_1" },
|
||||
{ id: "gold_2", price: 3600, coin: 8000, firstPurchaseKey: "gold_2" },
|
||||
{ id: "gold_3", price: 6800, coin: 16000, firstPurchaseKey: "gold_3" },
|
||||
{ id: "gold_4", price: 12800, coin: 32000, firstPurchaseKey: "gold_4" },
|
||||
{ id: "gold_5", price: 32800, coin: 100000, firstPurchaseKey: "gold_5" },
|
||||
{ id: "gold_6", price: 64800, coin: 240000, firstPurchaseKey: "gold_6" },
|
||||
];
|
||||
|
||||
export const SHOP_B_GOLD: ShopProduct[] = [
|
||||
{ id: "new_gold_1", price: 600, coin: 1200, firstPurchaseKey: "gold_1" },
|
||||
{ id: "new_gold_2", price: 3000, coin: 6800, firstPurchaseKey: "gold_2" },
|
||||
{ id: "new_gold_3", price: 6800, coin: 16000, firstPurchaseKey: "gold_3" },
|
||||
{ id: "new_gold_4", price: 12800, coin: 32000, firstPurchaseKey: "gold_4" },
|
||||
{ id: "new_gold_5", price: 32800, coin: 84000, firstPurchaseKey: "gold_5" },
|
||||
{ id: "new_gold_6", price: 64800, coin: 168000, firstPurchaseKey: "gold_6" },
|
||||
];
|
||||
|
||||
export const SHOP_B_BUNDLES: ShopProduct[] = [
|
||||
{ id: "new_unlimited_health_bundle_8", price: 800, coin: 1500, hammer: 2, freeze: 2, magic: 2, infiniteHealth: 0 },
|
||||
{ id: "new_unlimited_health_bundle_18", price: 1800, coin: 3000, hammer: 5, freeze: 5, magic: 5, infiniteHealth: 1800 },
|
||||
{ id: "new_unlimited_health_bundle_36", price: 3600, coin: 6000, hammer: 10, freeze: 10, magic: 10, infiniteHealth: 7200 },
|
||||
{ id: "new_unlimited_health_bundle_68", price: 6800, coin: 10000, hammer: 20, freeze: 20, magic: 20, infiniteHealth: 21600 },
|
||||
{ id: "new_unlimited_health_bundle_98", price: 9800, coin: 20000, hammer: 25, freeze: 25, magic: 25, infiniteHealth: 43200 },
|
||||
];
|
||||
|
||||
// 按订单商品 ID 查奖励,补单不能使用玩家当前的 AB 分组决定数值。
|
||||
export function getNewShopProduct(id: string): ShopProduct {
|
||||
return SHOP_B_GOLD.concat(SHOP_B_BUNDLES).find(product => product.id === id);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "3cf4c676-9dc9-48c9-852c-2bd77c5c2039",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -145,6 +145,8 @@ export default class NewClass extends cc.Component {
|
||||
}
|
||||
|
||||
init() {
|
||||
// 与首页弹窗动画的最终尺寸一致,局内入口也不能保留预制体的 1 倍缩放。
|
||||
this.node.scale = 0.7;
|
||||
let isExpired = cc.fx.GameTool.checkExpiration();
|
||||
if (cc.sys.platform === cc.sys.WECHAT_GAME || cc.sys.platform === cc.sys.BYTEDANCE_GAME) {
|
||||
// 定义监听函数
|
||||
@@ -209,7 +211,8 @@ export default class NewClass extends cc.Component {
|
||||
|
||||
}, 300);
|
||||
} else {
|
||||
console.log("无法获取JiaZai组件");
|
||||
const scene = jiazaiNode.getComponent("SceneManager");
|
||||
if (scene) scene.updateCoin();
|
||||
}
|
||||
|
||||
this.refreshCardState(true);
|
||||
@@ -222,6 +225,7 @@ export default class NewClass extends cc.Component {
|
||||
let shopComp = shop.getComponent("shop");
|
||||
if (shopComp) {
|
||||
shopComp.openShop();
|
||||
shopComp.refreshJungleRewardDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user