Compare commits

...

2 Commits

Author SHA1 Message Date
YZ\249929363 6c88048986 Merge branch 'main' of https://git.sparkus.cn/yangzhao/cb 2025-07-04 11:07:59 +08:00
YZ\249929363 ca63e97f30 增加数数SDK,修正区分测试服和正式服判定 2025-07-04 11:07:49 +08:00
5 changed files with 56 additions and 23 deletions

View File

@ -586,7 +586,7 @@
"__id__": 18 "__id__": 18
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 21 "__id__": 21
@ -3041,7 +3041,7 @@
"__id__": 7 "__id__": 7
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 64 "__id__": 64
@ -3137,7 +3137,7 @@
"__id__": 7 "__id__": 7
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 66 "__id__": 66

View File

@ -65,7 +65,13 @@ private heathScheduleCallback: Function = null;
// console.log("加载关卡配置2"); // console.log("加载关卡配置2");
// window.initMgr(); // window.initMgr();
GameManager._instance.Block_Color = this.Block_Color; 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 预制体 // 预加载 shop 预制体
if (!JiaZai.cachedShopPrefab) { if (!JiaZai.cachedShopPrefab) {
cc.assetManager.loadBundle('shop', (err: Error, bundle: cc.AssetManager.Bundle) => { 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); console.log("————————准备注册事件", cc.fx.GameConfig.GM_INFO.openid);
if (cc.fx.GameConfig.GM_INFO.openid != "") { if (cc.fx.GameConfig.GM_INFO.openid != "") {
console.log("————————发送注册事件"); 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); cc.fx.AudioManager._instance.playEffect("zhuan1", null);
this.node.getChildByName("zhuanchang").active = true; this.node.getChildByName("zhuanchang").active = true;
@ -275,12 +286,21 @@ stopHeathTimeCutDown() {
} }
if (this.node.getChildByName("Load").getChildByName("startBtn").getComponent("btnControl")._touch) { if (this.node.getChildByName("Load").getChildByName("startBtn").getComponent("btnControl")._touch) {
this.node.getChildByName("Load").getChildByName("startBtn").getComponent("btnControl").setTouch(false); this.node.getChildByName("Load").getChildByName("startBtn").getComponent("btnControl").setTouch(false);
if(this.custom.string != ""){ let version = cc.fx.GameTool.getWechatGameVersion();
cc.fx.GameConfig.GM_INFO.level = parseInt(this.custom.string) - 1; if(version == "开发版" || version == "体验版"){
// cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString()); if(this.custom.string != ""){
cc.fx.GameConfig.LEVEL_INFO_init(true); 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); cc.fx.AudioManager._instance.playEffect("zhuan1", null);
this.node.getChildByName("zhuanchang").active = true; this.node.getChildByName("zhuanchang").active = true;
this.node.getChildByName("zhuanchang").getComponent(sp.Skeleton).setAnimation(1, "up", false); this.node.getChildByName("zhuanchang").getComponent(sp.Skeleton).setAnimation(1, "up", false);

View File

@ -1137,7 +1137,7 @@ export namespace MiniGameSdk {
API._ta.login(cc.fx.GameConfig.GM_INFO.openid); API._ta.login(cc.fx.GameConfig.GM_INFO.openid);
const result = "success"; const result = "success";
API.shushu_Track("login", result); 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) { if (typeof wx !== 'undefined' && wx !== null && API._ta) {
const versionData = "1.3"; const versionData = "1.3";
// API._ta.userSetOnce({ register_time:time}); // API._ta.userSetOnce({ register_time:time});
var superProperties = { var superProperties = {};
superProperties = {
current_level: (cc.fx.GameConfig.GM_INFO.level + 1), //当前关卡等级 number current_level: (cc.fx.GameConfig.GM_INFO.level + 1), //当前关卡等级 number
current_health: cc.fx.GameConfig.GM_INFO.hp, //当前体力值 current_health: cc.fx.GameConfig.GM_INFO.hp, //当前体力值
tmp_coin: cc.fx.GameConfig.GM_INFO.coin,//当前金币 tmp_coin: cc.fx.GameConfig.GM_INFO.coin,//当前金币
version: versionData 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);//设置公共事件属性 API._ta.setSuperProperties(superProperties);//设置公共事件属性
} }
} }

View File

@ -353,7 +353,7 @@ var GameTool = {
result:"success" result:"success"
} }
cc.fx.GameTool.shushu_Track("finish_stage",data); cc.fx.GameTool.shushu_Track("finish_stage",data);
MiniGameSdk.API.shushu_SetSuperProperties(); MiniGameSdk.API.shushu_SetSuperProperties(null);
} }
cc.fx.GameTool.setUserLevel((data)=>{ cc.fx.GameTool.setUserLevel((data)=>{
@ -382,7 +382,7 @@ var GameTool = {
coin: cc.fx.GameConfig.GM_INFO.coin, coin: cc.fx.GameConfig.GM_INFO.coin,
timestamp: timestamp, timestamp: timestamp,
} }
MiniGameSdk.API.shushu_SetSuperProperties(); MiniGameSdk.API.shushu_SetSuperProperties(null);
cc.fx.StorageMessage.setStorage("coin", coinInfo); cc.fx.StorageMessage.setStorage("coin", coinInfo);
// console.log("存储金币数据:",cc.fx.GameConfig.GM_INFO.coin,coinInfo); // console.log("存储金币数据:",cc.fx.GameConfig.GM_INFO.coin,coinInfo);
cc.fx.GameTool.setUserCoin((data) => { cc.fx.GameTool.setUserCoin((data) => {
@ -494,7 +494,7 @@ var GameTool = {
"health":cc.fx.GameConfig.GM_INFO.hp, "health":cc.fx.GameConfig.GM_INFO.hp,
"timestamp":data.result.timestamp "timestamp":data.result.timestamp
} }
MiniGameSdk.API.shushu_SetSuperProperties(); MiniGameSdk.API.shushu_SetSuperProperties(null);
cc.fx.StorageMessage.setStorage("health",healthInfo); cc.fx.StorageMessage.setStorage("health",healthInfo);
} }
else if(data.result.code == 404 && data.result.message == "未找到体力数据"){ else if(data.result.code == 404 && data.result.message == "未找到体力数据"){
@ -588,7 +588,7 @@ var GameTool = {
} }
} }
cc.fx.StorageMessage.setStorage("health",healthInfo); cc.fx.StorageMessage.setStorage("health",healthInfo);
MiniGameSdk.API.shushu_SetSuperProperties(); MiniGameSdk.API.shushu_SetSuperProperties(null);
//@ts-ignore //@ts-ignore
if (typeof wx!== 'undefined' && wx!== null) { if (typeof wx!== 'undefined' && wx!== null) {
//@ts-ignore //@ts-ignore
@ -887,6 +887,9 @@ var GameTool = {
let eventData = {} let eventData = {}
switch(name){ switch(name){
case "register": case "register":
eventData = {
register_time: data.register_time,
}
break; break;
case "enter_stage": case "enter_stage":
eventData = { eventData = {

View File

@ -1275,7 +1275,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
15, 15,
150, 160,
0, 0,
0, 0,
0, 0,
@ -1971,7 +1971,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
20, 20,
150, 160,
0, 0,
0, 0,
0, 0,
@ -2667,7 +2667,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
15, 15,
150, 160,
0, 0,
0, 0,
0, 0,
@ -3363,7 +3363,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
18, 18,
150, 165,
0, 0,
0, 0,
0, 0,
@ -4059,7 +4059,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
14, 14,
150, 165,
0, 0,
0, 0,
0, 0,
@ -4755,7 +4755,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
21, 21,
150, 165,
0, 0,
0, 0,
0, 0,