refactor: 将代码中的card_lv统一替换为rarity

本次提交完成了全项目范围内术语的统一替换,将原本指代卡牌品质/等级的card_lv字段全部重命名为rarity,对齐了设计文档中的命名规范,避免了术语混淆:
1.  更新了所有配置文件、组件类、数据结构中的字段定义
2.  同步修改了注释、文档说明中的相关表述
3.  修正了英雄、技能、装备卡牌的品质显示逻辑
4.  调整了背景颜色切换、属性计算等相关业务逻辑
This commit is contained in:
pan
2026-09-02 16:42:54 +08:00
parent 6620b67103
commit d9bccd7c93
36 changed files with 312 additions and 312 deletions

View File

@@ -43,7 +43,7 @@ export class SCardComp extends CCComp {
@property({ type: Node })
private icon_node: Node = null;
/** 背景节点(含 green/blue/purple/red/yellow 颜色子节点,按 card_lv 激活) */
/** 背景节点(含 green/blue/purple/red/yellow 颜色子节点,按 rarity 激活) */
@property({ type: Node })
private bg_node: Node = null;
@@ -189,11 +189,11 @@ export class SCardComp extends CCComp {
// 等级标签(★ 表示卡牌等级)
if (this.level_label) {
const lv = this.cardData.card_lv ?? 1;
const lv = this.cardData.rarity ?? 1;
this.level_label.string = lv >= 2 ? "★".repeat(lv - 1) : "";
}
// 背景:按 card_lv 激活对应颜色子节点(1→green 2→blue 3→purple 4→red 5→yellow)
// 背景:按 rarity 激活对应颜色子节点(1→green 2→blue 3→purple 4→red 5→yellow)
this.updateBgNode();
// 描述富文本(数值随 overrides 档位自动同步高亮)
@@ -228,13 +228,13 @@ export class SCardComp extends CCComp {
}
/**
* 根据 card_lv 切换 bg_node 下的颜色子节点显示。
* 根据 rarity 切换 bg_node 下的颜色子节点显示。
* 等级与颜色对应关系:
* card_lv 1 → green
* card_lv 2 → blue
* card_lv 3 → purple
* card_lv 4 → red
* card_lv 5 → yellow
* rarity 1 → green
* rarity 2 → blue
* rarity 3 → purple
* rarity 4 → red
* rarity 5 → yellow
*/
private updateBgNode() {
if (!this.bg_node || !this.cardData) return;
@@ -245,7 +245,7 @@ export class SCardComp extends CCComp {
4: "red",
5: "yellow",
};
const targetColor = lvToColor[this.cardData.card_lv ?? 1];
const targetColor = lvToColor[this.cardData.rarity ?? 1];
this.bg_node.children.forEach(child => {
child.active = (child.name === targetColor);
});