fix: 将调试日志从console.log替换为mLogger并默认关闭调试模式
- 在MissionCardComp中默认关闭调试模式 - 在MissionHomeComp、Mon、HeroAttrsSystem和HInfoComp中引入mLogger - 使用debugMode控制日志输出,避免生产环境产生过多console日志
This commit is contained in:
@@ -5,6 +5,7 @@ import { Attrs } from "../common/config/HeroAttrs";
|
||||
import { HeroUpSet } from "../common/config/heroSet";
|
||||
import { HeroSkillsComp } from "./HeroSkills";
|
||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
import { mLogger } from "../common/Logger";
|
||||
/**
|
||||
* ==================== 英雄属性更新系统 ====================
|
||||
*
|
||||
@@ -44,14 +45,14 @@ export class HeroAttrSystem extends ecs.ComblockSystem
|
||||
const model = e.get(HeroAttrsComp);
|
||||
if (!model) return;
|
||||
|
||||
console.log(`[HeroAttrSystem] 英雄进入系统: ${model.hero_name} (uuid: ${model.hero_uuid})`);
|
||||
mLogger.log(this.debugMode, 'HeroAttrSystem', `[HeroAttrSystem] 英雄进入系统: ${model.hero_name} (uuid: ${model.hero_uuid})`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统首次更新前调用(整个系统只调用一次)
|
||||
*/
|
||||
firstUpdate(): void {
|
||||
console.log("[HeroAttrSystem] 系统首次更新");
|
||||
mLogger.log(this.debugMode, 'HeroAttrSystem', "[HeroAttrSystem] 系统首次更新");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +74,7 @@ export class HeroAttrSystem extends ecs.ComblockSystem
|
||||
|
||||
// 调试日志(可选,调试时启用)
|
||||
if (this.debugMode) {
|
||||
console.log(` [${this.entityCount}] 更新英雄: ${model.hero_name}, HP: ${model.hp.toFixed(2)}`);
|
||||
mLogger.log(this.debugMode, 'HeroAttrSystem', ` [${this.entityCount}] 更新英雄: ${model.hero_name}, HP: ${model.hp.toFixed(2)}`);
|
||||
}
|
||||
|
||||
// 1. 更新临时 Buff/Debuff(时间递减,过期自动移除)
|
||||
@@ -106,7 +107,7 @@ export class HeroAttrSystem extends ecs.ComblockSystem
|
||||
// 每 60 帧输出一次统计
|
||||
this.frameCount++;
|
||||
if (this.frameCount % 60 === 0 && this.entityCount === 1) {
|
||||
console.log(`[HeroAttrSystem] 第 ${this.frameCount} 帧,处理 ${this.entityCount} 个英雄`);
|
||||
mLogger.log(this.debugMode, 'HeroAttrSystem', `[HeroAttrSystem] 第 ${this.frameCount} 帧,处理 ${this.entityCount} 个英雄`);
|
||||
}
|
||||
|
||||
// 注意:显示更新由 HeroViewComp 负责,这里只处理数据
|
||||
|
||||
Reference in New Issue
Block a user