import { _decorator, Button, Component, director, Node } from 'cc'; import { BasePanel } from './BasePanel'; import ch_audio from '../../ch/audio/audio'; import { UIManager } from './UIManager'; import { MyGame } from '../Game/MyGame'; import { UpdateScore } from '../Game/UpdateScore'; import { ch } from '../../ch/ch'; const { ccclass, property } = _decorator; @ccclass('ResultPanel') export class ResultPanel extends BasePanel { private Return_Btn: Button; private Next_Btn: Button; start() { this.Return_Btn = this.node.getChildByName("Return_Btn").getComponent(Button); this.Next_Btn = this.node.getChildByName("Next_Btn").getComponent(Button); this.Return_Btn.node.on(Button.EventType.CLICK, this.ReturnHall, this); this.Next_Btn.node.on(Button.EventType.CLICK, this.NextLevel, this); } async ReturnHall() { //返回大厅 //获取当前玩家最高分决定是否要更新排行榜 let ret = await chsdk.saveRankData("全国", UpdateScore.instance.getScore(), chsdk.updateType.none); if (ret.code == 0) { await MyGame.getInstance().setRankInfo(ret.data); MyGame.getInstance().saveData(); } MyGame.getInstance().setLastScene("Main"); ch_audio.getInstance().stop(); UIManager.Instance.clearStack(); const sceneName = 'Hall'; director.loadScene(sceneName, (err, scene) => { if (err) { console.error('场景加载失败:', err); return; } }); } NextLevel() { } update(deltaTime: number) { } onClose() { super.onClose(null); } }