12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import { _decorator, Component, Label, Node, Sprite, SpriteFrame } from 'cc';
- import { GameManager } from '../Manager/GameManager';
- 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();
- }
- }
- }
|