refactor(map): 调整英雄列表布局参数与添加页签红点逻辑

1. 新增英雄列表卡片宽度、间距、边距可配置属性,修正列表内容宽度计算
2. 为任务主页添加英雄成长和天赋更新事件监听,实现页签红点自动刷新
3. 补充全英雄可升级状态检测与红点显示逻辑
This commit is contained in:
panFD
2026-09-08 22:20:22 +08:00
parent cfaed3b63f
commit 214231d64f
4 changed files with 1190 additions and 739 deletions

View File

@@ -114,6 +114,18 @@ export class HerosListComp extends CCComp {
@property(RichText)
upgrade_info_label = null!
/** 卡片宽度 */
@property
card_w = 120
/** 卡片横向间隔 */
@property
spacing_x = 10
/** 卡片左右边距 */
@property
margin_x = 15
// ======================== 运行时状态 ========================
huuid: number = 0
@@ -364,6 +376,11 @@ export class HerosListComp extends CCComp {
const total = this.cards_node.children.length
if (total === 0) return
// 宽度 = 卡片总宽 + 卡片间隔 + 左右边距
const contentW = total * this.card_w
+ (total - 1) * this.spacing_x
+ this.margin_x * 2
const cols = 4
const rows = Math.ceil(total / cols)
const cardH = 200
@@ -372,11 +389,11 @@ export class HerosListComp extends CCComp {
const uiTrans = this.cards_node.getComponent(UITransform)
if (uiTrans) {
uiTrans.setContentSize(uiTrans.width, contentH)
uiTrans.setContentSize(contentW, contentH)
}
mLogger.log(this.debugMode, "HerosListComp", "updateContentSize", {
total, cols, rows, contentH,
total, cols, rows, contentW, contentH,
})
}