refactor: 移除调试日志并统一使用日志工具

- 删除多个文件中的 console.log/console.warn/console.error 调试输出
- 将日志输出统一替换为 mLogger 工具,支持调试模式控制
- 清理注释掉的调试代码和空方法体
This commit is contained in:
panw
2026-02-03 16:49:24 +08:00
parent dc746e28da
commit 3a8f015a78
21 changed files with 65 additions and 80 deletions

View File

@@ -11,6 +11,7 @@ import { TalEffet, TriType } from "../common/config/TalSet";
import { BoxSet, FacSet } from "../common/config/GameSet";
import { GameConst } from "../common/config/GameConst";
import { Attrs } from "../common/config/HeroAttrs";
import { mLogger } from "../common/Logger";
/**
* ==================== 自动施法系统 ====================
@@ -29,6 +30,7 @@ import { Attrs } from "../common/config/HeroAttrs";
*/
@ecs.register('SACastSystem')
export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
debugMode: boolean = false; // 是否启用调试模式
filter(): ecs.IMatcher {
return ecs.allOf(HeroSkillsComp, HeroAttrsComp, HeroViewComp);
@@ -155,7 +157,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
const heroAttrs=casterEntity.get(HeroAttrsComp)
const config = SkillSet[s_uuid];
if (!config) {
console.error("[SACastSystem] 技能配置不存在:", s_uuid);
mLogger.error(this.debugMode, 'SACastSystem', "[SACastSystem] 技能配置不存在:", s_uuid);
return false;
}
@@ -182,7 +184,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
// 获取目标位置(伤害技能)
let targets = this.sTargets(heroView, s_uuid);
if (targets.length === 0) {
console.warn("[SACastSystem] 没有找到有效目标");
mLogger.warn(this.debugMode, 'SACastSystem', "[SACastSystem] 没有找到有效目标");
return false;
}
// 2.1 普通攻击逻辑
@@ -243,14 +245,14 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],ext_dmg:number=0) {
// 检查节点有效性
if (!caster.node || !caster.node.isValid) {
console.warn("[SACastSystem] 施法者节点无效");
mLogger.warn(this.debugMode, 'SACastSystem', "[SACastSystem] 施法者节点无效");
return;
}
// 获取场景节点
const parent = caster.node.parent;
if (!parent) {
console.warn("[SACastSystem] 场景节点无效");
mLogger.warn(this.debugMode, 'SACastSystem', "[SACastSystem] 场景节点无效");
return;
}
@@ -263,7 +265,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
const startPos = caster.node.position.clone();
const targetPos = targets[0]; // 使用第一个目标位置
// console.log(`[SACastSystem]: ${s_uuid}, 起始位置: ${startPos}, 目标位置: ${targetPos}`);
// mLogger.log(this.debugMode, 'SACastSystem', `[SACastSystem]: ${s_uuid}, 起始位置: ${startPos}, 目标位置: ${targetPos}`);
// 加载技能实体(包括预制体、组件初始化等)
skill.load(startPos, parent, s_uuid, targetPos, caster,ext_dmg);
@@ -440,7 +442,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
// 检查概率
if (buffConf.chance >= 1 || Math.random() < buffConf.chance) {
targetAttrs.addBuff(buffConf);
console.log(`[SACastSystem] Buff生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, Buff类型=${buffConf.buff}, 值=${buffConf.value}`);
mLogger.log(this.debugMode, 'SACastSystem', `[SACastSystem] Buff生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, Buff类型=${buffConf.buff}, 值=${buffConf.value}`);
}
}
}
@@ -508,7 +510,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
targetAttrs.add_hp(healAmount, true);
targetView.health(healAmount);
console.log(`[SACastSystem] 治疗生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, 治疗量=${healAmount}`);
mLogger.log(this.debugMode, 'SACastSystem', `[SACastSystem] 治疗生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, 治疗量=${healAmount}`);
}
}, delay);
@@ -537,7 +539,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
targetAttrs.add_shield(shieldAmount, true);
targetView.add_shield(shieldAmount);
console.log(`[SACastSystem] 护盾生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, 护盾量=${shieldAmount}`);
mLogger.log(this.debugMode, 'SACastSystem', `[SACastSystem] 护盾生效: 施法者=${casterEntity.get(HeroAttrsComp)?.hero_name}, 技能=${config.name}, 目标=${targetAttrs.hero_name}, 护盾量=${shieldAmount}`);
}
}, delay);