|
|
@@ -2,18 +2,16 @@
|
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
|
* @Date: 2025-03-20 15:01:09
|
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
|
- * @LastEditTime: 2025-04-09 12:03:13
|
|
|
+ * @LastEditTime: 2025-04-09 16:46:12
|
|
|
* @Description: 消除游戏主场景
|
|
|
*/
|
|
|
-import { _decorator, Color, EventTouch, instantiate, JsonAsset, Label, Node, Prefab, randomRangeInt, Sprite, Toggle, tween, UITransform, Vec2, Vec3, Widget } from "cc";
|
|
|
-import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
|
|
|
+import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
|
|
|
import { oops } from "db://oops-framework/core/Oops";
|
|
|
import { ecs } from "db://oops-framework/libs/ecs/ECS";
|
|
|
import { LabelChange } from "db://oops-framework/libs/gui/label/LabelChange";
|
|
|
import { CCComp } from "db://oops-framework/module/common/CCComp";
|
|
|
import { GameEvent } from "../../common/config/GameEvent";
|
|
|
import { UIID } from "../../common/config/GameUIConfig";
|
|
|
-import { Button } from "cc";
|
|
|
import { smc } from "../../common/SingletonModuleComp";
|
|
|
|
|
|
const { ccclass, property } = _decorator;
|
|
|
@@ -144,7 +142,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
private addSpeedBtn: Button = null!;
|
|
|
|
|
|
|
|
|
-
|
|
|
//游戏配置行列
|
|
|
private rows: number = 8; // 行数
|
|
|
private cols: number = 8; // 列数
|
|
|
@@ -155,6 +152,8 @@ export class EliminateViewComp extends CCComp {
|
|
|
private score: number = 0; //本局分数
|
|
|
private money: number = 0; //左边金钱
|
|
|
private cash: number = 0; //右边红包钱数
|
|
|
+ private goldNum: number = 0; //尽快数量
|
|
|
+
|
|
|
private targetScore: number = 0; //目标分数
|
|
|
|
|
|
private totalNum: number = 0; //累计消除次数,断了就是又从0开始
|
|
|
@@ -162,11 +161,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
private _isDoubleSpeed: boolean = false; //是否开启二倍速
|
|
|
private _doubleNum: number = 2; //除2就是开启了2倍速,除1就是关闭了2倍速
|
|
|
|
|
|
- //网格列表
|
|
|
- // gridsNode: Node | null = null; //中间网格区域
|
|
|
- // brickNode: Node | null = null; //底部三个item块区域
|
|
|
- // moveNode: Node | null = null; //移动层Node
|
|
|
- // rotateNode: Node | null = null; //旋转Node吧
|
|
|
|
|
|
//没使用颜色
|
|
|
notUseColor = new Color(255, 255, 255, 255)
|
|
|
@@ -176,7 +170,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
unavailableColor = new Color(255, 0, 0, 100)
|
|
|
//旋转容错
|
|
|
rotateFaultTolerant = 10;
|
|
|
- private _isAutoFunc: (() => void) | null = null;
|
|
|
|
|
|
isAutoMode: boolean = false;
|
|
|
autoModeInterval: number = 1 // 自动模式的间隔时间(秒)
|
|
|
@@ -204,18 +197,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
// 添加新的属性来跟踪是否需要重置消除计数
|
|
|
private shouldResetEliminateCount: boolean = true;
|
|
|
|
|
|
- // 添加配置属性 - 消除基础分
|
|
|
- @property({ displayName: "消除一行/列基础分" })
|
|
|
- private eliminateBaseScore: number = 10;
|
|
|
-
|
|
|
- //当前局数
|
|
|
- private curGameNum: number = 0;
|
|
|
- //第一通关开始新人模式
|
|
|
- //第二局开始马上播放新的弹窗
|
|
|
- //往后根据每局需要弹窗就弹窗
|
|
|
- //通关一局算一块金砖
|
|
|
- //通关比例算金砖比例
|
|
|
-
|
|
|
private autoState: boolean = false; //自动状态
|
|
|
|
|
|
/** 视图层逻辑代码分离演示 */
|
|
|
@@ -226,6 +207,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
await this.loadConfig();
|
|
|
this.initGrid();
|
|
|
this.initData();
|
|
|
+ this.setData();
|
|
|
this.addEventList();
|
|
|
}
|
|
|
|
|
|
@@ -263,24 +245,29 @@ export class EliminateViewComp extends CCComp {
|
|
|
private initData() {
|
|
|
// this.gameMode = GameMode.MANUAL;
|
|
|
this.score = 0;
|
|
|
- this.targetScore = smc.account.AccountModel.curLevelConfig.score;
|
|
|
+ this.targetScore = 0;
|
|
|
this.money = 0;
|
|
|
this.cash = 0;
|
|
|
this.totalNum = 0;
|
|
|
- // this._doubleNum = 2;
|
|
|
this.autoState = false;
|
|
|
this.shouldResetEliminateCount = true;
|
|
|
this.lab_score.string = this.score.toString();
|
|
|
this.amountLb.string = this.money.toString();
|
|
|
this.awardLb.string = this.cash.toString();
|
|
|
+ this.lab_taget.string = this.targetScore.toString();
|
|
|
}
|
|
|
|
|
|
- //初始化关卡信息
|
|
|
- private initLevelInfo() {
|
|
|
- //关卡通关服务器或者本地读出来
|
|
|
- // const level =
|
|
|
-
|
|
|
|
|
|
+ //设置数据
|
|
|
+ setData() {
|
|
|
+ this.score = smc.account.AccountModel.curLevelInfo.score;
|
|
|
+ this.money = smc.account.AccountModel.gameCoin;
|
|
|
+ this.cash = smc.account.AccountModel.cashCoin;
|
|
|
+ this.targetScore = smc.account.AccountModel.curLevelConfig.score;
|
|
|
+ this.lab_score.string = this.score.toString();
|
|
|
+ this.amountLb.string = this.money.toString();
|
|
|
+ this.awardLb.string = this.cash.toString();
|
|
|
+ this.lab_taget.string = this.targetScore.toString();
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1477,7 +1464,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
//========================打开其他界面和按钮逻辑=======================
|
|
|
|
|
|
/** 视图对象通过 ecs.Entity.remove(eliminateViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|