refactor(ui): 优化卡牌等级显示逻辑和布局更新
- 移除HInfoComp中品质边框切换逻辑,专注卡牌等级显示 - 简化CardComp中等级节点的布局更新逻辑,仅使用Widget组件 - 调整card.prefab的布局参数和原始宽度 - 禁用role_controller.prefab的_active属性
This commit is contained in:
6
.trae/rules/git-commit-message.md
Normal file
6
.trae/rules/git-commit-message.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
alwaysApply: true
|
||||
scene: git_message
|
||||
---
|
||||
|
||||
在此处编写规则,自定义 AI 生成提交信息的风格。
|
||||
@@ -6392,9 +6392,9 @@
|
||||
"__prefab": {
|
||||
"__id__": 283
|
||||
},
|
||||
"_alignFlags": 33,
|
||||
"_alignFlags": 9,
|
||||
"_target": null,
|
||||
"_left": -4.281999999999989,
|
||||
"_left": -0.7980000000000018,
|
||||
"_right": 130.798,
|
||||
"_top": 67.42699999999999,
|
||||
"_bottom": -6.274000000000001,
|
||||
@@ -6406,7 +6406,7 @@
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 0,
|
||||
"_originalWidth": 40,
|
||||
"_originalHeight": 40,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
@@ -9318,6 +9318,8 @@
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "4d8lwMrctFq4mRNVU1cDrV",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1938,7 +1938,7 @@
|
||||
"__id__": 92
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_active": false,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 100
|
||||
|
||||
@@ -729,19 +729,12 @@ export class CardComp extends CCComp {
|
||||
}
|
||||
|
||||
if (this.lv_node) {
|
||||
const lvTrans = this.lv_node.getComponent(UITransform);
|
||||
if (lvTrans) {
|
||||
lvTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
|
||||
const widget = this.lv_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
const widget = this.lv_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
|
||||
this.lv_node.children.forEach(child => {
|
||||
const childTrans = child.getComponent(UITransform);
|
||||
if (childTrans) {
|
||||
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
|
||||
const widget = child.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
const childWidget = child.getComponent(Widget);
|
||||
if (childWidget) childWidget.updateAlignment();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -981,19 +974,12 @@ export class CardComp extends CCComp {
|
||||
});
|
||||
}
|
||||
if (this.lv_node) {
|
||||
const lvTrans = this.lv_node.getComponent(UITransform);
|
||||
if (lvTrans) {
|
||||
lvTrans.setContentSize(170, 230);
|
||||
const widget = this.lv_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
const widget = this.lv_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
|
||||
this.lv_node.children.forEach(child => {
|
||||
const childTrans = child.getComponent(UITransform);
|
||||
if (childTrans) {
|
||||
childTrans.setContentSize(170, 230);
|
||||
const widget = child.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
const childWidget = child.getComponent(Widget);
|
||||
if (childWidget) childWidget.updateAlignment();
|
||||
});
|
||||
}
|
||||
if (this.HF_node) {
|
||||
|
||||
@@ -53,6 +53,9 @@ export class HInfoComp extends CCComp {
|
||||
@property(Node)
|
||||
HF_node=null!
|
||||
|
||||
@property(Node)
|
||||
lv_node=null!
|
||||
|
||||
/** 绑定的英雄 ECS 实体 ID */
|
||||
private eid: number = 0;
|
||||
/** 绑定的英雄属性数据模型引用 */
|
||||
@@ -96,16 +99,10 @@ export class HInfoComp extends CCComp {
|
||||
refresh() {
|
||||
if (!this.model) return;
|
||||
|
||||
// ---- 品质边框切换 ----
|
||||
const isHighLevel = (this.model.lv ?? 0) > 1;
|
||||
if (this.HF_node) this.HF_node.active = isHighLevel;
|
||||
if (this.NF_node) this.NF_node.active = !isHighLevel;
|
||||
|
||||
// 按卡池等级显示对应子节点
|
||||
const activeFrameNode = isHighLevel ? this.HF_node : this.NF_node;
|
||||
if (activeFrameNode) {
|
||||
// ---- 卡牌等级显示 ----
|
||||
if (this.lv_node) {
|
||||
const cardLvStr = `lv${this.model.pool_lv ?? 1}`;
|
||||
activeFrameNode.children.forEach(child => {
|
||||
this.lv_node.children.forEach(child => {
|
||||
child.active = (child.name === cardLvStr);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user