diff --git a/assets/resources/gui/role_controller.prefab b/assets/resources/gui/role_controller.prefab index 05e99adf..a28d7ec5 100644 --- a/assets/resources/gui/role_controller.prefab +++ b/assets/resources/gui/role_controller.prefab @@ -5600,7 +5600,7 @@ }, { "__type__": "cc.Node", - "_name": "cb", + "_name": "cb1", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -5876,7 +5876,7 @@ }, { "__type__": "cc.Node", - "_name": "cb-001", + "_name": "cb2", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -6152,7 +6152,7 @@ }, { "__type__": "cc.Node", - "_name": "cb-002", + "_name": "cb3", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -6428,7 +6428,7 @@ }, { "__type__": "cc.Node", - "_name": "cb-003", + "_name": "cb4", "_objFlags": 0, "__editorExtras__": {}, "_parent": { diff --git a/assets/script/game/map/CardComp.ts b/assets/script/game/map/CardComp.ts index 3102a793..f11dbf74 100644 --- a/assets/script/game/map/CardComp.ts +++ b/assets/script/game/map/CardComp.ts @@ -50,6 +50,9 @@ export class CardComp extends CCComp { private isDragging: boolean = false; private isUsing: boolean = false; private restPosition: Vec3 = new Vec3(); + private hasFixedBasePosition: boolean = false; + private fixedBaseY: number = 0; + private fixedBaseZ: number = 0; private opacityComp: UIOpacity | null = null; private cardUseComp: CardUseComp | null = null; private iconVisualToken: number = 0; @@ -228,7 +231,12 @@ export class CardComp extends CCComp { setSlotPosition(x: number) { const current = this.node.position; - this.restPosition = new Vec3(x, current.y, current.z); + if (!this.hasFixedBasePosition) { + this.fixedBaseY = current.y; + this.fixedBaseZ = current.z; + this.hasFixedBasePosition = true; + } + this.restPosition = new Vec3(x, this.fixedBaseY, this.fixedBaseZ); if (!this.isDragging && !this.isUsing) { this.node.setPosition(this.restPosition); }