diff --git a/assets/Script/GameManager.ts b/assets/Script/GameManager.ts index cdd1553..b90e754 100644 --- a/assets/Script/GameManager.ts +++ b/assets/Script/GameManager.ts @@ -272,7 +272,7 @@ export default class GameManager extends cc.Component { } } - console.log("abTests:", cc.fx.GameConfig.GM_INFO.abTests); + // console.log("abTests:", cc.fx.GameConfig.GM_INFO.abTests); } readUserData(retryCount = 0) { @@ -848,6 +848,7 @@ export default class GameManager extends cc.Component { MiniGameSdk.API.yinli_Login(); this.setWX(); if (this.register_time != 0) MiniGameSdk.API.shushu_userSet(this.register_time); + MiniGameSdk.API.shushu_userSetLast(cc.fx.GameTool.formatDate(new Date())); this.startGame(); } } diff --git a/assets/Script/JiaZai.ts b/assets/Script/JiaZai.ts index a2943df..7f3fcb9 100644 --- a/assets/Script/JiaZai.ts +++ b/assets/Script/JiaZai.ts @@ -3762,12 +3762,13 @@ export default class JiaZai extends cc.Component { }, true) } } + // console.log("rankingData_________", rankData); } } } - // console.log("rankingData_________", rankData); + }); }, isShow); } diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index 6eb3259..e308c9b 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -554,6 +554,7 @@ export default class MapConroler extends cc.Component { if ((cc.fx.GameConfig.GM_INFO.level + 1) == 1) { this.guideNode.getComponent(Animation).stop(); this.guideNode.active = false; + MiniGameSdk.API.tencent_TutorialEnd(1); } if (cc.fx.GameConfig.GM_INFO.winStreak >= 10) { this.is_frenzy = true; @@ -573,6 +574,7 @@ export default class MapConroler extends cc.Component { cc.fx.StorageMessage.setStorage("winState", cc.fx.GameConfig.GM_INFO.winState); } cc.fx.GameTool.shushu_Track("enter_stage", data); + MiniGameSdk.API.tencent_LevelEnter(cc.fx.GameConfig.GM_INFO.level + 1); this.stopTimeCutDown(); this.startTimeCutDown(); } @@ -731,6 +733,7 @@ export default class MapConroler extends cc.Component { this.guideNode.active = true; this.guideNode.zIndex = 1000; this.guideNode.getComponent(Animation).play(); + MiniGameSdk.API.tencent_TutorialStart(1); } if (cc.fx.GameConfig.GM_INFO.hammerFirst == true) { @@ -3185,6 +3188,7 @@ export default class MapConroler extends cc.Component { console.log("获胜了成功了!!!!!!") this.gameWin = true; this.gameStart = false; + MiniGameSdk.API.tencent_LevelPass(cc.fx.GameConfig.GM_INFO.level + 1); // alert("游戏成功"); Utils.getCityRank((res) => { if (res.code === 1) { @@ -4029,6 +4033,7 @@ export default class MapConroler extends cc.Component { this.node.parent.parent.getChildByName("Lose").active = false; + MiniGameSdk.API.tencent_LevelEnter(cc.fx.GameConfig.GM_INFO.level + 1); setTimeout(() => { this.reviewState = false; this.blockNum = this.blocks.length; @@ -4096,6 +4101,7 @@ export default class MapConroler extends cc.Component { this.blockNum = this.blocks.length; if (this.blockNum == 0) this.nextLevel(1); this.node.parent.parent.getChildByName("Lose").active = false; + MiniGameSdk.API.tencent_LevelEnter(cc.fx.GameConfig.GM_INFO.level + 1); setTimeout(() => { this.reviewState = false; }, 200); @@ -4240,6 +4246,7 @@ export default class MapConroler extends cc.Component { //返回主界面 returnHome(event, customEventData) { + MiniGameSdk.API.tencent_LevelExit(cc.fx.GameConfig.GM_INFO.level + 1); cc.fx.AudioManager._instance.playEffect("anniu_Big", null); if (MapConroler._instance = null) { return; @@ -4333,6 +4340,7 @@ export default class MapConroler extends cc.Component { this.stopTimeCutDown(); //失败 + MiniGameSdk.API.tencent_LevelLose(cc.fx.GameConfig.GM_INFO.level + 1); if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) { let eventData = { identity: "helper", //发起者为helped 帮助者为helper diff --git a/assets/Script/Sdk/MiniGameSdk.ts b/assets/Script/Sdk/MiniGameSdk.ts index fd1a68c..8d3a9ca 100644 --- a/assets/Script/Sdk/MiniGameSdk.ts +++ b/assets/Script/Sdk/MiniGameSdk.ts @@ -974,6 +974,13 @@ export namespace MiniGameSdk { private static _ta: any = null; private static _ge: any = null; static _tencent: any; + private static _tencentLevelActive: boolean = false; + private static _tencentLevelId: number = 0; + private static _tencentLevelEnterTime: number = 0; + private static _tencentLevelAdCount: number = 0; + private static _tencentPendingLevelAdCount: number = 0; + private static _tencentTutorialStarted: boolean = false; + private static _tencentTutorialEnded: boolean = false; /** * 分享app给朋友,微信小游戏分享是没有onSuccess回调的。 * @param title 标题 @@ -1555,7 +1562,7 @@ export namespace MiniGameSdk { } static tencent_SetOpenId(openId: string) { - if (API._tencent) API._tencent.setOpenId(cc.fx.GameConfig.GM_INFO.openid); + if (API._tencent) API._tencent.setOpenId(openId); } static tencent_OnRegister() { @@ -1566,6 +1573,93 @@ export namespace MiniGameSdk { if (API._tencent) API._tencent.onAddToWishlist(); } + /** DataNexus IAP 质量看板使用的通用事件上报入口。 */ + static tencent_Track(actionType: string, actionParam: any = {}) { + if (!API._tencent) return null; + return API._tencent.track(actionType, actionParam); + } + + static tencent_TutorialStart(tutorialId: number = 1) { + if (API._tencentTutorialStarted || API._tencentTutorialEnded) return; + API._tencentTutorialStarted = true; + API.tencent_Track("TUTORIAL_START", { + id: tutorialId, + first: true, + }); + console.log("______________________开始新手指引上報"); + } + + static tencent_TutorialEnd(tutorialId: number = 1) { + if (!API._tencentTutorialStarted || API._tencentTutorialEnded) return; + API._tencentTutorialEnded = true; + API.tencent_Track("TUTORIAL_END", { + id: tutorialId, + last: true, + }); + console.log("______________________完成新手指引上報"); + // 同时上报开发指引中的标准“完成新手指引”转化事件。 + if (API._tencent) API._tencent.onTutorialFinish(); + } + + static tencent_LevelEnter(levelId: number) { + const normalizedLevelId = Math.max(1, Math.floor(Number(levelId) || 1)); + API._tencentLevelId = normalizedLevelId; + API._tencentLevelEnterTime = Date.now(); + API._tencentLevelAdCount = API._tencentPendingLevelAdCount; + API._tencentPendingLevelAdCount = 0; + API._tencentLevelActive = true; + API.tencent_Track("LEVEL_ENTER", { + level_id: normalizedLevelId, + }); + } + + private static tencent_LevelFinish(actionType: string, levelId?: number) { + if (!API._tencentLevelActive) return; + + const normalizedLevelId = Math.max( + 1, + Math.floor(Number(levelId || API._tencentLevelId) || 1) + ); + const duration = API._tencentLevelEnterTime > 0 + ? Math.max(0, Math.floor((Date.now() - API._tencentLevelEnterTime) / 1000)) + : 0; + + API.tencent_Track(actionType, { + level_id: normalizedLevelId, + ad_cnt: API._tencentLevelAdCount, + duration: duration, + }); + + API._tencentLevelActive = false; + API._tencentLevelId = 0; + API._tencentLevelEnterTime = 0; + API._tencentLevelAdCount = 0; + } + + static tencent_LevelPass(levelId?: number) { + API.tencent_LevelFinish("LEVEL_PASS", levelId); + } + + static tencent_LevelLose(levelId?: number) { + API.tencent_LevelFinish("LEVEL_LOSE", levelId); + } + + static tencent_LevelExit(levelId?: number) { + API.tencent_LevelFinish("LEVEL_EXIT", levelId); + } + + /** 记录关卡内完整观看的营销单元次数,供 LEVEL_PASS 等结束事件携带 ad_cnt。 */ + static tencent_MarketingUnitComplete(count: number = 1, currentPage: string = "") { + if (currentPage !== "GameScene") return; + const normalizedCount = Math.max(1, Math.floor(Number(count) || 1)); + if (API._tencentLevelActive) { + API._tencentLevelAdCount += normalizedCount; + } else { + // 失败后观看的复活广告属于复活后的下一次关卡循环。 + API._tencentPendingLevelAdCount += normalizedCount; + } + } + //#region 数数平台 /* * 数数平台初始化以及登录 @@ -1648,6 +1742,14 @@ export namespace MiniGameSdk { } } + static shushu_userSetLast(time) { + //@ts-ignore + if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) { + console.log("_______________设置用户最后登录属性", time); + API._ta.userSet({ last_login_time: time }); + } + } + static updateCoinAndLevel() { //@ts-ignore if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) { @@ -1849,6 +1951,7 @@ export namespace MiniGameSdk { if (version == "开发版" || version == "体验版") { } else { + if (API._tencent) API._tencent.onPurchase(payAmount); API._ge.payEvent(payAmount, "CNY", orderId, payReason, "微信"); } console.log("版本:", version); @@ -2297,4 +2400,4 @@ export namespace MiniGameSdk { } } -} \ No newline at end of file +} diff --git a/assets/Script/module/Config/GameConfig.ts b/assets/Script/module/Config/GameConfig.ts index 54fa0ea..0b11ba7 100644 --- a/assets/Script/module/Config/GameConfig.ts +++ b/assets/Script/module/Config/GameConfig.ts @@ -309,7 +309,7 @@ export class GameConfig { vibrateOpen: true, //震动 coinnum: 0, //每局的金币数 paid_user: false, //是否是付费用户 - version: "1.9.97", //版本号 + version: "1.9.98", //版本号 shushu_DistinctId: "", //数数访客ID shushu_AccountId: "", //数数账号ID uid: "", //用户和后端唯一id diff --git a/assets/Script/module/Tool/GameTool.ts b/assets/Script/module/Tool/GameTool.ts index 4ca05bd..d812eed 100644 --- a/assets/Script/module/Tool/GameTool.ts +++ b/assets/Script/module/Tool/GameTool.ts @@ -1912,6 +1912,7 @@ var GameTool = { data.is_complete_play = true; MiniGameSdk.API.showToast('用户看完广告,可以奖励'); cc.fx.GameTool.shushu_Track("ad_close", data); + MiniGameSdk.API.tencent_MarketingUnitComplete(count, videoData.current_page); callback(true, "ad"); // cc.fx.GameTool.preloadRewardedVideoAd(true); break; @@ -2538,4 +2539,4 @@ var GameTool = { } }; -export { GameTool }; \ No newline at end of file +export { GameTool }; diff --git a/settings/project.json b/settings/project.json index cda32d7..c948759 100644 --- a/settings/project.json +++ b/settings/project.json @@ -1,5 +1,5 @@ { - "last-module-event-record-time": 1783394460369, + "last-module-event-record-time": 1784108777617, "group-list": [ "default", "Map"