feat(ui): 添加卡槽自动布局并禁用角色控制器节点
- 在 CardComp 中新增 setSlotPosition 方法,支持动态设置卡槽位置 - 在 MissionCardComp 中实现 layoutCardSlots 方法,根据卡槽数量自动水平居中布局 - 在任务开始、抽卡等关键时机调用布局更新,确保卡槽位置正确 - 禁用角色控制器预制件中的节点,防止其干扰UI交互
This commit is contained in:
@@ -159,6 +159,14 @@ export class CardComp extends CCComp {
|
||||
return this.isLocked;
|
||||
}
|
||||
|
||||
setSlotPosition(x: number) {
|
||||
const current = this.node.position;
|
||||
this.restPosition = new Vec3(x, current.y, current.z);
|
||||
if (!this.isDragging && !this.isUsing) {
|
||||
this.node.setPosition(this.restPosition);
|
||||
}
|
||||
}
|
||||
|
||||
/** 系统清槽:用于任务开始/结束等强制重置场景 */
|
||||
clearBySystem() {
|
||||
Tween.stopAllByTarget(this.node);
|
||||
|
||||
Reference in New Issue
Block a user