5 Commits

Author SHA1 Message Date
panFD
9d0c418b88 style(HerosListComp): 修正英雄等级显示的大小写格式
将英雄等级文本的前缀从小写lv.改为大写Lv.,统一UI显示样式
2026-08-30 23:43:19 +08:00
panFD
120ea12a36 refactor(map): 移除技能框背景节点相关代码
1.  删除SskillBoxComp中bg_node属性和updateBgNode方法
2.  精简prefab中冗余的节点配置
3.  修复CardLiteComp的canup渲染覆盖问题
2026-08-30 23:43:13 +08:00
panFD
af4c45dc28 feat(hero card): add upgrade reminder feature
1. 新增英雄升级配置判定模块,封装升级条件校验逻辑
2. 为卡牌组件添加可升级标识节点和刷新逻辑
3. 实现英雄列表面板统一刷新所有卡牌的升级标识
4. 监听英雄成长变更事件实时更新升级提示状态
2026-08-30 23:10:08 +08:00
panFD
6e38e062b7 feat(map): add inactive skill icon background toggle logic
新增技能未激活时的图标背景显示逻辑,添加对应的节点引用和更新方法,实现1级档位未解锁时显示背景的功能
2026-08-30 22:54:44 +08:00
panFD
a7e9bb2ace fix(ui): 修复升级按钮相关的预制体和动画配置
1.  更新cardlite预制体,新增升级图标节点与相关组件
2.  调整up动画的采样率、时长与关键帧参数
2026-08-30 22:53:51 +08:00
13 changed files with 3048 additions and 1424 deletions

View File

@@ -7,11 +7,11 @@
"embeddedPlayerGroups": []
},
"_native": "",
"sample": 12,
"sample": 15,
"speed": 1,
"wrapMode": 2,
"enableTrsBlending": false,
"_duration": 0.75,
"_duration": 0.6,
"_hash": 500763545,
"_tracks": [
{
@@ -70,7 +70,7 @@
"__type__": "cc.RealCurve",
"_times": [
0,
0.75
0.6
],
"_values": [
{
@@ -83,7 +83,9 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
"__editorExtras__": {
"broken": null
}
},
{
"__type__": "cc.RealKeyframeValue",
@@ -95,7 +97,9 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
"__editorExtras__": {
"broken": null
}
}
],
"preExtrapolation": 1,
@@ -111,7 +115,7 @@
"__type__": "cc.RealCurve",
"_times": [
0,
0.75
0.6
],
"_values": [
{
@@ -124,19 +128,23 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
"__editorExtras__": {
"broken": null
}
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 70,
"value": 10,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
"__editorExtras__": {
"broken": null
}
}
],
"preExtrapolation": 1,
@@ -152,7 +160,7 @@
"__type__": "cc.RealCurve",
"_times": [
0,
0.75
0.6
],
"_values": [
{
@@ -165,7 +173,9 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
"__editorExtras__": {
"broken": null
}
},
{
"__type__": "cc.RealKeyframeValue",
@@ -177,7 +187,9 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
"__editorExtras__": {
"broken": null
}
}
],
"preExtrapolation": 1,
@@ -243,23 +255,11 @@
"__type__": "cc.RealCurve",
"_times": [
0,
0.16666666666666666,
0.5,
0.75
0.06666666666666667,
0.4,
0.6
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 255,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
@@ -271,7 +271,7 @@
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
"broken": null
}
},
{
@@ -297,6 +297,20 @@
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 255,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"broken": null
}
}
],
"preExtrapolation": 1,
@@ -312,23 +326,11 @@
"__type__": "cc.RealCurve",
"_times": [
0,
0.16666666666666666,
0.5,
0.75
0.06666666666666667,
0.4,
0.6
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 194,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
@@ -340,7 +342,7 @@
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
"broken": null
}
},
{
@@ -366,6 +368,20 @@
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 194,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"broken": null
}
}
],
"preExtrapolation": 1,
@@ -381,23 +397,11 @@
"__type__": "cc.RealCurve",
"_times": [
0,
0.16666666666666666,
0.5,
0.75
0.06666666666666667,
0.4,
0.6
],
"_values": [
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
@@ -409,7 +413,7 @@
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
"broken": null
}
},
{
@@ -435,6 +439,20 @@
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
"interpolationMode": 0,
"tangentWeightMode": 0,
"value": 0,
"rightTangent": 0,
"rightTangentWeight": 1,
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"broken": null
}
}
],
"preExtrapolation": 1,
@@ -450,9 +468,9 @@
"__type__": "cc.RealCurve",
"_times": [
0,
0.16666666666666666,
0.5,
0.75
0.06666666666666667,
0.4,
0.6
],
"_values": [
{
@@ -465,7 +483,9 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
"__editorExtras__": {
"broken": null
}
},
{
"__type__": "cc.RealKeyframeValue",
@@ -477,9 +497,7 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": {
"tangentMode": 0
}
"__editorExtras__": null
},
{
"__type__": "cc.RealKeyframeValue",
@@ -503,7 +521,9 @@
"leftTangent": 0,
"leftTangentWeight": 1,
"easingMethod": 0,
"__editorExtras__": null
"__editorExtras__": {
"broken": null
}
}
],
"preExtrapolation": 1,

