|
@@ -2,7 +2,7 @@
|
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
|
* @Date: 2025-03-20 15:01:09
|
|
* @Date: 2025-03-20 15:01:09
|
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
|
- * @LastEditTime: 2025-03-27 17:49:05
|
|
|
|
|
|
|
+ * @LastEditTime: 2025-03-27 18:40:24
|
|
|
* @Description: 消除游戏主场景
|
|
* @Description: 消除游戏主场景
|
|
|
*/
|
|
*/
|
|
|
import { _decorator } from "cc";
|
|
import { _decorator } from "cc";
|
|
@@ -29,6 +29,7 @@ import { randomRangeInt } from "cc";
|
|
|
import { EventTouch } from "cc";
|
|
import { EventTouch } from "cc";
|
|
|
import { Vec2 } from "cc";
|
|
import { Vec2 } from "cc";
|
|
|
import { tween } from "cc";
|
|
import { tween } from "cc";
|
|
|
|
|
+import { GameEvent } from "../../common/config/GameEvent";
|
|
|
|
|
|
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
|
@@ -197,7 +198,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
private grid: CellState[][] = []; //数组管理网格状态
|
|
private grid: CellState[][] = []; //数组管理网格状态
|
|
|
private gridBlocks: (BlockItemView | null)[][] = []; // 存储网格中的方块脚本引用
|
|
private gridBlocks: (BlockItemView | null)[][] = []; // 存储网格中的方块脚本引用
|
|
|
private gridCells: Node[][] = [];
|
|
private gridCells: Node[][] = [];
|
|
|
-
|
|
|
|
|
// 方块数据保存数组,生成后就保存起来
|
|
// 方块数据保存数组,生成后就保存起来
|
|
|
private brickList: BrickData[] = [];
|
|
private brickList: BrickData[] = [];
|
|
|
|
|
|
|
@@ -214,14 +214,25 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ addEventList() {
|
|
|
|
|
+ oops.message.on(GameEvent.RestartGame, this.restartGame, this);
|
|
|
|
|
+ // oops.message.on(GameEvent.Resurrection, this.resurrection, this);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //增加一个新人新手引导
|
|
|
|
|
+ private addNewPlayerGuide() {
|
|
|
|
|
+ // 获取当前引导步骤
|
|
|
|
|
+ // const currentStep = this.getTutorialStep();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
private initComponents() {
|
|
private initComponents() {
|
|
|
// this.winthdrawNode = this.node.getChildByPath("Scene/Top/btn_withdraw")!;
|
|
// this.winthdrawNode = this.node.getChildByPath("Scene/Top/btn_withdraw")!;
|
|
|
// this.awardNode = this.node.getChildByPath("Scene/Top/btn_award")!;
|
|
// this.awardNode = this.node.getChildByPath("Scene/Top/btn_award")!;
|
|
|
const toggle = this.node.getChildByPath("Scene/Bottom/btn_auto/auto_Toggle/Off")!;
|
|
const toggle = this.node.getChildByPath("Scene/Bottom/btn_auto/auto_Toggle/Off")!;
|
|
|
this.autoOnToggle = toggle.getComponent(Toggle)!;
|
|
this.autoOnToggle = toggle.getComponent(Toggle)!;
|
|
|
-
|
|
|
|
|
this.lab_speed = this.node.getChildByPath("Scene/Bottom/btn_double/lab_time")!.uiLabel;
|
|
this.lab_speed = this.node.getChildByPath("Scene/Bottom/btn_double/lab_time")!.uiLabel;
|
|
|
- this.lab_speed.string = "9999999"
|
|
|
|
|
|
|
+ this.lab_speed.string = "二倍速"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -865,6 +876,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
score += this.rows * i
|
|
score += this.rows * i
|
|
|
}
|
|
}
|
|
|
this.score += score
|
|
this.score += score
|
|
|
|
|
+ this.lab_score.string = this.score.toString();
|
|
|
|
|
|
|
|
const lastGrid = gridEliminateList[gridEliminateList.length - 1];
|
|
const lastGrid = gridEliminateList[gridEliminateList.length - 1];
|
|
|
if (lastGrid?.gridNode && this.coinPrefab && this.amountLb?.node) {
|
|
if (lastGrid?.gridNode && this.coinPrefab && this.amountLb?.node) {
|
|
@@ -1150,6 +1162,8 @@ export class EliminateViewComp extends CCComp {
|
|
|
gameOver() {
|
|
gameOver() {
|
|
|
this.gameState = GameState.GAME_OVER
|
|
this.gameState = GameState.GAME_OVER
|
|
|
this.setGameState(GameState.GAME_OVER)
|
|
this.setGameState(GameState.GAME_OVER)
|
|
|
|
|
+ console.log("游戏结束")
|
|
|
|
|
+ oops.gui.open(UIID.GameOver);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1161,9 +1175,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
children.forEach(node => node.destroy());
|
|
children.forEach(node => node.destroy());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
private setGameState(state: GameState) {
|
|
private setGameState(state: GameState) {
|
|
|
this.gameState = state;
|
|
this.gameState = state;
|
|
|
switch (state) {
|
|
switch (state) {
|
|
@@ -1451,9 +1462,8 @@ export class EliminateViewComp extends CCComp {
|
|
|
//重新开始
|
|
//重新开始
|
|
|
private restartGame() {
|
|
private restartGame() {
|
|
|
if (this.gameState === GameState.READY) return;
|
|
if (this.gameState === GameState.READY) return;
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ this.initData();
|
|
|
|
|
+ this.reopenGrid();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private reopenGrid() {
|
|
private reopenGrid() {
|