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
}
],
"_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

View File

@ -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,6 +286,8 @@ stopHeathTimeCutDown() {
}
if (this.node.getChildByName("Load").getChildByName("startBtn").getComponent("btnControl")._touch) {
this.node.getChildByName("Load").getChildByName("startBtn").getComponent("btnControl").setTouch(false);
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());
@ -287,6 +300,13 @@ stopHeathTimeCutDown() {
cc.fx.GameConfig.LEVEL_INFO_init(true, 1000);
}
}
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);
cc.fx.GameConfig.LEVEL_INFO_init(true, 1000);
}
}

View File

@ -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);//设置公共事件属性
}
}

View File

@ -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 = {

View File

@ -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,