feat(map): 新增英雄图鉴技能分档描述渲染逻辑
1. 为技能图标组件新增所属英雄UUID字段,传递英雄上下文 2. 在英雄列表面板中为技能图标绑定所属英雄ID 3. 新增英雄技能分档渲染逻辑,根据英雄等级展示对应技能解锁状态和描述 4. 补充注释和类型定义,完善代码文档
This commit is contained in:
@@ -513,6 +513,7 @@ export class HerosListComp extends CCComp {
|
|||||||
this.skills_node.children[i].destroy()
|
this.skills_node.children[i].destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// huuid 已在 onCardSelect 赋值,addSkillIcon 用它携带英雄语境
|
||||||
const lv = Math.max(1, smc.getHeroOuterLv(hero.uuid))
|
const lv = Math.max(1, smc.getHeroOuterLv(hero.uuid))
|
||||||
|
|
||||||
// ---- 大招:skills[1] 及以后(英雄出场即激活,与能量条同语义,恒不锁定) ----
|
// ---- 大招:skills[1] 及以后(英雄出场即激活,与能量条同语义,恒不锁定) ----
|
||||||
@@ -547,7 +548,8 @@ export class HerosListComp extends CCComp {
|
|||||||
const node = instantiate(this.skill_icon_prefab)
|
const node = instantiate(this.skill_icon_prefab)
|
||||||
node.name = `skill_${s_uuid}`
|
node.name = `skill_${s_uuid}`
|
||||||
const comp = node.getComponent(SSkillBoxComp) || node.addComponent(SSkillBoxComp)
|
const comp = node.getComponent(SSkillBoxComp) || node.addComponent(SSkillBoxComp)
|
||||||
comp.initHeroSkill(s_uuid, s_lv, locked, isField)
|
// 携带所属英雄,点击弹窗按英雄技能分档描述渲染
|
||||||
|
comp.initHeroSkill(s_uuid, s_lv, locked, isField, this.huuid)
|
||||||
this.skills_node.addChild(node)
|
this.skills_node.addChild(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ export class SSkillBoxComp extends CCComp {
|
|||||||
|
|
||||||
/** 技能 UUID */
|
/** 技能 UUID */
|
||||||
private s_uuid: number = 0;
|
private s_uuid: number = 0;
|
||||||
|
/** 所属英雄 UUID(英雄图鉴模式,>0 时点击弹窗走英雄技能分档描述) */
|
||||||
|
private hero_uuid: number = 0;
|
||||||
/** 卡牌等级 */
|
/** 卡牌等级 */
|
||||||
private card_lv: number = 1;
|
private card_lv: number = 1;
|
||||||
/** 卡牌自定义图标ID(优先级最高,未定义则按 trigger_type 自动取) */
|
/** 卡牌自定义图标ID(优先级最高,未定义则按 trigger_type 自动取) */
|
||||||
@@ -77,6 +79,8 @@ export class SSkillBoxComp extends CCComp {
|
|||||||
skill_name: this.resolveSkillName(),
|
skill_name: this.resolveSkillName(),
|
||||||
field: this.field,
|
field: this.field,
|
||||||
trigger_type: this.trigger_type,
|
trigger_type: this.trigger_type,
|
||||||
|
// 英雄图鉴模式:携带所属英雄,弹窗按英雄技能分档描述渲染
|
||||||
|
hero_uuid: this.hero_uuid || undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,13 +124,15 @@ export class SSkillBoxComp extends CCComp {
|
|||||||
/**
|
/**
|
||||||
* 初始化英雄技能图标(英雄图鉴面板专用):
|
* 初始化英雄技能图标(英雄图鉴面板专用):
|
||||||
* 图标按 s_uuid 直接取 SkillSet / FieldSkillSet 配置,不走 EquipPoolList。
|
* 图标按 s_uuid 直接取 SkillSet / FieldSkillSet 配置,不走 EquipPoolList。
|
||||||
* @param s_uuid 技能 UUID(大招/触发技能指向 SkillSet,光环词条指向 FieldSkillSet)
|
* @param s_uuid 技能 UUID(大招/触发技能指向 SkillSet,光环词条指向 FieldSkillSet)
|
||||||
* @param s_lv 当前英雄等级下生效的技能等级(显示在等级标签)
|
* @param s_lv 当前英雄等级下生效的技能等级(显示在等级标签)
|
||||||
* @param locked 当前等级未激活时显示锁定遮罩
|
* @param locked 当前等级未激活时显示锁定遮罩
|
||||||
* @param isField true 时图标取 FieldSkillSet(驻场光环词条)
|
* @param isField true 时图标取 FieldSkillSet(驻场光环词条)
|
||||||
|
* @param heroUuid 所属英雄 UUID(点击弹窗按英雄技能分档描述渲染)
|
||||||
*/
|
*/
|
||||||
initHeroSkill(s_uuid: number, s_lv: number, locked: boolean, isField: boolean = false) {
|
initHeroSkill(s_uuid: number, s_lv: number, locked: boolean, isField: boolean = false, heroUuid: number = 0) {
|
||||||
this.s_uuid = s_uuid;
|
this.s_uuid = s_uuid;
|
||||||
|
this.hero_uuid = heroUuid;
|
||||||
this.card_lv = s_lv;
|
this.card_lv = s_lv;
|
||||||
this.hero_icon_source = isField ? "field" : "skill";
|
this.hero_icon_source = isField ? "field" : "skill";
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
|
|||||||
@@ -17,13 +17,15 @@
|
|||||||
* skill_name: "战后恢复", // 名称(可选)
|
* skill_name: "战后恢复", // 名称(可选)
|
||||||
* field: [...], // 驻场词条(装备卡)
|
* field: [...], // 驻场词条(装备卡)
|
||||||
* trigger_type: 3, // 触发类型
|
* trigger_type: 3, // 触发类型
|
||||||
|
* hero_uuid: 5001, // 所属英雄(英雄图鉴模式:按英雄技能分档描述渲染)
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* 依赖:
|
* 依赖:
|
||||||
* - oops.gui(UI 生命周期)—— open / removeByNode
|
* - oops.gui(UI 生命周期)—— open / removeByNode
|
||||||
* - SkillSet / FieldSkillSet(技能/光环静态配置)
|
* - SkillSet / FieldSkillSet(技能/光环静态配置)
|
||||||
* - SkillCardList / EquipPoolList(卡牌静态配置)
|
* - SkillCardList / EquipPoolList(卡牌静态配置)
|
||||||
* - HeroSkillDesc(buildCardDescRich 富文本描述生成)
|
* - HeroSkillDesc(buildCardDescRich 富文本描述生成,卡牌模式)
|
||||||
|
* - HeroSkillText(buildHeroSkillTierLines 技能分档描述,英雄技能模式)
|
||||||
*/
|
*/
|
||||||
import { _decorator, Node, Label, RichText, NodeEventType, Sprite, Color, input, Input, EventTouch, UITransform, Vec3 } from "cc";
|
import { _decorator, Node, Label, RichText, NodeEventType, Sprite, Color, input, Input, EventTouch, UITransform, Vec3 } from "cc";
|
||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
@@ -35,6 +37,7 @@ import { SkillCardList } from "../common/config/SCardSet";
|
|||||||
import { EquipPoolList } from "../common/config/EquipSet";
|
import { EquipPoolList } from "../common/config/EquipSet";
|
||||||
import { FieldEntry } from "../common/config/heroSet";
|
import { FieldEntry } from "../common/config/heroSet";
|
||||||
import { buildCardDescRich } from "../common/config/HeroSkillDesc";
|
import { buildCardDescRich } from "../common/config/HeroSkillDesc";
|
||||||
|
import { buildHeroSkillTierLines, HeroSkillTierLine } from "../common/HeroSkillText";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
@@ -53,6 +56,8 @@ export interface SInfoParams {
|
|||||||
field?: FieldEntry[];
|
field?: FieldEntry[];
|
||||||
/** 触发类型 */
|
/** 触发类型 */
|
||||||
trigger_type?: CardTriggerType;
|
trigger_type?: CardTriggerType;
|
||||||
|
/** 所属英雄 UUID(英雄图鉴模式:按英雄技能分档描述渲染,优先级高于卡牌逻辑) */
|
||||||
|
hero_uuid?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 等级提升信息(用于 2 级 / 3 级面板) */
|
/** 等级提升信息(用于 2 级 / 3 级面板) */
|
||||||
@@ -188,11 +193,64 @@ export class SinfoComp extends CCComp {
|
|||||||
|
|
||||||
// ======================== 渲染逻辑 ========================
|
// ======================== 渲染逻辑 ========================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 英雄技能模式渲染(文本二:单个技能各阶段说明)。
|
||||||
|
* - main_info:技能 slv1 完整描述
|
||||||
|
* - lv2_desc:slv2 相对 slv1 的提升;lv3_desc:slv3 及以后档(合并展示)
|
||||||
|
* - lv2/lv3_status:按英雄局外等级(smc.getHeroOuterLv)对比档位解锁等级判定激活
|
||||||
|
* @returns true 已渲染(拦截通用卡牌逻辑);false 技能无分档数据(光环/复活词条),回退通用逻辑
|
||||||
|
*/
|
||||||
|
private renderHeroSkill(p: SInfoParams): boolean {
|
||||||
|
const tiers = buildHeroSkillTierLines(p.hero_uuid!, p.uuid);
|
||||||
|
if (tiers.length === 0) return false;
|
||||||
|
|
||||||
|
// 图标 / 名称 / 当前技能等级与通用逻辑一致(card_lv 传的就是当前生效 s_lv)
|
||||||
|
this.renderIcon(p);
|
||||||
|
this.setLabel(this.name_label, this.resolveName(p));
|
||||||
|
this.setLabel(this.lv_label, `Lv.${p.card_lv}`);
|
||||||
|
|
||||||
|
// 技能 1 级:完整能力描述
|
||||||
|
if (this.main_info && this.main_info.isValid) {
|
||||||
|
this.main_info.string = tiers[0].text || "暂无描述";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 英雄当前局外等级:激活判定基准
|
||||||
|
const heroLv = Math.max(1, smc.getHeroOuterLv(p.hero_uuid!));
|
||||||
|
|
||||||
|
// 技能 2 级 / 3 级(3 级以后档位合并进 3 级栏,多行展示)
|
||||||
|
const lv2 = tiers.find(t => t.sLv === 2);
|
||||||
|
const lv3Plus = tiers.filter(t => t.sLv >= 3);
|
||||||
|
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") }
|
||||||
|
: undefined;
|
||||||
|
this.renderLvPanelFromTier(lv3Merged, heroLv, this.lv3_status, this.lv3_desc);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 按档位渲染单等级面板:激活状态按英雄等级对比档位解锁等级 */
|
||||||
|
private renderLvPanelFromTier(tier: HeroSkillTierLine | undefined, heroLv: number, statusLabel: Label | null, descRich: RichText | null) {
|
||||||
|
if (statusLabel && statusLabel.isValid) {
|
||||||
|
const unlocked = !!tier && heroLv >= tier.heroLv;
|
||||||
|
statusLabel.string = unlocked ? "已激活" : (tier ? `${tier.heroLv}级解锁` : "");
|
||||||
|
// 已激活显示绿色,未激活显示灰色
|
||||||
|
statusLabel.color = unlocked
|
||||||
|
? new Color(0, 255, 10, 255)
|
||||||
|
: new Color(150, 150, 150, 255);
|
||||||
|
}
|
||||||
|
if (descRich && descRich.isValid) {
|
||||||
|
descRich.string = tier?.text ?? "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 主渲染入口 */
|
/** 主渲染入口 */
|
||||||
private render() {
|
private render() {
|
||||||
if (!this.params) return;
|
if (!this.params) return;
|
||||||
const p = this.params;
|
const p = this.params;
|
||||||
|
|
||||||
|
// ---- 英雄技能模式:按英雄语境渲染分档描述(文本二) ----
|
||||||
|
if (p.hero_uuid && this.renderHeroSkill(p)) return;
|
||||||
|
|
||||||
// ---- 图标 ----
|
// ---- 图标 ----
|
||||||
this.renderIcon(p);
|
this.renderIcon(p);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user