diff --git a/assets/Scene/GameScene.fire b/assets/Scene/GameScene.fire index 5675af1..5c7534c 100644 --- a/assets/Scene/GameScene.fire +++ b/assets/Scene/GameScene.fire @@ -363,10 +363,10 @@ "__id__": 1219 }, { - "__id__": 291 + "__id__": 501 }, { - "__id__": 501 + "__id__": 291 }, { "__id__": 207 @@ -24286,8 +24286,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 1010, - "height": 337 + "width": 1009, + "height": 332 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -26588,8 +26588,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 114, - "height": 114 + "width": 112, + "height": 112 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -27868,7 +27868,7 @@ "component": "", "_componentId": "2234assp7RIvpDgrnqljp2R", "handler": "homeBtn", - "customEventData": "" + "customEventData": "time" }, { "__type__": "cc.Node", @@ -29921,8 +29921,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 516, - "height": 516 + "width": 514, + "height": 514 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -31919,7 +31919,7 @@ "component": "", "_componentId": "2234assp7RIvpDgrnqljp2R", "handler": "homeBtn", - "customEventData": "" + "customEventData": "lock" }, { "__type__": "cc.Node", @@ -34890,7 +34890,7 @@ "component": "", "_componentId": "2234assp7RIvpDgrnqljp2R", "handler": "homeBtn", - "customEventData": "" + "customEventData": "Revolving" }, { "__type__": "cc.Node", @@ -37861,7 +37861,7 @@ "component": "", "_componentId": "2234assp7RIvpDgrnqljp2R", "handler": "homeBtn", - "customEventData": "" + "customEventData": "LongAndShort" }, { "__type__": "cc.Node", @@ -40832,7 +40832,7 @@ "component": "", "_componentId": "2234assp7RIvpDgrnqljp2R", "handler": "homeBtn", - "customEventData": "" + "customEventData": "LongAndShortColor" }, { "__type__": "cc.Node", @@ -43803,7 +43803,7 @@ "component": "", "_componentId": "2234assp7RIvpDgrnqljp2R", "handler": "homeBtn", - "customEventData": "" + "customEventData": "BlockLock" }, { "__type__": "cc.Node", @@ -44968,8 +44968,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 412, - "height": 111 + "width": 408, + "height": 108 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -46774,7 +46774,7 @@ "component": "", "_componentId": "2234assp7RIvpDgrnqljp2R", "handler": "homeBtn", - "customEventData": "" + "customEventData": "Wall" }, { "__type__": "cc.Node", @@ -47860,8 +47860,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 114, - "height": 114 + "width": 112, + "height": 112 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -48375,8 +48375,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 114, - "height": 114 + "width": 112, + "height": 112 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -49732,8 +49732,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 114, - "height": 114 + "width": 112, + "height": 112 }, "_anchorPoint": { "__type__": "cc.Vec2", diff --git a/assets/Scene/HomeScene.fire b/assets/Scene/HomeScene.fire index c8c465d..b9aeb36 100644 --- a/assets/Scene/HomeScene.fire +++ b/assets/Scene/HomeScene.fire @@ -2501,7 +2501,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 92, - "height": 88 + "height": 86 }, "_anchorPoint": { "__type__": "cc.Vec2", diff --git a/assets/Script/Block.ts b/assets/Script/Block.ts index 6ab85e6..ba6135f 100644 --- a/assets/Script/Block.ts +++ b/assets/Script/Block.ts @@ -1415,13 +1415,14 @@ export default class Block extends cc.Component { MapConroler._instance.blockLock == true || MapConroler._instance.change_colorBlock == true || MapConroler._instance.jump_state != null) && !MapConroler._instance.gameOver && !MapConroler._instance.gameWin) { + console.log("!!!!!!!!!准备判死啦"); let gameover = MapConroler._instance.predict_End(true); if (gameover == false) { MapConroler._instance.failReason(); } } } - }, 500); + }, 1200); }, time * 1000); @@ -2262,7 +2263,7 @@ export default class Block extends cc.Component { } } } - }, 500); + }, 900); //如果是锤子状态消除 MapConroler._instance.ishammer = false; diff --git a/assets/Script/GameManager.ts b/assets/Script/GameManager.ts index ac358a0..c175392 100644 --- a/assets/Script/GameManager.ts +++ b/assets/Script/GameManager.ts @@ -295,14 +295,16 @@ export default class GameManager extends cc.Component { cc.fx.GameConfig.GM_INFO.address = data.data.address; } this.checkDailyQuests(); + console.log("服务器强制刷新状态__________", data.data.forcedUpdate); //如果有连胜记录,就赋值 if (data.data.winStreak) { console.log("从服务器得到连胜", data.data.winStreak); cc.fx.GameConfig.GM_INFO.winStreak = parseInt(data.data.winStreak); let winState = cc.fx.StorageMessage.getStorage("winState"); console.log("本地连胜状态", winState); - if ((winState == null || winState == undefined) && winState != false) { - console.log("没有缓存进入这里"); + let noCache = (winState == null || winState == undefined) && winState != false; + if (data.data.forcedUpdate === true || noCache) { + console.log("没有缓存进入这里 || 或者强制刷新"); cc.fx.GameConfig.GM_INFO.winState = false; if (cc.fx.GameConfig.GM_INFO.winStreak >= 10) { cc.fx.GameConfig.GM_INFO.winState = true; @@ -310,6 +312,7 @@ export default class GameManager extends cc.Component { cc.fx.StorageMessage.setStorage("winState", cc.fx.GameConfig.GM_INFO.winState); } else { + console.log("以本地为主"); cc.fx.GameConfig.GM_INFO.winState = winState; console.log("连胜状态:", cc.fx.GameConfig.GM_INFO.winState); if (winState == false) { @@ -325,6 +328,7 @@ export default class GameManager extends cc.Component { } cc.fx.StorageMessage.setStorage("winStreak", cc.fx.GameConfig.GM_INFO.winStreak); } + //服务器没有连胜记录,以本地为主 else { let winStreak = cc.fx.StorageMessage.getStorage("winStreak"); if (winStreak == undefined || winStreak == "" || winStreak == null) { @@ -428,9 +432,21 @@ export default class GameManager extends cc.Component { cc.fx.GameConfig.GM_INFO.magicAmount = propInfo.magicAmount; const timestamp = Date.now(); if (coinInfo.coin != data.coinAmount) { - if (coinInfo == undefined || coinInfo.coin == null) { + if ((coinInfo == undefined || coinInfo.coin == null) || data.forcedUpdate === true) { + console.log("没有缓存进入这里 || 或者强制刷新", data.forcedUpdate); + cc.fx.GameConfig.GM_INFO.coin = data.coinAmount; let coinInfo = { "coin": cc.fx.GameConfig.GM_INFO.coin, "timestamp": timestamp }; cc.fx.StorageMessage.setStorage("coin", coinInfo); + cc.fx.GameConfig.GM_INFO.freezeAmount = data.freezeAmount; + cc.fx.GameConfig.GM_INFO.hammerAmount = data.hammerAmount; + cc.fx.GameConfig.GM_INFO.magicAmount = data.magicAmount; + let propInfo = { + "freezeAmount": data.freezeAmount, + "hammerAmount": data.hammerAmount, + "magicAmount": data.magicAmount, + "timestamp": timestamp, + } + cc.fx.StorageMessage.setStorage("prop", propInfo); } else { cc.fx.GameTool.setUserCoin((data) => { @@ -439,7 +455,8 @@ export default class GameManager extends cc.Component { } if (levelInfo.level != data.levelAmount) { - if (levelInfo.level == null || levelInfo == undefined) { + if ((levelInfo.level == null || levelInfo == undefined)) { + cc.fx.GameConfig.GM_INFO.level = data.levelAmount; let levelInfo = { "level": cc.fx.GameConfig.GM_INFO.level, "timestamp": timestamp }; cc.fx.StorageMessage.setStorage("level", levelInfo); } diff --git a/assets/Script/JiaZai.ts b/assets/Script/JiaZai.ts index 337d661..5ba8fae 100644 --- a/assets/Script/JiaZai.ts +++ b/assets/Script/JiaZai.ts @@ -2983,9 +2983,22 @@ export default class JiaZai extends cc.Component { entry_point: btnName, // 按钮名称 } cc.fx.GameTool.shushu_Track("interface_exposure", dataInfo); - + this.openLoad(); var passCheck = null; + let loadClosed = false; + let closeLoadTimer = setTimeout(() => { + if (!loadClosed) { + loadClosed = true; + MiniGameSdk.API.showToast("网络异常,获取通行证失败,请稍后重试"); + console.log("getPassCheckInfo 超时,强制关闭加载"); + this.closeLoad(); + } + }, 5000); Utils.getPassCheckInfo((data) => { + if (loadClosed) return; + loadClosed = true; + clearTimeout(closeLoadTimer); + this.closeLoad(); passCheck = data.data.passCheck; if (typeof passCheck === 'string') { @@ -3215,11 +3228,12 @@ export default class JiaZai extends cc.Component { // 判断是否已经记录过playerPassLevel,如果没有并且当前等级大于等于21级,则记录 if (currentLevel >= 21) { cc.fx.GameConfig.GM_INFO.playerPassLevel = currentLevel; - + let top = this.node.getChildByName("Load").getChildByName("Top"); + top.getChildByName("passBtn").active = true; let self = this; Utils.getPassCheckInfo((data) => { if (data.code == 1) { - let top = self.node.getChildByName("Load").getChildByName("Top"); + // let top = self.node.getChildByName("Load").getChildByName("Top"); if (data.data.time == null) { top.getChildByName("passBtn").active = false; } else { @@ -3229,7 +3243,6 @@ export default class JiaZai extends cc.Component { let now = new Date().getTime(); // console.log("服务器时间", serverTime, now); if (now < serverTime) { - top.getChildByName("passBtn").active = false; } else { top.getChildByName("passBtn").active = true; diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index 7b7989f..3642ed9 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -20,6 +20,7 @@ const { ccclass, property } = cc._decorator; @ccclass export default class MapConroler extends cc.Component { private MAX_RETRY_COUNT = 6; // 最大重试次数 + private _blocksEmptyTime: number | null = null; // 保底机制计时 static _instance: any; @property(cc.SpriteAtlas) fontUI: cc.SpriteAtlas = null; @@ -3143,6 +3144,7 @@ export default class MapConroler extends cc.Component { if (this.blockNum == 0 && !this.gameWin && !this.gameOver) { console.log("获胜了成功了!!!!!!") this.gameWin = true; + this.gameStart = false; // alert("游戏成功"); Utils.getCityRank((res) => { if (res.code === 1) { @@ -3163,6 +3165,8 @@ export default class MapConroler extends cc.Component { } } }, cc.fx.GameConfig.GM_INFO.address); + + if (cc.fx.GameConfig.GM_INFO.otherLevel == 0) { if (cc.fx.GameConfig.GM_INFO.tasks.levelPass.value < cc.fx.GameConfig.GM_INFO.tasks.levelPass.target) { cc.fx.GameConfig.GM_INFO.tasks.levelPass.value += 1; @@ -3186,7 +3190,7 @@ export default class MapConroler extends cc.Component { } } - this.setOtherLevel(); + else this.setOtherLevel(); if (cc.fx.GameConfig.GM_INFO.hp < cc.fx.GameConfig.GM_INFO.hp_Max) { console.log("恢复一点体力", cc.fx.GameConfig.GM_INFO.level); @@ -3262,20 +3266,10 @@ export default class MapConroler extends cc.Component { } } }); - const winCOIN = cc.find("Canvas"); // 假设 Canvas 节点 - if (winCOIN) { - const wincoin = winCOIN.getComponent(SceneManager); - if (wincoin) { - wincoin.updateWinCoin(); - } else { - console.log("JiaZai 组件未找到"); - } - } else { - console.log("JiaZai 节点未找到"); - } - this.check_NewMode(); + setTimeout(() => { this.node.parent.parent.getChildByName("Win").active = true; + this.node.parent.parent.getChildByName("Lose").active = false; // 记录通行证关卡 if (cc.fx.GameConfig.GM_INFO.level >= 21) { this.setPassProgress(); @@ -3297,6 +3291,19 @@ export default class MapConroler extends cc.Component { } }, 660); // console.log("游戏成功"); + + const winCOIN = cc.find("Canvas"); // 假设 Canvas 节点 + if (winCOIN) { + const wincoin = winCOIN.getComponent(SceneManager); + if (wincoin) { + wincoin.updateWinCoin(); + } else { + console.log("JiaZai 组件未找到"); + } + } else { + console.log("JiaZai 节点未找到"); + } + this.check_NewMode(); } else { if (this.gameOver == true) { @@ -3675,6 +3682,7 @@ export default class MapConroler extends cc.Component { } if (!this.againCanTouch) return; + this.gameStart = false; this.againCanTouch = false; // MapConroler._instance = null; @@ -3702,7 +3710,9 @@ export default class MapConroler extends cc.Component { //时间到了复活 reviewLevel(event, type) { + console.log("进入复活函数"); if (this.reviewState == true) { + console.log("在复活中,不可点击"); return; } this.reviewState = true; @@ -3737,10 +3747,8 @@ export default class MapConroler extends cc.Component { // console.log("自身金币:",cc.fx.GameConfig.GM_INFO.coin,"消耗金币:",coin); if (cc.fx.GameConfig.GM_INFO.coin < Math.abs(coin)) { MiniGameSdk.API.showToast("金币不足,无法加时间"); - setTimeout(() => { - this.openShop(); - this.reviewState = false; - }, 500); + this.openShop(); + this.reviewState = false; return; } @@ -3748,7 +3756,7 @@ export default class MapConroler extends cc.Component { this.isreview = true; cc.fx.GameTool.changeCoin(data.coin); const dataTemp = { - change_reason: "游戏内复活消耗金币", + change_reason: "游戏内复活消耗金币,复活原因:" + type + "游戏剩余时长:" + this.timeNumber, id: (1001 + ""), num: data.coin } @@ -3787,12 +3795,19 @@ export default class MapConroler extends cc.Component { //执行复活函数 runRewive(data) { - console.log("____________执行几次"); + console.log("____________ 执行几次"); this.runReviveAndCheck(data, 0, (success) => { if (!success) { - this.runMagic(); + this.runMagic(true); console.log("_____________复活失败后,使用魔法棒") setTimeout(() => { + console.log("魔法棒执行完毕后:", this.blocks.length, this.gameOver, this.gameWin); + if (this.blocks.length == 0) { + console.log("_____________魔法棒消除后游戏胜利,不再执行复活"); + this.gameOver = false; + this.nextLevel(1); + return; + } console.log("_____________复活失败后,使用魔法棒,重新复活"); this.runRewive(data); }, 1500); @@ -3842,12 +3857,13 @@ export default class MapConroler extends cc.Component { NumberToImage.getTimeMargi3(20, 45, "company_", this.timeLabel) } - this.blockNum = this.blocks.length; - if (this.blockNum == 0) this.nextLevel(1); + this.node.parent.parent.getChildByName("Lose").active = false; setTimeout(() => { this.reviewState = false; + this.blockNum = this.blocks.length; + if (this.blockNum == 0) this.nextLevel(1); }, 200); this.stopTimeCutDown(); }); @@ -3913,7 +3929,7 @@ export default class MapConroler extends cc.Component { } //上传数数游戏完成事件 可成功可失败 - trackFinishi(name) { + trackFinishi(name, customEventData) { let overTime = Date.now(); this.count_Time = overTime - this.count_Time; @@ -3925,7 +3941,7 @@ export default class MapConroler extends cc.Component { time: this.count_Time, add_Time: this.add_Time, is_frenzy: this.is_frenzy, - result: name, + result: name + "reason: " + customEventData, infinity: endLevel, } @@ -3943,7 +3959,11 @@ export default class MapConroler extends cc.Component { // 4. 处理结算界面显示 // 5. 返回HomeScene场景 // ============================================ - homeBtn() { + homeBtn(event, customEventData) { + if (this.reviewState == true) { + console.log("在复活中,不可点击"); + return; + } this.powerState = cc.fx.GameTool.getUserPowerTime(); // if (this.powerState) { // 之前直接返回homeScene // this.returnHome(null, false); @@ -3962,7 +3982,7 @@ export default class MapConroler extends cc.Component { this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Health").active = false; this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("WinStreak").active = false; - this.trackFinishi("fail"); + this.trackFinishi("fail", customEventData); if (cc.fx.GameConfig.GM_INFO.otherLevel == 0) { let data2 = { is_frenzy: this.is_frenzy, @@ -4056,7 +4076,7 @@ export default class MapConroler extends cc.Component { cc.fx.GameConfig.LEVEL_INFO_init(false, 0, false); if (cc.fx.GameConfig.GM_INFO.otherLevel == 0 && customEventData == false) { cc.fx.GameTool.setWinStreak("fail"); - MapConroler._instance.trackFinishi("give_up"); + MapConroler._instance.trackFinishi("give_up", "customEventData"); } if (this.new_mode == 3) { this.node.parent.parent.getChildByName("Win").active = false; @@ -4132,7 +4152,7 @@ export default class MapConroler extends cc.Component { if (this.blockNum == 0) { this.gameOver = false; this.gameWin = false; - this.nextLevel(0); + this.nextLevel(1); return; } else if (blockOld != this.blockNum && type != "boom" && type != "time") { @@ -4981,13 +5001,13 @@ export default class MapConroler extends cc.Component { } cc.fx.GameTool.shushu_Track("resource_cost", data); } - this.runMagic(); + this.runMagic(false); } } } //使用魔法棒随机消除两个方块 - runMagic() { + runMagic(type) { let magicBtn = this.node.parent.getChildByName("Bottom").getChildByName("magicBtn"); const timestamp = Date.now(); @@ -5410,6 +5430,13 @@ export default class MapConroler extends cc.Component { setTimeout(() => { if (this.freezeArray.length == 0 && this.lockArray.length == 0 && this.lockArray2.length == 0) { // console.log("只剩下一个块道具使用完毕"); + //强行复活时候,消除任何块 + if (type == true) { + if (this.blocks.length > 0) { + let random = Math.floor(Math.random() * this.blocks.length); + this.blocks[random].getComponent("Block").eliminate(false); + } + } } else { if (this.lockArray.length != 0) { @@ -5456,17 +5483,26 @@ export default class MapConroler extends cc.Component { } setTimeout(() => { - if (count != 0) { - console.log("没有普通快,魔法消除一个冻结块"); - for (let i = 0; i < this.freezeArray.length; i++) { - // console.log("没有普通快,魔法消除一个冻结块"); - // this.freezeArray[i].getComponent("Block").eliminate(); - count -= 1; - if (count == 0) { - break; - } + // if (count != 0 && this.freezeArray.length != 0) { + // console.log("没有普通快,魔法消除一个冻结块"); + // for (let i = 0; i < this.freezeArray.length; i++) { + // // console.log("没有普通快,魔法消除一个冻结块"); + // // this.freezeArray[i].getComponent("Block").eliminate(); + // count -= 1; + // if (count == 0) { + // break; + // } + // } + // } + + if (type == true && count != 0) { + console.log("所有可消除的块都消除了,没办法了", this.blocks.length); + if (this.blocks.length > 0) { + let random = Math.floor(Math.random() * this.blocks.length); + this.blocks[random].getComponent("Block").eliminate(true); } } + }, 100); } @@ -6653,5 +6689,32 @@ export default class MapConroler extends cc.Component { if (this.hitSoundCount > 0 && this.hitSoundTime && Date.now() - this.hitSoundTime > 3000) { this.hitSoundCount = 0; } + + if (this.blocks.length == 0 && !this.gameWin && this.gameStart == true) { + if (!this._blocksEmptyTime) { + this._blocksEmptyTime = Date.now(); + } + if (Date.now() - this._blocksEmptyTime >= 3000) { + console.log("保底机制:blocks为空超过2.5秒,强制胜利"); + let errorData = { + error_type: "javascript", + error_message: "胜利保底机制触发,方块全部消除且超过3秒,强制胜利。", + error_scene: 'null', + error_stack: '', + game_version: cc.fx.GameConfig.GM_INFO?.version || 'unknown', + user_id: cc.fx.GameConfig.GM_INFO?.userId || 'unknown', + level: cc.fx.GameConfig.GM_INFO?.level || 0, + timestamp: Date.now(), + coin: cc.fx.GameConfig.GM_INFO?.coin || 0 + }; + MiniGameSdk.API.shushu_Track('error', errorData); + this.gameWin = true; + this.gameStart = false; + this.nextLevel(1); + } + } + else { + this._blocksEmptyTime = null; + } } } diff --git a/assets/Script/Wall.ts b/assets/Script/Wall.ts index 440c5ff..4382026 100644 --- a/assets/Script/Wall.ts +++ b/assets/Script/Wall.ts @@ -1196,7 +1196,7 @@ export default class Wall extends cc.Component { //更新变色门颜色 updateColor() { this.color = this.colorArray[0]; - // console.log("改變顏色", this.color); + console.log("改變顏色", this.color); let direction = this.node.parent.name; let double = 0; if (direction == "left" || direction == "right") { @@ -1233,7 +1233,7 @@ export default class Wall extends cc.Component { //变色门删除颜色, 第一个参数为颜色,第二个参数为是否立刻刷新颜色, 第三个参数为是否删除起始颜色 removeColor(color, type) { - // console.log("整体删除颜色"); + console.log("整体删除颜色"); if (this.colorStartArray.length > 1) { let index = this.colorStartArray.indexOf(color); if (index !== -1) { diff --git a/assets/resources/prefab/block/block4.prefab b/assets/resources/prefab/block/block4.prefab index c2acf54..a3a1516 100644 --- a/assets/resources/prefab/block/block4.prefab +++ b/assets/resources/prefab/block/block4.prefab @@ -1484,9 +1484,6 @@ "magic_SkeletonData": { "__uuid__": "d0f588ae-3378-45a1-b3eb-9fab8e7bd03b" }, - "simple_SpriteFrame": { - "__uuid__": "9c34b08e-57a6-4f76-8a74-8095c9efa25a" - }, "_id": "" }, {