File diff suppressed because it is too large Load Diff

View File

@@ -35,19 +35,22 @@
},
{
"__id__": 296
},
{
"__id__": 304
}
],
"_active": true,
"_components": [
{
"__id__": 304
"__id__": 316
},
{
"__id__": 306
"__id__": 318
}
],
"_prefab": {
"__id__": 308
"__id__": 320
},
"_lpos": {
"__type__": "cc.Vec3",
@@ -4243,6 +4246,266 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "canUp",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 305
}
],
"_active": true,
"_components": [
{
"__id__": 313
}
],
"_prefab": {
"__id__": 315
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 47.248,
"y": 136.44,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "Slider_Level02_Icon_Up_Green",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 304
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 306
},
{
"__id__": 308
},
{
"__id__": 310
}
],
"_prefab": {
"__id__": 312
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -1.992,
"y": 4.834,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.4,
"y": 0.4,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 305
},
"_enabled": true,
"__prefab": {
"__id__": 307
},
"_contentSize": {
"__type__": "cc.Size",
"width": 54,
"height": 64
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f7TrvPC1NMyrrSAPc9IyT8"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 305
},
"_enabled": true,
"__prefab": {
"__id__": 309
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@f082c",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b1/udelkZOA5FLZTy+f8V0"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 305
},
"_enabled": true,
"__prefab": {
"__id__": 311
},
"playOnLoad": true,
"_clips": [
{
"__uuid__": "661bbd46-b8fb-4fec-889e-66b609c100d2",
"__expectedType__": "cc.AnimationClip"
}
],
"_defaultClip": {
"__uuid__": "661bbd46-b8fb-4fec-889e-66b609c100d2",
"__expectedType__": "cc.AnimationClip"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5eUib+aBBBoZ9H6+dEaNeW"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "70oQ6XbC9CgZ7GSks7Ipvs",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 304
},
"_enabled": true,
"__prefab": {
"__id__": 314
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "d1pJngjTNEo7nRP3gTymBk"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "5eLRBbiJ1BurJE6wgi1nba",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@@ -4253,7 +4516,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 305
"__id__": 317
},
"_contentSize": {
"__type__": "cc.Size",
@@ -4281,7 +4544,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 307
"__id__": 319
},
"name_node": {
"__id__": 282
@@ -4297,6 +4560,9 @@
"lvl_node": {
"__id__": 293
},
"canup_node": {
"__id__": 304
},
"_id": ""
},
{

View File

@@ -472,6 +472,8 @@
"__id__": 0
},
"fileId": "0609p02BxJi4U2Di/K3fcs",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@@ -524,10 +526,7 @@
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@58f49",
"__expectedType__": "cc.SpriteFrame"
},
"_spriteFrame": null,
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
@@ -1221,7 +1220,7 @@
"__id__": 87
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 93
@@ -1673,6 +1672,8 @@
"__id__": 0
},
"fileId": "70kRUgd4JHx7ic4UPHFlN9",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@@ -3377,9 +3378,11 @@
"__id__": 145
},
"icon_node": {
"__id__": 105
},
"bg_node": {
"__id__": 2
},
"bg_node": null,
"lv_label": {
"__id__": 124
},

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@@ -0,0 +1,77 @@
/**
* @file heroUpSet.ts
* @description 英雄局外升级规则与判定逻辑(纯逻辑模块,无 UI / 无单例依赖)
*
* 职责:
* 1. 封装 HERO_UPGRADE_NEED_FRAGMENTS 升级消耗表的查询口径(满级判定)。
* 2. 提供"是否可升级"的统一判定,供 smc.upgradeHero / HerosListComp / CardLiteComp 复用。
*
* 关键设计:
* - 不直接引用 smc 单例,由调用方传入成长数据(lv / fragments),保持纯函数可测试。
* - 升级表 key 为目标等级:need = HERO_UPGRADE_NEED_FRAGMENTS[lv + 1],查不到即满级。
*/
import { HERO_UPGRADE_NEED_FRAGMENTS } from "./GameSet";
/** 英雄升级状态快照 */
export interface HeroUpgradeState {
/** 当前局外等级 */
lv: number;
/** 下一级(满级时为当前等级) */
nextLv: number;
/** 当前拥有碎片数 */
fragments: number;
/** 升到下一级所需碎片数(满级为 0) */
needFragments: number;
/** 是否已满级 */
isMaxLv: boolean;
/** 是否满足升级条件(未满级且碎片充足) */
canUpgrade: boolean;
}
/** 英雄最高局外等级(升级表最大 key - 1) */
export const HERO_MAX_LV: number = Math.max(...Object.keys(HERO_UPGRADE_NEED_FRAGMENTS).map(Number)) - 1;
/**
* 查询从当前等级升到下一级所需的碎片数。
* @param lv 当前局外等级
* @returns 所需碎片数;已满级返回 undefined
*/
export function getHeroUpgradeNeedFragments(lv: number): number | undefined {
return HERO_UPGRADE_NEED_FRAGMENTS[lv + 1];
}
/**
* 判断英雄当前等级是否已满级。
* @param lv 当前局外等级
*/
export function isHeroMaxLv(lv: number): boolean {
return getHeroUpgradeNeedFragments(lv) === undefined;
}
/**
* 判断英雄是否满足升级条件(未满级且碎片充足)。
* @param lv 当前局外等级
* @param fragments 当前拥有碎片数
*/
export function canHeroUpgrade(lv: number, fragments: number): boolean {
const need = getHeroUpgradeNeedFragments(lv);
return need !== undefined && fragments >= need;
}
/**
* 汇总英雄升级状态快照(供 UI 一次性取用,避免重复查表)。
* @param lv 当前局外等级
* @param fragments 当前拥有碎片数
*/
export function getHeroUpgradeState(lv: number, fragments: number): HeroUpgradeState {
const need = getHeroUpgradeNeedFragments(lv);
const isMax = need === undefined;
return {
lv,
nextLv: isMax ? lv : lv + 1,
fragments,
needFragments: need ?? 0,
isMaxLv: isMax,
canUpgrade: !isMax && fragments >= (need as number),
};
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "621f3327-35b6-4b26-92f6-7f3c2abe74b7",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -6,22 +6,28 @@
* 1. 管理英雄图鉴中单张英雄卡牌的 **显示**(名称、图标动画、卡池等级、英雄等级)。
* 2. 接收英雄 UUID 并渲染对应卡面。
* 3. 点击卡牌时通过事件通知父组件(HerosListComp)切换选中英雄详情。
* 4. 英雄碎片满足升级条件时显示 canup 标识。
*
* 关键设计:
* - 轻量展示组件,仅用于英雄展示,无拖拽使用、无锁定、无费用扣除等交互。
* - 英雄卡图标加载 idle 动画剪辑并提取首帧静态展示。
* - 通过 iconVisualToken 防止异步加载竞态。
* - canup 标识监听 HERO_GROWTH_UPDATE 事件实时刷新(碎片变动/升级后自动更新)。
*
* 依赖:
* - HeroInfo(heroSet)—— 用于渲染英雄卡面信息
* - canHeroUpgrade(heroUpSet)—— 英雄升级条件判定
* - smc —— 全局单例,访问图标图集缓存与英雄局外等级
*/
import { mLogger } from "../common/Logger";
import { _decorator, AnimationClip, EventTouch, Label, Node, NodeEventType, Sprite, SpriteFrame, Tween, tween, UIOpacity, Vec3, resources } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { oops } from "db://oops-framework/core/Oops";
import { HeroInfo } from "../common/config/heroSet";
import { getLvColor, CARD_LV_BG_COLORS } from "../common/config/GameSet";
import { canHeroUpgrade } from "../common/config/heroUpSet";
import { GameEvent } from "../common/config/GameEvent";
import { smc } from "../common/SingletonModuleComp";
const { ccclass, property } = _decorator;
@@ -55,6 +61,10 @@ export class CardLiteComp extends CCComp {
@property(Label)
lvl_node: Label = null!
/** 可升级标识节点(碎片满足升级条件时显示) */
@property(Node)
canup_node: Node = null!
// ======================== 运行时状态 ========================
card_uuid: number = 0
@@ -70,6 +80,8 @@ export class CardLiteComp extends CCComp {
this.bindEvents();
this.opacityComp = this.node.getComponent(UIOpacity) || this.node.addComponent(UIOpacity);
this.opacityComp.opacity = 255;
// onLoad 在 addChild 时才触发,晚于 setHeroByUuid;此处按已赋值的数据重新判定 canup,避免覆盖渲染结果
this.refreshCanUp();
}
onDestroy() {
@@ -94,6 +106,7 @@ export class CardLiteComp extends CCComp {
this.card_uuid = uuid;
this.node.active = true;
this.applyHeroUI(hero);
this.refreshCanUp();
mLogger.log(this.debugMode, "CardLiteComp", "setHeroByUuid", { uuid });
}
@@ -108,9 +121,24 @@ export class CardLiteComp extends CCComp {
clear() {
this.card_uuid = 0;
this.applyEmptyUI();
if (this.canup_node) this.canup_node.active = false;
this.node.active = false;
}
/**
* 刷新可升级标识:碎片满足升级条件时显示 canup 节点。
* 渲染时自动调用一次;升级后由 HerosListComp 统一触发刷新。
*/
refreshCanUp() {
if (!this.canup_node) return;
if (!this.hasCard()) {
this.canup_node.active = false;
return;
}
const growth = smc.getHeroGrowth(this.card_uuid);
this.canup_node.active = canHeroUpgrade(growth.lv, growth.fragments);
}
/**
* 设置选中态:选中卡微微放大,取消选中恢复原尺寸。
* @param selected 是否选中

View File

@@ -168,6 +168,15 @@ export class HerosListComp extends CCComp {
if (this.huuid) {
this.updateHeroDetail(this.huuid)
}
this.refreshAllCardsCanUp()
}
/** 升级/碎片变动后统一刷新所有卡片的可升级标识(升级入口仅在本面板,无需卡片各自监听事件) */
private refreshAllCardsCanUp() {
if (!this.cards_node) return
this.cards_node.children.forEach(cardNode => {
cardNode.getComponent(CardLiteComp)?.refreshCanUp()
})
}
closeHeros() {
@@ -444,7 +453,7 @@ export class HerosListComp extends CCComp {
private updateLvDisplay(uuid: number) {
if (!this.lv_label) return
const outerLv = smc.getHeroOuterLv(uuid)
this.lv_label.string = `lv.${outerLv}`
this.lv_label.string = `Lv.${outerLv}`
}
private updateRoleDisplay(hero: typeof HeroInfo[number]) {

View File

@@ -26,10 +26,6 @@ export class SSkillBoxComp extends CCComp {
@property({ type: Node })
private icon_node: Node = null;
/** 技能图标节点:下面有 green blue purple red yellow 5个不同颜色节点*/
@property({ type: Node })
private bg_node: Node = null;
/** 技能等级标签 */
@property(Label)
private lv_label: Label = null;
@@ -136,27 +132,6 @@ export class SSkillBoxComp extends CCComp {
}
}
/**
* 根据技能等级切换 bg_node 下的颜色子节点显示。
* 等级与颜色对应关系:
* 技能卡档位:card_lv 1 (wave 1) → green,2 (wave 5) → blue,3 (wave 8) → purple
* 英雄技能等级:s_lv 1~5 → green / blue / purple / red / yellow
*/
private updateBgNode() {
if (!this.bg_node) return;
const lvToColor: Record<number, string> = {
1: "green",
2: "blue",
3: "purple",
4: "red",
5: "yellow",
};
const targetColor = lvToColor[this.card_lv];
this.bg_node.children.forEach(child => {
child.active = (child.name === targetColor);
});
}
/**
* 解析技能名称:
* 1. 显式设置的卡牌名(最高优先级);
@@ -228,15 +203,11 @@ export class SSkillBoxComp extends CCComp {
/**
* 更新 UI:
* - 背景:根据技能等级切换对应颜色子节点显示
* - 图标:从 uicons 图集获取
* - 名称标签:显示技能名称
* - 等级标签:显示技能等级(Lv.x 样式)
*/
updateUI() {
// 按技能等级切换背景颜色节点(与 getLvColor 等级配色一致)
this.updateBgNode();
// 加载技能图标
if (this.icon_node) {
// 优先使用卡牌自定义 icon;未定义则按图鉴模式 / 装备卡 trigger_type 自动取

View File

@@ -125,6 +125,10 @@ export class SinfoComp extends CCComp {
@property({ type: Node, displayName: "关闭按钮" })
private close_btn: Node = null;
/** 技能未激活图标背景(技能未激活时显示,已激活隐藏) */
@property({ type: Node, displayName: "未激活图标背景" })
private inactive_bg: Node = null;
// ======================== 运行时状态 ========================
/** 弹窗参数 */
@@ -242,6 +246,9 @@ export class SinfoComp extends CCComp {
// 英雄当前局外等级:激活判定基准
const heroLv = Math.max(1, smc.getHeroOuterLv(p.hero_uuid!));
// 未激活图标背景:1 级档位未解锁时显示
this.updateInactiveBg(heroLv >= tiers[0].heroLv);
// 技能 1 级:激活状态与 2/3 级面板同一表示方式(描述已在 main_info 展示,此处仅渲染状态)
this.renderLvPanelFromTier(tiers[0], heroLv, this.main_status, null);
@@ -427,6 +434,16 @@ export class SinfoComp extends CCComp {
}
}
/**
* 更新未激活图标背景显隐
* @param unlocked 技能是否已激活
*/
private updateInactiveBg(unlocked: boolean) {
if (this.inactive_bg && this.inactive_bg.isValid) {
this.inactive_bg.active = !unlocked;
}
}
/** ECS 组件移除时销毁节点 */
reset() {
if (this.node && this.node.isValid) {