diff --git a/assets/Scene/GameScene.fire b/assets/Scene/GameScene.fire index 67a8565..1b95e1f 100644 --- a/assets/Scene/GameScene.fire +++ b/assets/Scene/GameScene.fire @@ -964,15 +964,9 @@ "mask": { "__id__": 80 }, - "iceLabel": { - "__id__": 76 - }, - "hammerLabel": { - "__id__": 27 - }, - "magicLabel": { - "__id__": 44 - }, + "iceLabel": null, + "hammerLabel": null, + "magicLabel": null, "iceNode": { "__id__": 71 }, diff --git a/assets/Script/Block.ts b/assets/Script/Block.ts index 471e005..e2a1ee2 100644 --- a/assets/Script/Block.ts +++ b/assets/Script/Block.ts @@ -176,7 +176,7 @@ export default class Block extends cc.Component { this.type = block_Info.type; this.color = block_Info.color; this.blockId = block_Info.id; - console.log("方块类型",this.type,"方块颜色",this.color,"方块ID",this.blockId); + //console.log("方块类型",this.type,"方块颜色",this.color,"方块ID",this.blockId); // if(posX&&posY){ // this.posX = posX; // this.posY = posY; @@ -518,7 +518,7 @@ export default class Block extends cc.Component { this.block_Info.node = null; } else if(this.type == BlockType.炸弹块){ - this.node.getChildByName("boom").getComponent("Boom").stopBoom(); + this.node.getChildByName("boom").getComponent("Boom").destroyBoom(); } @@ -757,7 +757,7 @@ export default class Block extends cc.Component { self.block_Info.node.getComponent("Block").posY,false); } else if(self.type == BlockType.炸弹块){ - this.node.getChildByName("boom").getComponent("Boom").stopBoom(); + this.node.getChildByName("boom").getComponent("Boom").destroyBoom(); } MapConroler._instance.nextLevel(); diff --git a/assets/Script/JiaZai.ts b/assets/Script/JiaZai.ts index 5739c3c..9186d80 100644 --- a/assets/Script/JiaZai.ts +++ b/assets/Script/JiaZai.ts @@ -72,6 +72,9 @@ private heathScheduleCallback: Function = null; else if(version == "正式版"){ this.node.getChildByName("Load").getChildByName("New EditBox").active = false } + else{ + this.node.getChildByName("Load").getChildByName("New EditBox").active = true; + } // 预加载 shop 预制体 if (!JiaZai.cachedShopPrefab) { cc.assetManager.loadBundle('shop', (err: Error, bundle: cc.AssetManager.Bundle) => { @@ -307,10 +310,17 @@ stopHeathTimeCutDown() { cc.fx.GameConfig.LEVEL_INFO_init(true, 1000); } 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); + 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); + } } } diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index 83ecdcf..b5f8a39 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -152,9 +152,9 @@ export default class MapConroler extends cc.Component { this.add_Time = 0; - this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString(); - this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString(); - this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString(); + //this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString(); + // this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString(); + // this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString(); this.setPropNum(); // cc.game.addPersistRootNode(this.node); MapConroler._instance = this; @@ -183,22 +183,28 @@ export default class MapConroler extends cc.Component { //如果道具数量大于0,显示 cc.fx.GameConfig.GM_INFO.freezeAmount,如果为零显示'mul10' if(cc.fx.GameConfig.GM_INFO.freezeAmount > 0) { + this.iceNode.children[0].active = false; this.iceNode.children[1].active = true; NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.freezeAmount, 35, 15, "mul", this.iceNode.children[1], true); } else { this.iceNode.children[0].active = true + this.iceNode.children[1].active = false; } if(cc.fx.GameConfig.GM_INFO.hammerAmount > 0) { this.hammerNode.children[1].active = true; + this.hammerNode.children[0].active = false; NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hammerAmount, 35, 15, "mul", this.hammerNode.children[1], true); } else { - this.hammerNode.children[0].active = true + this.hammerNode.children[0].active = true; + this.hammerNode.children[1].active = false; } if(cc.fx.GameConfig.GM_INFO.magicAmount > 0) { this.magicNode.children[1].active = true; + this.magicNode.children[0].active = false; NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.magicAmount, 35, 15, "mul", this.magicNode.children[1], true); } else { this.magicNode.children[0].active = true + this.magicNode.children[1].active = false; } } @@ -209,12 +215,6 @@ export default class MapConroler extends cc.Component { console.log("准备进入下一关,发送下一关进入"); cc.fx.GameTool.shushu_Track("enter_stage"); this.startTimeCutDown(); - for (let i = 0; i < this.blocks.length; i++) { - if (this.blocks[i].getComponent("Block").type == 6) { - this.blocks[i].getChildByName("boom").getComponent("Boom").startBoom(); - } - } - } } @@ -1480,7 +1480,7 @@ export default class MapConroler extends cc.Component { console.log("复活回调函数内", data); cc.fx.GameTool.changeCoin(data); MiniGameSdk.API.showToast("继续游戏"); - + NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); if (cc.fx.GameConfig.GM_INFO.review < 2) cc.fx.GameConfig.GM_INFO.review += 1; @@ -1631,6 +1631,7 @@ export default class MapConroler extends cc.Component { //开始倒计时 startTimeCutDown() { + this.startBoom(); this.scheduleCallback = function () { if (this.pause) return; if (this.timeNumber <= 0) { @@ -1683,7 +1684,7 @@ export default class MapConroler extends cc.Component { if (!this.node.parent.getChildByName("Ice").active && !this.pause) { const timestamp = Date.now(); this.freezeMask.active = true; - + this.stopBoom(); this.pause = true; this.node.parent.getChildByName("Ice").active = true; // this.node.parent.getChildByName("Top").getChildByName("Ice").active = true; @@ -1691,7 +1692,8 @@ export default class MapConroler extends cc.Component { cc.fx.GameConfig.GM_INFO.freezeAmount -= 1; if (cc.fx.GameConfig.GM_INFO.freezeAmount < 0) cc.fx.GameConfig.GM_INFO.freezeAmount = 0; - this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString(); + this.setPropNum(); + // this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString(); let propInfo = cc.fx.StorageMessage.getStorage("prop"); propInfo.freezeAmount = cc.fx.GameConfig.GM_INFO.freezeAmount; propInfo.timestamp = timestamp; @@ -1720,12 +1722,15 @@ export default class MapConroler extends cc.Component { this.node.parent.getChildByName("Ice").active = false; // this.node.parent.getChildByName("Top").getChildByName("Ice").active = false; this.pause = false; + this.startBoom(); // this.startTimeCutDown(); } } handleBuySuccess(data) { + NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); this.pause = false; + this.startBoom(); const timestamp = Date.now(); // console.log("回调函数内:",this.pause); let freezeBtn = this.node.parent.getChildByName("Bottom").getChildByName("timeBtn"); @@ -1742,7 +1747,8 @@ export default class MapConroler extends cc.Component { cc.fx.StorageMessage.setStorage("prop", propInfo); this.node.parent.parent.parent.getComponent("SceneManager").closePropBuy(); setTimeout(() => { - this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString(); + this.setPropNum(); + // this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString(); MiniGameSdk.API.showToast("购买冻结时间道具成功"); }, 200); @@ -1757,7 +1763,8 @@ export default class MapConroler extends cc.Component { this.node.parent.parent.parent.getComponent("SceneManager").closePropBuy(); setTimeout(() => { MiniGameSdk.API.showToast("购买锤子道具成功"); - this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString(); + this.setPropNum(); + // this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString(); }, 200); } @@ -1769,7 +1776,8 @@ export default class MapConroler extends cc.Component { cc.fx.StorageMessage.setStorage("prop", propInfo); this.node.parent.parent.parent.getComponent("SceneManager").closePropBuy(); setTimeout(() => { - this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString(); + this.setPropNum(); + // this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString(); MiniGameSdk.API.showToast("购买魔法棒道具成功"); }, 200); @@ -1810,7 +1818,8 @@ export default class MapConroler extends cc.Component { cc.fx.GameConfig.GM_INFO.hammerAmount -= 1; if (cc.fx.GameConfig.GM_INFO.hammerAmount < 0) cc.fx.GameConfig.GM_INFO.hammerAmount = 0; - this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString(); + this.setPropNum(); + // this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString(); let propInfo = cc.fx.StorageMessage.getStorage("prop"); console.log("锤子道具信息:", propInfo); propInfo.hammerAmount = cc.fx.GameConfig.GM_INFO.hammerAmount; @@ -1912,7 +1921,8 @@ export default class MapConroler extends cc.Component { cc.fx.GameConfig.GM_INFO.magicAmount -= 1; if (cc.fx.GameConfig.GM_INFO.magicAmount < 0) cc.fx.GameConfig.GM_INFO.magicAmount = 0; - this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString(); + this.setPropNum(); + // this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString(); let propInfo = cc.fx.StorageMessage.getStorage("prop"); propInfo.magicAmount = cc.fx.GameConfig.GM_INFO.magicAmount; propInfo.timestamp = timestamp; @@ -2020,9 +2030,11 @@ export default class MapConroler extends cc.Component { usePause() { if (this.pause) { this.pause = false; + this.startBoom(); } else { this.pause = true; + this.stopBoom(); } } @@ -2090,7 +2102,7 @@ export default class MapConroler extends cc.Component { x = block.x - block.width * 0.33; } else if (block.anchorX == 0.66) { - x = block.x + block.width * 0.66; + x = block.x - block.width * 0.66; } if (jg == 3) { name = "right_" + height + "_" + width; @@ -2134,6 +2146,22 @@ export default class MapConroler extends cc.Component { } } + startBoom(){ + for (let i = 0; i < this.blocks.length; i++) { + if (this.blocks[i].getComponent("Block").type == 6) { + this.blocks[i].getChildByName("boom").getComponent("Boom").startBoom(); + } + } + } + + stopBoom() { + for (let i = 0; i < this.blocks.length; i++) { + if (this.blocks[i].getComponent("Block").type == 6) { + this.blocks[i].getChildByName("boom").getComponent("Boom").stopBoom(); + } + } + } + update(dt) { diff --git a/assets/Script/SceneManager.ts b/assets/Script/SceneManager.ts index bc5df95..c974a97 100644 --- a/assets/Script/SceneManager.ts +++ b/assets/Script/SceneManager.ts @@ -264,6 +264,7 @@ export default class SceneManager extends cc.Component { this.pause.getComponent("btnControl").setTouch(false); this.node.getChildByName("Pause").active = true; MapConroler._instance.pause = true; + MapConroler._instance.stopBoom(); } } @@ -279,11 +280,13 @@ export default class SceneManager extends cc.Component { this.node.getChildByName("Pause").active = false; if (MapConroler._instance.node.parent.getChildByName("Ice").active == false) { MapConroler._instance.pause = false; + MapConroler._instance.startBoom(); } } openPropBuy(name) { MapConroler._instance.pause = true; + MapConroler._instance.stopBoom(); this.btnName = name; let propWindow = this.node.getChildByName("Game").getChildByName("propWindow"); propWindow.active = true; @@ -328,6 +331,7 @@ export default class SceneManager extends cc.Component { closePropBuy() { MapConroler._instance.pause = false; + MapConroler._instance.startBoom(); let freezeBtn = MapConroler._instance.node.parent.getChildByName("Bottom").getChildByName("timeBtn"); let hammerBtn = MapConroler._instance.node.parent.getChildByName("Bottom").getChildByName("destroyBtn"); let magicBtn = MapConroler._instance.node.parent.getChildByName("Bottom").getChildByName("magicBtn"); diff --git a/assets/Script/prop/Boom.ts b/assets/Script/prop/Boom.ts index 76591c0..541b0da 100644 --- a/assets/Script/prop/Boom.ts +++ b/assets/Script/prop/Boom.ts @@ -38,12 +38,17 @@ export default class Boom extends cc.Component { this.schedule(this.updateTime, 1); } - stopBoom(){ + destroyBoom(){ this.unschedule(this.updateTime); this.node.parent.getComponent("Block").resetFreeze(); this.node.destroy(); } + stopBoom(){ + this.unschedule(this.updateTime); + } + + updateTime(){ this.time --; @@ -51,6 +56,7 @@ export default class Boom extends cc.Component { if(this.time <= 0){ this.unschedule(this.updateTime); this.node.getChildByName("zhandan").active = true; + this.node.getChildByName("bg").active = false; const skeleton = this.node.getChildByName("zhandan").getComponent(sp.Skeleton); skeleton.setAnimation(1,"eff",false); // 监听动画完成事件 diff --git a/assets/prefab/prop/boom.prefab b/assets/prefab/prop/boom.prefab index 36f28e6..30e987a 100644 --- a/assets/prefab/prop/boom.prefab +++ b/assets/prefab/prop/boom.prefab @@ -21,20 +21,23 @@ "__id__": 2 }, { - "__id__": 4 + "__id__": 5 + }, + { + "__id__": 7 } ], "_active": true, "_components": [ { - "__id__": 7 + "__id__": 10 }, { - "__id__": 8 + "__id__": 11 } ], "_prefab": { - "__id__": 9 + "__id__": 12 }, "_opacity": 255, "_color": { @@ -83,6 +86,115 @@ "groupIndex": 0, "_id": "" }, + { + "__type__": "cc.Node", + "_name": "bg", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 3 + } + ], + "_prefab": { + "__id__": 4 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 62, + "height": 95 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0.614, + 15.971, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "e22aadda-4f7e-403a-a1e6-d5374fc2862a" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": { + "__uuid__": "d2adfa00-68ea-4d63-97a0-44fca153a2d7" + }, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "4ahWLpW2tD8LfIbT5i2bbo", + "sync": false + }, { "__type__": "cc.Node", "_name": "time", @@ -94,7 +206,7 @@ "_active": false, "_components": [], "_prefab": { - "__id__": 3 + "__id__": 6 }, "_opacity": 255, "_color": { @@ -165,11 +277,11 @@ "_active": false, "_components": [ { - "__id__": 5 + "__id__": 8 } ], "_prefab": { - "__id__": 6 + "__id__": 9 }, "_opacity": 255, "_color": { @@ -223,7 +335,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 4 + "__id__": 7 }, "_enabled": true, "_materials": [ @@ -286,9 +398,7 @@ ], "_srcBlendFactor": 770, "_dstBlendFactor": 771, - "_spriteFrame": { - "__uuid__": "e22aadda-4f7e-403a-a1e6-d5374fc2862a" - }, + "_spriteFrame": null, "_type": 0, "_sizeMode": 1, "_fillType": 0, @@ -300,9 +410,7 @@ "_fillStart": 0, "_fillRange": 0, "_isTrimmedMode": true, - "_atlas": { - "__uuid__": "d2adfa00-68ea-4d63-97a0-44fca153a2d7" - }, + "_atlas": null, "_id": "" }, {