diff --git a/assets/Script/GameManager.ts b/assets/Script/GameManager.ts index ecee71d..f627199 100644 --- a/assets/Script/GameManager.ts +++ b/assets/Script/GameManager.ts @@ -259,7 +259,7 @@ export default class GameManager extends cc.Component { } this.setUserPower(data); this.setmonth(data); - + this.setRevive(data) let levelInfo = cc.fx.StorageMessage.getStorage("level"); //旧的读取数据设置数据方法,以强联网为主 if (levelInfo == undefined || levelInfo == "" || levelInfo == null) { @@ -340,7 +340,7 @@ export default class GameManager extends cc.Component { //laf云函数 Utils.getUserData((data) => { - this.setRevive(data) + }) } else { @@ -728,7 +728,7 @@ export default class GameManager extends cc.Component { //laf云函数 Utils.getUserData((data) => { - this.setRevive(data) + }) } @@ -836,9 +836,16 @@ export default class GameManager extends cc.Component { } //复活购买次数初始化 setRevive(data) { - console.log(data.data.rebornGiftCount, "🔥🔥🔥🔥🔥🔥🔥🔥") - cc.fx.GameConfig.GM_INFO.revive = data.data.rebornGiftCount; + + if (data.data.rebornGiftCount == undefined) { + cc.fx.GameConfig.GM_INFO.revive = 0; + } else { + cc.fx.GameConfig.GM_INFO.revive = data.data.rebornGiftCount; + } + console.log(data.data.rebornGiftCount, cc.fx.GameConfig.GM_INFO.revive, "🔥🔥🔥🔥🔥🔥🔥🔥") } + + update(dt) { //console.log("加载1:", this.load1, "加载2:", this.load2, "加载3:", this.load3, "加载4:", this.load4, "加载5:", this.load5, "加载6:", this.load6, "时间:", this.timeNumber); if (this.load1 && this.load2 && this.load3 && this.load4 && this.load5 && this.load6 == true && this.timeNumber <= 0) { diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index df2f50c..5c165a5 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -141,7 +141,7 @@ export default class MapConroler extends cc.Component { lastMagicTime: number; //上次使用魔法的时间 wall_Pass: any; //可通过门的数组 arr: any; - + isreview: boolean = false // mapInfo: number[][] = []; @@ -181,7 +181,7 @@ export default class MapConroler extends cc.Component { this.count_Time = 0; this.add_Time = 0; this.arr = []; // 初始化结算界面动画数组 - + this.isreview = false; //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(); @@ -325,6 +325,10 @@ export default class MapConroler extends cc.Component { } startUpdate() { + if (this.revive) { + this.startTimeCutDown(); + this.isreview = false; + } if (this.gameStart == false) { this.gameStart = true; let power = cc.fx.GameTool.getUserPowerTime(); @@ -1732,6 +1736,7 @@ export default class MapConroler extends cc.Component { //执行复活函数 runRewive(data) { console.log("复活回调函数内", data); + this.isreview = true; cc.fx.GameTool.changeCoin(data.coin); const dataTemp = { change_reason: "游戏内复活消耗金币", @@ -1764,7 +1769,7 @@ export default class MapConroler extends cc.Component { this.timeNumber = 21; this.add_Time += 20; } - + NumberToImage.getTimeMargin(20, 50, "time_", this.timeLabel) this.blockNum = this.blocks.length; if (this.blockNum == 0) this.nextLevel(); @@ -1773,9 +1778,29 @@ export default class MapConroler extends cc.Component { this.reviewState = false; }, 200); this.stopTimeCutDown(); - this.startTimeCutDown(); + // this.startTimeCutDown(); } + //执行复活函数 + runRewiveCopy() { + this.isreview = true; + console.log("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") + MiniGameSdk.API.showToast("继续游戏"); + this.gameOver = false; + this.gameWin = false; + this.pause = false; + this.timeNumber = 21; + this.add_Time += 20; + NumberToImage.getTimeMargin(20, 50, "time_", this.timeLabel) + this.blockNum = this.blocks.length; + if (this.blockNum == 0) this.nextLevel(); + this.node.parent.parent.getChildByName("Lose").active = false; + setTimeout(() => { + this.reviewState = false; + }, 200); + this.stopTimeCutDown(); + // this.startTimeCutDown(); + } homeBtn() { @@ -1801,6 +1826,7 @@ export default class MapConroler extends cc.Component { } if (cc.fx.GameConfig.GM_INFO.revive == 0 && this.revive) { this.revive.getComponent(Revive).offShow(); + this.node.active = false; } cc.fx.GameTool.shushu_Track("finish_stage", data); } @@ -1873,6 +1899,7 @@ export default class MapConroler extends cc.Component { setTimeout(() => { this.node.parent.parent.getChildByName("Lose").active = true; this.node.parent.parent.getChildByName("Lose").getChildByName("Time").active = true; + this.revive.getComponent(Revive).init(); this.node.parent.parent.getChildByName("Lose").getChildByName("Boom").active = false; if (type) { if (type == "time") { diff --git a/assets/Script/Revive.ts b/assets/Script/Revive.ts index 64d125d..4871791 100644 --- a/assets/Script/Revive.ts +++ b/assets/Script/Revive.ts @@ -138,13 +138,16 @@ export default class Revive extends cc.Component { } } init() { + console.log() this.btn_Touch = true; - + if (cc.fx.GameConfig.GM_INFO.revive == 1) { + this.node.active = false; + } } //购买 buyGift() { - Utils.rebornGift(0, (data) => { + Utils.rebornGift(1, (data) => { console.log("购买'✅ ", data.code); if (data.code == 1) { MapConroler._instance.setPropNum(); @@ -164,6 +167,11 @@ export default class Revive extends cc.Component { shopComp.openShop(); } } + cc.fx.GameConfig.GM_INFO.revive = 1; + setTimeout(() => { + this.node.active = false; + }, 200); + MapConroler._instance.runRewiveCopy(); } }) // update (dt) {} @@ -176,7 +184,7 @@ export default class Revive extends cc.Component { return; } this.btn_Touch = false; - const productId = customData; + const productId = "reborn_Gift"; let id = "10011"; let price = 100; let count = 1; diff --git a/assets/Script/module/Tool/GameTool.ts b/assets/Script/module/Tool/GameTool.ts index 995242f..508b3a6 100644 --- a/assets/Script/module/Tool/GameTool.ts +++ b/assets/Script/module/Tool/GameTool.ts @@ -1095,7 +1095,7 @@ var GameTool = { case "reborn_Gift": cc.fx.GameTool.changeCoin(1000); coin = 1000; - price = 500; + price = 600; rewardData = [ { type: "coin", count: coin }, { type: "freeze", count: 1 }, diff --git a/assets/shop/img/Revive.plist b/assets/shop/img/Revive.plist index 4d58d15..ecd2ac1 100644 --- a/assets/shop/img/Revive.plist +++ b/assets/shop/img/Revive.plist @@ -108,7 +108,7 @@ size {956,517} smartupdate - $TexturePacker:SmartUpdate:f859f5f556d19ca1eb4a54fe66eb76f1:5d4e0bb5271032a10e97ef4da52806e2:4bc5e2af1b5c2e21a2f402a6d1605d1c$ + $TexturePacker:SmartUpdate:b9e2c1358b9daff3ac16be709c7b2d30:2130556b444cc2f963b7d072eb04e04a:4bc5e2af1b5c2e21a2f402a6d1605d1c$ textureFileName Revive.png diff --git a/assets/shop/img/Revive.png b/assets/shop/img/Revive.png index 0292678..4f2b965 100644 Binary files a/assets/shop/img/Revive.png and b/assets/shop/img/Revive.png differ