Procházet zdrojové kódy

【BUG】修改游戏结束展示进度条不对问题

mojunshou před 7 měsíci
rodič
revize
a5ed3d2429

+ 1 - 1
assets/bundle/gui/eliminate/eliminate.prefab

@@ -9122,7 +9122,7 @@
         "__id__": 397
       }
     ],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 401

+ 7 - 5
assets/script/game/view/EliminateViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 15:01:09
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-21 16:38:46
+ * @LastEditTime: 2025-04-21 17:33:14
  * @Description: 消除游戏主场景
  */
 import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
@@ -239,6 +239,7 @@ export class EliminateViewComp extends CCComp {
         if (this.guideStep === 0 && smc.account.AccountModel.curLevel == 1) {
             this.startGuideMode()
         } else {
+            this.guideNode.active = false;
             this.initGrid();
         }
 
@@ -311,7 +312,9 @@ export class EliminateViewComp extends CCComp {
         this.lab_wxCoin.string = Format.formatWxCoin(this.money);
         this.lab_hbCoin.string = Format.formatRedPacketCoin(this.cash);
         this.lab_taget.string = this.targetScore.toString();
-        this.lab_goldNum.string = smc.account.AccountModel.goldCoin.toString();
+        //金砖数量要加1
+        const num = smc.account.AccountModel.goldCoin
+        this.lab_goldNum.string = `${num + 1}`;
         this.gameState = GameState.PLAYING;
     }
 
@@ -564,9 +567,7 @@ export class EliminateViewComp extends CCComp {
                 }
             );
         }
-
         this.updateGameScore();
-
     }
 
 
@@ -1106,6 +1107,7 @@ export class EliminateViewComp extends CCComp {
 
                 // 显示放置得分动画(显示一次,包含总格子数)
                 this.showScoreAnimation(centerPos, placedGridCount);
+                //这里要计算分数,并且计算能消除的分数,然后增加分,这才对
 
                 // 标记需要重置消除计数器
                 this.shouldResetEliminateCount = true;
@@ -1252,7 +1254,6 @@ export class EliminateViewComp extends CCComp {
 
         // 更新总分
         this.score += calculatedScore;
-        this.updateGameScore();
     }
 
     // 显示消除次数动画
@@ -1324,6 +1325,7 @@ export class EliminateViewComp extends CCComp {
             console.log("消除总数", this.eliminateTotal)
             if (gridEliminateList.length < 1) {
                 // 没有发生消除
+                this.updateGameScore();
                 this.shouldResetEliminateCount = true;  // 下一次消除需要重置计数
                 resolve(false);
                 return;

+ 6 - 13
assets/script/game/view/GameOverView.ts

@@ -2,19 +2,17 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-27 18:19:53
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-21 11:33:46
+ * @LastEditTime: 2025-04-21 18:10:36
  * @Description: 游戏结束界面
  */
-import { _decorator, Label, ProgressBar } from 'cc';
+import { _decorator } from 'cc';
 import { oops } from 'db://oops-framework/core/Oops';
-import { GameComponent } from "db://oops-framework/module/common/GameComponent";
+import VMParent from 'db://oops-framework/libs/model-view/VMParent';
 import { AD_TYPE } from '../common/config/GameDefine';
-import { GameEvent } from '../common/config/GameEvent';
 import { UIID } from '../common/config/GameUIConfig';
 import { ADHandler } from '../common/manager/ADHandler';
 import { ServerHandler } from '../common/manager/ServerHandler';
 import { smc } from '../common/SingletonModuleComp';
-import VMParent from 'db://oops-framework/libs/model-view/VMParent';
 
 const { ccclass, property } = _decorator;
 
@@ -40,8 +38,8 @@ export class GameOverView extends VMParent {
         this.data.cd = score;
         this.data.cdMax = targetScore;
         //取整数
-        let scoreInt = Math.floor(progress);
-        this.data.schedule = scoreInt * 100;
+        let scoreInt = Math.floor(progress * 100);
+        this.data.schedule = scoreInt;
     }
 
     private btn_restart() {
@@ -51,15 +49,10 @@ export class GameOverView extends VMParent {
     }
 
 
-
     private btn_resurrection() {
-        //打开广告
-        //我这调你登录,你登录后,返回给我,可以登录,我这边加载资源,userinfo-头像,UID nickname,关卡,还有配置,
-        //复活
         smc.game.GameModel.viewType = "revive_reward";
         //复活 分数不清零
         ADHandler.inst.showAd(AD_TYPE.Resurrection);
-        oops.gui.remove(UIID.GameOver);
-        // oops.message.dispatchEvent(GameEvent.Resurrection);
+        // oops.gui.remove(UIID.GameOver);
     }
 }