From ca63e97f30c396dd293cabe707fe92ee178bb422 Mon Sep 17 00:00:00 2001 From: "YZ\\249929363" <249929363@qq.com> Date: Fri, 4 Jul 2025 11:07:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=95=B0SDK?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=AD=A3=E5=8C=BA=E5=88=86=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=9C=8D=E5=92=8C=E6=AD=A3=E5=BC=8F=E6=9C=8D=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Scene/HomeScene.fire | 6 ++--- assets/Script/JiaZai.ts | 34 +++++++++++++++++++++------ assets/Script/Sdk/MiniGameSdk.ts | 16 ++++++++++--- assets/Script/module/Tool/GameTool.ts | 11 +++++---- assets/shop/prefab/shop.prefab | 12 +++++----- 5 files changed, 56 insertions(+), 23 deletions(-) diff --git a/assets/Scene/HomeScene.fire b/assets/Scene/HomeScene.fire index 1857dc4..6b0377a 100644 --- a/assets/Scene/HomeScene.fire +++ b/assets/Scene/HomeScene.fire @@ -586,7 +586,7 @@ "__id__": 18 } ], - "_active": true, + "_active": false, "_components": [ { "__id__": 21 @@ -3041,7 +3041,7 @@ "__id__": 7 }, "_children": [], - "_active": true, + "_active": false, "_components": [ { "__id__": 64 @@ -3137,7 +3137,7 @@ "__id__": 7 }, "_children": [], - "_active": true, + "_active": false, "_components": [ { "__id__": 66 diff --git a/assets/Script/JiaZai.ts b/assets/Script/JiaZai.ts index 01faf21..fca5fd9 100644 --- a/assets/Script/JiaZai.ts +++ b/assets/Script/JiaZai.ts @@ -65,7 +65,13 @@ private heathScheduleCallback: Function = null; // console.log("加载关卡配置2"); // window.initMgr(); GameManager._instance.Block_Color = this.Block_Color; - + let version = cc.fx.GameTool.getWechatGameVersion(); + if(version == "开发版" || version == "体验版"){ + this.node.getChildByName("Load").getChildByName("New EditBox").active = true; + } + else if(version == "正式版"){ + this.node.getChildByName("Load").getChildByName("New EditBox").active = false + } // 预加载 shop 预制体 if (!JiaZai.cachedShopPrefab) { cc.assetManager.loadBundle('shop', (err: Error, bundle: cc.AssetManager.Bundle) => { @@ -88,7 +94,12 @@ private heathScheduleCallback: Function = null; console.log("————————准备注册事件", cc.fx.GameConfig.GM_INFO.openid); if (cc.fx.GameConfig.GM_INFO.openid != "") { console.log("————————发送注册事件"); - cc.fx.GameTool.shushu_Track("register"); + const time = cc.fx.GameTool.formatDate(new Date()); + let data = { + register_time: time, // 注册时间 + } + cc.fx.GameTool.shushu_Track("register",data); + MiniGameSdk.API.shushu_SetSuperProperties(time); } cc.fx.AudioManager._instance.playEffect("zhuan1", null); this.node.getChildByName("zhuanchang").active = true; @@ -275,12 +286,21 @@ stopHeathTimeCutDown() { } if (this.node.getChildByName("Load").getChildByName("startBtn").getComponent("btnControl")._touch) { this.node.getChildByName("Load").getChildByName("startBtn").getComponent("btnControl").setTouch(false); - if(this.custom.string != ""){ - cc.fx.GameConfig.GM_INFO.level = parseInt(this.custom.string) - 1; - // cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString()); - cc.fx.GameConfig.LEVEL_INFO_init(true); + let version = cc.fx.GameTool.getWechatGameVersion(); + if(version == "开发版" || version == "体验版"){ + if(this.custom.string != ""){ + cc.fx.GameConfig.GM_INFO.level = parseInt(this.custom.string) - 1; + // cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString()); + cc.fx.GameConfig.LEVEL_INFO_init(true); + } + else{ + cc.fx.AudioManager._instance.playEffect("zhuan1", null); + this.node.getChildByName("zhuanchang").active = true; + this.node.getChildByName("zhuanchang").getComponent(sp.Skeleton).setAnimation(1, "up", false); + cc.fx.GameConfig.LEVEL_INFO_init(true, 1000); + } } - else{ + else if(version == "正式版"){ cc.fx.AudioManager._instance.playEffect("zhuan1", null); this.node.getChildByName("zhuanchang").active = true; this.node.getChildByName("zhuanchang").getComponent(sp.Skeleton).setAnimation(1, "up", false); diff --git a/assets/Script/Sdk/MiniGameSdk.ts b/assets/Script/Sdk/MiniGameSdk.ts index d282a67..3a378f0 100644 --- a/assets/Script/Sdk/MiniGameSdk.ts +++ b/assets/Script/Sdk/MiniGameSdk.ts @@ -1137,7 +1137,7 @@ export namespace MiniGameSdk { API._ta.login(cc.fx.GameConfig.GM_INFO.openid); const result = "success"; API.shushu_Track("login", result); - API.shushu_SetSuperProperties(); + API.shushu_SetSuperProperties(null); } } @@ -1152,16 +1152,26 @@ export namespace MiniGameSdk { * 数数平台设置动态公共属性 */ - static shushu_SetSuperProperties() { + static shushu_SetSuperProperties(register_time) { if (typeof wx !== 'undefined' && wx !== null && API._ta) { const versionData = "1.3"; // API._ta.userSetOnce({ register_time:time}); - var superProperties = { + var superProperties = {}; + superProperties = { current_level: (cc.fx.GameConfig.GM_INFO.level + 1), //当前关卡等级 number current_health: cc.fx.GameConfig.GM_INFO.hp, //当前体力值 tmp_coin: cc.fx.GameConfig.GM_INFO.coin,//当前金币 version: versionData }; + if(register_time != null){ + superProperties = { + current_level: (cc.fx.GameConfig.GM_INFO.level + 1), //当前关卡等级 number + current_health: cc.fx.GameConfig.GM_INFO.hp, //当前体力值 + tmp_coin: cc.fx.GameConfig.GM_INFO.coin,//当前金币 + version: versionData, + register_time:register_time + }; + } API._ta.setSuperProperties(superProperties);//设置公共事件属性 } } diff --git a/assets/Script/module/Tool/GameTool.ts b/assets/Script/module/Tool/GameTool.ts index baf036d..de8f849 100644 --- a/assets/Script/module/Tool/GameTool.ts +++ b/assets/Script/module/Tool/GameTool.ts @@ -353,7 +353,7 @@ var GameTool = { result:"success" } cc.fx.GameTool.shushu_Track("finish_stage",data); - MiniGameSdk.API.shushu_SetSuperProperties(); + MiniGameSdk.API.shushu_SetSuperProperties(null); } cc.fx.GameTool.setUserLevel((data)=>{ @@ -382,7 +382,7 @@ var GameTool = { coin: cc.fx.GameConfig.GM_INFO.coin, timestamp: timestamp, } - MiniGameSdk.API.shushu_SetSuperProperties(); + MiniGameSdk.API.shushu_SetSuperProperties(null); cc.fx.StorageMessage.setStorage("coin", coinInfo); // console.log("存储金币数据:",cc.fx.GameConfig.GM_INFO.coin,coinInfo); cc.fx.GameTool.setUserCoin((data) => { @@ -494,7 +494,7 @@ var GameTool = { "health":cc.fx.GameConfig.GM_INFO.hp, "timestamp":data.result.timestamp } - MiniGameSdk.API.shushu_SetSuperProperties(); + MiniGameSdk.API.shushu_SetSuperProperties(null); cc.fx.StorageMessage.setStorage("health",healthInfo); } else if(data.result.code == 404 && data.result.message == "未找到体力数据"){ @@ -588,7 +588,7 @@ var GameTool = { } } cc.fx.StorageMessage.setStorage("health",healthInfo); - MiniGameSdk.API.shushu_SetSuperProperties(); + MiniGameSdk.API.shushu_SetSuperProperties(null); //@ts-ignore if (typeof wx!== 'undefined' && wx!== null) { //@ts-ignore @@ -887,6 +887,9 @@ var GameTool = { let eventData = {} switch(name){ case "register": + eventData = { + register_time: data.register_time, + } break; case "enter_stage": eventData = { diff --git a/assets/shop/prefab/shop.prefab b/assets/shop/prefab/shop.prefab index aed5526..ffa270a 100644 --- a/assets/shop/prefab/shop.prefab +++ b/assets/shop/prefab/shop.prefab @@ -1275,7 +1275,7 @@ "ctor": "Float64Array", "array": [ 15, - 150, + 160, 0, 0, 0, @@ -1971,7 +1971,7 @@ "ctor": "Float64Array", "array": [ 20, - 150, + 160, 0, 0, 0, @@ -2667,7 +2667,7 @@ "ctor": "Float64Array", "array": [ 15, - 150, + 160, 0, 0, 0, @@ -3363,7 +3363,7 @@ "ctor": "Float64Array", "array": [ 18, - 150, + 165, 0, 0, 0, @@ -4059,7 +4059,7 @@ "ctor": "Float64Array", "array": [ 14, - 150, + 165, 0, 0, 0, @@ -4755,7 +4755,7 @@ "ctor": "Float64Array", "array": [ 21, - 150, + 165, 0, 0, 0,