perf: 移除调试日志并统一调试模式控制
- 将 HeroAttrsComp 中的 console.log 改为注释以提升性能 - 将 HeroViewComp 的 debugMode 默认值设为 false 并移除冗余日志 - 在 SkillView 中统一添加 debugMode 控制,替换直接 console 调用 - 在 MissionCardComp 中添加调试日志以跟踪卡牌应用效果
This commit is contained in:
@@ -440,7 +440,11 @@ export class MissionCardComp extends CCComp {
|
||||
// 直接调用 TalComp 添加天赋
|
||||
const talComp = role.get(TalComp);
|
||||
if (talComp) {
|
||||
const beforeCount = Object.keys(talComp.Tals).length;
|
||||
console.log(`[MissionCard] Talent Before: Count=${beforeCount}`);
|
||||
talComp.addTal(selectedData.uuid);
|
||||
const afterCount = Object.keys(talComp.Tals).length;
|
||||
console.log(`[MissionCard] Talent After: Count=${afterCount}, Added=${selectedData.uuid}`);
|
||||
}
|
||||
break;
|
||||
case CardType.Skill:
|
||||
@@ -448,7 +452,11 @@ export class MissionCardComp extends CCComp {
|
||||
// 直接调用 HeroSkillsComp 添加技能
|
||||
const skillComp = role.get(HeroSkillsComp);
|
||||
if (skillComp) {
|
||||
const beforeCount = Object.keys(skillComp.skills).length;
|
||||
console.log(`[MissionCard] Skill Before: Count=${beforeCount}`);
|
||||
skillComp.addSkill(selectedData.uuid);
|
||||
const afterCount = Object.keys(skillComp.skills).length;
|
||||
console.log(`[MissionCard] Skill After: Count=${afterCount}, Added=${selectedData.uuid}`);
|
||||
}
|
||||
break;
|
||||
case CardType.Partner:
|
||||
@@ -461,6 +469,9 @@ export class MissionCardComp extends CCComp {
|
||||
if (attrsComp) {
|
||||
const potion = PotionCards[selectedData.uuid];
|
||||
if (potion) {
|
||||
const beforeVal = attrsComp.Attrs[potion.attr] || 0;
|
||||
console.log(`[MissionCard] Potion Before: Attr[${potion.attr}]=${beforeVal}`);
|
||||
|
||||
const buffConf: BuffConf = {
|
||||
buff: potion.attr,
|
||||
value: potion.value,
|
||||
@@ -470,6 +481,8 @@ export class MissionCardComp extends CCComp {
|
||||
};
|
||||
attrsComp.addBuff(buffConf);
|
||||
smc.updateHeroInfo(attrsComp);
|
||||
|
||||
console.log(`[MissionCard] Potion Applied: ${potion.desc}, Value=${potion.value}`);
|
||||
oops.gui.toast(potion.desc);
|
||||
}
|
||||
}
|
||||
@@ -478,6 +491,17 @@ export class MissionCardComp extends CCComp {
|
||||
// 属性卡:更新全局属性并刷新主角
|
||||
const attrCard = AttrCards[selectedData.uuid];
|
||||
if (attrCard) {
|
||||
let globalBefore = 0;
|
||||
if (smc.global_attrs[attrCard.attr]) {
|
||||
globalBefore = smc.global_attrs[attrCard.attr][0];
|
||||
}
|
||||
const roleAttrs = role.get(HeroAttrsComp);
|
||||
let roleBefore = 0;
|
||||
if (roleAttrs) {
|
||||
roleBefore = roleAttrs.Attrs[attrCard.attr] || 0;
|
||||
}
|
||||
console.log(`[MissionCard] Attr Before: Global=${globalBefore}, Hero=${roleBefore}`);
|
||||
|
||||
if (!smc.global_attrs[attrCard.attr]) {
|
||||
smc.global_attrs[attrCard.attr] = [0, 0];
|
||||
}
|
||||
@@ -485,13 +509,14 @@ export class MissionCardComp extends CCComp {
|
||||
current[0] += attrCard.value;
|
||||
current[1] += 1;
|
||||
|
||||
console.log(`[MissionCard] 全局属性更新: Attr=${attrCard.attr}, Add=${attrCard.value}, Total=${current[0]}`);
|
||||
|
||||
// 直接触发主角属性重算
|
||||
const attrsComp = role.get(HeroAttrsComp);
|
||||
if (attrsComp) {
|
||||
attrsComp.recalculateSingleAttr(attrCard.attr);
|
||||
smc.updateHeroInfo(attrsComp);
|
||||
|
||||
const roleAfter = attrsComp.Attrs[attrCard.attr] || 0;
|
||||
console.log(`[MissionCard] Attr After: Global=${current[0]}, Hero=${roleAfter}`);
|
||||
}
|
||||
oops.gui.toast(attrCard.desc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user