feat(技能UI): 添加技能冷却遮罩显示功能

为SkillBoxComp组件新增CD遮罩的初始化与帧更新逻辑,根据技能触发间隔动态计算冷却进度
调整多个技能相关预制体的布局,添加cd_mask精灵节点以支持冷却UI展示
优化部分技能框的UI排版与节点配置
This commit is contained in:
panFD
2026-06-04 21:12:12 +08:00
parent ac1c810636
commit 998300f721
4 changed files with 276 additions and 48 deletions

View File

@@ -183,6 +183,18 @@ export class SkillBoxComp extends CCComp {
this.info_label.string = "";
}
}
// 初始化或重置 CD 遮罩表现
if (this.cd_mask && this.cd_mask.isValid) {
let sprite = this.cd_mask.getComponent(Sprite);
if (sprite) {
if (this.is_instant || this.trigger_interval <= 0) {
sprite.fillRange = 0; // 无需冷却,直接归 0
} else {
sprite.fillRange = Math.max(0, 1 - (this.timer / this.trigger_interval));
}
}
}
}
// ======================== 战斗状态事件 ========================
@@ -274,6 +286,15 @@ export class SkillBoxComp extends CCComp {
if (this.current_trigger_times < this.trigger_times) {
this.timer += dt;
// 更新 CD 遮罩 (fillRange 从 1 降到 0)
if (this.cd_mask && this.cd_mask.isValid && this.trigger_interval > 0) {
let sprite = this.cd_mask.getComponent(Sprite);
if (sprite) {
sprite.fillRange = Math.max(0, 1 - (this.timer / this.trigger_interval));
}
}
if (this.timer >= this.trigger_interval) {
this.timer = 0;
this.triggerSkill();