feat(ui): 将卡牌槽位从4个调整为3个并更新布局

- 隐藏第四个卡牌槽位,将抽卡逻辑从4张改为3张
- 调整卡牌预制体中的位置和尺寸以适配新布局
- 更新角色控制器UI的宽度和间距设置
- 修改卡牌放大时的位置判定阈值和高度
This commit is contained in:
panw
2026-04-24 10:05:16 +08:00
parent 5dfc790412
commit 051342a9c4
4 changed files with 535 additions and 654 deletions

View File

@@ -416,7 +416,7 @@ export class CardComp extends CCComp {
// x轴偏移逻辑
if (this.restPosition.x < -200) { // -260
targetX = this.restPosition.x + 30;
} else if (this.restPosition.x > 200) { // 260
} else if (this.restPosition.x > 80) { // 260 -> 86也算
targetX = this.restPosition.x - 30;
}
// y轴变大时 +35
@@ -549,7 +549,7 @@ export class CardComp extends CCComp {
if (this.isEnlarged) {
if (this.restPosition.x <= -200) {
baseX = this.restPosition.x + 30;
} else if (this.restPosition.x >= 200) {
} else if (this.restPosition.x >= 80) {
baseX = this.restPosition.x - 30;
}
baseY = this.restPosition.y + 35;
@@ -657,7 +657,7 @@ export class CardComp extends CCComp {
this.node.setSiblingIndex(99); // 变大时提到最前
if (this.restPosition.x <= -200) { // -260
targetX = this.restPosition.x + 30;
} else if (this.restPosition.x >= 200) { // 260
} else if (this.restPosition.x >= 80) { // 260 -> 86也算
targetX = this.restPosition.x - 30;
}
targetY = this.restPosition.y + 35; // y轴增加
@@ -705,7 +705,7 @@ export class CardComp extends CCComp {
// ---- 按卡牌类型渲染具体内容 ----
const uiTrans = this.node.getComponent(UITransform);
if (uiTrans) {
uiTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
uiTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
const widget = this.node.getComponent(Widget);
if (widget) widget.updateAlignment();
}
@@ -714,14 +714,14 @@ export class CardComp extends CCComp {
if (this.BG_node) {
const bgTrans = this.BG_node.getComponent(UITransform);
if (bgTrans) {
bgTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
bgTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
const widget = this.BG_node.getComponent(Widget);
if (widget) widget.updateAlignment();
}
this.BG_node.children.forEach(child => {
const childTrans = child.getComponent(UITransform);
if (childTrans) {
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
const widget = child.getComponent(Widget);
if (widget) widget.updateAlignment();
}
@@ -741,14 +741,14 @@ export class CardComp extends CCComp {
if (this.HF_node) {
const hfTrans = this.HF_node.getComponent(UITransform);
if (hfTrans) {
hfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
hfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
const widget = this.HF_node.getComponent(Widget);
if (widget) widget.updateAlignment();
}
this.HF_node.children.forEach(child => {
const childTrans = child.getComponent(UITransform);
if (childTrans) {
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
const widget = child.getComponent(Widget);
if (widget) widget.updateAlignment();
}
@@ -758,14 +758,14 @@ export class CardComp extends CCComp {
if (this.NF_node) {
const nfTrans = this.NF_node.getComponent(UITransform);
if (nfTrans) {
nfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
nfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
const widget = this.NF_node.getComponent(Widget);
if (widget) widget.updateAlignment();
}
this.NF_node.children.forEach(child => {
const childTrans = child.getComponent(UITransform);
if (childTrans) {
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
const widget = child.getComponent(Widget);
if (widget) widget.updateAlignment();
}
@@ -776,7 +776,7 @@ export class CardComp extends CCComp {
if (hbNode) {
const hbTrans = hbNode.getComponent(UITransform);
if (hbTrans) {
hbTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
hbTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
const widget = hbNode.getComponent(Widget);
if (widget) widget.updateAlignment();
}
@@ -905,7 +905,7 @@ export class CardComp extends CCComp {
if (this.isEnlarged) {
if (this.restPosition.x <= -200) {
targetX = this.restPosition.x + 30;
} else if (this.restPosition.x >= 200) {
} else if (this.restPosition.x >= 80) {
targetX = this.restPosition.x - 30;
}
targetY = this.restPosition.y + 35;