| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /*
- * @Author: mojunshou 1637302775@qq.com
- * @Date: 2025-03-27 18:19:53
- * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-23 17:49:45
- * @Description: 游戏结束界面
- */
- import { _decorator } from 'cc';
- import { oops } from 'db://oops-framework/core/Oops';
- import VMParent from 'db://oops-framework/libs/model-view/VMParent';
- import { AD_TYPE } from '../common/config/GameDefine';
- import { UIID } from '../common/config/GameUIConfig';
- import { ADHandler } from '../common/manager/ADHandler';
- import { ServerHandler } from '../common/manager/ServerHandler';
- import { smc } from '../common/SingletonModuleComp';
- import { DCHandler } from '../common/manager/DCHandler';
- const { ccclass, property } = _decorator;
- /** 显示对象控制 */
- @ccclass('GameOverView')
- export class GameOverView extends VMParent {
- data: any = {
- cd: 20,
- cdMax: 100,
- schedule: 0
- }
- protected start() {
- this.setButton();
- DCHandler.inst.reportData(3000601);
- //计算分数,取后两位小数*100
- let score = smc.game.GameModel.curScore;
- let targetScore = smc.game.GameModel.targetScore;
- let progress = score / targetScore;
- if (progress > 1) {
- progress = 1;
- }
- this.data.cd = score;
- this.data.cdMax = targetScore;
- //取整数
- let scoreInt = Math.floor(progress * 100);
- this.data.schedule = scoreInt;
- }
- private btn_restart() {
- // oops.message.dispatchEvent(GameEvent.RestartGame);
- ServerHandler.inst.RestartGame();
- oops.gui.remove(UIID.GameOver);
- DCHandler.inst.reportData(3000603);
- }
- private btn_resurrection() {
- smc.game.GameModel.viewType = "revive_reward";
- //复活 分数不清零
- ADHandler.inst.showAd(AD_TYPE.Resurrection);
- oops.gui.remove(UIID.GameOver);
- DCHandler.inst.reportData(3000602);
- }
- }
|