/* * @Author: mojunshou 1637302775@qq.com * @Date: 2025-03-27 18:19:53 * @LastEditors: mojunshou 1637302775@qq.com * @LastEditTime: 2025-04-16 10:48:30 * @Description: 游戏结束界面 */ import { _decorator } from 'cc'; import { oops } from 'db://oops-framework/core/Oops'; import { GameComponent } from "db://oops-framework/module/common/GameComponent"; import { UIID } from '../common/config/GameUIConfig'; import { GameEvent } from '../common/config/GameEvent'; import { smc } from '../common/SingletonModuleComp'; import { ADHandler } from '../common/manager/ADHandler'; import { AD_TYPE } from '../common/config/GameDefine'; import { ServerHandler } from '../common/manager/ServerHandler'; import VMParent from 'db://oops-framework/libs/model-view/VMParent'; const { ccclass, property } = _decorator; /** 显示对象控制 */ @ccclass('GameOverView') export class GameOverView extends VMParent { data: any = { cd: 0, cdMax: 100, schedule: 0, } protected start() { this.setButton(); //计算分数,取后两位小数*100 let score = smc.game.GameModel.curScore; let targetScore = smc.game.GameModel.targetScore; //除,然后取后两位小数*100 this.data.cd = Math.floor(score / targetScore); //计算进度条 this.data.schedule = Math.floor((score / targetScore) * 100); } private btn_restart() { // oops.message.dispatchEvent(GameEvent.RestartGame); ServerHandler.inst.RestartGame(); oops.gui.remove(UIID.GameOver); } 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); } }