体力扣除逻辑

This commit is contained in:
YZ\249929363 2025-07-08 10:37:17 +08:00
parent 6a07a4f30d
commit 0fe42d5322
6 changed files with 42 additions and 35 deletions

View File

@ -232,6 +232,7 @@ stopHeathTimeCutDown() {
if (this.Stamina && this.Stamina.getChildByName("time")) {
this.Stamina.getChildByName("time").getComponent(cc.Label).string = timeTemp;
}
MiniGameSdk.API.showToast("恢复一点体力");
cc.fx.GameTool.setUserHealth(1, (data) => {
cc.fx.GameTool.getHealth(null);
this.setHealthInfo();

View File

@ -217,6 +217,8 @@ export default class MapConroler extends cc.Component {
startUpdate() {
if (this.gameStart == false) {
this.gameStart = true;
cc.fx.GameTool.setUserHealth(-1, (data) => {
})
this.count_Time = Date.now();
//发送数数事件——进入关卡
console.log("准备进入下一关,发送下一关进入");
@ -1345,7 +1347,9 @@ export default class MapConroler extends cc.Component {
if (this.blockNum == 0 && !this.gameWin && !this.gameOver) {
// alert("游戏成功");
this.gameWin = true;
console.log("恢复一点体力")
cc.fx.GameTool.setUserHealth(1, (data) => {
})
this.stopTimeCutDown();
// console.log("即将上报成功________________________:",this.add_Time);
// console.log("成功消除一个",this.add_Time);
@ -1547,10 +1551,11 @@ export default class MapConroler extends cc.Component {
result: "fail"
}
cc.fx.GameTool.shushu_Track("finish_stage", data);
if (this.gameStart == true) {
cc.fx.GameTool.setUserHealth(-1, (data) => {
})
}
// if (this.gameStart == true) {
// cc.fx.GameTool.setUserHealth(-1, (data) => {
// })
// }
// this.node.parent.parent.parent.destroy();
}

View File

@ -192,8 +192,8 @@ export default class SceneManager extends cc.Component {
this.closePause();
if (MapConroler._instance.gameStart == true) {
MiniGameSdk.API.showToast("体力值减少");
cc.fx.GameTool.setUserHealth(-1, (data) => {
})
// cc.fx.GameTool.setUserHealth(-1, (data) => {
// })
if (MapConroler._instance.count_Time) {
let overTime = Date.now();
let count_Time = overTime - MapConroler._instance.count_Time;

View File

@ -8,8 +8,8 @@
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1997,
"height": 251,
"width": 504,
"height": 1053,
"platformSettings": {},
"subMetas": {}
}

View File

@ -8,8 +8,8 @@
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1833,
"height": 791,
"width": 1831,
"height": 826,
"platformSettings": {},
"subMetas": {}
}

View File

@ -131,6 +131,7 @@ export default class NewClass extends cc.Component {
if (this.Stamina && this.Stamina.getChildByName("time")) {
this.Stamina.getChildByName("time").getComponent(cc.Label).string = timeTemp;
}
MiniGameSdk.API.showToast("恢复一点滴点体力");
cc.fx.GameTool.setUserHealth(1, (data) => {
cc.fx.GameTool.getHealth(null);
this.setHealthInfo();