perf: 移除调试日志并统一调试模式控制
- 将 HeroAttrsComp 中的 console.log 改为注释以提升性能 - 将 HeroViewComp 的 debugMode 默认值设为 false 并移除冗余日志 - 在 SkillView 中统一添加 debugMode 控制,替换直接 console 调用 - 在 MissionCardComp 中添加调试日志以跟踪卡牌应用效果
This commit is contained in:
@@ -249,7 +249,7 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
this.hp = Math.max(0, Math.min(this.hp, this.Attrs[Attrs.HP_MAX]));
|
||||
this.dirty_hp = true; // ✅ 仅标记需要更新
|
||||
smc.updateHeroInfo(this);
|
||||
console.log(`[HeroAttrs] HP变更: ${this.hero_name}, 变化=${addValue.toFixed(1)}, ${oldHp.toFixed(1)} -> ${this.hp.toFixed(1)}`);
|
||||
// console.log(`[HeroAttrs] HP变更: ${this.hero_name}, 变化=${addValue.toFixed(1)}, ${oldHp.toFixed(1)} -> ${this.hp.toFixed(1)}`);
|
||||
}
|
||||
add_mp(value:number,isValue:boolean){
|
||||
const oldMp = this.mp;
|
||||
|
||||
@@ -26,7 +26,7 @@ export interface BuffInfo {
|
||||
@ccclass('HeroViewComp') // 定义Cocos Creator 组件
|
||||
@ecs.register('HeroView', false) // 定义ECS 组件
|
||||
export class HeroViewComp extends CCComp {
|
||||
private debugMode: boolean = true; // 是否启用调试模式
|
||||
private debugMode: boolean = false; // 是否启用调试模式
|
||||
|
||||
// 添加条件日志方法
|
||||
private debugLog(...args: any[]): void {
|
||||
@@ -198,7 +198,7 @@ export class HeroViewComp extends CCComp {
|
||||
// 不再基于血量是否满来决定显示状态,只更新进度条
|
||||
let hp=this.model.hp;
|
||||
let hp_max=this.model.Attrs[Attrs.HP_MAX];
|
||||
this.debugLog("hp_show",hp,hp_max)
|
||||
// this.debugLog("hp_show",hp,hp_max)
|
||||
|
||||
let targetProgress = hp / hp_max;
|
||||
let hpNode = this.top_node.getChildByName("hp");
|
||||
@@ -500,18 +500,10 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
// 伤害计算和战斗逻辑已迁移到 HeroBattleSystem
|
||||
|
||||
|
||||
|
||||
|
||||
/** 调试日志(已禁用) */
|
||||
to_console(value:any, value2:any=null, value3:any=null){
|
||||
// 调试用,生产环境已禁用
|
||||
}
|
||||
|
||||
|
||||
playSkillEffect(skill_id:number) {
|
||||
let skill = SkillSet[skill_id]
|
||||
console.log('[heroview] skill_id'+skill_id,skill)
|
||||
this.debugLog('[heroview] skill_id'+skill_id,skill)
|
||||
if (!skill) return;
|
||||
switch(skill.act){
|
||||
case "max":
|
||||
|
||||
Reference in New Issue
Block a user