From 94b52d3151790f4bae094efc9ed0a6d00d6b5a86 Mon Sep 17 00:00:00 2001 From: "COMPUTER\\EDY" <249929363@qq.com> Date: Tue, 17 Mar 2026 15:02:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B3=A8=E5=86=8C=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/GameManager.ts | 28 +++++++++++------------ assets/Script/Map.ts | 33 ++++++++++++++++++--------- assets/Script/Sdk/MiniGameSdk.ts | 5 ++-- assets/Script/Wall.ts | 2 -- assets/Script/module/Tool/GameTool.ts | 12 ++++++++++ 5 files changed, 50 insertions(+), 30 deletions(-) diff --git a/assets/Script/GameManager.ts b/assets/Script/GameManager.ts index cff7e0b..ac358a0 100644 --- a/assets/Script/GameManager.ts +++ b/assets/Script/GameManager.ts @@ -46,6 +46,7 @@ export default class GameManager extends cc.Component { load4: boolean = false; load5: boolean = false; load6: boolean = false; + register_time: number = 0; scheduleCallback: any; timeNumber: number; nowTime: number; @@ -56,6 +57,7 @@ export default class GameManager extends cc.Component { onLoad() { window.initMgr(); + this.register_time = 0; this.timeNumber = 2; // cc.director.preloadScene("HomeScene", (err, asset) => { // }); @@ -269,21 +271,14 @@ export default class GameManager extends cc.Component { cc.fx.GameConfig.GM_INFO.useravaterkuang = data.data.useravatarIcon; cc.fx.GameConfig.GM_INFO.useravaterkuang = "kuang_" + (parseInt(cc.fx.GameConfig.GM_INFO.useravaterkuang) + 1); } - if (data.data.register_time) { - const timestamp2 = Date.now(); + this.register_time = data.data.register_time; + console.log("注册时间:", data.data.register_time); cc.fx.GameConfig.GM_INFO.firstTime = data.data.register_time; - console.log("注册时间:", cc.fx.GameConfig.GM_INFO.firstTime); - if (data.register_time) { - console.log("是否是服务器中的新用户", data.isFirst, "发送setOnce"); - let time = data.register_time; - if (time == undefined || time == null) { - time = timestamp2; - } - else { - MiniGameSdk.API.shushu_userSet(time); - } - } + + } else { + let time = Date.now(); + this.register_time = time; } if (data.data.task) { @@ -504,6 +499,7 @@ export default class GameManager extends cc.Component { this.setFirstInfo(); } + //无论是不是新用户,以防新用户第一次退出了 没有isFirst但是没发送setonce注册,统一走一遍 this.load3 = true; @@ -671,14 +667,15 @@ export default class GameManager extends cc.Component { //第一次进游戏用户处理信息 setFirstInfo() { - // console.log("————————发送注册事件"); + const time = cc.fx.GameTool.formatDate(new Date()); let data = { register_time: time, // 注册时间 } - // console.log("注册时间:", time); + cc.fx.GameTool.shushu_Track("register", data); MiniGameSdk.API.shushu_SetSuperProperties(time, false); + } /** 主循环,判断是否各项加载完成进入游戏 */ update(dt) { @@ -687,6 +684,7 @@ export default class GameManager extends cc.Component { MiniGameSdk.API.shushu_Login(); MiniGameSdk.API.yinli_Init(); MiniGameSdk.API.yinli_Login(); + if (this.register_time != 0) MiniGameSdk.API.shushu_userSet(this.register_time); this.startGame(); } } diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index e2d9cff..04bf9af 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -821,7 +821,7 @@ export default class MapConroler extends cc.Component { this.addMoveFloor(); }, delayTime); } - console.log("创建完成", this.change_Block); + // console.log("创建完成", this.change_Block); if (this.change_Block == true) { setTimeout(() => { this.addChangeBlock(); @@ -2255,6 +2255,14 @@ export default class MapConroler extends cc.Component { } } + changeColorWall() { + for (let i = 0; i < this.wallArray.length; i++) { + if (this.wallArray[i].getComponent("Wall").colorArray.length > 0) { + this.wallArray[i].getComponent("Wall").changeColorWall(); + } + } + } + //检测方块和门中间有没有夹杂其他块 detectingBlock(direction, posX, posY, blocks) { let jg = true; @@ -3004,29 +3012,29 @@ export default class MapConroler extends cc.Component { if (blockInfo.floorMove != undefined) { if (blockInfo.floorMove == true) { if (this.teamBlocks.length == 0) { - console.log("放入一个移动地板块1"); + this.teamBlocks.push(this.blocks2[i]); this.blocks2[i].getComponent("Block").setTeamBlocks(this.teamBlocks); if (i == (this.blocks2.length - 1)) { - console.log("结束1"); + // console.log("结束1"); this.removeFloor(true); } } else { if (blockInfo.floor == this.teamBlocks[0].getComponent("Block").block_Info.floor) { this.teamBlocks.push(this.blocks2[i]); - console.log("放入一个移动地板块2"); + // console.log("放入一个移动地板块2"); this.blocks2[i].getComponent("Block").setTeamBlocks(this.teamBlocks); if (i == (this.blocks2.length - 1)) { - console.log("结束2"); + // console.log("结束2"); this.removeFloor(true); } } else { - console.log("结束3") + // console.log("结束3") this.removeFloor(false); this.teamBlocks.push(this.blocks2[i]); this.blocks2[i].getComponent("Block").setTeamBlocks(this.teamBlocks); if (i == (this.blocks2.length - 1)) { - console.log("结束4"); + // console.log("结束4"); this.removeFloor(true); } } @@ -3034,21 +3042,21 @@ export default class MapConroler extends cc.Component { } else { if (i == (this.blocks2.length - 1)) { - console.log("结束5"); + // console.log("结束5"); this.removeFloor(true); } } } else { if (i == (this.blocks2.length - 1)) { - console.log("结束6"); + // console.log("结束6"); this.removeFloor(true); } } } else { if (i == (this.blocks2.length - 1)) { - console.log("结束7"); + // console.log("结束7"); this.removeFloor(true); } } @@ -3057,7 +3065,7 @@ export default class MapConroler extends cc.Component { } removeFloor(type) { - console.log("结束__________"); + // console.log("结束__________"); if (type == true) { this.blocks2 = []; } @@ -3269,6 +3277,7 @@ export default class MapConroler extends cc.Component { this.changeLongAndShortWall();//改变长短门以及长短变色门 this.changeBlockLock(); //改变开关方块 this.changeBlockColor(null);//改变变色块 + this.changeColorWall(); } else if (data.type == "revolving") { this.changeLockWall(); @@ -3277,6 +3286,7 @@ export default class MapConroler extends cc.Component { this.changeLongAndShortWall(); this.changeBlockLock(); this.changeBlockColor(null);//改变变色块 + this.changeColorWall(); } else if (data.type == "longAndShort") { this.changeLockWall(); @@ -3285,6 +3295,7 @@ export default class MapConroler extends cc.Component { this.changeLongAndShortWall(); this.changeBlockLock(); this.changeBlockColor(null);//改变变色块 + this.changeColorWall(); } } diff --git a/assets/Script/Sdk/MiniGameSdk.ts b/assets/Script/Sdk/MiniGameSdk.ts index d3f49fc..b0c9281 100644 --- a/assets/Script/Sdk/MiniGameSdk.ts +++ b/assets/Script/Sdk/MiniGameSdk.ts @@ -1590,7 +1590,7 @@ export namespace MiniGameSdk { static shushu_userSet(time) { //@ts-ignore if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) { - // console.log("设置用户注册属性"); + console.log("_______________设置用户注册属性", time); API._ta.userSet({ register_time: time }); API._ta.userSetOnce({ uid: cc.fx.GameConfig.GM_INFO.userId.toString() }); } @@ -1600,7 +1600,7 @@ export namespace MiniGameSdk { //@ts-ignore if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) { // console.log("上传金币和关卡信息给数数") - API._ta.userSet({ current_level: (cc.fx.GameConfig.GM_INFO.level + 1) }); + API._ta.userSet({ current_level: (cc.fx.GameConfig.GM_INFO.level) }); API._ta.userSet({ current_coin: cc.fx.GameConfig.GM_INFO.coin }); API._ta.userSet({ uid: cc.fx.GameConfig.GM_INFO.userId }); } @@ -1638,6 +1638,7 @@ export namespace MiniGameSdk { user_id: cc.fx.GameConfig.GM_INFO.userId, //用户id pay_user: pay_user }; + } if (pay_user != null && pay_user != false) { // console.log("设置用户公共属性支付:————————————", pay_user); diff --git a/assets/Script/Wall.ts b/assets/Script/Wall.ts index e7bdd30..8129e3d 100644 --- a/assets/Script/Wall.ts +++ b/assets/Script/Wall.ts @@ -717,7 +717,6 @@ export default class Wall extends cc.Component { if (this.colorArray.length <= 2) { for (let i = 0; i < this.colorStartArray.length; i++) { this.colorArray.push(this.colorStartArray[i]); - console.log("将颜色放入数组:", this.colorStartArray[i]) } } } @@ -808,7 +807,6 @@ export default class Wall extends cc.Component { if (this.colorArray.length <= 2) { for (let i = 0; i < this.colorStartArray.length; i++) { this.colorArray.push(this.colorStartArray[i]); - // console.log("将颜色放入数组:", this.colorStartArray[i]) } } if (type == true) this.updateColor(); diff --git a/assets/Script/module/Tool/GameTool.ts b/assets/Script/module/Tool/GameTool.ts index e208da8..f6179d5 100644 --- a/assets/Script/module/Tool/GameTool.ts +++ b/assets/Script/module/Tool/GameTool.ts @@ -1247,6 +1247,18 @@ var GameTool = { return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`; }, + formatDate2(date: Date | number): string { + const d = typeof date === 'number' ? new Date(date) : date; + const year = d.getFullYear(); + const month = String(d.getMonth() + 1).padStart(2, '0'); + const day = String(d.getDate()).padStart(2, '0'); + const hours = String(d.getHours()).padStart(2, '0'); + const minutes = String(d.getMinutes()).padStart(2, '0'); + const seconds = String(d.getSeconds()).padStart(2, '0'); + + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; + }, + //获取时间戳 getTime() { const timestamp = (new Date().getTime())