|
|
@@ -2,7 +2,7 @@
|
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
|
* @Date: 2025-03-11 18:05:45
|
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
|
- * @LastEditTime: 2025-03-14 18:27:33
|
|
|
+ * @LastEditTime: 2025-03-17 14:06:35
|
|
|
* @Description:
|
|
|
*/
|
|
|
import { _decorator, Color, EventTouch, instantiate, JsonAsset, Node, Prefab, Sprite, UITransform, Vec3, Widget, tween } from "cc";
|
|
|
@@ -124,6 +124,12 @@ export class EliminateViewComp extends CCComp {
|
|
|
itemNode: Node | null = null; //底部三个item块区域
|
|
|
moveNode: Node | null = null; //移动层Node
|
|
|
rotateNode: Node | null = null; //旋转Node
|
|
|
+ hammerNode: Node | null = null; //锤子节点
|
|
|
+
|
|
|
+ //锤子功能
|
|
|
+ hammerMode = false; // 是否在锤子模式
|
|
|
+ hammerRange = 2; // 锤子影响范围(以点击位置为中心的方形区域边长)
|
|
|
+ hammerPreviewNodes: Node[] = []; // 预览区域的节点列表
|
|
|
|
|
|
|
|
|
|
|
|
@@ -162,6 +168,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.itemNode = this.node.getChildByPath("Scene/itemNode");
|
|
|
this.moveNode = this.node.getChildByPath("Scene/MoveNode");
|
|
|
this.rotateNode = this.node.getChildByPath("Scene/rotateNode");
|
|
|
+ this.hammerNode = this.node.getChildByPath("Scene/hammerNode")
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -180,7 +187,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.brickNum = GameConfig.BlockNum;
|
|
|
this.rotateFlag = false;
|
|
|
this.rotateBrickData = null;
|
|
|
- this.setGameStatus(GameStatus.None);
|
|
|
+ this.setGameStatus(GameStatus.Start);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -260,7 +267,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
oops.res.load(json_name, JsonAsset, (err: Error | null, res: any) => {
|
|
|
if (res) {
|
|
|
this.gameConfig = res.json;
|
|
|
- console.log("???????????????????", this.gameConfig);
|
|
|
resolve();
|
|
|
} else {
|
|
|
console.log("JSON数据加载失,请检查文件");
|
|
|
@@ -753,7 +759,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
// 方块到格子
|
|
|
else if (this.editingData.brickData && this.editingData.gridList.length > 0) {
|
|
|
- // console.log("")
|
|
|
+ console.log("移动到格子了")
|
|
|
// 修改格子
|
|
|
this.editingData.gridList.forEach((gridData) => {
|
|
|
gridData.status = GridStatus.Used
|
|
|
@@ -783,6 +789,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
// 方块回到待选区
|
|
|
else {
|
|
|
+ console.log("返回带待选区域")
|
|
|
const brickData = this.editingData.brickData
|
|
|
this.bricksList.push(brickData)
|
|
|
// this.audioManager.playMoveFail()
|
|
|
@@ -809,6 +816,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.editingData.brickData.rotateFlag &&
|
|
|
event.getUILocation().subtract(this.touchStartLocation).length() < this.rotateFaultTolerant
|
|
|
) {
|
|
|
+ console.log("进这里啦?????????????????????")
|
|
|
this.rotateFlag = true
|
|
|
this.rotateBrickData = this.editingData.brickData;
|
|
|
if (this.rotateBrickData.brickNode) {
|
|
|
@@ -822,13 +830,14 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
}
|
|
|
// 格子颜色恢复
|
|
|
- this.gridColorRecovery()
|
|
|
+ this.gridColorRecovery();
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
// 提示
|
|
|
prompt(tipFlag = true) {
|
|
|
+ console.log("点击了提示按钮")
|
|
|
return new Promise((resolve, reject) => {
|
|
|
const gridPromptList: GridData[] = []
|
|
|
let moveFlag = false
|
|
|
@@ -1093,7 +1102,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
|
|
|
|
|
|
- // 消除
|
|
|
+ // 消除,这里增加飞的动画
|
|
|
gridEliminate() {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
const d = this.gridEliminateCheck(this.gridList)
|
|
|
@@ -1237,7 +1246,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
|
|
|
|
|
|
// //刷新按钮
|
|
|
- onRefreshBtnClick() {
|
|
|
+ btn_refresh() {
|
|
|
if (
|
|
|
this.game_status !== GameStatus.Start
|
|
|
) return
|
|
|
@@ -1261,7 +1270,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
|
|
|
//提示按钮
|
|
|
- onPromptBtnClick() {
|
|
|
+ btn_hint() {
|
|
|
if (
|
|
|
this.game_status !== GameStatus.Start
|
|
|
) return
|
|
|
@@ -1277,11 +1286,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- //重新开始
|
|
|
- onAgainBtnClick() {
|
|
|
- if (this.game_status === GameStatus.None) return
|
|
|
- this.initGameData();
|
|
|
- }
|
|
|
|
|
|
//继续按钮
|
|
|
onContinueBtnClick() {
|
|
|
@@ -1518,8 +1522,12 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ //重新开始-这样正常要接广告
|
|
|
+ private btn_reopen() {
|
|
|
+ console.log("重新开始");
|
|
|
+ if (this.game_status === GameStatus.None) return
|
|
|
+ this.initGameData()
|
|
|
+ }
|
|
|
|
|
|
// ... 添加自动模式的开关方法
|
|
|
onAutoButtonClick() {
|