|
|
@@ -1,4 +1,4 @@
|
|
|
-import { _decorator, Component, Node, Prefab, instantiate, Vec3, EventTouch, Vec2, UITransform, find, Rect, Label, Color, Size, Sprite, SpriteFrame, resources, Button } from 'cc';
|
|
|
+import { _decorator, Component, Node, Prefab, instantiate, Vec3, EventTouch, Vec2, UITransform, find, Rect, Label, Color, Size, Sprite, SpriteFrame, resources, Button, Collider2D } from 'cc';
|
|
|
import { ConfigManager, WeaponConfig } from '../Core/ConfigManager';
|
|
|
import { SaveDataManager } from '../LevelSystem/SaveDataManager';
|
|
|
import { LevelSessionManager } from '../Core/LevelSessionManager';
|
|
|
@@ -433,6 +433,9 @@ export class BlockManager extends Component {
|
|
|
|
|
|
block.setSiblingIndex(block.parent.children.length - 1);
|
|
|
this.tempStoreBlockOccupiedGrids(block);
|
|
|
+ // 拖拽开始时禁用碰撞体
|
|
|
+ const collider = block.getComponent(Collider2D);
|
|
|
+ if (collider) collider.enabled = false;
|
|
|
}, this);
|
|
|
|
|
|
block.on(Node.EventType.TOUCH_MOVE, (event: EventTouch) => {
|
|
|
@@ -467,6 +470,9 @@ export class BlockManager extends Component {
|
|
|
|
|
|
|
|
|
this.currentDragBlock = null;
|
|
|
+ // 拖拽结束时恢复碰撞体
|
|
|
+ const collider = block.getComponent(Collider2D);
|
|
|
+ if (collider) collider.enabled = true;
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
@@ -474,6 +480,9 @@ export class BlockManager extends Component {
|
|
|
if (this.currentDragBlock) {
|
|
|
this.returnBlockToOriginalPosition();
|
|
|
this.currentDragBlock = null;
|
|
|
+ // 拖拽取消时恢复碰撞体
|
|
|
+ const collider = block.getComponent(Collider2D);
|
|
|
+ if (collider) collider.enabled = true;
|
|
|
}
|
|
|
}, this);
|
|
|
}
|
|
|
@@ -553,9 +562,9 @@ export class BlockManager extends Component {
|
|
|
if (this.gameStarted) {
|
|
|
this.addLockedVisualHint(this.currentDragBlock);
|
|
|
}
|
|
|
-+
|
|
|
-+ // 检查并执行合成
|
|
|
-+ this.tryMergeBlock(this.currentDragBlock);
|
|
|
+
|
|
|
+ // 检查并执行合成
|
|
|
+ this.tryMergeBlock(this.currentDragBlock);
|
|
|
} else {
|
|
|
if (this.deductPlayerCoins(price)) {
|
|
|
this.clearTempStoredOccupiedGrids(this.currentDragBlock);
|
|
|
@@ -576,9 +585,9 @@ export class BlockManager extends Component {
|
|
|
if (this.gameStarted) {
|
|
|
this.addLockedVisualHint(this.currentDragBlock);
|
|
|
}
|
|
|
-+
|
|
|
-+ // 检查并执行合成
|
|
|
-+ this.tryMergeBlock(this.currentDragBlock);
|
|
|
+
|
|
|
+ // 检查并执行合成
|
|
|
+ this.tryMergeBlock(this.currentDragBlock);
|
|
|
} else {
|
|
|
this.returnBlockToOriginalPosition();
|
|
|
}
|