refactor: 移除调试日志并统一使用日志工具
- 删除多个文件中的 console.log/console.warn/console.error 调试输出 - 将日志输出统一替换为 mLogger 工具,支持调试模式控制 - 清理注释掉的调试代码和空方法体
This commit is contained in:
@@ -4,6 +4,7 @@ import { EType, RType, SkillSet } from "../common/config/SkillSet";
|
||||
import { SMoveDataComp } from "./SMoveComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { SkillView } from "./SkillView";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
/**
|
||||
* ==================== 技能移动系统 ====================
|
||||
@@ -21,7 +22,7 @@ import { SkillView } from "./SkillView";
|
||||
*/
|
||||
@ecs.register('SMoveSystem')
|
||||
export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
||||
|
||||
debugMode: boolean = false;
|
||||
filter(): ecs.IMatcher {
|
||||
return ecs.allOf(SMoveDataComp, SkillView);
|
||||
}
|
||||
@@ -35,7 +36,7 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
// 获取技能配置
|
||||
const skillConfig = SkillSet[moveComp.s_uuid];
|
||||
if (!skillConfig) {
|
||||
console.warn(`[SMoveSystem] 技能配置不存在: ${moveComp.s_uuid}`);
|
||||
mLogger.warn(this.debugMode, 'SMoveSystem', `[SMoveSystem] 技能配置不存在: ${moveComp.s_uuid}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
moveComp.startMove();
|
||||
}
|
||||
|
||||
// console.log(`[SMoveSystem] 技能 ${skillConfig.name} 开始移动,类型: ${moveComp.runType}`);
|
||||
mLogger.log(this.debugMode, 'SMoveSystem', `[SMoveSystem] 技能 ${skillConfig.name} 开始移动,类型: ${moveComp.runType}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,10 +9,12 @@ import { SDataCom } from "./SDataCom";
|
||||
import { SMoveDataComp } from "../skill/SMoveComp";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
/** Skill 模块 */
|
||||
@ecs.register(`Skill`)
|
||||
export class Skill extends ecs.Entity {
|
||||
private debugMode: boolean = false;
|
||||
/** 多键对象池:Map<prefabPath, NodePool> */
|
||||
static pools: Map<string, NodePool> = new Map();
|
||||
|
||||
@@ -57,7 +59,7 @@ export class Skill extends ecs.Entity {
|
||||
const config = SkillSet[s_uuid];
|
||||
|
||||
if (!config) {
|
||||
console.error("[Skill] 技能配置不存在:", s_uuid);
|
||||
mLogger.error(this.debugMode, 'Skill', "[Skill] 技能配置不存在:", s_uuid);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,12 +67,10 @@ export class Skill extends ecs.Entity {
|
||||
const path = `game/skill/atk/${config.sp_name}`;
|
||||
const prefab:Prefab = oops.res.get(path, Prefab);
|
||||
if (!prefab) {
|
||||
console.error("[Skill] 预制体加载失败:", path);
|
||||
mLogger.error(this.debugMode, 'Skill', "[Skill] 预制体加载失败:", path);
|
||||
return;
|
||||
}
|
||||
// console.log("load skill startPos",startPos)
|
||||
const node: Node = instantiate(prefab);
|
||||
// console.log("load skill node",node)
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!.getChildByName("SKILL")!;
|
||||
// 设置节点属性
|
||||
|
||||
@@ -50,7 +50,7 @@ export class SkillView extends CCComp {
|
||||
}
|
||||
if(this.node.getComponent(Animation)){
|
||||
let anim = this.node.getComponent(Animation);
|
||||
//console.log("[SkillCom]:has anim",anim)
|
||||
mLogger.log(this.debugMode, 'SkillView', "[SkillCom]:has anim",anim)
|
||||
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||
|
||||
// 对象池复用时,需要手动播放默认动画(因为 Play On Load 只在首次生效)
|
||||
@@ -82,7 +82,7 @@ export class SkillView extends CCComp {
|
||||
return;
|
||||
}
|
||||
let model = targetView.ent.get(HeroAttrsComp);
|
||||
// console.log(`[skillView] 碰撞3`, oCol.group, seCol.group, model);
|
||||
mLogger.log(this.debugMode, 'SkillView', `[skillView] 碰撞3`, oCol.group, seCol.group, model);
|
||||
if (!model) return;
|
||||
if (model.is_dead) return;
|
||||
if (this.sData.fac == model.fac) return;
|
||||
|
||||
Reference in New Issue
Block a user