diff --git a/assets/Scene/GameScene.fire b/assets/Scene/GameScene.fire index 6876cdd..6681481 100644 --- a/assets/Scene/GameScene.fire +++ b/assets/Scene/GameScene.fire @@ -17581,7 +17581,7 @@ "_srcBlendFactor": 770, "_dstBlendFactor": 771, "_spriteFrame": { - "__uuid__": "ab9b1a6d-9c1b-4d87-ba50-43dbe414eb7f" + "__uuid__": "b51c6577-3f31-4777-bf4a-6bfad58f0612" }, "_type": 0, "_sizeMode": 1, diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index 6ae7457..c49a8e0 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -152,7 +152,6 @@ export default class MapConroler extends cc.Component { revolving_state: number = 0;//是否是旋转门关卡,0:不是,1:顺时针旋转,2:逆时针旋转 revolvingWallArray: any; //旋转门数组 isTimeRewive: boolean = false; // 是否使用时间复活过 - isShare: boolean = true; // 分享or Ad // mapInfo: number[][] = []; @@ -198,7 +197,6 @@ export default class MapConroler extends cc.Component { this.revolving_state = 0; this.isTimeRewive = false; - this.isShare = true; //this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString(); // this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString(); // this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString(); @@ -1981,12 +1979,42 @@ export default class MapConroler extends cc.Component { // coin: -coin } - cc.fx.GameTool.shareToWX(() => { - this.runRewive(data); - }); + // cc.fx.GameTool.shareToWX(() => { + // cc.fx.GameTool.onShowVideo(() => { + // this.runRewive(data); + // }); // let coin = 500; - + if (type == "time") { + if (cc.fx.GameTool.canObtainByShare("reviveTime")) { + cc.fx.GameTool.shareToWX(this.runRewive(data)) + } else { + cc.fx.GameTool.onShowVideo(this.runRewive(data)) + } + } + else if (type == "boom") { + if (cc.fx.GameTool.canObtainByShare("removeBomb")) { + cc.fx.GameTool.shareToWX(this.runRewive(data)) + } else { + cc.fx.GameTool.onShowVideo(this.runRewive(data)) + } + } + else if (type == "lock") { + if (cc.fx.GameTool.canObtainByShare("openDoor")) { + cc.fx.GameTool.shareToWX(this.runRewive(data)) + } else { + cc.fx.GameTool.onShowVideo(this.runRewive(data)) + } + } + else if (type == "revolving") { + if (cc.fx.GameTool.canObtainByShare("removeJam")) { + cc.fx.GameTool.shareToWX(this.runRewive(data)) + } else { + cc.fx.GameTool.onShowVideo(this.runRewive(data)) + } + } else { + // this.runRewive(data); + } // if (type == "time") { // if (cc.fx.GameConfig.GM_INFO.review == 1) coin = 1000; // else if (cc.fx.GameConfig.GM_INFO.review == 2) coin = 1500; @@ -2303,60 +2331,32 @@ export default class MapConroler extends cc.Component { this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Boom").active = false; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Lock").active = false; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Revolving").active = false; - - //// buyBtn.getChildByName("coin1").active = buyBtn.getChildByName("coin2").active = buyBtn.getChildByName("coin3").active = false; - // if (cc.fx.GameConfig.GM_INFO.review == 0) buyBtn.getChildByName("coin1").active = true; - // else if (cc.fx.GameConfig.GM_INFO.review == 1) buyBtn.getChildByName("coin2").active = true; - // else if (cc.fx.GameConfig.GM_INFO.review == 2) buyBtn.getChildByName("coin3").active = true; - // if (this.isShare) { - // timeBuyBtn.getChildByName("share_img").active = true; - // timeBuyBtn.getChildByName("share_img").active = true; - // } else { - // timeBuyBtn.getChildByName("share_img").active = false; - // } - let buyBtn = this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Time").getChildByName("buyBtn"); - isShareOrAdShow(buyBtn, this.isShare) + isShareOrAdShow(buyBtn, cc.fx.GameTool.canObtainByShare("reviveTime")) } else if (type == "boom") { this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Time").active = false; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Boom").active = true; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Lock").active = false; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Revolving").active = false; - - // buyBtn.getChildByName("coin1").active = buyBtn.getChildByName("coin2").active = buyBtn.getChildByName("coin3").active = false; - // if (cc.fx.GameConfig.GM_INFO.reviewBoom == 0) buyBtn.getChildByName("coin1").active = true; - // else if (cc.fx.GameConfig.GM_INFO.reviewBoom == 1) buyBtn.getChildByName("coin2").active = true; - // else if (cc.fx.GameConfig.GM_INFO.reviewBoom == 2) buyBtn.getChildByName("coin3").active = true; - let buyBtn = this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Boom").getChildByName("buyBtn"); - isShareOrAdShow(buyBtn, this.isShare) + isShareOrAdShow(buyBtn, cc.fx.GameTool.canObtainByShare("removeBomb")) } else if (type == "lock") { this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Time").active = false; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Boom").active = false; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Lock").active = true; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Revolving").active = false; - - // buyBtn.getChildByName("coin1").active = buyBtn.getChildByName("coin2").active = buyBtn.getChildByName("coin3").active = false; - // if (cc.fx.GameConfig.GM_INFO.reviewDoor == 0) buyBtn.getChildByName("coin1").active = true; - // else if (cc.fx.GameConfig.GM_INFO.reviewDoor == 1) buyBtn.getChildByName("coin2").active = true; - // else if (cc.fx.GameConfig.GM_INFO.reviewDoor == 2) buyBtn.getChildByName("coin3").active = true; let buyBtn = this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Lock").getChildByName("buyBtn"); - isShareOrAdShow(buyBtn, this.isShare) + isShareOrAdShow(buyBtn, cc.fx.GameTool.canObtainByShare("openDoor")) } else if (type == "rotate") { this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Time").active = false; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Boom").active = false; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Lock").active = false; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Revolving").active = true; - - // buyBtn.getChildByName("coin1").active = buyBtn.getChildByName("coin2").active = buyBtn.getChildByName("coin3").active = false; - // if (cc.fx.GameConfig.GM_INFO.reviewDoor == 0) buyBtn.getChildByName("coin1").active = true; - // else if (cc.fx.GameConfig.GM_INFO.reviewDoor == 1) buyBtn.getChildByName("coin2").active = true; - // else if (cc.fx.GameConfig.GM_INFO.reviewDoor == 2) buyBtn.getChildByName("coin3").active = true; let buyBtn = this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Revolving").getChildByName("buyBtn"); - isShareOrAdShow(buyBtn, this.isShare) + isShareOrAdShow(buyBtn, cc.fx.GameTool.canObtainByShare("removeJam")) } } }, time); @@ -2710,6 +2710,14 @@ export default class MapConroler extends cc.Component { if (!this.hammer) { this.hammerMask.active = true; this.node.parent.getChildByName("Mask").active = true; + this.node.parent.getChildByName("Mask").on(cc.Node.EventType.TOUCH_START, () => { + this.hammerMask.active = false; + this.node.parent.getChildByName("Mask").active = false; + this.hammer = false; + this.ishammer = false; + this.pause = false; + hammerBtn.getComponent("btnControl").setTouch(true); + }); this.hammer = true; this.ishammer = true; this.stopBoom(); @@ -2724,6 +2732,7 @@ export default class MapConroler extends cc.Component { } costHammer() { + if (cc.fx.GameConfig.GM_INFO.otherLevel == 0) { if (cc.fx.GameConfig.GM_INFO.tasks.useProp.value < cc.fx.GameConfig.GM_INFO.tasks.useProp.target) { cc.fx.GameConfig.GM_INFO.tasks.useProp.value += 1; @@ -2757,7 +2766,6 @@ export default class MapConroler extends cc.Component { cc.fx.GameTool.shushu_Track("resource_cost", data); } - buyMagic() { console.log("购买道具魔法杖"); // if (cc.fx.GameConfig.GM_INFO.coin < 900) { diff --git a/assets/Script/SceneManager.ts b/assets/Script/SceneManager.ts index 138d521..3622714 100644 --- a/assets/Script/SceneManager.ts +++ b/assets/Script/SceneManager.ts @@ -357,14 +357,27 @@ export default class SceneManager extends cc.Component { propWindow.getChildByName("share_Btn").getComponent("btnControl").setTouch(true); propWindow.getChildByName(name).active = true; - if (MapConroler._instance.isShare == true) { - propWindow.getChildByName("share_Btn").getChildByName("share_img").active = true; - propWindow.getChildByName("share_Btn").getChildByName("ad_img").active = false; + var isShareOrAd = function (isShare) { + if (isShare == true) { + propWindow.getChildByName("share_Btn").getChildByName("share_img").active = true; + propWindow.getChildByName("share_Btn").getChildByName("ad_img").active = false; - } else { - propWindow.getChildByName("share_Btn").getChildByName("share_img").active = false; - propWindow.getChildByName("share_Btn").getChildByName("ad_img").active = true; + } else { + propWindow.getChildByName("share_Btn").getChildByName("share_img").active = false; + propWindow.getChildByName("share_Btn").getChildByName("ad_img").active = true; + } } + + if (this.btnName == "freeze") { + isShareOrAd(cc.fx.GameTool.canObtainByShare("freeze")) + } + else if (this.btnName == "hammer") { + isShareOrAd(cc.fx.GameTool.canObtainByShare("hammer")) + } + else if (this.btnName == "magic") { + isShareOrAd(cc.fx.GameTool.canObtainByShare("magicWand")) + } + } diff --git a/assets/Script/Sdk/MiniGameSdk.ts b/assets/Script/Sdk/MiniGameSdk.ts index de24d67..df90c25 100644 --- a/assets/Script/Sdk/MiniGameSdk.ts +++ b/assets/Script/Sdk/MiniGameSdk.ts @@ -282,17 +282,30 @@ export namespace MiniGameSdk { */ show(onResult: (res: EAdVideoResult, count: number) => void, target?: any, maxVideoCount: number = 3): void { let callback = (state: EAdVideoResult, count: number) => { + // 确保广告实例被清理 + if (this._adVideo) { + this._adVideo.offLoad?.(); + this._adVideo.offError?.(); + this._adVideo.offClose?.(); + this._adVideo = null; + } onResult?.call(target, state, count); } if (!isWechat() && !isBytedance()) { callback(EAdVideoResult.ACCEPT, 1); - this._adVideo = null; return; } + // 总是创建新的广告实例 + if (this._adVideo) { + this._adVideo.offLoad?.(); + this._adVideo.offError?.(); + this._adVideo.offClose?.(); + this._adVideo = null; + } + let onAdVideoClosed = (res: any) => { - this._adVideo?.offClose(onAdVideoClosed); if (isWechat()) { if (res && res.isEnded || res === undefined) { callback(EAdVideoResult.ACCEPT, 1); @@ -309,40 +322,77 @@ export namespace MiniGameSdk { } } - this._adVideo?.offClose(onAdVideoClosed); - if (isWechat()) { + try { + // @ts-ignore + this._adVideo = wx.createRewardedVideoAd({ + adUnitId: this._adUid + }); + } catch (e) { + console.error('Failed to create rewarded video ad:', e); + callback(EAdVideoResult.ERROR, 0); + return; + } + } else if (isBytedance()) { // @ts-ignore - this._adVideo = wx.createRewardedVideoAd({ - adUnitId: this._adUid + this._adVideo = tt.createRewardedVideoAd({ + adUnitId: this._adUid, + multiton: true, + multitonRewardMsg: ['多1次奖励', '再多一次奖励', '再多一次奖励'], + multitonRewardTimes: maxVideoCount, }); } else { this._adVideo = null; } + // 确保广告对象已创建 + if (!this._adVideo) { + callback(EAdVideoResult.ERROR, 0); + return; + } - this._adVideo?.onLoad(() => { + this._adVideo.onLoad(() => { console.log('Ad load success'); }); - this._adVideo?.onError((err: { errMsg: string, errCode: number }) => { + this._adVideo.onError((err: { errMsg: string, errCode: number }) => { console.log('Ad video error:', err); + if (err.errCode) { + console.log('Ad video error code:', err.errCode); + } callback(EAdVideoResult.ERROR, 0); }); - this._adVideo?.onClose(onAdVideoClosed); + // const onCloseHandler = onAdVideoClosed; - this._adVideo?.show().catch(() => { - this._adVideo?.load().then(() => - this._adVideo?.show()).catch((err: { errMsg: string, errCode: number }) => { - console.log('Catch video ad error:', err); - callback(EAdVideoResult.ERROR, 0); - }); + // this._adVideo.onLoad(onLoadHandler); + // this._adVideo.onError(onErrorHandler); + this._adVideo.onClose(onAdVideoClosed); + + // 尝试显示广告 + this._adVideo.show().catch((err: { errMsg: string, errCode: number }) => { + console.log('Show video ad error:', err); + // 尝试加载广告后再显示 + this._adVideo.load().then(() => { + return this._adVideo.show(); + }).catch((loadErr: { errMsg: string, errCode: number }) => { + console.log('Load and show video ad error:', loadErr); + if (loadErr.errCode) { + console.log('Load error code:', loadErr.errCode); + } + callback(EAdVideoResult.ERROR, 0); + }); }); } destory() { - this._adVideo?.destory(); + if (this._adVideo) { + this._adVideo.offLoad?.(); + this._adVideo.offError?.(); + this._adVideo.offClose?.(); + this._adVideo.destroy?.(); + this._adVideo = null; + } } } @@ -484,13 +534,9 @@ export namespace MiniGameSdk { * @param maxVideoCount 最大视频个数。默认是3,仅对抖音平台生效。微信平台看完视频count的结果永远是1或0 */ public showVideo(adUid: string, onVideoResult: (res: EAdVideoResult, count: number) => void, target?: any, maxVideoCount: number = 3) { - if (this._video && this._video.aduid === adUid) { - this._video.show(onVideoResult, target, maxVideoCount); - } else { - this._video?.destory(); - this._video = new ADVideo(adUid); - this._video.show(onVideoResult, target, maxVideoCount); - } + this._video?.destory(); + this._video = new ADVideo(adUid); + this._video.show(onVideoResult, target, maxVideoCount); } /** diff --git a/assets/Script/heathnum.ts b/assets/Script/heathnum.ts index 00fac86..27be94f 100644 --- a/assets/Script/heathnum.ts +++ b/assets/Script/heathnum.ts @@ -1,6 +1,7 @@ import NumberToImage from "./NumberToImage"; import JiaZai from "./JiaZai"; import { MiniGameSdk } from "./Sdk/MiniGameSdk"; +import { MiniGameManager } from "./Sdk/MiniGameManager"; // prefab/pop/heathpop const { ccclass, property } = cc._decorator; @@ -30,6 +31,15 @@ export default class NewClass extends cc.Component { onLoad() { this.btn_Touch = true; + if (cc.fx.GameTool.canObtainByShare("health")) { + // 分享 + this.switchButtons[2].getChildByName("share_img").active = true; + this.switchButtons[2].getChildByName("ad_img").active = false; + } else { + // 视频 + this.switchButtons[2].getChildByName("share_img").active = true; + this.switchButtons[2].getChildByName("ad_img").active = false; + } } start() { this.btn_Touch = true; @@ -68,18 +78,12 @@ export default class NewClass extends cc.Component { // let curCoin = cc.fx.GameConfig.GM_INFO.coin; // if (curCoin >= 1000) { // cc.fx.GameConfig.GM_INFO.hp = 1; // 测试时不通过微信分享使用 - cc.fx.GameTool.shareToWX(() => { + + var callback = function () { //// 分享成功后才执行以下代码 console.log("分享得体力"); this.switchButtons[1].active = false; - // cc.fx.GameTool.changeCoin(-1000); - // const data = { - // change_reason: "首页购买体力", - // id: (1001 + ""), - // num: -1000 - // } - // cc.fx.GameTool.shushu_Track("resource_cost", data); - // cc.fx.GameConfig.GM_INFO.hp = cc.fx.GameConfig.GM_INFO.hp_Max; + cc.fx.GameConfig.GM_INFO.hp = 1; cc.fx.GameConfig.GM_INFO.min_Time = 0; // NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hp, 40, 20, "month_", this.heatht, true); @@ -94,24 +98,14 @@ export default class NewClass extends cc.Component { cc.fx.GameTool.setUserHealth(0, (data) => { cc.fx.GameTool.getHealth(null); }) - // const buyData = { - // item_id: "refill_health", - // item_num: 3, - // item_price: 1000, - // cost_type: "gold" - // } - // // console.log("____________即将上传Shop_buy", buyData); - // cc.fx.GameTool.shushu_Track("shop_buy", buyData); + } + + if (cc.fx.GameTool.canObtainByShare("health")) { + cc.fx.GameTool.shareToWX(callback) + } else { + cc.fx.GameTool.onShowVideo(callback) + } - // } - // else { - // MiniGameSdk.API.showToast("金币不足,无法购买体力"); - // setTimeout(() => { - // this.btn_Touch = true; - // this.openShop(); - // }, 500); - // } - }); } //关闭弹窗 diff --git a/assets/Script/module/Config/GameConfig.ts b/assets/Script/module/Config/GameConfig.ts index 507ff40..b0699ee 100644 --- a/assets/Script/module/Config/GameConfig.ts +++ b/assets/Script/module/Config/GameConfig.ts @@ -125,13 +125,19 @@ export class GameConfig { winState: boolean; //是否延续连胜状态 tasks: {}; //任务 openHeath: boolean; // 是否体力不足 + dailyShareCounts: {}; // 每日分享次数 }; - - - - - + static DAILY_SHARE_LIMITS = { + health: 2, //获得体力每日分享限制次数 + hammer: 0, //获得锤子道具每日分享限制次数 + freeze: 2, //获得冰冻时间道具每日分享限制次数 + magicWand: 2, //获得魔棒道具每日分享限制次数 + reviveTime: 0, //复活加时间道具每日分享限制次数 + removeBomb: 0, //复活移除炸弹道具每日分享限制次数 + openDoor: 0, //把门打开道具每日分享限制次数 + removeJam: 0 //弹走果酱道具每日分享限制次数 + }; @@ -290,6 +296,16 @@ export class GameConfig { winStreak: 0, //连胜 tasks: { levelPass: { value: 0, target: 0, state: 0 }, share: { value: 0, target: 0, state: 0 }, useEnergy: { value: 0, target: 0, state: 0 }, useProp: { value: 0, target: 0, state: 0 } }, openHeath: false, + dailyShareCounts: { + health: 0, //获得体力已分享次数 + hammer: 0, //获得锤子道具已分享次数 + freeze: 0, //获得冰冻时间道具已分享次数 + magicWand: 0, //获得魔棒道具已分享次数 + reviveTime: 0, //复活加时间道具已分享次数 + removeBomb: 0, //复活移除炸弹道具已分享次数 + openDoor: 0, //把门打开道具已分享次数 + removeJam: 0 //弹走果酱道具已分享次数 + }, }; // this.setCode(this.getKey("scode")); // this.GM_INFO.level = 0; diff --git a/assets/Script/module/Tool/GameTool.ts b/assets/Script/module/Tool/GameTool.ts index cdc0cf2..a3e19e5 100644 --- a/assets/Script/module/Tool/GameTool.ts +++ b/assets/Script/module/Tool/GameTool.ts @@ -661,27 +661,16 @@ var GameTool = { buyProp(propid, callback: Function) { //@ts-ignore if (typeof wx !== 'undefined' && wx !== null) { - cc.fx.GameTool.shareToWX(() => { + + var cb = function () { let num = 1; //3 - // let cost = 600; if (propid == 2003) { - // cost = 900; num = 1; // 3 } else if (propid == 2002) { num = 1; } - //console.log("_____________新版本", num); - // cc.fx.GameTool.changeCoin(-cost); - - // const dataTemp = { - // change_reason: "商城购买道具消耗", - // id: (1001 + ""), - // num: -cost - // } - // cc.fx.GameTool.shushu_Track("resource_cost", dataTemp); - let _id = ""; let propNumber = 0; if (propid == 2001) { @@ -712,17 +701,33 @@ var GameTool = { } cc.fx.GameTool.shushu_Track("resource_get", data); - //// const buyData = { - // item_id: _id, - // item_num: num, - // item_price: cost, - // cost_type: "gold" - // } - // //console.log("____________即将上传Shop_buy", buyData); - // cc.fx.GameTool.shushu_Track("shop_buy", buyData); - callback(); - }); + } + + if (propid == 2001) { + if (cc.fx.GameTool.canObtainByShare("freeze")) { + cc.fx.GameTool.shareToWX(cb) + } else { + cc.fx.GameTool.onShowVideo(cb) + } + } + else if (propid == 2002) { + if (cc.fx.GameTool.canObtainByShare("hammer")) { + cc.fx.GameTool.shareToWX(cb) + } else { + cc.fx.GameTool.onShowVideo(cb) + } + } + else if (propid == 2003) { + if (cc.fx.GameTool.canObtainByShare("magicWand")) { + cc.fx.GameTool.shareToWX(cb) + } else { + cc.fx.GameTool.onShowVideo(cb) + } + } + // cc.fx.GameTool.shareToWX(() => { + // cc.fx.GameTool.onShowVideo(() => { + // }); } }, @@ -1412,6 +1417,61 @@ var GameTool = { }, + onShowVideo(callback: Function, parentNode) { + MiniGameSdk.AdvertManager.instance.showVideo('adunit-32a23bc2b2f4ee0a', (res: MiniGameSdk.EAdVideoResult, count: number) => { + console.log('用户看的视频广告个数是:', count); + // 根据用户观看广告的结果,执行不同的逻辑 + switch (res) { + case MiniGameSdk.EAdVideoResult.ACCEPT: + // MiniGameSdk.API.showToast('用户看完广告,可以奖励'); + callback(); + break; + case MiniGameSdk.EAdVideoResult.REJECT: + MiniGameSdk.API.showToast('广告中断,未获得奖励'); + break; + case MiniGameSdk.EAdVideoResult.ERROR: + MiniGameSdk.API.showToast('广告加载失败,请稍后再试'); + break; + default: + // 其他情况,不作处理 + break; + } + }); + }, + + //检查是否可以使用分享方式获取道具 + + canObtainByShare(propType: string): boolean { + const today = new Date().toDateString(); + const lastShareDate = cc.fx.StorageMessage.getStorage(`dailyShareCounts${propType}`) || 0; + + // 如果是新的一天,重置分享次数 + if (today !== lastShareDate) { + cc.fx.GameConfig.GM_INFO.dailyShareCounts[propType] = 0; + cc.fx.StorageMessage.setStorage(`dailyShareCounts${propType}`, today); + } + + const shareLimit = (cc.fx.GameConfig.DAILY_SHARE_LIMITS && cc.fx.GameConfig.DAILY_SHARE_LIMITS[propType]) || 0; + // console.log("获得分享次数", cc.fx.GameConfig.GM_INFO.dailyShareCounts[propType] + "+++" + shareLimit); + return cc.fx.GameConfig.GM_INFO.dailyShareCounts[propType] < shareLimit; + }, + + // 增加分享次数 + addShareCount(propType: string): void { + const today = new Date().toDateString(); + const lastShareDate = cc.fx.StorageMessage.getStorage(`dailyShareCounts${propType}`) || 0; + + // 如果是新的一天,重置分享次数 + if (today !== lastShareDate) { + cc.fx.GameConfig.GM_INFO.dailyShareCounts[propType] = 0; + cc.fx.StorageMessage.setStorage(`dailyShareCounts${propType}`, today); + } + + cc.fx.GameConfig.GM_INFO.dailyShareCounts[propType]++; + // 保存到本地存储 + cc.fx.StorageMessage.setStorage(`dailyShareCounts${propType}`, cc.fx.GameConfig.GM_INFO.dailyShareCounts[propType]); + }, + isFromShareByScene(): boolean { if (cc.sys.platform === cc.sys.WECHAT_GAME) { try { diff --git a/assets/prefab/pop/heathpop.prefab b/assets/prefab/pop/heathpop.prefab index 71d55a2..2f91a9b 100644 --- a/assets/prefab/pop/heathpop.prefab +++ b/assets/prefab/pop/heathpop.prefab @@ -27,14 +27,14 @@ "_active": true, "_components": [ { - "__id__": 70 + "__id__": 73 }, { - "__id__": 71 + "__id__": 74 } ], "_prefab": { - "__id__": 72 + "__id__": 75 }, "_opacity": 255, "_color": { @@ -251,7 +251,7 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 69 + "__id__": 72 }, "_opacity": 255, "_color": { @@ -629,23 +629,23 @@ { "__id__": 42 }, - { - "__id__": 50 - }, { "__id__": 53 }, { - "__id__": 62 + "__id__": 56 }, { "__id__": 65 + }, + { + "__id__": 68 } ], "_active": true, "_components": [], "_prefab": { - "__id__": 68 + "__id__": 71 }, "_opacity": 255, "_color": { @@ -1621,19 +1621,22 @@ "_children": [ { "__id__": 43 + }, + { + "__id__": 46 } ], "_active": true, "_components": [ { - "__id__": 46 + "__id__": 49 }, { - "__id__": 48 + "__id__": 51 } ], "_prefab": { - "__id__": 49 + "__id__": 52 }, "_opacity": 255, "_color": { @@ -1684,7 +1687,7 @@ }, { "__type__": "cc.Node", - "_name": "share_label", + "_name": "share_img", "_objFlags": 0, "_parent": { "__id__": 42 @@ -1722,7 +1725,7 @@ "ctor": "Float64Array", "array": [ 0, - 10.033, + 8, 0, 0, 0, @@ -1791,6 +1794,115 @@ "fileId": "d1sq1BsQlHK4ffc6DVGC5U", "sync": false }, + { + "__type__": "cc.Node", + "_name": "ad_img", + "_objFlags": 0, + "_parent": { + "__id__": 42 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 47 + } + ], + "_prefab": { + "__id__": 48 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 112, + "height": 98 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 8, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 46 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "41b25e26-ca60-4ce6-b762-d2579d6b25c0" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": { + "__uuid__": "c4e438bd-a42c-4b6b-9baa-f9617ab45d99" + }, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "dbVicLG/9Fp69/J1fbmuj1", + "sync": false + }, { "__type__": "cc.Button", "_name": "", @@ -1805,7 +1917,7 @@ "zoomScale": 1.1, "clickEvents": [ { - "__id__": 47 + "__id__": 50 } ], "_N$interactable": true, @@ -1931,11 +2043,11 @@ "_active": false, "_components": [ { - "__id__": 51 + "__id__": 54 } ], "_prefab": { - "__id__": 52 + "__id__": 55 }, "_opacity": 255, "_color": { @@ -1989,7 +2101,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 50 + "__id__": 53 }, "_enabled": true, "_materials": [ @@ -2038,20 +2150,20 @@ }, "_children": [ { - "__id__": 54 + "__id__": 57 }, { - "__id__": 57 + "__id__": 60 } ], "_active": true, "_components": [ { - "__id__": 60 + "__id__": 63 } ], "_prefab": { - "__id__": 61 + "__id__": 64 }, "_opacity": 255, "_color": { @@ -2105,17 +2217,17 @@ "_name": "tili_x", "_objFlags": 0, "_parent": { - "__id__": 53 + "__id__": 56 }, "_children": [], "_active": false, "_components": [ { - "__id__": 55 + "__id__": 58 } ], "_prefab": { - "__id__": 56 + "__id__": 59 }, "_opacity": 255, "_color": { @@ -2169,7 +2281,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 54 + "__id__": 57 }, "_enabled": true, "_materials": [ @@ -2214,17 +2326,17 @@ "_name": "huifuyidian", "_objFlags": 0, "_parent": { - "__id__": 53 + "__id__": 56 }, "_children": [], "_active": true, "_components": [ { - "__id__": 58 + "__id__": 61 } ], "_prefab": { - "__id__": 59 + "__id__": 62 }, "_opacity": 255, "_color": { @@ -2278,7 +2390,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 57 + "__id__": 60 }, "_enabled": true, "_materials": [ @@ -2322,7 +2434,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 56 }, "_enabled": true, "_materials": [ @@ -2373,11 +2485,11 @@ "_active": false, "_components": [ { - "__id__": 63 + "__id__": 66 } ], "_prefab": { - "__id__": 64 + "__id__": 67 }, "_opacity": 255, "_color": { @@ -2431,7 +2543,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 62 + "__id__": 65 }, "_enabled": true, "_materials": [ @@ -2482,11 +2594,11 @@ "_active": true, "_components": [ { - "__id__": 66 + "__id__": 69 } ], "_prefab": { - "__id__": 67 + "__id__": 70 }, "_opacity": 255, "_color": { @@ -2540,7 +2652,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 65 + "__id__": 68 }, "_enabled": true, "_materials": [ @@ -2645,14 +2757,14 @@ }, "switchNode": [ { - "__id__": 50 + "__id__": 53 }, { - "__id__": 53 + "__id__": 56 } ], "timeNode": { - "__id__": 57 + "__id__": 60 }, "switchButtons": [ { diff --git a/settings/project.json b/settings/project.json index a52dad0..18be263 100644 --- a/settings/project.json +++ b/settings/project.json @@ -1,5 +1,5 @@ { - "last-module-event-record-time": 1759996464818, + "last-module-event-record-time": 1760669428233, "group-list": [ "default", "Map"