1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import { _decorator, Component, Label, Node, Sprite, SpriteFrame } from 'cc';
- import { GameManager } from '../Manager/GameManager';
- import { AudioManage } from '../Manager/AudioManage';
- import { Global } from '../Common/Global';
- const { ccclass, property } = _decorator;
- @ccclass('GameEndTip')
- export class GameEndTip extends Component {
- @property(SpriteFrame)
- successBg: SpriteFrame = null;
- @property(SpriteFrame)
- failBg: SpriteFrame = null;
- @property(Label)
- curLevelLabel: Label = null;
- @property(Label)
- curScoreLabel: Label = null;
- @property(Label)
- totalScoreLabel: Label = null;
- @property(Label)
- btnLabel: Label = null;
- @property(Node)
- reusltIcon: Node = null;
- result: boolean = false;
- start() {
- }
- showEndView(curLevel: number, curScore: number, totalScore: number, result: boolean, isTime: boolean) {
- if (result) {
- this.reusltIcon.getComponent(Sprite).spriteFrame = this.successBg;
- this.btnLabel.string = '下一关';
- } else {
- this.reusltIcon.getComponent(Sprite).spriteFrame = this.failBg;
- this.btnLabel.string = '继续';
- }
- this.result = result;
- if (isTime) {
- this.curLevelLabel.string = '超时游戏失败';
- } else {
- this.curLevelLabel.string = '当前关卡: 第' + curLevel + '关';
- }
- this.curScoreLabel.string = '本关得分: ' + curScore;
- this.totalScoreLabel.string = '总得分: ' + totalScore;
- console.log('curLevel:' + curLevel);
- }
- backHomeBtn() {
- this.node.active = false;
- // GameManager.getInstance().BackHomePage();
- }
- levelBtn() {
- this.node.active = false;
- if (this.result) {
- GameManager.getInstance().NextLevel();
- } else {
- GameManager.getInstance().RestartGame();
- }
- }
- }
|