refactor(talentItem): 优化天赋道具的状态逻辑与UI布局
1. 调整天赋道具的状态判断逻辑,将阶位未解锁和未加点状态合并为未激活状态 2. 移除整卡透明度遮罩,改为仅显示左上角锁图标 3. 更新锁节点提示文案,明确未激活的两种场景 4. 调整锁、加号、满级角标的位置与资源配置 5. 扩展点击交互范围,支持锁角标点击触发升级
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
|||||||
* 职责:
|
* 职责:
|
||||||
* 1. 接收 TalentsComp 下发的天赋配置 + 当前等级 + 阶位解锁态,渲染迷你点选卡。
|
* 1. 接收 TalentsComp 下发的天赋配置 + 当前等级 + 阶位解锁态,渲染迷你点选卡。
|
||||||
* 2. 卡面自包含:图标 / 名称 / 当前已生效数值(Lv0 显示每级数值引导)/ 右下「当前/满级」角标。
|
* 2. 卡面自包含:图标 / 名称 / 当前已生效数值(Lv0 显示每级数值引导)/ 右下「当前/满级」角标。
|
||||||
* 3. 状态机:可升级(右上 + 徽标,绿光呼吸)/ 满级(MAX 金角标)/ 阶未解锁(半透明 + 锁)。
|
* 3. 状态机:可升级(右上 + 徽标)/ 满级(MAX 金角标)/ 未激活(左上锁角标,点击锁/卡体可升级激活)。
|
||||||
* 4. 点击回调上抛(含 + 徽标与卡体),升级校验与 toast 统一由 TalentsComp 处理(单一决策点)。
|
* 4. 点击回调上抛(含 + 徽标与卡体),升级校验与 toast 统一由 TalentsComp 处理(单一决策点)。
|
||||||
*
|
*
|
||||||
* 依赖:
|
* 依赖:
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* - CardBgComp —— 阶位品质底框(Ⅰ蓝 / Ⅱ紫 / Ⅲ金)
|
* - CardBgComp —— 阶位品质底框(Ⅰ蓝 / Ⅱ紫 / Ⅲ金)
|
||||||
* - smc.uiconsAtlas —— 图标解析(缺省回退资源目录)
|
* - smc.uiconsAtlas —— 图标解析(缺省回退资源目录)
|
||||||
*/
|
*/
|
||||||
import { _decorator, Label, Node, NodeEventType, Sprite, SpriteFrame, UIOpacity } from "cc";
|
import { _decorator, Label, Node, NodeEventType, Sprite, SpriteFrame } from "cc";
|
||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||||
import { TalentConfig, TalentTier, getTalentDisplayText } from "../common/config/TalentSet";
|
import { TalentConfig, TalentTier, getTalentDisplayText } from "../common/config/TalentSet";
|
||||||
@@ -56,7 +56,7 @@ export class TalentItemComp extends CCComp {
|
|||||||
@property({ type: Node, tooltip: "MAX 满级角标" })
|
@property({ type: Node, tooltip: "MAX 满级角标" })
|
||||||
node_max: Node = null!;
|
node_max: Node = null!;
|
||||||
|
|
||||||
@property({ type: Node, tooltip: "阶位未解锁遮罩/锁图标" })
|
@property({ type: Node, tooltip: "未激活锁遮罩/锁图标(未加点或阶位未解锁)" })
|
||||||
node_lock: Node = null!;
|
node_lock: Node = null!;
|
||||||
|
|
||||||
/** 点击回调(卡体与 + 徽标同源上抛),由父级统一校验升级 */
|
/** 点击回调(卡体与 + 徽标同源上抛),由父级统一校验升级 */
|
||||||
@@ -104,18 +104,14 @@ export class TalentItemComp extends CCComp {
|
|||||||
if (frame) this.icon.spriteFrame = frame;
|
if (frame) this.icon.spriteFrame = frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 状态徽标:满级 MAX / 可升级 + / 阶位锁定 🔒
|
// 状态徽标:满级 MAX / 可升级 + / 未激活锁角标(未加点或阶位未解锁,置于左上角)
|
||||||
const maxed = lv >= cfg.max_lv;
|
const maxed = lv >= cfg.max_lv;
|
||||||
if (this.node_max) this.node_max.active = maxed;
|
if (this.node_max) this.node_max.active = maxed;
|
||||||
if (this.node_plus) this.node_plus.active = !maxed && tierUnlocked && canUp;
|
if (this.node_plus) this.node_plus.active = !maxed && tierUnlocked && canUp;
|
||||||
if (this.node_lock) this.node_lock.active = !tierUnlocked;
|
if (this.node_lock) this.node_lock.active = lv <= 0 || !tierUnlocked;
|
||||||
|
|
||||||
// 阶位锁定整卡压暗(UIOpacity:Cocos 3.x 节点透明度组件)
|
|
||||||
const uo = this.node.getComponent(UIOpacity) ?? this.node.addComponent(UIOpacity);
|
|
||||||
uo.opacity = tierUnlocked ? 255 : 110;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 卡体/+ 徽标点击:上抛 uuid,升级校验与提示由 TalentsComp 统一处理 */
|
/** 卡体/+ 徽标/锁角标点击:触摸事件冒泡至卡体统一上抛 uuid,升级校验与提示由 TalentsComp 处理 */
|
||||||
private onTap(): void {
|
private onTap(): void {
|
||||||
this.onTalentTap?.(this.curUuid);
|
this.onTalentTap?.(this.curUuid);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user