feat(hero skill): add slot support for hero skill detail panel
1. 新增技能槽位参数,解决同底座技能(如普攻+触发技能)的分档定位问题 2. 新增2级/3级面板节点配置,自动隐藏无对应档位的面板 3. 重构英雄技能档位生成逻辑,支持按槽位精确查找技能配置 4. 优化技能弹窗渲染逻辑,传递槽位参数避免匹配错误分组
This commit is contained in:
@@ -34,7 +34,7 @@ import { oops } from "db://oops-framework/core/Oops";
|
||||
import { CardTriggerType, CardConfig } from "../common/config/CardSet";
|
||||
import { SkillSet, FieldSkillSet } from "../common/config/SkillSet";
|
||||
import { SkillCardList } from "../common/config/SCardSet";
|
||||
import { FieldEntry } from "../common/config/heroSet";
|
||||
import { FieldEntry, SkillTriggerType } from "../common/config/heroSet";
|
||||
import { buildCardDescRich } from "../common/config/CardSkillText";
|
||||
import { buildHeroSkillTierLines, HeroSkillTierLine } from "../common/HeroSkillText";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
@@ -57,6 +57,9 @@ export interface SInfoParams {
|
||||
trigger_type?: CardTriggerType;
|
||||
/** 所属英雄 UUID(英雄图鉴模式:按英雄技能分档描述渲染,优先级高于卡牌逻辑) */
|
||||
hero_uuid?: number;
|
||||
/** 技能所属槽位(英雄图鉴模式):同一底座可同时为普攻与触发技能(如 5002 的 6004),
|
||||
* 指定后仅在该槽位取档,激活等级/档位按槽位独立判定 */
|
||||
hero_slot?: SkillTriggerType;
|
||||
}
|
||||
|
||||
/** 等级提升信息(用于 2 级 / 3 级面板) */
|
||||
@@ -94,6 +97,10 @@ export class SinfoComp extends CCComp {
|
||||
@property({ type: Label, displayName: "1级激活状态" })
|
||||
private main_status: Label = null;
|
||||
|
||||
/** 2级面板节点(无 2 级档位的技能隐藏) */
|
||||
@property({ type: Node, displayName: "2级面板" })
|
||||
private lv2_node: Node = null;
|
||||
|
||||
/** 2级激活状态标签 */
|
||||
@property({ type: Label, displayName: "2级激活状态" })
|
||||
private lv2_status: Label = null;
|
||||
@@ -102,6 +109,10 @@ export class SinfoComp extends CCComp {
|
||||
@property({ type: RichText, displayName: "2级提升说明" })
|
||||
private lv2_desc: RichText = null;
|
||||
|
||||
/** 3级面板节点(无 3 级及以上档位的技能隐藏) */
|
||||
@property({ type: Node, displayName: "3级面板" })
|
||||
private lv3_node: Node = null;
|
||||
|
||||
/** 3级激活状态标签 */
|
||||
@property({ type: Label, displayName: "3级激活状态" })
|
||||
private lv3_status: Label = null;
|
||||
@@ -215,7 +226,7 @@ export class SinfoComp extends CCComp {
|
||||
* @returns true 已渲染(拦截通用卡牌逻辑);false 技能无分档数据,回退通用卡牌逻辑
|
||||
*/
|
||||
private renderHeroSkill(p: SInfoParams): boolean {
|
||||
const tiers = buildHeroSkillTierLines(p.hero_uuid!, p.uuid);
|
||||
const tiers = buildHeroSkillTierLines(p.hero_uuid!, p.uuid, p.hero_slot);
|
||||
if (tiers.length === 0) return false;
|
||||
|
||||
// 图标 / 名称 / 当前技能等级与通用逻辑一致(skill_lv 传的就是当前生效 s_lv)
|
||||
@@ -237,6 +248,9 @@ export class SinfoComp extends CCComp {
|
||||
// 技能 2 级 / 3 级(3 级以后档位合并进 3 级栏,多行展示)
|
||||
const lv2 = tiers.find(t => t.sLv === 2);
|
||||
const lv3Plus = tiers.filter(t => t.sLv >= 3);
|
||||
// 无对应档位的技能隐藏 2 级 / 3 级面板节点
|
||||
this.setPanelActive(this.lv2_node, !!lv2);
|
||||
this.setPanelActive(this.lv3_node, lv3Plus.length > 0);
|
||||
this.renderLvPanelFromTier(lv2, heroLv, this.lv2_status, this.lv2_desc);
|
||||
const lv3Merged = lv3Plus.length
|
||||
? { sLv: lv3Plus[0].sLv, heroLv: lv3Plus[0].heroLv, text: lv3Plus.map(t => t.text).join("\n") }
|
||||
@@ -245,6 +259,13 @@ export class SinfoComp extends CCComp {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 设置等级面板节点显隐(无对应档位时隐藏) */
|
||||
private setPanelActive(node: Node | null, active: boolean) {
|
||||
if (node && node.isValid) {
|
||||
node.active = active;
|
||||
}
|
||||
}
|
||||
|
||||
/** 按档位渲染单等级面板:激活状态按英雄等级对比档位解锁等级 */
|
||||
private renderLvPanelFromTier(tier: HeroSkillTierLine | undefined, heroLv: number, statusLabel: Label | null, descRich: RichText | null) {
|
||||
if (statusLabel && statusLabel.isValid) {
|
||||
|
||||
Reference in New Issue
Block a user