更新体力

This commit is contained in:
COMPUTER\EDY 2025-10-13 14:44:06 +08:00
parent 7848545253
commit ae8bee6838
7 changed files with 79 additions and 37 deletions

View File

@ -673,6 +673,7 @@ export default class Block extends cc.Component {
MapConroler._instance.node.parent.getChildByName("Bottom").getChildByName("destroyBtn").getComponent("btnControl").setTouch(true);
MapConroler._instance.costHammer();
MapConroler._instance.usePause();
MapConroler._instance.node.parent.getChildByName("Mask").active = false;
return false;
}
if (this.type != BlockType. && this.type != BlockType.) {

View File

@ -542,7 +542,7 @@ export default class GameManager extends cc.Component {
cc.fx.GameConfig.GM_INFO.hp_Max = 7;
cc.fx.GameConfig.GM_INFO.doubleCoin = 2;
} else {
cc.fx.GameConfig.GM_INFO.hp_Max = 5;
cc.fx.GameConfig.GM_INFO.hp_Max = 3;
cc.fx.GameConfig.GM_INFO.doubleCoin = 1;
}
//本地储存当前服务器时间

View File

@ -472,16 +472,18 @@ export default class JiaZai extends cc.Component {
if (cc.fx.GameConfig.GM_INFO.min_Time <= 0) {
this.stopHeathTimeCutDown();
let timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
let timeTemp = cc.fx.GameTool.getTimeMargin2(cc.fx.GameConfig.GM_INFO.min_Time);
//console.log("健康值倒计时结束,当前时间:", timeTemp, cc.fx.GameConfig.GM_INFO.min_Time);
if (timeLabelNode) {
NumberToImage.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time, 50, "month_", timeLabelNode);
timeLabelNode.getComponent(cc.Label).string = timeTemp;
// NumberToImage.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time, 50, "month_", timeLabelNode);
}
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hp, 40, 20, "month_", this.heath, true);
} else {
let timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
let timeTemp = cc.fx.GameTool.getTimeMargin2(cc.fx.GameConfig.GM_INFO.min_Time);
if (timeLabelNode) {
NumberToImage.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time, 50, "month_", timeLabelNode);
timeLabelNode.getComponent(cc.Label).string = timeTemp;
// NumberToImage.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time, 50, "month_", timeLabelNode);
}
}
}.bind(this);
@ -501,7 +503,7 @@ export default class JiaZai extends cc.Component {
this.scheduleCallback = function () {
if (cc.fx.GameConfig.GM_INFO.min_Time <= 0) {
this.stopTimeCutDown();
var timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
var timeTemp = cc.fx.GameTool.getTimeMargin2(cc.fx.GameConfig.GM_INFO.min_Time);
// 同步显示
if (this.Stamina && this.Stamina.getChildByName("time")) {
this.Stamina.getChildByName("time").getComponent(cc.Label).string = timeTemp;
@ -518,7 +520,7 @@ export default class JiaZai extends cc.Component {
}
else {
cc.fx.GameConfig.GM_INFO.min_Time -= 1;
var timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
var timeTemp = cc.fx.GameTool.getTimeMargin2(cc.fx.GameConfig.GM_INFO.min_Time);
// 同步显示
if (this.Stamina && this.Stamina.getChildByName("time")) {
let power = cc.fx.GameTool.getUserPowerTime();
@ -635,7 +637,7 @@ export default class JiaZai extends cc.Component {
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hp, 25, 15, "hp_", this.Stamina.getChildByName("health"), false);
this.Stamina.getChildByName("time").active = true;
if (cc.fx.GameConfig.GM_INFO.min_Time != 0) {
let time = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
let time = cc.fx.GameTool.getTimeMargin2(cc.fx.GameConfig.GM_INFO.min_Time);
this.Stamina.getChildByName("time").getComponent(cc.Label).string = time;
let power = cc.fx.GameTool.getUserPowerTime();
if (!power) this.Stamina.getChildByName("time").opacity = 255;

View File

@ -2662,6 +2662,7 @@ export default class MapConroler extends cc.Component {
else {
if (!this.hammer) {
this.hammerMask.active = true;
this.node.parent.getChildByName("Mask").active = true;
this.hammer = true;
this.ishammer = true;
this.stopBoom();
@ -3826,6 +3827,7 @@ export default class MapConroler extends cc.Component {
if (!this.hammer) {
const timestamp = Date.now();
this.hammerMask.active = true;
this.node.parent.getChildByName("Mask").active = true;
this.hammer = true;
this.ishammer = true;
//// this.winStreakBtn.node.active = false;

View File

@ -226,7 +226,7 @@ export class GameConfig {
this.GM_INFO = {
// isEnd: false,
mean_Time: 0, //平均放箭速度
hp: 5, //体力值
hp: 3, //体力值
review: 0, //复活次数
reviewBoom: 0, //炸弹复活次数
reviewDoor: 0, //门复活次数
@ -272,7 +272,7 @@ export class GameConfig {
hammerFirst: false, //锤子道具第一次
magicAFirst: false, //魔法棒道具第一次
winStreakFirst: false, //每次第一次连胜
hp_Max: 5, //体力最大值
hp_Max: 3, //体力最大值
doubleCoin: 1, //是否双倍
// monthTime: 0, //月卡时间
// revive: 0, //复活礼包购买次数

View File

@ -524,7 +524,7 @@ var GameTool = {
}
else if (health.health < cc.fx.GameConfig.GM_INFO.hp_Max) {
// 30分钟的毫秒数
const thirtyMinutes = 30 * 60 * 1000;
const thirtyMinutes = 240 * 60 * 1000;
const elapsedTime = timestamp - health.timestamp;
// 计算恢复的体力值
const recoveredHealth = Math.min(cc.fx.GameConfig.GM_INFO.hp_Max - health.health, Math.floor(elapsedTime / thirtyMinutes));
@ -1149,13 +1149,13 @@ var GameTool = {
cc.fx.GameConfig.GM_INFO.doubleCoin = 2;
return true;
} else {
cc.fx.GameConfig.GM_INFO.hp_Max = 5;
cc.fx.GameConfig.GM_INFO.hp_Max = 3;
cc.fx.GameConfig.GM_INFO.doubleCoin = 1;
return false;
}
} else {
cc.fx.GameConfig.GM_INFO.hp_Max = 5;
cc.fx.GameConfig.GM_INFO.hp_Max = 3;
cc.fx.GameConfig.GM_INFO.doubleCoin = 1;
cc.fx.StorageMessage.setStorage("mCardDate", 0);
return false;

View File

@ -27,14 +27,14 @@
"_active": true,
"_components": [
{
"__id__": 69
"__id__": 70
},
{
"__id__": 70
"__id__": 71
}
],
"_prefab": {
"__id__": 71
"__id__": 72
},
"_opacity": 255,
"_color": {
@ -251,7 +251,7 @@
"_active": true,
"_components": [],
"_prefab": {
"__id__": 68
"__id__": 69
},
"_opacity": 255,
"_color": {
@ -636,16 +636,16 @@
"__id__": 53
},
{
"__id__": 61
"__id__": 62
},
{
"__id__": 64
"__id__": 65
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 67
"__id__": 68
},
"_opacity": 255,
"_color": {
@ -2047,11 +2047,11 @@
"_active": true,
"_components": [
{
"__id__": 59
"__id__": 60
}
],
"_prefab": {
"__id__": 60
"__id__": 61
},
"_opacity": 255,
"_color": {
@ -2108,7 +2108,7 @@
"__id__": 53
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 55
@ -2218,22 +2218,26 @@
},
"_children": [],
"_active": true,
"_components": [],
"_components": [
{
"__id__": 58
}
],
"_prefab": {
"__id__": 58
"__id__": 59
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"r": 142,
"g": 88,
"b": 42,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 50.4
"height": 75.6
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -2244,8 +2248,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-400.572,
0,
-295.355,
-1,
0,
0,
0,
@ -2269,6 +2273,39 @@
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 57
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "",
"_N$string": "",
"_fontSize": 60,
"_lineHeight": 60,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 1,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
@ -2336,11 +2373,11 @@
"_active": false,
"_components": [
{
"__id__": 62
"__id__": 63
}
],
"_prefab": {
"__id__": 63
"__id__": 64
},
"_opacity": 255,
"_color": {
@ -2394,7 +2431,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 61
"__id__": 62
},
"_enabled": true,
"_materials": [
@ -2445,11 +2482,11 @@
"_active": true,
"_components": [
{
"__id__": 65
"__id__": 66
}
],
"_prefab": {
"__id__": 66
"__id__": 67
},
"_opacity": 255,
"_color": {
@ -2503,7 +2540,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 64
"__id__": 65
},
"_enabled": true,
"_materials": [