体力扣除逻辑
This commit is contained in:
parent
6a07a4f30d
commit
0fe42d5322
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 1997,
|
||||
"height": 251,
|
||||
"width": 504,
|
||||
"height": 1053,
|
||||
"platformSettings": {},
|
||||
"subMetas": {}
|
||||
}
|
|
@ -8,8 +8,8 @@
|
|||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 1833,
|
||||
"height": 791,
|
||||
"width": 1831,
|
||||
"height": 826,
|
||||
"platformSettings": {},
|
||||
"subMetas": {}
|
||||
}
|
|
@ -101,7 +101,7 @@ export default class NewClass extends cc.Component {
|
|||
}
|
||||
|
||||
|
||||
setHealthInfo() {
|
||||
setHealthInfo() {
|
||||
if (cc.fx.GameConfig.GM_INFO.hp >= 5) {
|
||||
this.Stamina.getChildByName("man").active = true;
|
||||
this.Stamina.getChildByName("health").active = true;
|
||||
|
@ -122,31 +122,32 @@ export default class NewClass extends cc.Component {
|
|||
}
|
||||
|
||||
startTimeCutDown() {
|
||||
this.scheduleCallback = function () {
|
||||
if (this.pause) return;
|
||||
if (cc.fx.GameConfig.GM_INFO.min_Time <= 0) {
|
||||
this.stopTimeCutDown();
|
||||
var timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
|
||||
// 同步显示
|
||||
if (this.Stamina && this.Stamina.getChildByName("time")) {
|
||||
this.Stamina.getChildByName("time").getComponent(cc.Label).string = timeTemp;
|
||||
this.scheduleCallback = function () {
|
||||
if (this.pause) return;
|
||||
if (cc.fx.GameConfig.GM_INFO.min_Time <= 0) {
|
||||
this.stopTimeCutDown();
|
||||
var timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
|
||||
// 同步显示
|
||||
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();
|
||||
})
|
||||
}
|
||||
cc.fx.GameTool.setUserHealth(1, (data) => {
|
||||
cc.fx.GameTool.getHealth(null);
|
||||
this.setHealthInfo();
|
||||
})
|
||||
}
|
||||
else {
|
||||
cc.fx.GameConfig.GM_INFO.min_Time -= 1;
|
||||
var timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
|
||||
// 同步显示
|
||||
if (this.Stamina && this.Stamina.getChildByName("time")) {
|
||||
this.Stamina.getChildByName("time").getComponent(cc.Label).string = timeTemp;
|
||||
else {
|
||||
cc.fx.GameConfig.GM_INFO.min_Time -= 1;
|
||||
var timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
|
||||
// 同步显示
|
||||
if (this.Stamina && this.Stamina.getChildByName("time")) {
|
||||
this.Stamina.getChildByName("time").getComponent(cc.Label).string = timeTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}.bind(this);
|
||||
this.schedule(this.scheduleCallback, 1);
|
||||
}
|
||||
}.bind(this);
|
||||
this.schedule(this.scheduleCallback, 1);
|
||||
}
|
||||
|
||||
// 停止倒计时
|
||||
stopTimeCutDown() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user